akhilpm / DroneDetectron2

Pytorch code for our CVPRw 2023 paper "Cascaded Zoom-in Detector for High Resolution Aerial Images"
MIT License
52 stars 7 forks source link

requirements #5

Closed mahilaMoghadami closed 1 year ago

mahilaMoghadami commented 1 year ago

hello

after installing PyTorch and building detectron2, which packages should be installed? I got this error : cannot import name 'bbox_inside_old' from 'utils.box_utils'

it seems there is no function called "bbox_inside_old" in box_utils.py. no requirement.txt I find...and also no setup.py thank you for your response.

akhilpm commented 1 year ago

All other dependencies are common python packages like matplotlib, PIL, numpy etc.

This error might be from an old version of the code you pulled in from this repo. I renamed the function "bbox_inside_old" to "bbox_enclose" in box_utils.py. You can also see that this function is not used in the main body of the code (it is used only in some ablation experiments), so you can comment that line.

This is not a Python package to provide setup.py etc. And requirements are given in the "Prerequisites" section.

mahilaMoghadami commented 1 year ago

Hello again I clone this repository today and check it again. you are right there is no function named "bbox_inside_old" and also no line which use this function but still there is this error while Im trying to train

Traceback (most recent call last): File "train_net.py", line 14, in from croptrain.engine.trainer import BaselineTrainer File "/media/2TB_1/.Trash-1003/files/DroneDetectron2/croptrain/engine/trainer.py", line 32, in from croptrain.engine.inference import inference_with_crops File "/media/2TB_1/.Trash-1003/files/DroneDetectron2/croptrain/engine/inference.py", line 14, in from utils.box_utils import bbox_inside_old ImportError: cannot import name 'bbox_inside_old' from 'utils.box_utils' (/media/2TB_1/.Trash-1003/files/DroneDetectron2/utils/box_utils.py)

akhilpm commented 1 year ago

It is a simple error that will go away if you comment that import line! Anyway, I just removed that and pushed the changes.

mahilaMoghadami commented 1 year ago

Hello again Thank you

I got error about my annotation.json file but Im sure that my visdrone coco format annotations are true because I trained different models with them. I have categories 1 to 10 (10 classes) and category_ids are match.

this is my error: KeyError: "Encountered category_id=10 but this id does not exist in 'categories' of the json file."

akhilpm commented 1 year ago

Probably you are not passing the data in Detectron2 compatible format. Detectron2 labels classes from 0 to 9 (for a 10-class dataset). And class 10 is assigned for "background" class. This is different from the old convention used in Faster RCNN and related code-base where you assign label 0 to "background" class.

I have updated ReadMe with the info about converting VisDrone XML annotations to COCO format. A link to the code used is provided. Once the JSON files are prepared properly, the "register_visdrone" function in my code is taking care of this conversion to 0-9. Refer to that function for more info, if one wants to give different ids for categories it should be possible to do it there by tweaking the labeling part.

mahilaMoghadami commented 1 year ago

thank you.

I changed labels as you mentioned (0 to 10 for ten classes). But the problem still persists.

KeyError: "Encountered category_id=9 but this id does not exist in 'categories' of the json file."

any way I will convert visdrone dataset annotation to coco again with link you shared.

thank you.

akhilpm commented 1 year ago

Yeah, this error is not from the code, it is from the data preparation. So you have to figure it out!

mahilaMoghadami commented 1 year ago

Is it possible for you to share your VisDrone train and val json annotation in your repository?

akhilpm commented 1 year ago

No, it is big. I just put it in my google drive, you can download it from here:

https://drive.google.com/file/d/1awV0WWScKO7rRdff8mPkn_Q-S261i7Tm/view?usp=sharing

https://drive.google.com/file/d/1SAxFcQDM6txwzK5Itb0sYjxp9i2CYqC4/view?usp=sharing

mahilaMoghadami commented 1 year ago

thank you.

AI-AUT commented 1 year ago

No, it is big. I just put it in my google drive, you can download it from here:

https://drive.google.com/file/d/1awV0WWScKO7rRdff8mPkn_Q-S261i7Tm/view?usp=sharing

https://drive.google.com/file/d/1SAxFcQDM6txwzK5Itb0sYjxp9i2CYqC4/view?usp=sharing

Hello why you have category-id = 11 in your annotation.json file? while VisDrone only have 10 classes. is category-id==11 for unknown regions?

Yhsun20001116 commented 6 months ago

谢谢。

正如您提到的,我更改了标签(十个类从 0 到 10)。但问题仍然存在。

KeyError:“遇到 category_id=9,但此 id 不存在于 json 文件的”类别“中。

无论如何,我都会使用您共享的链接再次将 visdrone 数据集注释转换为 coco。

谢谢。 请问这个问题解决了吗

thank you.

I changed labels as you mentioned (0 to 10 for ten classes). But the problem still persists.

KeyError: "Encountered category_id=9 but this id does not exist in 'categories' of the json file."

any way I will convert visdrone dataset annotation to coco again with link you shared.

thank you.

May I ask if this problem has been resolved

Yhsun20001116 commented 6 months ago

ValueError: need at least one array to concatenate What is the problem

akhilpm commented 6 months ago

I shared my JSON annotation file in google drive. It solved the KeyError issue mentioned above.

Your error looks like is due to not reading any annotations from the JSON file properly. Check if the path is correct, and annotation is getting parsed properly.