Skip to content
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

About the input image size #32

Open
xxx2974 opened this issue Jan 9, 2019 · 4 comments
Open

About the input image size #32

xxx2974 opened this issue Jan 9, 2019 · 4 comments

Comments

@xxx2974
Copy link

xxx2974 commented Jan 9, 2019

Hello,If the input image size resized to 512×256,it will report an error. So the height to width ratio is can only be 3:1? If I want a size of 512×256,what should I do?

The error:
Traceback (most recent call last):
File "script/experiment/train_pcb.py", line 498, in
main()
File "script/experiment/train_pcb.py", line 436, in main
_, logits_list = model_w(ims_var)
File "/home/xiaozhenzhen/anaconda2/envs/pytorch-PCB/lib/python2.7/site-packages/torch/nn/modules/module.py", line 325, in call
result = self.forward(*input, **kwargs)
File "/home/xiaozhenzhen/anaconda2/envs/pytorch-PCB/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py", line 68, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "/home/xiaozhenzhen/anaconda2/envs/pytorch-PCB/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py", line 78, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "/home/xiaozhenzhen/anaconda2/envs/pytorch-PCB/lib/python2.7/site-packages/torch/nn/parallel/parallel_apply.py", line 67, in parallel_apply
raise output
AssertionError

@huanghoujing
Copy link
Owner

huanghoujing commented Jan 9, 2019

You have to make sure that image_height / 16 % 6 == 0. When your image height is 512, 512. / 16 % 6 is 2. This requirement is to make sure that height of Conv5 feature map should be evenly divided by number of stripes (the default stripe number is 6). The detail in code is here.

@xxx2974
Copy link
Author

xxx2974 commented Jan 10, 2019

Thanks a lot. I know the number 6 what means, but what's the mean of the number 16?

@huanghoujing
Copy link
Owner

If you set last conv stride of ResNet-50 to 1, the final feature map size is image_height / 16, image_width / 16 (this is the case of PCB); If you set last conv stride of ResNet-50 to 2, the final feature map size is image_height / 32, image_width / 32.

@xxx2974
Copy link
Author

xxx2974 commented Jan 10, 2019

I see, thank you very much. I will take a careful look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants