theAIGuysCode / YOLOv4-Cloud-Tutorial

This repository walks you through how to Build and Run YOLOv4 Object Detections with Darknet in the Cloud with Google Colab.
355 stars 299 forks source link

Extracting output ( absolute co-ordinates and bounding boxes) in json format #20

Open basicvisual opened 3 years ago

basicvisual commented 3 years ago

am using the following command in object detection !./darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights -ext_output -dont_show data/horses.jpg -out result.json I get the following console output ,

data/horses.jpg: Predicted in 32.813000 milli-seconds.
horse: 77%  (left_x:   -1   top_y:  189   width:  157   height:  202)
horse: 98%  (left_x:    3   top_y:  188   width:  312   height:  224)
horse: 90%  (left_x:  249   top_y:  198   width:  171   height:  166)
horse: 86%  (left_x:  369   top_y:  210   width:   87   height:  113)
horse: 100% (left_x:  432   top_y:  213   width:  163   height:  13
`5)

but the json file output is more as follows


[

{
 "frame_id":1, 
 "filename":"data/horses.jpg", 
 "objects": [ 
  {"class_id":17, "name":"horse", "relative_coordinates":{"center_x":0.664307, "center_y":0.547429, "width":0.210341, "height":0.263563}, "confidence":0.996012}, 
  {"class_id":17, "name":"horse", "relative_coordinates":{"center_x":0.205768, "center_y":0.585460, "width":0.404084, "height":0.437523}, "confidence":0.981816}, 
  {"class_id":17, "name":"horse", "relative_coordinates":{"center_x":0.433081, "center_y":0.548049, "width":0.221746, "height":0.324552}, "confidence":0.901274}, 
  {"class_id":17, "name":"horse", "relative_coordinates":{"center_x":0.533728, "center_y":0.519726, "width":0.112260, "height":0.220399}, "confidence":0.861711}, 
  {"class_id":17, "name":"horse", "relative_coordinates":{"center_x":0.100395, "center_y":0.566308, "width":0.203570, "height":0.393987}, "confidence":0.768916}
 ] 
}
]

Is there a way to get the absolute value of the co-ordinates ?