1

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.

user60108
  • 3,270
  • 2
  • 27
  • 43
  • 3
    Check out https://github.com/datvuthanh/Stereo-Matching – Jae sung Chung Apr 28 '21 at 05:07
  • Thanks, but unfortunately the project uses operator operators outside the definition of the model, to perform the inference, (such as tf.reduce_sum and tf.multiply). It is my understanding that there is no direct implementation in TFLite of such operators, I think it is not a very good option :( – user60108 Apr 29 '21 at 14:00
  • 1
    FYI, tf.reduce_sum and tf.multiply are supported in TFLite builtin ops. – Jae sung Chung Apr 29 '21 at 14:06
  • I understand that they are operations supported by the interpreter with an exported model. But the project uses them outside the definition of the model. I could not instantiate any of these operations from the libraries within the namespace tensorflow-lite. https://www.tensorflow.org/lite/guide/op_select_allowlist – user60108 Apr 29 '21 at 18:37
  • 1
    Sorry. I don't understand the meaning of the 'outside the definition of the model'. Could you share the conversion error message? – Jae sung Chung Apr 29 '21 at 20:02
  • for example, this line when he makes an inference https://github.com/datvuthanh/Stereo-Matching/blob/33f9f391a298e0cd43822b2e29a9dbf5a4fc318b/inference.py#L122 in this case, the model is purely convolutional. The rest of the calculation is done outside the model – user60108 Apr 29 '21 at 20:11
  • 1
    There is possibility that the above inference code can be turned into a single TF model by using tf.function or the TF model serialization. It requires some more coding for that. You may ask the github owner for a feature request. – Jae sung Chung Apr 29 '21 at 20:44
  • Thank you very much for your advice. I will investigate how to include it within the model with tf.function. – user60108 Apr 29 '21 at 21:08

1 Answers1

1

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)

Ibai Gorordo
  • 11
  • 1
  • 2