-
Notifications
You must be signed in to change notification settings - Fork 4
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
Questions about making ResNets equivariant with e2cnn #3
Comments
Main questions:
2.1 I am not sure what you mean with 2.2 One you verified all representations in 2.3 The same trick can be used for expansions. If you want to preserve the total number of channels or the number of parameters (as recommended earlier), I'd recommend to estimate the number of channels using something like this and pass it Smaller questions:
Hope this helped! let me know if you have other questions |
Hey Gabriele, thanks for your elaborate answer, this makes it much more clear now! It seems that e2wrn.py is an improved version of e2_wide_resnet.py. Apart from some variable renaming (for example |
Based on answer 2.2 from QUVA-Lab/e2cnn_experiments#3 (comment)
I have another question related to the comment above. Based on my understanding it seems to me that the group space used in a FieldType should correspond to it's representation. For example, a FieldType with a trivial space should have trivial representations. Based on the examples, I see that this is not the case, for example in the first layer the gspace is Rot2dOnR2() (instead of TrivialOnR2()) while the representations are trivial (for example, in the 3rd code cell here). Can you explain why is my reasoning incorrect? |
Sorry for the late reply Regarding the difference between e2wrn.py and e2_wide_resnet.py: the first is a cleaner example I prepared for the tutorial of the library while the second was a more flexible model I built to be able to run different experiments. Regarding the other question Take a look at this tutorial; does it make things more clear? Best, |
sorry for the late reply. No, the equivariance to 90 deg should be almost perfect, with an absolute error probably lower than 1e-5. At a first look, your code seems ok. Check page 3 of our paper for more details on this issue and how to solve it. Let me know if this was your problem Best, |
I'm trying to create an equivariant ResNet model based on
e2_wide_resnet.py
and I would really appreciate if you could clarify some of my doubts.Main questions
I see that in your repo
e2_wide_resnet.py
is the equivariant version ofwide_resnet.py
andWideBasic
is equivalent toBasicBlock
. In standard, non-equivariant CNNs, we pass the argumentsin_planes
andout_planes
toBasicBlock
which correspond to the number of input and output channels of the block. Afaik the number of channels in standard CNNs are equivalent to number of representations ine2cnn.nn.FieldType
. However, in WideBasic instead of passing input and output FieldTypes,in_fiber
andout_fiber
, you also pass the inner FieldTypeinner_fiber
. So my question is why is passing those two FieldTypes (like in non-equivariant network) not enough and we need the third one?Apart from using
BasicBlock
, I also want to use a different block needed for most models in the resnet family - Bottleneck.Bottleneck
is a bit more complicated thanBasicBlock
, this is how it initialization looks like:which looks like this on a diagram from the ResNext paper (for 32 groups):

At the beginning, we calculate the
width
which is the number of output channels in the self.conv1 and the number of input channels of self.conv2 (128 in the diagram above). Given that we need a different number of channels (or number of representations in FieldType), for the equivariant bottleneck, I create a new FieldTypewidth_fiber
:Does that seem correct to you? Is there a cleaner way to retrieve the representation type from FieldType instead of hardcoding it?
After doing that, I again need to use a different number of channels (from planes to planes * expansion) and I do a similar thing as before for
exp_out_fiber
. Here is the whole code for E2Bottleneck initialization:Smaller questions about e2_wide_resnet.py
BatchNorm2d isn't even used, should we replace it with InnerBatchNorm or remove that part entirely (InnerBatchNorm doesn't have instance variables weight or bias from what I've checked). Also why is the standard linear initialized to 0 instead of using standard initializations?
Looking forward to your reply and please let me know if there is anything unclear in my question :)
The text was updated successfully, but these errors were encountered: