You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Resizing Images and Boxes for Vision Scenarios #6629
@luisquintanilla - @michaelgsharp and I were chatting and it probably makes sense to have a ObjectDetectionResize transform in ML.NET. Something that resizes images and bounding boxes the same way.
We would need to figure out what type of resizes we want to support.
An added benefit to this ... is if we make sure all images are the same size ... we can batch. This requires re-sizing larger and re-sizing smaller to make it happen.
@JakeRadMSFT : You could create a generic image+keypoints resize transform. This could then in future handle segmentation, key point detection (e.g. human pose detection), and various other ML tasks which include points which scale with the image.
Related work for co-handling the image+keypoints, is an image augmentation transform. To handle image rotation, keystoning, crop-and-zoom, skew, etc (list), the labeled points need to move with the image pixels.
One hard part is understanding the various label formats; another is properly handling box/segment/instance removal if a box/etc is partially or fully cropped out of out image.
One additional recommendation here - if we know that 800x600 is the preferred size, let's make those the default values in the methods. Users can provide a different size if needed.
Activity
JakeRadMSFT commentedon Apr 24, 2023
@luisquintanilla - @michaelgsharp and I were chatting and it probably makes sense to have a ObjectDetectionResize transform in ML.NET. Something that resizes images and bounding boxes the same way.
We would need to figure out what type of resizes we want to support.
An added benefit to this ... is if we make sure all images are the same size ... we can batch. This requires re-sizing larger and re-sizing smaller to make it happen.
justinormont commentedon Apr 24, 2023
@JakeRadMSFT : You could create a generic
image+keypointsresize transform. This could then in future handle segmentation, key point detection (e.g. human pose detection), and various other ML tasks which include points which scale with the image.Related work for co-handling the image+keypoints, is an image augmentation transform. To handle image rotation, keystoning, crop-and-zoom, skew, etc (list), the labeled points need to move with the image pixels.
One hard part is understanding the various label formats; another is properly handling box/segment/instance removal if a box/etc is partially or fully cropped out of out image.
JakeRadMSFT commentedon Apr 25, 2023
Copying some notes from meeting.
Yangyu recommends to resize the image resolution to 800x600.
There are several points need to be careful:
JakeRadMSFT commentedon Apr 25, 2023
Seems like we can do what we want to with the ResizeTransformer using IsoPad resize
machinelearning/src/Microsoft.ML.ImageAnalytics/MLImage.cs
Line 284 in 2ede226
and this code (based on the ISO Pad Resize code).
xOffset, yOffset, and aspect can be re-used for all key points for the same image.
luisquintanilla commentedon Apr 25, 2023
Thanks for the feedback @justinormont and @JakeRadMSFT for looking into it.
For resizing I'm okay to proceed with the recommended solution from Yangyu and Jake.
@michaelgsharp thoughts?
luisquintanilla commentedon Apr 27, 2023
One additional recommendation here - if we know that 800x600 is the preferred size, let's make those the default values in the methods. Users can provide a different size if needed.
[-]Object Detection Stalls with Large Images[/-][+]Resizing Images and Boxes for Vision Scenarios[/+]yyl9510 commentedon Apr 27, 2023
What @JakeRadMSFT said is very correct. For large images, resizing is necessary. The white padding part can be set to (r,g,b) = (0,0,0).