-
Notifications
You must be signed in to change notification settings - Fork 85
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
Undesired behaviour of warp_to_mask in MaskedImage #449
Comments
Exactly correct
I would strongly argue against this. The above definition you gave is simple to understand - warped_img = masked_img.warp_to_mask(template, warp_mask=False) # old API
warped_img = masked_img.as_unmasked().warp_to_mask(template) # new API #369 was a huge change and I am not surprised to find we are now finding the edge cases. I think the right response is to be more disciplined, and stop using masked images were they really don't make sense. For instance I don't think it ever makes sense to build an AAM from masked images. Instances that the AAM returns should be masked images, because that is the way in Menpo that we say these pixel values should not be interpreted as meaning anything. The images used in construction require no such definition. The edge case errors we are hitting now are equivalent to the statement:
In the context of AAM construction, we know the response we want to give is:
In which case - why mask it in the first place? @jalabort can you confirm this error is arising due to us building AAMs from |
This is arising when trying to fit You have a good point there, maybe we do not want to fit |
Yes, the same argument holds for fitting. The idea was now that |
I was turning them to OK, if you guys all knew about this and are happy with the current behaviour then it is also fine by me. I just found it strange that it crashed, hence the issue. |
Ok. I'll leave this open as a reminder that we should ensure in all notebooks and Menpo itself we don't promote using masked images in the fitting framework. Once we are happy everything is converted we can close this. |
Decision from meeting - raise a Warning on training and fitting if you use |
@jalabort did you look into this? I think we just decided to raise a warning if using masked images in fitting. This will now be on menpofit, so once it's done over there we can close this issue. |
This has changed now with the introduction of #563. Now, an explicit exception is raised ( For this reason, I'm going to close this and open a Menpofit issue about it. |
The method
warp_to_mask
inMaskedImage
always warps the mask on the particularMaskedImage
from which the method is executed.While this makes a lot of sense in general, it might cause problems when using
AAMs
. In particular, for some edge cases thewarped image
and thereference frame
end up having different number of pixels which causes the AAM fitting to crash.This can be easily solved by bringing back the old
kwarg
warp_mask
but becausewarp_to_mask
is a very general method I though I would open this issue for further discussion.The text was updated successfully, but these errors were encountered: