haofeixu / aanet

[CVPR'20] AANet: Adaptive Aggregation Network for Efficient Stereo Matching
Apache License 2.0
534 stars 102 forks source link

Random Crop for training on custom datasets #43

Closed aplusc98 closed 4 years ago

aplusc98 commented 4 years ago

The paper mentions about using random crops for the scene flow and KITTI datasets, but how to select a crop ratio for training on own datasets? I tried a couple of different crops but all of those gave me a dimension mismatch error in one of the layers also Why is the KITTI original image size different from the size mentioned in the script? Thanks

haofeixu commented 4 years ago

The crops need to be divisible by 48 due to the downsampling layers of the network. For KITTI, we use padding to make the input size divisible by 48.

aplusc98 commented 4 years ago

selected a random crop of 624,480 (multiple of 48) from original image size of 640,480 getting the error

File "/home/ubuntu/aanet/nets/refinement.py", line 173, in forward x = self.deconv4a(x, rem3) File "/home/ubuntu/anaconda3/envs/aanet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/home/ubuntu/aanet/nets/feature.py", line 369, in forward assert (x.size() == rem.size()) AssertionError

anything else that I should look out for?

haofeixu commented 4 years ago

It seems that you are using our AANet+ model, in that case, the crop needs to be multiple of 96. You can refer to the code: https://github.com/haofeixu/aanet/blob/f689abf81ef072b4e50eb480d3a73db66eebda44/predict.py#L149-L151