tensorrtx icon indicating copy to clipboard operation
tensorrtx copied to clipboard

Add the possibility to crop the image

Open Mustapha-AJEGHRIR opened this issue 2 years ago • 6 comments

There are 2 main advantages : doesn't add a big padding for images of 16:9 aspect ratio that should be converted to 640*640 + It is faster ! the resizing and padding takes 20 to 30 ms on a jetson nano (the model execution 'YOLOv5n6' takes only 33ms).

Mustapha-AJEGHRIR avatar Jun 05 '22 10:06 Mustapha-AJEGHRIR

@Mustapha-AJEGHRIR Thanks,

I have doubts here, what's the input shape of the tensorrt model in your case?

wang-xinyu avatar Jun 06 '22 03:06 wang-xinyu

For my case, it is a "YOLOv5n6" so the input shape is 640*640

Mustapha-AJEGHRIR avatar Jun 06 '22 07:06 Mustapha-AJEGHRIR

I have also changed the xywh2xyxy function to correctly draw the bounding boxes. But I will have to admit that this approach will not be beneficial for most people especially since it does not detect objects near the cropped borders. For my application, this is fine.

Mustapha-AJEGHRIR avatar Jun 07 '22 13:06 Mustapha-AJEGHRIR

@Mustapha-AJEGHRIR So the model input is 640x640, and your original image is 1920x1080? You crop a 640x640 region from 1920x1080 directly? Is it?

wang-xinyu avatar Jun 11 '22 03:06 wang-xinyu

For my case, the original resolution is 1280*720. Then I directly crop the image (I lose the borders)

Mustapha-AJEGHRIR avatar Jun 11 '22 07:06 Mustapha-AJEGHRIR

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.

stale[bot] avatar Aug 10 '22 14:08 stale[bot]