Trying to read image properties in predict.py #9217
Stevew7777
started this conversation in
General
Replies: 1 comment 5 replies
-
It will make a copy of the original image with size of 1920 x 1280 and resize it into 640x640 and run inference on 640x640 image and produce prediction boxes and rescale them into 1920 x 1280 image size. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Ive managed to extract the bounding box xywh parameters in YOLO format from adding some code to Predict.py.
However, the current input image I'm working with is 1920 x 1280 pixels and I want to be able to work out each of the 4 bounding box corner positions ( x,y ) in relation to the original 1920 x 1280 image, so I can then work with the top right quadrant of the bounding box area when its overlayed on the original image.
I have 2 questions :
(1) If when I run predict.py the --imgsz input parameter is set at 640 x 640, will the 1920 x 1280 pixel image be left as 1920 x 1280 before being processed? Or will predict.py truncate or scale down the image to 640 x 640 before being processed?
(2) if the image is not resized to 640 x 640, how do I extract the original input image size ( e.g. 1920 x 1280 ) from within predict.py please, so I can output the bounding box corners in pixels? Its not immediately obvious. I could import numpy and work with that but would rather not.
Any help appreciated.
A hint for anyone struggling with predict.py telling you you have a mismatch between class labels etc.
Predict.py will be right, you probably have a "15" ( or whatever ) where a "0" should be in the first column in a label file somewhere - this code will find what youre looking for quickly in linux ( this helped me, so I'm giving back to the community ...)
grep -rIH '<text_to_look_for>'
how to use example :
grep -rIH '15'
Beta Was this translation helpful? Give feedback.
All reactions