LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Deep learning - Google AutoML - How to use .pb model

Hi,

 

I have created a deep learning model (object detection model in pictures) using Google AutoML, a very useful tool for non expert IA expert.
https://cloud.google.com/automl

 

It is possible to generate trained models in several formats : TensorFlow Lite (.tflite), Core ML (.mlmodel), Conteneur (.pb), Edge TPU (.tflite), Web (.js).
https://cloud.google.com/vision/automl/docs/export-edge#tf-lite

 

Now, I would like to use my model in my LabVIEW application. I chose .pb format because I found an example using this format in the NI Vision Development Module and the TensorFlow API.
https://forums.ni.com/t5/Example-Code/Deep-Learning-Object-Detection-using-Vision-Development-Module...

 

But when I try to use my own model, I have an error from the "Create" fonction of the TensorFlow API.

erreur.png

After some researches on internet, I have found that some people had the same issue and it is due to the TensorFlow version used by the API, which is 1.14.0

version.png


I didn't know yet which is the version uses by Google AutoML to generate the model but I guess it is above this because the last version of TensorFlow are 2.10 and even 2.11! This NI link reports that we have to generate model in a version compatible with the version used by the TensorFlow API.
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019UUSSA2&l=fr-CH

 

It is impossible for me cause Google generates the model file for me. I have also tried to install the last version of TensorFlow on my computer but it doesn't work.

 

Anyone would have a solution to use Google AutoML model in a LabVIEW application? 

I think it would be interesting for NI to work on this, deep learning technology is more and more popular and Google and its AutoML Tool is a great solution for non IA experts !

 

Attached, my .pb model file.

0 Kudos
Message 1 of 5
(1,100 Views)

There are at least to flavors of .pb files saving neural networks:

 

flavor 1 is to keep weights, biases, and the model architektur or tensorflow-graph all to gether in one .pb - flavor 1 is often called "frozen graph".pb and as far as I have experienced was the way neural nets were exported in Tensorflow 1

 

flavor 2 is to separate weights, biases from the graph - flavor 2 has no particular name, but this "graph-only"-.pb is the way neural nets are exported in Tensorflow 2 nowadys .

 

 

I'd encourage NI to support TF 2 in IMAQ - but do they have GPU support for their Deep Learning Models Inference in LabView IMAQ or is it still cpu-only?

 

0 Kudos
Message 2 of 5
(1,065 Views)

After more researches, I understand a little the differences between TF1 and TF2.

I could understand that there is no good and easy ways to convert models from TF2 to TF1 and it is not really recommanded.

I guess the only way for now is to learn tensorflow to call my model with python and then try to call my python code with a LabVIEW wrapper?

I hope NI will add TF2 compatibility one day...

 

0 Kudos
Message 3 of 5
(1,005 Views)

@Loïs wrote:

 

I guess the only way for now is to learn tensorflow to call my model with python and then try to call my python code with a LabVIEW wrapper

 


 

 

I would also suggest to use python separatly from LabView , but exchange Data between LabView and Python via tcp or udp.

 

Why?

 

If you have Labview's python node in mind, be warned, that some python packages are not fully supported e.g. https://forums.ni.com/t5/LabVIEW/Pandas/m-p/4166693

 

 

 

0 Kudos
Message 4 of 5
(979 Views)

@alexderjuengere wrote:

 

If you have Labview's python node in mind, be warned, that some python packages are not fully supported e.g. https://forums.ni.com/t5/LabVIEW/Pandas/m-p/4166693

 

 

 


or this thread: https://forums.ni.com/t5/LabVIEW/Tensorflow-Python-Node-breaks-after-weights-load/m-p/4217127#M12228...

0 Kudos
Message 5 of 5
(963 Views)