Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

segmentation_models_pytorch model cant travel to utils folder#796

Unanswered
supratimpaul13 asked this question inQ&A
Discussion options

#782 This is the code in example folder for car segmentations.

loss = smp.utils.losses.DiceLoss()
metrics = [
smp.utils.metrics.IoU(threshold=0.5),
]

optimizer = torch.optim.Adam([
dict(params=model.parameters(), lr=0.0001),
])

and it is giving me error:

ModuleNotFoundError Traceback (most recent call last)
Cell In[92], line 4
1 # Dice/F1 score -https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient
2 # IoU/Jaccard score -https://en.wikipedia.org/wiki/Jaccard_index
----> 4 import segmentation_models_pytorch.utils.losses as smp_losses
5 import segmentation_models_pytorch.utils.metrics as smp_metrics
7 loss = smp_losses.DiceLoss()

ModuleNotFoundError: No module named 'segmentation_models_pytorch.utils'

I have installed all the necessary libraries required but cant find any solution

You must be logged in to vote

Replies: 1 comment

Comment options

I've faced the same error too, it got resolve by just simply importing the 'utils' from 'segmentation_models_pytorch'. however its other varients are depreciated for counting the loss.
Here is the code snippet.

Screenshot 2024-02-15 011035

i hope this helps.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@supratimpaul13@Prathamdesai-07

[8]ページ先頭

©2009-2025 Movatter.jp