2

I managed to train the YOLO V5 model on my customed data and I'm having great results. I was just wondering how I could export the bonding boxes in a csv or txt file in which I'd have the coordinates and the score of prediction. I've read that I'll need to change the detect.py file but I just don't know how.

Dilow
  • 35
  • 5

1 Answers1

0

in the line 159 at https://github.com/ultralytics/yolov5/blob/master/detect.py

there is an argument to save txt files, usage shoud be something like:

python detect.py --weights yolov5s.pt --save-txt det.txt

the other option is to:

import pandas as pd
detections = []

...
detections.append(line)

... 
#condition to save
df = pd.DataFrame.from_dict( {'detections': detections})
df.to_csv("detections.csv")
Guinther Kovalski
  • 1,629
  • 1
  • 7
  • 15
  • 1
    Thanks I'm now able to get the coordinates of the bounding boxes, I was wondering if I could add to them the score of prediciton – Dilow Jun 10 '22 at 16:53