Coder Social home page Coder Social logo

tanmaniac / monodepth-pytorch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oniroai/monodepth-pytorch

0.0 2.0 0.0 12.35 MB

Unofficial implementation of Unsupervised Monocular Depth Estimation neural network MonoDepth in PyTorch

Jupyter Notebook 12.04% Python 87.96%

monodepth-pytorch's Introduction

MonoDepth

This repo is inspired by an amazing work of Clément Godard, Oisin Mac Aodha and Gabriel J. Brostow for Unsupervised Monocular Depth Estimation. Original code and paper could be found via following links:

  1. Original repo
  2. Original paper

MonoDepth-PyTorch

This repository contains code and additional parts for the PyTorch port of the MonoDepth Deep Learning algorithm. For more information about original work please visit author's website

Purpose

Purpose of this repository is to make more lightweighted model for depth estimation with better accuracy.

Train results

The following results may be obtained using the model pretrained for 150 epochs on the whole dataset with initial lr = 0.01 and batch_size = 20 with resnet18 as encoder. demo.gif animation

Dataset

KITTI

This algorithm requires stereo-pair images for training and single images for testing. KITTI dataset was used for training. It contains 38237 training samples. Raw dataset (about 175 GB) can be downloaded by running:

wget -i kitti_archives_to_download.txt -P ~/my/output/folder/

kitti_archives_to_download.txt may be found in the original repo.

Dataloader

Dataloader assumes the following structure of the folder with train examples ('data_dir' argument contains path to that folder): It contains subfolders with folders "image_02/data" for left images and "image_03/data" for right images. Such structure is default for KITTI dataset

Example data folder structure:

data
├── kitti
│   ├── 2011_09_26_drive_0001_sync
│   │   ├── image_02
│   │   │   ├─ data
│   │   │   │   ├── 0000000000.png
│   │   │   │   └── ...
│   │   ├── image_03
│   │   │   ├── data
│   │   │   │   ├── 0000000000.png
│   │   │   │   └── ...
│   ├── ...
├── models
├── output
├── test
│   ├── left
│   │   ├── test_1.jpg
│   │   └── ...

Training

Example of training can be find in Monodepth notebook.

Model class from main_monodepth_pytorch.py should be initialized with following params (as easydict) for training:

  • data_dir: path to the dataset folder
  • model_path: path to save the trained model
  • output_directory: where save dispairities for tested images
  • input_height
  • input_width
  • model: model for encoder (resnet18 or resnet50)
  • mode: train or test
  • epochs: number of epochs,
  • learning_rate
  • batch_size
  • adjust_lr: apply learning rate decay or not
  • tensor_type:'torch.cuda.FloatTensor' or 'torch.FloatTensor'
  • do_augmentation:do data augmentation or not
  • augment_parameters:lowest and highest values for gamma, lightness and color respectively
  • print_images
  • print_weights

Optionally after initialization we can load pretrained model via load model.

After that calling train() on Model class object starts training process.

Also it can be started via calling main_monodepth_pytorch.py through the terminal and feeding parameters as argparse arguments.

Pretrained model

One of our pretrained models which showed best results may be downloaded from here. For training following parameters were used: model:'resnet18_md' epochs:150, learning_rate:1e-2, batch_size:20, adjust_lr:True

Testing

Example of testing can be find in Monodepth notebook.

Model class from main_monodepth_pytorch.py should be initialized with following params (as easydict) for testing:

  • data_dir: path to the dataset folder
  • model_path: path to save the trained model
  • output_directory: where save dispairities for tested images
  • input_height
  • input_width
  • model: model for encoder (resnet18 or resnet50)
  • mode: train or test

After that calling test() on Model class object starts testing process.

Also it can be started via calling main_monodepth_pytorch.py through the terminal and feeding parameters asargparse arguments.

Requirements

This code was tested with PyTorch 0.4.0, CUDA 9.1 and Ubuntu 16.04.

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.