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

Error in visualization of CWD test results. #52

Closed
sunshiding opened this issue Jan 16, 2022 · 4 comments · Fixed by #53
Closed

Error in visualization of CWD test results. #52

sunshiding opened this issue Jan 16, 2022 · 4 comments · Fixed by #53
Assignees
Labels
bug Something isn't working

Comments

@sunshiding
Copy link

I get an error when I execute the following command:

python tools/mmseg/test_mmseg.py /home/sunshiding/mmrazor/work_dirs/cwd_cls_head_pspnet_r50_d8_pspnet_r18_d8_512x512_voc12/cwd_cls_head_pspnet_r50_d8_pspnet_r18_d8_512x512_voc12.py /home/sunshiding/mmrazor/work_dirs/cwd_cls_head_pspnet_r50_d8_pspnet_r18_d8_512x512_voc12/iter_4000.pth --show-dir ./results/cwd_cls_head_pspnet_r50_d8_pspnet_r18_d8_512x512_voc12

The error is as follows:

load checkpoint from local path: /home/sunshiding/mmrazor/work_dirs/cwd_cls_head_pspnet_r50_d8_pspnet_r18_d8_512x512_voc12/iter_4000.pth
[ ] 0/115, elapsed: 0s, ETA:Traceback (most recent call last):
File "tools/mmseg/test_mmseg.py", line 248, in
main()
File "tools/mmseg/test_mmseg.py", line 210, in main
format_args=eval_kwargs)
File "/home/sunshiding/mmsegmentation-master/mmseg/apis/test.py", line 140, in single_gpu_test
opacity=opacity)
File "/home/sunshiding/.conda/envs/razor/lib/python3.7/site-packages/mmrazor/models/algorithms/base.py", line 170, in show_result
return self.architecture.show_result(img, result, **kwargs)
File "/home/sunshiding/.conda/envs/razor/lib/python3.7/site-packages/mmrazor/models/architectures/base.py", line 41, in show_result
return self.model.show_result(img, result, **kwargs)
File "/home/sunshiding/mmsegmentation-master/mmseg/models/segmentors/base.py", line 242, in show_result
assert palette.shape[0] == len(self.CLASSES)
File "/home/sunshiding/.conda/envs/razor/lib/python3.7/site-packages/torch/nn/modules/module.py", line 779, in getattr
type(self).name, name))
torch.nn.modules.module.ModuleAttributeError: 'EncoderDecoder' object has no attribute 'CLASSES'

@wwjwy
Copy link

wwjwy commented Jan 17, 2022

you can change File "/home/sunshiding/mmsegmentation-master/mmseg/models/segmentors/base.py", line 242, in show_result
assert palette.shape[0] == len(self.CLASSES) to assert palette.shape[0] == 21(the number of classes), i meet the same problem and solve it like this.

@pppppM pppppM assigned pppppM and wutongshenqiu and unassigned pppppM Jan 17, 2022
@wutongshenqiu
Copy link
Contributor

Thanks for your issue. This is probably due to the fact that the CLASSES property is only assigned to algorithm instead of the model used in mmsegmentation, we will fix this soon.

@wutongshenqiu
Copy link
Contributor

Could you please modify test_mmseg.py according to this pr open-mmlab/mmrazor#53 and see if there is still an error?

@wutongshenqiu wutongshenqiu linked a pull request Jan 17, 2022 that will close this issue
2 tasks
@sunshiding
Copy link
Author

Could you please modify test_mmseg.py according to this pr open-mmlab/mmrazor#53 and see if there is still an error?

Thank you very much, this problem has been solved perfectly.

@wutongshenqiu wutongshenqiu added the bug Something isn't working label Jan 18, 2022
humu789 pushed a commit to humu789/mmrazor that referenced this issue Feb 13, 2023
* [Refactor] add enum class and use functions to get configuration (open-mmlab#40)

* add task and codebase enum class

* use funcitons to get config

* Refactor wrappers of mmcls and mmseg (open-mmlab#41)

* move wrappers of cls & det to apis

* remove get_classes_from_config

* rename onnx_helper to onnx_utils

* move import to outside of class

* refactor ortwrappers

* Refactor build dataset and dataloader for mmseg (open-mmlab#44)

* refactor build_dataset and build_dataloader for mmcls and mmseg

* remove repeated classes

* set build_dataloader with shuffle=False

* [Refactor] pplwrapper and mmocr refactor (open-mmlab#46)

* add

* add pplwrapper and refactor mmocr

* fix lint

* remove unused arguments

* apply dict input for pplwrapper and ortwrapper

* add condition before import ppl and ort stuff

* update ppl (open-mmlab#51)

* Refactor return value and extract_model (open-mmlab#54)

* remove ret_value

* refactor extract_model

* fix typo

* resolve comments

* [Refactor] Refactor model inference pipeline (open-mmlab#52)

* move attribute_to_dict to extract_model

* simplify the inference and visualization

* remove unused import

* [Feature] Support SRCNN in mmedit with ONNXRuntime and TensorRT (open-mmlab#45)

* finish mmedit-ort

* edit __init__ files

* add noqa

* add tensorrt support

* 1. Rename "base.py"
2. Move srcnn.py to correct directory

* fix bugs

* remove figures

* align to refactor-v1

* update comment in srcnn

* fix lint

* newfunc -> new_func

* Add visualize.py

split visualize() in each codebase

* fix lint

* fix lint

* remove unnecessary code in ORTRestorer

* remove .api

* edit super(), remove dataset

* [Refactor]: Change name of split to partition (open-mmlab#57)

* refactor mmcls configs

* refactor mmdet configs and split params

* rename rest split to partition from master

* remove base.py

* fix init of inference class

* fix mmocr init, add show_result alias

Co-authored-by: AllentDan <41138331+AllentDan@users.noreply.github.com>
Co-authored-by: RunningLeon <maningsheng@sensetime.com>
Co-authored-by: Yifan Zhou <singlezombie@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants