w1oves / Rein

[CVPR 2024] Official implement of <Stronger, Fewer, & Superior: Harnessing Vision Foundation Models for Domain Generalized Semantic Segmentation>
https://zxwei.site/rein
GNU General Public License v3.0
215 stars 19 forks source link

tools/test.py did't work #14

Closed wqfdewifi closed 5 months ago

w1oves commented 5 months ago

Please provide detailed error information.

wqfdewifi commented 5 months ago

Thank you for your amazing work!! I have faced some problem and hope you can give me some advice.

1、 I run the evaluation code “python tools/test.py configs/dinov2/rein_dinov2_mask2former_512x512_bs1x4.py checkpoints/dinov2_rein_and_head.pth --backbone dinov2_converted.pth”,

And I got KeyError: 'LoadBackboneHook is not in the mmseg::hook registry. Please check whether the value of LoadBackboneHook is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module'

2、after that I remove --backbone dinov2_converted.pth, and download your released checkpoint. I run the evaluation code “python tools/test.py configs/dinov2/rein_dinov2_mask2former_512x512_bs1x4.py checkpoints/iter_40000_published.pth” ,I got a very terrible results

+---------------+-------+-------+ [634/1922] | Class | IoU | Acc |
+---------------+-------+-------+
| road | 1.16 | 1.36 |
| sidewalk | 0.83 | 1.02 |
| building | 19.09 | 65.2 |
| wall | 0.19 | 0.62 |
| fence | 0.98 | 14.62 |
| pole | 1.66 | 8.41 |
| traffic light | 0.0 | 0.0 |
| traffic sign | 0.49 | 1.82 |
| vegetation | 0.43 | 0.44 |
| terrain | 0.27 | 0.51 |
| sky | 1.39 | 1.48 |
| person | 0.11 | 0.12 |
| rider | 0.0 | 0.0 |
| car | 0.03 | 0.03 |
| truck | 0.66 | 4.39 |
| bus | 0.0 | 0.0 |
| train | 0.0 | 0.0 |
| motorcycle | 0.0 | 0.0 |
| bicycle | 0.0 | 0.0 |
+---------------+-------+-------+
number of samples for citys: 500 03/27 10:45:37 - mmengine - INFO - Iter(test) [500/500] citys_aAcc: 15.2600 citys_mIoU: 1.4400 citys_mAcc: 5.2600 mean_aAcc: 15.2600 mean_mIoU: 1.4400 mean_mAcc: 5.2600 da ta_time: 0.0059 time: 0.8145

What did I miss?

w1oves commented 5 months ago

Apologies! This might be due to my mistakenly registering the LoadBackboneHook. However, this part of the code runs fine in my environment. Since I don't currently have access to my server, I've attempted to replace 'mmengine' with 'mmseg' on the first line in rein/hooks/load_backbone_hook.py and have updated the project with these changes. I'm unsure whether this modification will resolve your issue, so please try running the following command again after making the change:

python tools/test.py configs/dinov2/rein_dinov2_mask2former_512x512_bs1x4.py checkpoints/dinov2_rein_and_head.pth --backbone dinov2_converted.pth
wqfdewifi commented 5 months ago

It works, thank you so much! I wish you all the best :)