huanghoujing / beyond-part-models

PCB of paper: Beyond Part Models: Person Retrieval with Refined Part Pooling, using Pytorch
331 stars 81 forks source link

About the input image size #32

Open xxx2974 opened 5 years ago

xxx2974 commented 5 years ago

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/trainpcb.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 commented 5 years ago

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 commented 5 years ago

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

huanghoujing commented 5 years ago

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 commented 5 years ago

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