Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run demo code #3

Open
yestaehyung opened this issue Jul 27, 2022 · 8 comments
Open

Can't run demo code #3

yestaehyung opened this issue Jul 27, 2022 · 8 comments

Comments

@yestaehyung
Copy link

hello when i run demo code there was some error

python demo/image_demo.py ../dataset/test/03fc99c4deaf14724ef6277dec16b8e8.jpg work_dirs/attribute_mask_rcnn_swin_b_3x/attribute_mask_rcnn_swin_b_3x.py work_dirs/attribute_mask_rcnn_swin_b_3x/latest.pth

how can i solve this error?

Traceback (most recent call last):
File "/home/kshan/anaconda3/envs/fashionformer/lib/python3.8/site-packages/mmcv/utils/misc.py", line 73, in import_modules_from_strings
imported_tmp = import_module(imp)
File "/home/kshan/anaconda3/envs/fashionformer/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'datasets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "demo/image_demo.py", line 69, in
main(args)
File "demo/image_demo.py", line 35, in main
model = init_detector(args.config, args.checkpoint, device=args.device)
File "/home/kshan/taehyung/mmdetection/mmdet/apis/inference.py", line 33, in init_detector
config = mmcv.Config.fromfile(config)
File "/home/kshan/anaconda3/envs/fashionformer/lib/python3.8/site-packages/mmcv/utils/config.py", line 343, in fromfile
import_modules_from_strings(**cfg_dict['custom_imports'])
File "/home/kshan/anaconda3/envs/fashionformer/lib/python3.8/site-packages/mmcv/utils/misc.py", line 80, in import_modules_from_strings
raise ImportError
ImportError

@xushilin1
Copy link
Owner

Thanks for your interest in our work.
I think you can try the command like this.
PYTHONPATH='.' python demo/image_demo.py ...

@abaybektursun
Copy link

Same issue here. I tried

PYTHONPATH='.' python demo/image_demo.py demo.jpg configs/fashionformer/fashionpedia/fashionformer_r50_mlvl_feat_3x.py fashionformer_r50_3x.pth

Same error.

@abaybektursun
Copy link

abaybektursun commented Aug 28, 2022

I was able to solve this error by installing depedencies that are missing in the readme.

pip install git+https://github.com/cocodataset/panopticapi.git
pip install sklearn
pip install scikit-image

However, another issue came to its place:

