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

error in `examples/binary_segmentation_intro.ipynb` #816

Closed kamangir closed 6 months ago

kamangir commented 9 months ago

error in https://github.com/qubvel/segmentation_models.pytorch/blob/master/examples/binary_segmentation_intro.ipynb

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[6], line 3
      1 # lets look at some samples
----> 3 sample = train_dataset[0]
      4 plt.subplot(1,2,1)
      5 plt.imshow(sample["image"].transpose(1, 2, 0)) # for visualization we have to transpose back to HWC

File [/usr/local/lib/python3.11/site-packages/segmentation_models_pytorch/datasets/oxford_pet.py:90](https://file+.vscode-resource.vscode-cdn.net/usr/local/lib/python3.11/site-packages/segmentation_models_pytorch/datasets/oxford_pet.py:90), in SimpleOxfordPetDataset.__getitem__(self, *args, **kwargs)
     87 sample = super().__getitem__(*args, **kwargs)
     89 # resize images
---> 90 image = np.array(Image.fromarray(sample["image"]).resize((256, 256), Image.LINEAR))
     91 mask = np.array(Image.fromarray(sample["mask"]).resize((256, 256), Image.NEAREST))
     92 trimap = np.array(Image.fromarray(sample["trimap"]).resize((256, 256), Image.NEAREST))

AttributeError: module 'PIL.Image' has no attribute 'LINEAR'

may be related to https://github.com/facebookresearch/detectron2/issues/5010

ShaoxiongYao commented 8 months ago

I have the same problem and downgrade PIL version fixed my problem.

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.

github-actions[bot] commented 6 months ago

This issue was closed because it has been stalled for 7 days with no activity.