Code Monkey home page Code Monkey logo

lijiunderstand / segdepth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hakansivuk/segdepth

0.0 0.0 0.0 32.24 MB

In this project, semantic segmentation is used as a booster to the depth estimation task. Segmentation masks that separate foreground objects from background are created from full scale disparity maps through a U-net architecture. In addition to minimum reprojection loss and edge-aware smoothness loss, pixel-wise weighted cross entropy loss is used as an additional supervision signal.

Python 97.05% Shell 2.95%

segdepth's Introduction

SegDepth

Segmentation-Guided Self-Supervised Monocular Depth Estimation

In this project, semantic segmentation is used as a booster to the depth estimation task. Segmentation masks that separate foreground objects from background are created from full scale disparity maps through a U-net architecture. In addition to minimum reprojection loss and edge-aware smoothness loss, pixel-wise weighted cross entropy loss is used as an additional supervision signal.

You can find the dataset (KITTI raw) from this link

You can find the pretrained baseline and SegDepth network on KITTI raw subset dataset from this link

Training Process

I performed all experiments on NVIDIA Geforce 1050-TI Training baseline model on eigen_zhou_subset took 2.5 hours approximately. Training improved model on eigen_zhou_subset took 7 hours approximately.

Splits

I used subset of eigen_zhou_subset split. You can find it under splits/ folder.

Instructions for Running Scripts

In this section, necessary instructions to run scripts are described.

Warning

Before downloading the dataset (step 1), you will get an error if you try to run a script below. Since downloading all the dataset is time consuming, you can skip to Toy Examples section to run with a very few samples that are already in kitti_data folder without any error.

1) Download Dataset

You can download training subset data by typing the commands below:

wget -i splits/kitti_archives_to_download_subset.txt -P kitti_data/
cd kitti_data
unzip "*.zip"
cd ..

2) Creating Segmentation Masks

For creating segmentation masks, create and use the conda environment specified below:

conda create -n csm python=3.6.6
conda activate csm
pip install torch torchvision
pip install opencv-python
pip install numpy
python create_segmentation_masks.py

3) Training

Follow the steps below:

conda create -n segdepth python=3.6.6
conda activate segdepth
conda install pytorch=0.4.1 torchvision=0.2.1 -c pytorch
conda install scikit-image
conda install opencv=3.3.1

By default models are saved to tmp/<model_name>. This can be changed with the --log_dir flag.

python train.py --model_name mono_model

4) Prediction

You can predict depth for a single image with (change model path according to your case):

python test_simple.py --image_path assets/test_image.jpg --model_name mono_model --model_path tmp/mono_model/models/weights_19/

5) Eigen split evaluation

To prepare the ground truth depth maps run:

python export_gt_depth.py --data_path kitti_data --split eigen

...assuming that you have placed the KITTI dataset in the default location of ./kitti_data/.

The following example command evaluates the epoch 19 weights of a model named mono_model:

python evaluate_depth.py --load_weights_folder tmp/mono_model/models/weights_19/ --eval_mono

Toy Examples

In this section, you can run the scripts above with a very few data without any downloading process.

1) Training

Follow the steps below:

conda create -n segdepth python=3.6.6
conda activate segdepth
conda install pytorch=0.4.1 torchvision=0.2.1 -c pytorch
conda install scikit-image
conda install opencv=3.3.1
python train.py --model_name mono_model --example_run --batch_size 1

2) Eigen split evaluation

To prepare the ground truth depth maps run:

python export_gt_depth.py --data_path kitti_data --split eigen --test_file test_files_example.txt

assuming that you have placed the KITTI dataset in the default location of ./kitti_data/.

The following example command evaluates the epoch 19 weights of a model named mono_model:

python evaluate_depth.py --load_weights_folder tmp/mono_model/models/weights_19/ --eval_mono --test_file test_files_example.txt

segdepth's People

Contributors

hakansivuk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.