Traceback (most recent call last):
  File "demo/image_demo.py", line 68, in <module>
    main(args)
  File "demo/image_demo.py", line 34, in main
    model = init_detector(args.config, args.checkpoint, device=args.device)
  File "/home/abaybektursun/projects/Product_Labels_Ejike_Uzoigwe/FashionFormer/venv/lib/python3.8/site-packages/mmdet/apis/inference.py", line 33, in init_detector
    config = mmcv.Config.fromfile(config)
  File "/home/abaybektursun/projects/Product_Labels_Ejike_Uzoigwe/FashionFormer/venv/lib/python3.8/site-packages/mmcv/utils/config.py", line 335, in fromfile
    import_modules_from_strings(**cfg_dict['custom_imports'])
  File "/home/abaybektursun/projects/Product_Labels_Ejike_Uzoigwe/FashionFormer/venv/lib/python3.8/site-packages/mmcv/utils/misc.py", line 73, in import_modules_from_strings
    imported_tmp = import_module(imp)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/abaybektursun/projects/Product_Labels_Ejike_Uzoigwe/FashionFormer/projects/FashionFormer/__init__.py", line 2, in <module>
    from .kernel_roi_head import KernelIterHead
  File "/home/abaybektursun/projects/Product_Labels_Ejike_Uzoigwe/FashionFormer/projects/FashionFormer/kernel_roi_head.py", line 8, in <module>
    from models.assigner.mask_pseudo_sampler import MaskPseudoSampler
  File "/home/abaybektursun/projects/Product_Labels_Ejike_Uzoigwe/FashionFormer/models/assigner/__init__.py", line 1, in <module>
    from .mask_hungarian_assigner import DiceCost, MaskCost, MaskHungarianAssigner
  File "/home/abaybektursun/projects/Product_Labels_Ejike_Uzoigwe/FashionFormer/models/assigner/mask_hungarian_assigner.py", line 15, in <module>
    class DiceCost(object):
  File "/home/abaybektursun/projects/Product_Labels_Ejike_Uzoigwe/FashionFormer/venv/lib/python3.8/site-packages/mmcv/utils/registry.py", line 311, in _register
    self._register_module(
  File "/home/abaybektursun/projects/Product_Labels_Ejike_Uzoigwe/FashionFormer/venv/lib/python3.8/site-packages/mmcv/utils/registry.py", line 246, in _register_module
    raise KeyError(f'{name} is already registered '
KeyError: 'DiceCost is already registered in Match Cost'

UPDATE: downgraded to mmdet==2.18.0 all other versions match according to readme.
Now I get this error:

Traceback (most recent call last):
  File "demo/image_demo.py", line 68, in <module>
    main(args)
  File "demo/image_demo.py", line 38, in main
    show_result_pyplot(
TypeError: show_result_pyplot() got an unexpected keyword argument 'palette'

@xushilin1
Copy link
Owner

Thanks for your interest and sorry for the late reply.
I have reproduced this issue and fixed this bug in mmdet==2.18.0;

@danailliu
Copy link

hello,when I run the demo. ALL the coordinate of BBOX is zero.like this:

[array([[0. , 0. , 0. , 0. , 0.79686284]],
dtype=float32),
array([[0. , 0. , 0. , 0. , 0.05989303]],
dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([[0. , 0. , 0. , 0. , 0.0524485]],
dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([[0. , 0. , 0. , 0. , 0.02910043],
[0. , 0. , 0. , 0. , 0.02114534],
[0. , 0. , 0. , 0. , 0.01676908],
[0. , 0. , 0. , 0. , 0.01669254]],
dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([[0. , 0. , 0. , 0. , 0.02301841],
[0. , 0. , 0. , 0. , 0.01924651]],
dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([[0. , 0. , 0. , 0. , 0.03298811]],
dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([[0. , 0. , 0. , 0. , 0.01731287]],
dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([[0. , 0. , 0. , 0. , 0.89752316]],
dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([[0. , 0. , 0. , 0. , 0.06933805],
[0. , 0. , 0. , 0. , 0.05986979],
[0. , 0. , 0. , 0. , 0.02281323],
[0. , 0. , 0. , 0. , 0.01794562]],
dtype=float32),
array([[0. , 0. , 0. , 0. , 0.90336406],
[0. , 0. , 0. , 0. , 0.5355902 ],
[0. , 0. , 0. , 0. , 0.33188647],
[0. , 0. , 0. , 0. , 0.03402795],
[0. , 0. , 0. , 0. , 0.02057427],
[0. , 0. , 0. , 0. , 0.01929876]],
dtype=float32),
array([[0. , 0. , 0. , 0. , 0.77538824],
[0. , 0. , 0. , 0. , 0.7699898 ],
[0. , 0. , 0. , 0. , 0.04109826],
[0. , 0. , 0. , 0. , 0.03557413],
[0. , 0. , 0. , 0. , 0.03185431],
[0. , 0. , 0. , 0. , 0.03024532],
[0. , 0. , 0. , 0. , 0.02898962],
[0. , 0. , 0. , 0. , 0.02549006],
[0. , 0. , 0. , 0. , 0.02261182],
[0. , 0. , 0. , 0. , 0.02258267],
[0. , 0. , 0. , 0. , 0.02063485],
[0. , 0. , 0. , 0. , 0.02014134],
[0. , 0. , 0. , 0. , 0.01998736],
[0. , 0. , 0. , 0. , 0.01909333],
[0. , 0. , 0. , 0. , 0.01787589],
[0. , 0. , 0. , 0. , 0.01767974],
[0. , 0. , 0. , 0. , 0.01759748],
[0. , 0. , 0. , 0. , 0.01683186]],
dtype=float32),
array([[0. , 0. , 0. , 0. , 0.02470406],
[0. , 0. , 0. , 0. , 0.0189336 ],
[0. , 0. , 0. , 0. , 0.01676438]],
dtype=float32),
array([], shape=(0, 5), dtype=float32),
array([[0. , 0. , 0. , 0. , 0.03116137]],
dtype=float32),

@ranjeetthakur193
Copy link

Spent whole day can't setup the environment, Better to add a colab notebook or a docker image

@MroutsideturnAF
Copy link

Spent whole day can't setup the environment, Better to add a colab notebook or a docker image

The following setup worked for me on colab.
pip_freeze.txt

@anilsathyan7
Copy link

anilsathyan7 commented Nov 16, 2023

This seems to work, atleast with cpu mode:

conda create --name fashionformer python=3.8.13
conda activate fashionformer
conda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cudatoolkit=11.3 -c pytorch -c conda-forge
pip install -U openmim
mim install mmcv-full==1.4.0
pip install mmdet==2.18.0
pip install git+https://github.com/cocodataset/panopticapi.git
pip3 install -U scikit-learn scipy matplotlib scikit-image chainercv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants