qubvel / segmentation_models

Segmentation models with pretrained backbones. Keras and TensorFlow Keras.
MIT License
4.66k stars 1.03k forks source link

module 'segmentation_models.losses' has no attribute 'DiceLoss' #560

Open xpji opened 1 year ago

xpji commented 1 year ago

The version I installed is 1.0.1, and I found an error when using its function: dice_loss = sm.losses.DiceLoss(class_weights=weights) focal_loss = sm.losses.CategoricalFocalLoss()

the erros is:module 'segmentation_models.losses' has no attribute 'DiceLoss'

Baakchsu commented 10 months ago

Hi @xpji! I tried to reproduce your issue by installing v1.0.1 (pip3 install segmentation_models==1.0.1) and importing sm.losses.DiceLoss(). However, I am able to execute without any errors. image

It'd be great if you could share more details (pip version, python version).