### Install dependencies with pip Source: https://github.com/alibaba/cascade-stereo/blob/master/README.md Install the project dependencies listed in requirements.txt. Use the --user flag to install in the user site-packages directory. ```bash pip install -r requirements.txt --user ``` -------------------------------- ### Install Apex for synchronized batch normalization Source: https://github.com/alibaba/cascade-stereo/blob/master/README.md Clone and install NVIDIA Apex with CUDA and C++ extensions to enable synchronized batch normalization. Run these commands in sequence from the apex directory. ```bash git clone https://github.com/NVIDIA/apex.git ``` ```bash cd apex ``` ```bash pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./ ``` -------------------------------- ### Test CasMVSNet with Gipuma fusion Source: https://github.com/alibaba/cascade-stereo/blob/master/CasMVSNet/README.md Run testing and fusion using Gipuma; requires installing fusibile. ```bash export save_results_dir="./outputs" ./test.sh $CKPT_FILE --outdir $save_results_dir --interval_scale 1.06 --filter_method gipuma ``` -------------------------------- ### Train CasMVSNet with apex sync_bn Source: https://github.com/alibaba/cascade-stereo/blob/master/CasMVSNet/README.md Enable sync_bn during training if apex is installed, by adding --using_apex and --sync_bn flags. ```bash export NGPUS=8 export $save_results_dir="./checkpoints" ./train.sh $NGPUS $save_results_dir --ndepths "48,32,8" --depth_inter_r "4,2,1" --dlossw "0.5,1.0,2.0" --batch_size 2 --eval_freq 3 --using_apex --sync_bn ``` -------------------------------- ### Scene Flow Multi-GPU Training Source: https://github.com/alibaba/cascade-stereo/blob/master/CasStereoNet/README.md Run multi-GPU training on Scene Flow datasets. Update DATAPATH in sceneflow.sh first. Use --model gwcnet-c for concatenation cost volume (similar to PSMNet) or --model gwcnet for GwcNet-gc baseline. ```bash export NGPUS=8 export save_results_dir="./checkpoints" ./scripts/sceneflow.sh $NGPUS $save_results_dir --ndisps "48,24" --disp_inter_r "4,1" --dlossw "0.5,1.0,2.0" --batch_size 2 --eval_freq 3 --model gwcnet-c ``` -------------------------------- ### KITTI 2012/2015 Evaluation Source: https://github.com/alibaba/cascade-stereo/blob/master/CasStereoNet/README.md Evaluate a trained model on KITTI. Set CKPT_FILE to your checkpoint; a pretrained model for KITTI 2015 is available. Uses --mode test. ```bash export NGPUS=8 export save_results_dir="./checkpoints" ./scripts/kitti15.sh $NGPUS $save_results_dir --loadckpt $CKPT_FILE- --ndisps "48,24" --disp_inter_r "4,1" --batch_size 2 --mode test --model gwcnet-c ``` -------------------------------- ### KITTI 2012/2015 Training Source: https://github.com/alibaba/cascade-stereo/blob/master/CasStereoNet/README.md Train on KITTI 2012 or 2015. Update DATAPATH in kitti15.sh first. Uses the same hyperparameters as Scene Flow training. ```bash export NGPUS=8 export save_results_dir="./checkpoints" ./scripts/kitti15.sh $NGPUS $save_results_dir --ndisps "48,24" --disp_inter_r "4,1" --dlossw "0.5,1.0,2.0" --batch_size 2 --eval_freq 3 --model gwcnet-c ``` -------------------------------- ### Scene Flow Evaluation Source: https://github.com/alibaba/cascade-stereo/blob/master/CasStereoNet/README.md Evaluate a trained model on Scene Flow. Set CKPT_FILE to your checkpoint path; pretrained models are available for download. Uses --mode test with the same script. ```bash export NGPUS=8 export save_results_dir="./checkpoints" ./scripts/sceneflow.sh $NGPUS $save_results_dir --loadckpt $CKPT_FILE- --ndisps "48,24" --disp_inter_r "4,1" --batch_size 2 --mode test --model gwcnet-c ``` -------------------------------- ### Train CasMVSNet (Multi-GPU) Source: https://github.com/alibaba/cascade-stereo/blob/master/CasMVSNet/README.md Launch multi-GPU training with specified ndepths, depth_inter_r, dlossw, batch size, and eval frequency. ```bash export NGPUS=8 export save_results_dir="./checkpoints" ./train.sh $NGPUS $save_results_dir --ndepths "48,32,8" --depth_inter_r "4,2,1" --dlossw "0.5,1.0,2.0" --batch_size 2 --eval_freq 3 ``` -------------------------------- ### Test CasMVSNet and Fusion (default) Source: https://github.com/alibaba/cascade-stereo/blob/master/CasMVSNet/README.md Run testing and fusion using the default MVSNet-pytorch fusion method. ```bash export save_results_dir="./outputs" ./test.sh $CKPT_FILE --outdir $save_results_dir --interval_scale 1.06 ``` -------------------------------- ### Convert COLMAP SfM to CasMVSNet input Source: https://github.com/alibaba/cascade-stereo/blob/master/CasMVSNet/README.md Generate CasMVSNet input and dense point cloud from COLMAP SfM results. ```bash export $save_results_dir="outputs/colmap" python colmap2mvsnet.py --dense_folder COLMAP/dense --save_folder $save_scene_result/casmvsnet ./test.sh $CKPT_FILE --testpath_single_scene $save_results_dir/casmvsnet --testlist all --outdir $save_results_dir/ply --interval_scale 1.06 ``` -------------------------------- ### KITTI Save Disparity Predictions Source: https://github.com/alibaba/cascade-stereo/blob/master/CasStereoNet/README.md Save disparity predictions to the specified output directory. Uses kitti15_save.sh with --loadckpt and without --mode test. ```bash export save_path="./outputs/predictions" ./scripts/kitti15_save.sh $save_results_dir --loadckpt $CKPT_FILE --ndisps "48,24" --disp_inter_r "4,1" --batch_size 2 --model gwcnet-c ``` -------------------------------- ### DTU dataset folder structure Source: https://github.com/alibaba/cascade-stereo/blob/master/CasMVSNet/README.md Expected layout of the $MVS_TRANING folder after downloading and unzipping the DTU training data and Depths_raw. ```text ├── Cameras ├── Depths ├── Depths_raw ├── Rectified ├── Cameras ``` -------------------------------- ### Citation BibTeX entry Source: https://github.com/alibaba/cascade-stereo/blob/master/README.md BibTeX entry for citing the Cascade Cost Volume paper in academic work. ```bibtex @inproceedings{gu2020cascade, title={Cascade cost volume for high-resolution multi-view stereo and stereo matching}, author={Gu, Xiaodong and Fan, Zhiwen and Zhu, Siyu and Dai, Zuozhuo and Tan, Feitong and Tan, Ping}, booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition}, pages={2495--2504}, year={2020} } ```