Tensorflow lite - depth map - based on stereo vision - android

I have not found any project, library, model or guide to measure distance using stereo imaging with tensorflow lite 2.
I want to be able to measure distance from stereo images.
I would like to be able to run it on android, so I would like to create a model in tensorflow 2 or use an existing one. But I don't know where to start, everything I found uses pytorch
I know that opencv provides a method to do it, but according to the literature neural networks achieve better results. But I have not found any model in tensorflow 2.
I can't use google ar, because my device doesn't support google play services.

I have just uploaded a repository for this purpose:
https://github.com/ibaiGorordo/TFLite-HITNET-Stereo-depth-estimation
It uses the stereo depth estimation HITNET model (from Google-Research) converted to tensorflow lite by #PINTO0309 (find the models here: https://github.com/PINTO0309/PINTO_model_zoo/tree/main/142_HITNET)

Related

Firebase Ml kit, Google cloud vision API or openCV

I want to build an android app for gaze tracking and I would like to ask which of the following tools I should use for better results.
Google Cloud Vision API
OpenCV (ex HaarCascade classifier)
Firebase ML kit with facial landmarks
I don't know if you plan to create a commercial application or if it's for research purposes, the things to consider change a bit in these two scenarios.
For object tracking I'd problably go with google's mlkit, it has some ready-to-use models that also works offline, it also simplifies all the hard work of pure tensorflow (even on iOS) if you want to use your custom models. So your hard work will be to create an efficient model and not running it.
Google Cloud Vision API I've not used yet, just the GCP machines to train a NN and they came in handy for it.
OpenCV is a good one but might be hard to implement and mantain after, your app size will also considerably increase. I've used HaarCascade in my final paper 2 years ago, the work was hard and the result not that accurate, today I'd check the OpenCV's DNN module and go with Yolo like here. To summarize, I'd just recomment it if you have some specific image processing demand, but first check the Android's ColorFilter or ImageFilterView. If you choose to use OpenCV, I'd recommend you to compile it by yourself with cmake like described here just with the modules you need to use, so you app size won't increase that much.
There's also some other options like Dlib or PyTorch, I've been working with dlib's SVM with a custom model last year, its results were good but it's slow to run, about 3~4 seconds, compared to a NN with tensorflow that runs in 50~60 milliseconds (even faster with quantized models). I don't have experience with PyTorch or other framework to share something with you.

Creating a simple neural network on Tensorflow by means of Android

I want to create a simple neural network based on the example https://github.com/googlesamples/android-ndk/tree/master/nn_sample. Is it possible to create this with the help on Tensorflow only with Android tools on Java
Take a look at this folder https://github.com/googlesamples/android-ndk/tree/master/nn_sample/app/src/main/cpp
simple_model.h is the model trained in Tensorflow before creating the Android project. Now the model likes black-box, get input and predict output only, if you want to build your own model, try this tutorial (All steps from training, evaluating, prediction to deploy onto Android):
https://medium.com/#elye.project/applying-tensorflow-in-android-in-4-steps-to-recognize-superhero-f224597eb055
Affirmative. You can use TensorFlow Lite on Android, it's an open source deep learning framework which helps to compress and deploy models to a mobile or embedded application. It basically can take models as input and then deploys and interpret and perform resource-conserving optimizations for mobile applications. The NNAPI of Android NDK can interface with TFLite easily too. This link contains gesture, image, object & speech detection and classification example implementations on Android with Java using TFLite.

Firebase ML Kit: Pre-Trained Models

I can see there are 3 pre-trained models included in the assets folder of the ML-Kit sample app.
Please help me understand
Which of these models correspond to face detection?
What is the data set used to train these models?
Those are custom models provided to highlight the ML Kit functionality that allows you to bring your own TFLite models.
The pre-trained APIs, also known as Base APIs (text recognition, image labeling, etc) get added by including the appropriate libraries in your app's gradle file. No need to include anything in your assets folder. See an example here:
https://firebase.google.com/docs/ml-kit/android/recognize-text

Tensorflow Object Detection API on Android

I'd like to swap out the multibox_model.pb being used by TensorFlowMultiBoxDetector.java in Google's Tensorflow Detect Sample App with the mobilenet frozen_inference_graph.pb included in the object detection API's model zoo.
I've ran the optimize_for_inference script on it but the tensorflowInferenceInterface can't parse the optimized model. It can, however, parse the original frozen_inference_graph.pb. I still think I need to modify this graph somehow to take in a square-sized input image, such as the 224x224 one that multibox_model.pb does.
I'm one of the developers --- just FYI, we'll be releasing an update to the Android Detection demo in the next few weeks to make it compatible with the Tensorflow Object Detection API, so please stay tuned.

How to work with Tensorflow on Android platform?

Google has made the TENSORFLOW open source for developers..
Is there any way out for using this on android?
The link is here TensorFlow.
I would love to have some directions to work on this API.
The TensorFlow source repository includes an Android example application, with some documentation.
The Android example includes a pre-trained model for image classification, and uses this to classify images captured by the camera. Typically you would build and train a model using the Python API; generate a serialised version of the model as a GraphDef protocol buffer (and possibly a checkpoint of the model parameters); and then load that and run inference steps using the C++ API.

Categories

Resources