I'd like to output the coordinates of a detection in the format of the original image to be used to draw bounding boxes at a later stage.
Currently it looks like data saved in output txt file is class, centroids, w, h but not as it relates to original image, instead it is in a normalized format, how to revert to original?
thanks
Hello @jayabrams, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook , Docker Image, and Google Cloud Quickstart Guide for example environments.
If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:
For more information please visit https://www.ultralytics.com.
From detect example script, this is the code your looking for.
You end up with upper left corner (x,y) lower right corner (x,y) in im0 coordinate space
det[:, :4] = scale_coords(img.shape[2:], det[:, :4], im0.shape).round()
for *xyxy, conf, cls in reversed(det):
c1, c2 = (int(xyxy[0]), int(xyxy[1])), (int(xyxy[2]), int(xyxy[3]))
@jayabrams What iceisfun said is in here, modify it.
https://github.com/ultralytics/yolov5/blob/c8c5ef36c9a19c7843993ee8d51aebb685467eca/detect.py#L94-L109
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
From detect example script, this is the code your looking for.
You end up with upper left corner (x,y) lower right corner (x,y) in im0 coordinate space
det[:, :4] = scale_coords(img.shape[2:], det[:, :4], im0.shape).round()
for *xyxy, conf, cls in reversed(det):
c1, c2 = (int(xyxy[0]), int(xyxy[1])), (int(xyxy[2]), int(xyxy[3]))