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

detector valid generates all "image_id" is 0 #5615

Open
lazerliu opened this issue May 14, 2020 · 6 comments
Open

detector valid generates all "image_id" is 0 #5615

lazerliu opened this issue May 14, 2020 · 6 comments

Comments

@lazerliu
Copy link

lazerliu commented May 14, 2020

Dear Alexey,
First of all, thank you for your great work.

I've used validto generate coco_results.json,but I got all the image_idis 0,my results like this:

[
...
{"image_id":0, "category_id":1, "bbox":[629.906372, 93.858353, 18.401489, 16.803741], "score":0.113654},
{"image_id":0, "category_id":1, "bbox":[140.943192, 342.924347, 20.169861, 30.018188], "score":0.089187},
{"image_id":0, "category_id":1, "bbox":[624.000000, 97.106476, 24.103394, 21.146072], "score":0.033187},
{"image_id":0, "category_id":1, "bbox":[144.488617, 355.852173, 17.576019, 17.879456], "score":0.018196},
{"image_id":0, "category_id":1, "bbox":[621.957886, 113.128845, 25.458862, 33.240417], "score":0.005647},
{"image_id":0, "category_id":1, "bbox":[612.411011, 99.263046, 10.962769, 17.111465], "score":0.004837},
{"image_id":0, "category_id":1, "bbox":[633.184082, 97.726295, 21.925049, 19.070374], "score":0.003713},
{"image_id":0, "category_id":1, "bbox":[618.204102, 92.849335, 17.411987, 18.312973], "score":0.002731},
{"image_id":0, "category_id":1, "bbox":[617.733582, 90.278694, 44.910400, 23.889359], "score":0.002378},
{"image_id":0, "category_id":1, "bbox":[603.124878, 89.683998, 11.797363, 12.185028], "score":0.002228},
{"image_id":0, "category_id":1, "bbox":[0.000000, 29.954353, 4.645081, 26.263885], "score":0.002055},
{"image_id":0, "category_id":1, "bbox":[0.000000, 20.163948, 3.774524, 19.243519], "score":0.001632},
{"image_id":0, "category_id":1, "bbox":[137.526642, 339.686676, 16.503113, 25.850891], "score":0.001602},
{"image_id":0, "category_id":1, "bbox":[647.096008, 25.978762, 22.297729, 25.604887], "score":0.001168},
{"image_id":0, "category_id":1, "bbox":[90.852844, 366.714111, 19.151260, 25.072632], "score":0.001075},
{"image_id":0, "category_id":1, "bbox":[655.136353, 0.000000, 23.170166, 6.582273], "score":0.001035}
]

and my test.txt like this

/home/xxx/documents/gits/alexab/darknet/build/darknet/x64/data/obj/test_0000.jpg
/home/xxx/documents/gits/alexab/darknet/build/darknet/x64/data/obj/test_0001.jpg
/home/xxx/documents/gits/alexab/darknet/build/darknet/x64/data/obj/test_0002.jpg
/home/xxx/documents/gits/alexab/darknet/build/darknet/x64/data/obj/test_0003.jpg
/home/xxx/documents/gits/alexab/darknet/build/darknet/x64/data/obj/test_0004.jpg
/home/xxx/documents/gits/alexab/darknet/build/darknet/x64/data/obj/test_0005.jpg
/home/xxx/documents/gits/alexab/darknet/build/darknet/x64/data/obj/test_0006.jpg
/home/xxx/documents/gits/alexab/darknet/build/darknet/x64/data/obj/test_0007.jpg
/home/xxx/documents/gits/alexab/darknet/build/darknet/x64/data/obj/test_0008.jpg

Is there any problem?
Thank you very very much!

@lazerliu lazerliu changed the title Get All all the metrics of COCO mAP detector valid generates all "image_id" is 0 May 14, 2020
@lazerliu
Copy link
Author

While I use the original darknet yolov3 valid these same images,it generate the right json like this


{"image_id":0, "category_id":2, "bbox":[356.486206, 2.146976, 12.569397, 7.220934], "score":0.029387},
{"image_id":0, "category_id":2, "bbox":[311.298920, 2.309143, 28.693665, 17.816805], "score":0.006101},
{"image_id":1, "category_id":2, "bbox":[378.651367, 288.187378, 12.964233, 16.216003], "score":0.991247},
{"image_id":1, "category_id":1, "bbox":[289.078491, 54.320377, 21.093567, 8.391327], "score":0.006931},
{"image_id":1, "category_id":2, "bbox":[289.078491, 54.320377, 21.093567, 8.391327], "score":0.640269},
{"image_id":1, "category_id":1, "bbox":[255.469391, 489.705231, 30.240356, 10.294769], "score":0.079129},
{"image_id":1, "category_id":1, "bbox":[267.355560, 493.283203, 18.491638, 6.514526], "score":0.035697},

@AlexeyAB
Copy link
Owner

You can use ./darknet detector valid only for MSCOCO, PascalVOC, BDD100k, Kitti and ImageNet datasets.

For you custom dataset you should use ./darknet detector map...

You can't get AP_s, AP_l, ... for you custom dataset. You should implement your own code.

@lazerliu
Copy link
Author

Thanks for your reply,I will try to implement it.

@latifisalar
Copy link

@lazerliu Did you manage to find the issue?
I am facing the same problem while generating the coco_results.json with ./darknet detector valid for 5k.txt set of images on val2014.

@shaojiestar
Copy link

Thanks for your reply,I will try to implement it.

I am facing the same problem,have you solved this issue? or could you implement this?

@Fushier
Copy link

Fushier commented Sep 27, 2021

@lazerliu Did you manage to find the issue?
I am facing the same problem while generating the coco_results.json with ./darknet detector valid for 5k.txt set of images on val2014.

Because the name format of "val2014" is "COCO_val2014_000000522418.jpg",but in :

//int image_id = get_coco_image_id(image_path);
,
It uses base_cfg():
char *basecfg(char *cfgfile)

So the file name of val2014 can't be parsed to int in line465, then you can see all the image_ids are zeros.
You can uncomment the get_coco_image_id(image_path) then it will work.
If you are using a custom dataset, you can also change the code of get_coco_image_id to get the correct image_id.

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

5 participants