-
Notifications
You must be signed in to change notification settings - Fork 45.9k
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
Spatial transformer implementation may have a bug somewhere #193
Comments
I found a problem in the code that may be causing this. In the Substituting the line above to I have to investigate whether this fix breaks the case where out_size is smaller than the image size, but from these results I believe it fixes the case where out_size is bigger than the image size - it works for any affine transformation, not just identity as in my example. If it doesn't, should I make a pull request or should someone else check on this? |
@elezar You recenetly changed the code mentioned in the above message. Could you please take a look at this bug? |
Thanks for pinging me on this @prb12. I will have a look, but if I recall correctly, the only changes that I made to the code was to update the documentation for the function parameters, and apply PEP8 formatting. (or at least this was my intention. It could be that I inadvertently committed something that I shouldn't have). |
I have confirmed that the only changes were to whitespace (and the formulation that is is incorrect is also used in https://github.com/skaae/transformer_network/blob/master/transformerlayer.py#L103 from which this implementation is apparently taken). |
With regards to #193 (comment). Note, I don't agree that 1.01 should be used here. That seems a little arbitrary, and an input value of 1 should return the value of that last pixel exactly! It seems as if it has been corrected in https://github.com/Lasagne/Lasagne/blob/master/lasagne/layers/special.py#L473 Looking at the file history the change was introduced in this commit: |
@elezar Who is the owner of this code? If it was copied from another repo, should the fix be imported? |
@prb12 It seems as if it was added by @daviddao in 41c52d6. It was later modified by @psycharo in bf60abf. If I understand correctly, the code was adapted from https://github.com/skaae/transformer_network (which was subsequently moved into Lasagne as a layer). The original example also contains the bug. The way I see it, there are two options:
|
@seuqaj114 The formula that achieves that mapping is So the point is that the clamp is the part that is missing. |
@aselle Is there a bug here that should be fixed? |
Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks! |
So I was trying to plug this ST module into a the write attention part of a DRAW model, and I just couldn't get it to work. After a grueling day of trying every parameter choice, I tried comparing the output of an identity scaling of ST vs scipy interpolation zoom, and that's when I found something interesting.
The code I used is below, adapted from the example.py.
The resulting images are the following.
Result of scipy zoom (correct)
Result of spatial trasnformer
As you can see the trasnformer output neglects that down and right side, and instead creates a 23x23 (ish) version of the image, when I asked it to create a 30x30 version. This can easily go unnoticed if the background of the image is black itself, which is why it took me so long to notice it.
Let me know what you think,
Miguel
The text was updated successfully, but these errors were encountered: