qubvel-org / segmentation_models.pytorch

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

ModuleNotFoundError: No module named 'segmentation_models_pytorch.unetplusplus' #853

Closed ShroukMansour closed 1 month ago

ShroukMansour commented 8 months ago

I was using an older version from segmentation models and everything was working fine, when i've upgraded to the latest version i got this error message

 barcode_det_model_path =  os.path.join("passport_barcode_det_UnetPlusPlus_resnext50_32x4d_e39_lv0.026_ltr0.014_ltest0.038_iv0.95_itr0.973_itest0.932.pth")

self.barcode_det_model = torch.load(barcode_det_model_path, map_location=torch.device('cpu') if device.type == 'cpu' else None)
  File "/data2/home/development/anaconda3/envs/ovr3.10/lib/python3.10/site-packages/torch/serialization.py", line 809, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "/data2/home/development/anaconda3/envs/ovr3.10/lib/python3.10/site-packages/torch/serialization.py", line 1172, in _load
    result = unpickler.load()
  File "/data2/home/development/anaconda3/envs/ovr3.10/lib/python3.10/site-packages/torch/serialization.py", line 1165, in find_class
    return super().find_class(mod_name, name)
ModuleNotFoundError: No module named 'segmentation_models_pytorch.unetplusplus'

here is the ouput of pip show segmentation-models-pytorch

ame: segmentation-models-pytorch
Version: 0.3.3
Summary: Image segmentation models with pre-trained backbones. PyTorch.
Home-page: https://github.com/qubvel/segmentation_models.pytorch
Author: Pavel Iakubovskii
Author-email: qubvel@gmail.com
License: MIT
Location: /data2/home/development/anaconda3/envs/ovr3.10/lib/python3.10/site-packages
Requires: efficientnet-pytorch, pillow, pretrainedmodels, timm, torchvision, tqdm

how can i fix this issue?

github-actions[bot] commented 6 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

qubvel commented 6 months ago

It is now under segmentation_models_pytorch.encoders.unetplusplus

canekkazan commented 4 months ago

How could you solve this issue?

qubvel commented 4 months ago

@canekkazan you can downgrade the package to load model

canekkazan commented 4 months ago

To which version should I downgrade?

The model weights that I use are trained on torch == 1.7.1 and segmentation-models-pytorch == 0.1.3 which creates so many conflicts. Here is the model weights I try to load https://github.com/TolgaBkm/Istanbul_Dataset

If possible, I would like to downgrade a newer version of SMP so that I will not need a very old version of pytorch and I will not have so many conflicts

qubvel commented 4 months ago

It probably should work with any pytorch version, only segmentation-models-pytorch should be downgraded to 0.1.3

adamjstewart commented 1 month ago

It looks like this issue was resolved. If you still encounter any issues, let us know.