Closed CharlesNJ closed 3 years ago
Installing mmdet after installing apex solved it. For some reason, installing apex messed with mmcv (assumed that mmdet gets automatically installed with mmcv), it threw an error saying mmdet was missing so installing it AFTER resolved it. And, now ended up with a new problem.
Traceback (most recent call last):
File "tools/test.py", line 220, in
@CharlesNJohn Good to hear the install worked. As for the new error, it might mean that there's a syntax error with your config file (e.g. a missing comma somewhere), assuming you've modified the default one.
Thank you! I haven't touched any of the files, I am just running them as it is.
Ah okay, what command did you run?
!python tools/test.py /content/swin_base_patch4_window12_384.yaml /content/swin_base_patch4_window12_384.pth --eval bbox segm
Ah okay, what command did you run?
Thank you for taking time to help, I appreciate it.
No worries. Where did you get this 'config' file ('/content/swin_base_patch4_window12_384.yaml ') from? And same with your checkpoint file ('/content/swin_base_patch4_window12_384.pth')?
I think your config file should be a .py file. Example config files and their corresponding checkpoint files for swin object detection are given here. Try downloading this config file and it's checkpoint file and running test.py with those instead. You'll probably need to modify the config file to point to your images but try running it first. If it complains about the images then you'll know you're on the right track.
I could be wrong though.
I did not realize I have been back and forth with another SwinTr. from Microsoft. https://github.com/microsoft/Swin-Transformer I got those files from here. I think I will go with yours first and then try the msft one. Thank you!
Can I ask which guide you followed when installing mmdetection?
Can I ask which guide you followed when installing mmdetection?
Sorry, I thought I should not bother you and just do more googling before asking you, that's why I deleted my previous comment.
Now you responded, here it is!
Traceback (most recent call last):
File "tools/test.py", line 220, in
https://github.com/open-mmlab/mmdetection/blob/master/docs/get_started.md
Okay thanks. Since we are installing mmdetection for swin, we need to follow this guide not that one:
https://github.com/SwinTransformer/Swin-Transformer-Object-Detection/blob/master/docs/get_started.md
The reason you are getting the error is because the instructions you followed tell you to clone a different repo (https://github.com/open-mmlab/mmdetection/) to the swin one we are currently in (https://github.com/SwinTransformer/Swin-Transformer-Object-Detection). That probably explains the previous error with Apex.
I recommend following the correct guide and doing a reinstall, and remember to clone the right repo (https://github.com/SwinTransformer/Swin-Transformer-Object-Detection) for this step in the guide:
Clone the MMDetection repository.
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
Thank you @AlphonsGwatimba, I have followed the procedure but I still get the same error as above, '..swin_fpn.py doesn't exist'
Hmm that's odd, what's the name of the directory you're running the command from?
I am running it from the Swin Transfomer Object Detection directory
Does this file exist in that directory:
Swin-Transformer-Object-Detection/configs/base/models/mask_rcnn_swin_fpn.py
It does exist!
I wonder if that is taking from the same directory.
I wonder if that is taking from the same directory.
there are no other base/models though!
I have tried it with other models (masked rcnn) too, throws the same error that it is not found.
I see what's happening - It's searching in "Downloads/base/models/mask_rcnn_swin_fpn.py", instead of "Downloads/Swin-Transformer-Object-Detection/configs/base/models/mask_rcnn_swin_fpn.py"
Do I just change the code of the file of the path.py? Do you know a better approach to change the path? "Downloads/mmcv/mmcv/utils/path.py"
Changed the code in the config file, that issue is solved.
base = [ './configs/base/models/mask_rcnn_swin_fpn.py', './configs/base/datasets/coco_instance.py', './configs/base/schedules/schedule_1x.py', './configs/base/default_runtime.py' ]
@CharlesNJohn Sorry for the late reply but glad you fixed it!
Thank you for your continuous support, it really helps when you know someone out there is to help. I appreciate it. I am getting so many errors lol, just trying to run a pre-trained model here. Haha
Downloads/mmcv/mmcv/utils/registry.py", line 54, in build_from_cfg raise type(e)(f'{obj_cls.__name__}: {e}') FileNotFoundError: CocoDataset: [Errno 2] No such file or directory: 'data/coco/annotations/instances_val2017.json'
Thank you for your continuous support, it really helps when you know someone out there is to help. I appreciate it. I am getting so many errors lol, just trying to run a pre-trained model here. Haha
Downloads/mmcv/mmcv/utils/registry.py", line 54, in build_from_cfg raise type(e)(f'{obj_cls.__name__}: {e}') FileNotFoundError: CocoDataset: [Errno 2] No such file or directory: 'data/coco/annotations/instances_val2017.json'
pycocotools is already installed. Do you know which directory to look this up?
That error means it's looking for images and their annotations to use for inference but it can't find them. Remember what I said in a previous comment:
You'll probably need to modify the config file to point to your images but try running it first. If it complains about the images then you'll know you're on the right track.
We are now at that stage where it's complaining about the images so that's good, you're on the right track. From this point on I recommend reading the official guide here which will explain everything about using mmdetection, such as tweaking the config, image/annotations. Maybe start with "1: Inference and train with existing models and standard datasets".
Did you install Apex?