Git Product home page Git Product logo

densedepth-1's Introduction

Modify from https://github.com/ialhashim/DenseDepth and https://github.com/amitshekhariitbhu/Android-TensorFlow-Lite-Example

Main Contributions:

  1. Porting source from tensorflow1.x to tensorflow2.2
  2. Convert pre-trained keras model(.h5) to tensorflow2.2(.pb) and tensorflow-lite(.tflite)
  3. Android app with the tensorflow-lite quantized model

Difficulties in tflite convertion:

  1. The keras model can't be loaded from TFLiteConverter.from_keras_model() because custom_objects parsing isn't supported
  2. The keras model can't be loaded from TFLiteConverter.from_saved_model() because dynamic input shape [NONE, NONE, NONE, NONE] is not supported

Solution Steps:

  1. After loading .pb, converting its input shape to fixed shape [1, 480, 640, 3] in the session graph.
  2. Resave .pb from session graph. (Very improtant! converting and inferring directly without resave won't succeed...)
  3. Load .pb again for inference.

Results

  • Comparision of Keras, Tensorflow2.2 and Tensorflow-lite model over NYU Depth V2

Requirements

  • Install Tensorflow 2.2, python3.6
  • Download and put cudart64_101.dll under your cuda bin directory (ex: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin)
  • Download Keras model based on NYU Depth V2 and put it under the project

Converted Models

Over NYU Depth V2

Run Demo

After download and put the pre-trained keras model(nyu.h5) in the project

  1. Run python convert.py. to generate tensorflow2.2 and lite models with its corresponding depth map.
  2. Rename nyuQuan.tflite with nyu.tflite and put it on Android/app/src/main/assets
  3. Build and run Android with android studio

you can also download and install DenseDepth apk with the Tensorflow-lite quantized model

Reference

Thanks for the authors. If using the code, please cite their paper:

@article{Alhashim2018,
  author    = {Ibraheem Alhashim and Peter Wonka},
  title     = {High Quality Monocular Depth Estimation via Transfer Learning},
  journal   = {arXiv e-prints},
  volume    = {abs/1812.11941},
  year      = {2018},
  url       = {https://arxiv.org/abs/1812.11941},
  eid       = {arXiv:1812.11941},
  eprint    = {1812.11941}
}

densedepth-1's People

Contributors

jojo13572001 avatar rdcdt1 avatar

Watchers

 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.