qubvel / segmentation_models.pytorch

Semantic segmentation models with 500+ pretrained convolutional and transformer-based backbones.
https://smp.readthedocs.io/
MIT License
9.14k stars 1.63k forks source link

AttributeError: module 'segmentation_models_pytorch' has no attribute 'utils' #786

Closed kapedalex closed 1 year ago

kapedalex commented 1 year ago

Tried this block from https://github.com/qubvel/segmentation_models.pytorch/blob/master/examples/cars%20segmentation%20(camvid).ipynb:

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

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

Returns AttributeError: module 'segmentation_models_pytorch' has no attribute 'utils'

kapedalex commented 1 year ago

You can fix this with from segmentation_models_pytorch import utils