RepLKNet-pytorch
RepLKNet-pytorch copied to clipboard
ERF is smaller after changing the input image size
i changed the input size to 224×224,and compare RepLKNet with resnet101, it seems that resnet101 is larger than RepLKNet-13, left is RepLKNet-13, right is resnet101
Hi, thanks for sharing the results. We would appreciate it if you could provide more details. For example, which weights have you loaded?
Hi, thanks for sharing the results. We would appreciate it if you could provide more details. For example, which weights have you loaded?
Hi,thanks for reply. i followed the instruction in README.md, loaded the weights of RepLKNet-13 provided by this link. Resnet101 model is downloaded from torchvision.
Then i modify the code line https://github.com/DingXiaoH/RepLKNet-pytorch/blob/2b8b6c67a3455dd5ae951ea682269fbca8aff9f2/erf/visualize_erf.py#L46
to transforms.Resize((224,224),interpolation=Image.BICUBIC)
here is the input image used (if it is needed)
code:qrgb
Hi, thanks for sharing the results. We would appreciate it if you could provide more details. For example, which weights have you loaded?
Hi,thanks for reply. i followed the instruction in README.md, loaded the weights of RepLKNet-13 provided by this link. Resnet101 model is downloaded from torchvision.
Then i modify the code line
https://github.com/DingXiaoH/RepLKNet-pytorch/blob/2b8b6c67a3455dd5ae951ea682269fbca8aff9f2/erf/visualize_erf.py#L46
to
transforms.Resize((224,224),interpolation=Image.BICUBIC)
here is the input image used (if it is needed) code:qrgb
Hi, I meet the similar problem, the only differencve is that i use RepLKNet-31B rather than RepLKNet-13. It also seems that resnet101 is larger than RepLKNet-31B when input size is set to be 224, above is RepLKNet-31B, below is resnet101.
Except for the problem, i observe the other phenomenon. When we use the model which is initialized by default rather than by pretrained on ImageNet-1K, its ERF is visualized as below(input size is set to 1024):
The visual result which use the pretrained model on ImageNet can bee seen below:
We can see that ERF is very small when the model is initialized by default, and if it is a kind of unreasonable initial bias? More over,if the initialization will bring difficulties durging learning?
(All code follows the instruction in README.md)
Hi, I think the image size is too small (but downstream tasks usually use much higher resolutions) so that every model's ERF can cover the whole image. In this case, the definition of ERF intuitively changes from "which part can the model see" to "in the region the model can see, which part does it mostly attend to". And in this case, the contribution scores have low variance and the normalization will make the ERF map look unnatural.
Hi, I think the image size is too small (but downstream tasks usually use much higher resolutions) so that every model's ERF can cover the whole image. In this case, the definition of ERF intuitively changes from "which part can the model see" to "in the region the model can see, which part does it mostly attend to". And in this case, the contribution scores have low variance and the normalization will make the ERF map look unnatural.
Thanks so much! It really helps me understand it.
I tried to view the effective receptive field, but when I used this !python erf/visualize_erf.py --model resnet101 --data_path /path/to/imagenet-1k --save_path resnet101_erf_matrix.npy
I got this error
Traceback (most recent call last):
File "/content/RepLKNet-pytorch/erf/visualize_erf.py", line 15, in
Moreover, this code is very complex. If I want to visualize the erf for my custom model, how can I use this? My model combines CNN and transformer, but this code is very complex to understand and use by early learners like me. Maybe this code is suitable for experts. It could be great if you shared your knowledge and great work that can be understandable by basic learners like me.