Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Object Distance Detection (Stereo)

Minimal stereo pipeline to estimate object distances from rectified stereo pairs. It supports classical stereo (SGBM) or deep stereo (CREStereo ONNX), then runs YOLO detection or segmentation and reports per-object distance.

Contents

  • run_stereo_depth_od.py — main entry point
  • utils/ — helper functions and CREStereo ONNX wrapper

Requirements

  • Python 3.10
  • NumPy
  • OpenCV (opencv-python)
  • Matplotlib
  • Ultralytics YOLO (ultralytics)
  • Open3D
  • ONNXRuntime (onnxruntime) only if using --stereo deep

Environment Setup

Conda:

conda env create -f environment.yml
conda activate merged_3dcv_crestereo

Pip:

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Quick Start

From this folder:

python3 run_stereo_depth_od.py \
  --data_root /path/to/KITTI_RAW_seq

Use deep stereo (CREStereo):

python3 run_stereo_depth_od.py \
  --data_root /path/to/KITTI_RAW_seq \
  --stereo deep \
  --crestereo_model /path/to/crestereo_model.onnx

Run segmentation mode:

python3 run_stereo_depth_od.py \
  --data_root /path/to/KITTI_RAW_seq \
  --detector seg \
  --seg_weights /path/to/yolo11n-seg.pt

Save depth maps and visualizations:

python3 run_stereo_depth_od.py \
  --data_root /path/to/KITTI_RAW_seq \
  --save_depth --save_visuals

Expected Dataset Layout

The --data_root should contain the KITTI RAW rectified structure:

<seq> /
  image_02/data/*.png
  image_03/data/*.png
  calib/calib_cam_to_cam.txt
  label_2_from_tracklets/*.txt   (optional, for MAE)

Outputs

All outputs go to --out_dir (default: output_pipeline under data_root).

  • summary.csv — per-frame stats and optional MAE vs labels
  • depth_map_*.npy — depth maps (if --save_depth)
  • depth_vis_*.png — colored depth images (if --save_visuals)
  • result_with_depth_*.png or result_with_depth_mask_*.png (if --save_visuals)

Notes

  • Default detector weights expect yolo11n.pt in this folder, or pass --det_weights.
  • Segmentation uses yolo11n-seg.pt if provided via --seg_weights.
  • If the CREStereo model output shape differs, update utils/crestereo_onnx.py.

Typical Commands

Classical stereo, single frame:

python3 run_stereo_depth_od.py \
  --data_root /path/to/KITTI_RAW_seq \
  --index 13

SGBM tuning (example):

python3 run_stereo_depth_od.py \
  --data_root /path/to/KITTI_RAW_seq \
  --sgbm_params "numDisparities=160,blockSize=7,uniquenessRatio=5"

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages