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

What is yolo (.txt) format? #15

Closed
einareinarsson opened this issue Feb 22, 2021 · 3 comments
Closed

What is yolo (.txt) format? #15

einareinarsson opened this issue Feb 22, 2021 · 3 comments

Comments

@einareinarsson
Copy link

I try to use the program while having YOLO-like text annotations per image in the following format.

Ground truth annotations:

6 0.4435201401050788 0.6020274689339438 0.059544658493870466 0.14061478090255072
8 0.36646234676007006 0.18999345977763243 0.05341506129597193 0.13276651406147807
10 0.36274080560420313 0.289404839764552 0.05647985989492113 0.17593198168737742
7 0.1725043782837128 0.36527141922825374 0.08231173380035027 0.20078482668410727
11 0.2539404553415061 0.7432962720732506 0.06917688266199651 0.1366906474820143
11 0.20556042031523644 0.05493786788750817 0.06348511383537656 0.10987573577501634

Predictions:

6.0 0.9641061425209045 0.7914067506790161 0.36787542700767517 0.07676965743303299 0.20017971098423004
2.0 0.9538318514823914 0.4433167576789856 0.3955462872982025 0.0672389417886734 0.14360184967517853
3.0 0.9517371654510498 0.6636454463005066 0.14527581632137299 0.050998225808143616 0.11069779098033905
8.0 0.9489786028862 0.5190893411636353 0.3004150092601776 0.049637917429208755 0.10972640663385391
3.0 0.9478994607925415 0.6771969199180603 0.2292448729276657 0.05333113670349121 0.10690070688724518
3.0 0.9314520955085754 0.699550211429596 0.40322744846343994 0.05508119612932205 0.11604183167219162

when having the file structure:

images
   a.jpg
   b.jpg
   c.jpg
annotations
   a.txt
   b.txt
   c.txt
predicted_labels
   a.txt
   b.txt
   c.txt

However, I have the following error: No file was found for the selected detection format in the annotations directory.
What goes wrong?

Coordinates format for Gt: (*)YOLO (.txt)
Coordinates format for Detections: <class_id> <x_center> <y_center> (REL)

(By the way, why images are expected for evaluating labels only?)

@rafaelpadilla
Copy link
Owner

Hi @einareinarsson,

As your txt files with detections have the same name as the ground-truth annotations, your structure looks fine.

Please, try the following steps:

  1. Update the repository. I made some updates in the code.
  2. Change the class_id of your predictions files (the first element) to integers. For example, instead of being:
    6.0 0.9641061425209045 0.7914067506790161 0.36787542700767517 0.07676965743303299 0.20017971098423004
    it will be
    6 0.9641061425209045 0.7914067506790161 0.36787542700767517 0.07676965743303299 0.20017971098423004
  3. For both ground-truth and detections, select a folder containing your image files.
  4. For both ground-truth and detections, choose a file listing your clases. In this file, the order of the classes must follow the <class_id> of your txt files. An example of this file can be seen here, where 'aeroplane' is class_id=0, 'bicycle' is class_id=1, and so on.
  5. For ground-truth coordinates format, choose (*) YOLO (.txt). For the coordinates format for the detections, select the first option: (*) <class_id> <confidence> <x_center> <y_center> <width> <height> (RELATIVE)

Then I believe you will be able to solve your problem and evaluate your detections.

Also check if you are able to see the ground-truth and detection statistics by clicking on the buttons show ground-truth statistics and show detections statistics. If not, please attach here some of your files (detection, groundtruth, images and txt file with list of your classes) so I will be able to investigate the problem.

The images are needed because as your bounding boxes are expressed in relative values, to know their exact position within the image it is necessary to know the image width and height. That's why you need to inform the images. :)

@einareinarsson
Copy link
Author

Thanks for the answer.
Meanwhile I discovered that the root problem was the complex filenames. When original filenames like 954jhj53hjhj822v_jpg.rf.3232xxvcb432ijoffg.txt were renamed to likes than 954jhj53hjhj822v.txt it works.

Maybe just two feature wishes:

  • Visualization option for predictions over images (like in case of ground truths)
  • Export option for metrics data into file

@rafaelpadilla
Copy link
Owner

Hi @einareinarsson ,

Good you got it working.

About your suggestions:

  • Visualizing the predictions over the images (like is done with groundtruths) is already implemented. After choosing the information related to your detections, click on the button show detections statistics. There you will see both detections and ground-truth bounding boxes. You could also save those images with the bounding boxes on.
  • The plots containing the results are saved in the output folder. Besides the plots, the user could copy the results from the Result and paste in an external text file. But good idea. It is better if the tool can save automatically the results in a text file in output folder.

Thanks

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

2 participants