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

Detection output in coco format #621

Closed
Pari-singh opened this issue Nov 16, 2019 · 12 comments
Closed

Detection output in coco format #621

Pari-singh opened this issue Nov 16, 2019 · 12 comments
Labels
enhancement New feature or request

Comments

@Pari-singh
Copy link

Hi @glenn-jocher, we have the option of getting our test.py results in coco (json) format. Is there a way to get the detection output as well in json format? Format like mentioned here http://cocodataset.org/#format-results

@Pari-singh Pari-singh added the enhancement New feature or request label Nov 16, 2019
@glenn-jocher
Copy link
Member

@Pari-singh this functionality is not available currently. Note that detect.py always runs at batch-size 1 also. The file is simply a demo of what's possible, so that you can use it as a starting point for your own development.

@daddydrac
Copy link

Ok I can modify this file, but where can I access the data needed to save the following metrics in COCO Format. (I understand I may have to do some math, but where is the raw data located for each of the following):

  1. Qualitative detection output images on validation set showing true positive detections, false positives and false negatives.

  2. mAP result on the validation set for IOU > 0.5.

  3. Class-wise analysis of precision and recall of detections.

@glenn-jocher
Copy link
Member

@joehoeller I don't understand your question. test.py returns all metrics on the selected dataset. See https://github.com/ultralytics/yolov3#map

@Pari-singh
Copy link
Author

@joehoeller, data can be any on which you want to do the detection. I was working with FLIR dataset, it is available on the FLIR website.
However, getting the detection output in coco format wasn't much difficult, I took the inspiration from test.py and instead of passing the image and labels in Pytorch dataloader, I passed the image as it is and ran the model detection, saving result in json, as done in test.py (which doesn't need labels). It worked fine. As @glenn-jocher warned the detect.py runs at single image per batch, detecting it to save in coco json using test.py makes it faster.

@FranciscoReveriano
Copy link
Contributor

Are you asking for a new post training grader .py file?

@daddydrac
Copy link

Ultralytics seems a lot better, I was previously using a Darknet fork that had very poor documentation. A lot of what you can do, and how to do it is (mostly) well documented here. So I think that was my main problem, was working in a forked repo.

I will look at test.py. Thank you all for your responses.

@daddydrac
Copy link

@Pari-singh excellent work btw.

@daddydrac
Copy link

daddydrac commented Nov 23, 2019

@glenn-jocher Please see - #650

@daddydrac
Copy link

How do we get labels for our own images? The directions are below but do not make sense to me.

Train On Custom Data

  1. Convert your data to Darknet format. Your data should mirror the directory structure created by data/get_coco_dataset.sh, with images and labels in separate folders, and one label file per image.

Each image's label file must be locatable by simply replacing /images/.jpg with /labels/.txt in its pathname. An example image and label pair would be:

../coco/images/val2014/COCO_val2014_000000013992.jpg  # image
../coco/labels/val2014/COCO_val2014_000000013992.txt  # label

One file per image (if no objects in image, no label file is required).
One row per object.
Each row is class x_center y_center width height format.
Box coordinates must be in normalized xywh format (from 0 - 1).
Classes are zero-indexed (start from 0).

@daddydrac
Copy link

UPDATE: I fixed the PR and updated the math, the COCO JSON -> Darknet conversion tool (Dark Chocolate) works now: daddydrac/Dark-Chocolate#2

@daddydrac
Copy link

We should merge Dark Chocolate into Ultralytics repo and close this out now that its vetted and tested.

@glenn-jocher
Copy link
Member

I'll close this issue for now as the original issue appears to have been resolved, and/or no activity has been seen for some time. Feel free to comment if this is not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants