ucbdrive / hd3

Code for Hierarchical Discrete Distribution Decomposition for Match Density Estimation (CVPR 2019)
BSD 3-Clause "New" or "Revised" License
204 stars 31 forks source link

跑出来的视差图好像不对 #8

Closed Hustle-Tung closed 5 years ago

Hustle-Tung commented 5 years ago

我想要得到KITTI_stereo_test_2015的视差图,于是 我执行了以下命令:

python -u inference.py \
  --task=stereo \
  --data_root=. \
  --data_list=./lists/KITTI_stereo_test_2015.txt \
  --context \
  --encoder=dlaup \
  --decoder=hda \
  --batch_size=1 \
  --workers=8 \
  --flow_format=png \
  --model_path=./model_zoo \
  --save_folder=./results

跑出来的结果不对: .\results\vis\kitti_stereo_2015\testing\image_2\000000_10.png

000000_10.png

.\results\vec\kitti_stereo_2015\testing\image_2\000000_10.png

000000_10.png

在这个过程中,我修改了源代码,因为我没有checkpoint: inference.py第131行

    if os.path.isfile(args.model_path):
        logger.info("=> loading checkpoint '{}'".format(args.model_path))
        checkpoint = torch.load(args.model_path)
        model.load_state_dict(checkpoint['state_dict'], strict=True)
        logger.info("=> loaded checkpoint '{}'".format(args.model_path))
    else:
        print("=> no checkpoint found at '{}'".format(args.model_path))
        # raise RuntimeError("=> no checkpoint found at '{}'".format(args.model_path))

我手动下载了模型到./model_zoo文件夹:

hd3f_chairs-04bf114d.pth
hd3f_chairs_things-462a3896.pth
hd3f_chairs_things_kitti-41b15827.pth
hd3f_chairs_things_sintel-5b4ad51a.pth
hd3fc_chairs-1367436d.pth
hd3fc_chairs_things-0b92a7f5.pth
hd3fc_chairs_things_kitti-bfa97911.pth
hd3fc_chairs_things_sintel-0b6e4b67.pth
hd3s_things-8b4dcd6d.pth
hd3s_things_kitti-1243813e.pth
hd3sc_things-57947496.pth
hd3sc_things_kitti-368975c0.pth

我的数据位置:

.\kitti_stereo_2015\testing\image_2
.\kitti_stereo_2015\testing\image_3

我的运行环境是:

windows 10
CUDA 9.0
cuDNN 7.4.1

python:
cudatoolkit 9.0
cudnn 7.3.1
cupy 6.0.0
python 3.7.3
pytorch 1.1.0
Hustle-Tung commented 5 years ago

Sorry, I found my mistake after re-reading the readme file. I just gave the model folder and did not specify which model to use:

--model_path=./model_zoo/hd3sc_things_kitti-368975c0.pth

But I still want to ask why output two kinds of pictures, gray and red?


Thank you for sharing!

yzcjtr commented 5 years ago

Hi, what's your folder hierarchy after running the inference code? There should be two folders containing the visualizations (color images) and the disparity maps (grayscale images) respectively. The disparity maps are converted to 2D flow for visualization. I'm afraid your result is still incorrect for the visualization shouldn't be pure red.

Hustle-Tung commented 5 years ago

The results are as follows: ├── results │ ├── vis │ │ ├── kitti_stereo_2015 │ │ │ ├── testing │ │ │ │ ├── image_2 │ │ │ │ │ ├── 000000_10.png │ │ │ │ │ ├── 000001_10.png │ │ │ │ │ ├── ...... │ ├── vec │ │ ├── kitti_stereo_2015 │ │ │ ├── testing │ │ │ │ ├── image_2 │ │ │ │ │ ├── 000000_10.png │ │ │ │ │ ├── 000001_10.png │ │ │ │ │ ├── ......

000000_10.png .\results\vis\kitti_stereo_2015\testing\image_2\000000_10.png 000000_10.png .\results\vec\kitti_stereo_2015\testing\image_2\000000_10.png

Is that right?

yzcjtr commented 5 years ago

Yes. Looks good now. The red one is only for visualization purpose. You can further confirm the precision by running the model on the KITTI training set and evaluating the accuracy.

Hustle-Tung commented 5 years ago

Oh, this is just my first step. Now I'm doing vehicle identification in autonomous driving through binocular stereo vision. I need to generate the U-V disparity from the disparity map. Maybe I just need grayscale images. Actually, I do not know how to do it next. I just took the first step, getting disparity map. So I don't think I need to confirm the precision that I don' konw. I"m not sure if I'm right.

Anyway, I sincerely appreciate your help!