haofeixu / aanet

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

how to set max_disp higher than default? #74

Closed jahad9819jjj closed 2 years ago

jahad9819jjj commented 2 years ago

First of all, thanks for the great method.

I have a question. As my use case, I want to do disparity estimation for stereo images in HD1080. So far, Sceneflow has hit a plausible result. However, I am not sure if it is because of the high resolution, but the right half of the image has good detail estimation while the left half has poor estimation. I think that the max_disp is low, so we try to estimate with it high. So I tried to retrain with max_disp from 192(default) to 250. Then I got the following error.

root@9b6f706f2335:/opt/aanet# bash scripts/aanet+_train.sh
[2021-10-28 08:02:02,666] => 35454 training samples found in the training set
Traceback (most recent call last):
  File "train.py", line 243, in <module>
    main()
  File "train.py", line 159, in main
    deformable_groups=args.deformable_groups).to(device)
  File "/opt/aanet/nets/aanet.py", line 94, in __init__
    intermediate_supervision=not no_intermediate_supervision)
  File "/opt/aanet/nets/aggregation.py", line 438, in __init__
    simple_bottleneck=simple_bottleneck_module))
  File "/opt/aanet/nets/aggregation.py", line 338, in __init__
    deformable_groups=deformable_groups))
  File "/opt/aanet/nets/deform.py", line 201, in __init__
    double_mask=double_mask)
  File "/opt/aanet/nets/deform.py", line 65, in __init__
    groups=deformable_groups, bias=True)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 330, in __init__
    False, _pair(0), groups, bias, padding_mode)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/conv.py", line 23, in __init__
    raise ValueError('in_channels must be divisible by groups')
ValueError: in_channels must be divisible by groups

Here is the script I ran and this script works well if I set max_disp at 192.

#!/usr/bin/env bash

# Train on Scene Flow training set
CUDA_VISIBLE_DEVICES=0,1 python train.py \
--checkpoint_dir checkpoints/aanet+_sceneflow \
--max_disp 250 \
--batch_size 16 \
--val_batch_size 64 \
--img_height 288 \
--img_width 576 \
--val_img_height 576 \
--val_img_width 960 \
--feature_type ganet \
--feature_pyramid \
--refinement_type hourglass \
--milestones 20,30,40,50,60 \
--max_epoch 64

Does anyone know anything about this error?

haofeixu commented 2 years ago

Hi @jahad9819jjj , could you please post the printed model definition as well? thanks!

jahad9819jjj commented 2 years ago

Hi @haofeixu , Sorry. In my earlier report, I had mentioned that I had run it at 240, but in fact I had set it at 210 or 250. When I ran the training at 240, it worked. Could this be because GANet determines max_disp in multiples of 3, just like img_size is determined in multiples of 96 or 48? Thanks.

haofeixu commented 2 years ago

Yes, that makes sense now, 240 should work well. The image size should be multiple of 48 when you use AANet+.