Picsart-AI-Research/SeMask-Segmentation

Error when run the demo.py

Closed this issue · 15 comments

Hi, I always have the ImportError: cannot import name '_log_api_usage_once' from 'torchvision.utils' (/home/jinshan/anaconda3/envs/tf/lib/python3.9/site-packages/ when I run the demo.py following the instruction, Could you help me with the problem? Thank you!!

Hi @Jinshan99, thanks for your interest. Could you share more information about the following:

  • For which model are you running the demo.py?
  • What's your torch version?

I will be able to provide better assistance with the above info. Thanks

I am running the SEMask-FPN and torch version is '1.12.0+cu102', Thank you~

Right, we tested our models with PyTorch 1.8.0. I suggest you try syncing the versions mentioned in the installation instructions. Also, you might want to run nvidia-smi and make sure your cuda version for torch matches with the one installed on your machine.

Thank you for your answer, I get the PyTorch 1.8.0 But after that I got ImportError: cannot import name 'PILLOW_VERSION' from 'PIL',

Hey, could you share information about your PIL version? This might be related to an incompatible PIL package.
https://discuss.pytorch.org/t/cannot-import-name-pillow-version-from-pil/66096

Hi, when I run I got "EncoderDecoder: 'SeMaskSwinTransformer is not in the models registry'"~ Is it possible to solve? Thank you~~

config_file_SEMASK ='configs/semask_swin/cityscapes/semfpn_semask_swin_base_patch4_window12_768x768_80k_cityscapes.py'
checkpoint_file_SEMASK ='checkpoints/semask_base_fpn_cityscapes.pth'
model_SEMASK = init_segmentor(config_file_SEMASK , checkpoint_file_SEMASK, device='cuda:0')

And get the error. Thank you for solving!~~

Hey @Jinshan99, you need to build mmsegmentation locally using the command pip install -e . to use SeMaskSwinTransformer. Before running the command please make sure your working directory is SeMask-FPN. For more details, please refer to the instructions here.

Hi, I followed the instructions, but still have the error ..

!rm -rf SeMask-Segmentation
!git clone https://github.com/Picsart-AI-Research/SeMask-Segmentation.git
%cd SeMask-Segmentation/SeMask-FPN
!pip install -e .

'SeMaskSwinTransformer is not in the models registry'

Could you try pip3 install -e .? Your python version might be different.

Hi, I used it but still "EncoderDecoder: 'SeMaskSwinTransformer is not in the models registry'". Is it need to import something else? Thank you~~

This is strange. I can run the repo on my end. Could you share the following information?

  • Run pip3 uninstall mmsegmentation
  • Run pip3 install -e . Please share the logs for this command.

I run the codes with python 3.7 with semask env, when I import mmseg, there is no mmcv error. I could not pip install mmcv-full==latest+torch1.5.0+cu101 -f https://download.openmmlab.com/mmcv/dist/index.html which says raise InvalidVersion(f"Invalid version: '{version}'")
pip._vendor.packaging.version.InvalidVersion: Invalid version: 'latest+torch1.5.0+cu101'

Hi @Jinshan99, please try the following command for installation with PyTorch-1.8.0 (assuming you are using Cuda version >=11.1)

pip install mmcv-full==1.3.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html

Hi @Jinshan99, I assume your issue was resolved since I did not hear back from you. Feel free to reopen this issue if you face any other problems.