-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annotations partially transformed out of the image canvas #223
Comments
A few thoughts:
|
What would you say about adjusting the canvas such that the entire image still fits? It would mean that all annotations remain valid, but also that rotations apply a sort of scaling since the transformed image is resized later on again. |
That could certainly work. However I worry that this would make using scale
augmentation difficult, since it means zooms would result in very large
images that might OOM.
I'll also note that we should care about zooms much more than rotations,
since using rotations in detection problems. Rotations will degrade the
quality of the bounding boxes, whereas zooms won't.
…On Jan 15, 2018 11:06 AM, "Hans Gaiser" ***@***.***> wrote:
What would you say about adjusting the canvas such that the entire image
still fits? It would mean that all annotations remain valid, but also that
rotations apply a sort of scaling since the transformed image is resized
later on again.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#223 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJe4yuzbinkl77N0tYt05Hs7q_wZAeSTks5tK3d0gaJpZM4ReiAh>
.
|
right, but won't zoom be undone by the internal scaling anyway? /edit: unless X and Y scaling is not the same, then it does do something I suppose. |
The zoom should be applied such that it is not undone by internal scaling right? Otherwise it has no effect. In my testing I have found zooms more useful than either translations (no real effect) or rotations. |
Oops, you're right. I didn't think that through. Since we're not modifying the canvas size right now, scaling does have an effect. If we would modify the canvas size, uniform scaling would become a NOP, and rotation/shearing would affect scaling. Hmm... |
I really don't think this is right. I'm looking into this issue now, here are my suggestions.
|
Yeah, I agree. Rotation/shearing shouldn't mess with scaling, and scaling shouldn't be a NOP. I think the best solution is to let the user provide a callback which determines what to do with transformed annotations, and provide one or a few configurable callbacks in the library for the different options. |
#190 added a new random transform generator as replacement for random transformation applied by keras. One open question that remained was how to deal with annotations that are transformed so that they partially fall out of the image canvas. This can happen for translation, scaling, rotation and shearing (but not for flips).
In general I believe there are 3 strategies for dealing with this:
A combination of these is also possible. For example: check the area of the clipped transformed bounding box compared to the original area, and drop it if falls below some threshold. Otherwise accepted the clipped box.
The most flexible solution would be to let the user provide a callback which determines wether to clip or drop an annotation. We could combine this with a callback to apply the transformation to the annotations, if we want to support other forms of annotations besides bounding boxes.
The text was updated successfully, but these errors were encountered: