Tensorflow 2.0 convert frozen_graph.pb to .tflite
Verfasst: Samstag 7. Dezember 2019, 18:30
Huhu und zwar verzweifele ich gerade daran ein Tensorflow frozen_graph.pb in eine .tflite zu konvertieren unter Tensorflow 2.0.
Vlt. kann mir ja hier jmd. helfen der damit schon Erfahrung hat und erklären wo mein Fehler liegt
Hier der Graph und die Map:
https://gofile.io/?c=YjsCuY
Gegeben:
frozen_graph.pb
label_map.pbtxt
PS: Retrain ist leider nicht möglich
input_tensor:
Skript zur Konvertierung:
Fehler:
Weitere Frage:
Ich versuche schon die ganze Zeit TF-gpu (Anaconda) unter Windows zu nutzen allerdings scheitere ich immer an diesem Fehler:
Github und StackOverflow gibt leider auch nichts brauchbares her 
Versuche:
Treiber downgrade
Anaconda komplett neu installiert
Ideen/Erfahrungen ?
Vielen Dank für eure Hilfe !
MfG Felix
Tensorflow-gpu über pip und CUDA direkt von NVIDIA
Vlt. kann mir ja hier jmd. helfen der damit schon Erfahrung hat und erklären wo mein Fehler liegt

Hier der Graph und die Map:
https://gofile.io/?c=YjsCuY
Gegeben:
frozen_graph.pb
label_map.pbtxt
PS: Retrain ist leider nicht möglich
input_tensor:
Code: Alles auswählen
Tensor("image_tensor:0", shape=(None, None, None, 3), dtype=uint8)
Code: Alles auswählen
import tensorflow as tf
graph_def_file = "traffic_graph.pb"
input_arrays = ["image_tensor"]
output_arrays = ['num_detections', 'detection_boxes', 'detection_scores', 'detection_classes']
converter = tf.compat.v1.lite.TFLiteConverter.from_frozen_graph(
graph_def_file, input_arrays, output_arrays, input_shapes={"image_tensor":[None, 800, 600, 3]}) #wäre aktuelle Webcam input [None, None, None, 3] mag er nicht
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
Code: Alles auswählen
2019-12-07 18:07:36.188665: I tensorflow/lite/toco/graph_transformations/graph_transformations.cc:39] Before Removing unused ops: 4129 operators, 6953 arrays (0 quantized)
2019-12-07 18:07:36.870121: I tensorflow/lite/toco/graph_transformations/graph_transformations.cc:39] After Removing unused ops pass 1: 4081 operators, 6862 arrays (0 quantized)
2019-12-07 18:07:37.941125: I tensorflow/lite/toco/graph_transformations/graph_transformations.cc:39] Before general graph transformations: 4081 operators, 6862 arrays (0 quantized)
2019-12-07 18:07:38.160704: F tensorflow/lite/toco/graph_transformations/resolve_constant_slice.cc:59] Check failed: dim_size >= 1 (0 vs. 1)
Fatal Python error: Aborted
Current thread 0x00000dd4 (most recent call first):
File "D:\Programme\Anaconda\lib\site-packages\tensorflow_core\lite\toco\python\toco_from_protos.py", line 52 in execute
File "D:\Programme\Anaconda\lib\site-packages\absl\app.py", line 250 in _run_main
File "D:\Programme\Anaconda\lib\site-packages\absl\app.py", line 299 in run
File "D:\Programme\Anaconda\lib\site-packages\tensorflow_core\python\platform\app.py", line 40 in run
File "D:\Programme\Anaconda\lib\site-packages\tensorflow_core\lite\toco\python\toco_from_protos.py", line 89 in main
File "D:\Programme\Anaconda\Scripts\toco_from_protos-script.py", line 10 in <module>
Weitere Frage:
Ich versuche schon die ganze Zeit TF-gpu (Anaconda) unter Windows zu nutzen allerdings scheitere ich immer an diesem Fehler:
Code: Alles auswählen
2019-06-28 00:04:13.171528: W tensorflow/stream_executor/cuda/redzone_allocator.cc:294] Internal: Invoking ptxas not supported on Windows Relying on driver to perform ptx compilation 2019-06-28 00:04:13.198421: W tensorflow/stream_executor/cuda/redzone_allocator.cc:294] Internal: Invoking ptxas not supported on Windows Relying on driver to perform ptx compilation 2019-06-28 00:04:13.207294: W tensorflow/stream_executor/cuda/redzone_allocator.cc:294] Internal: Invoking ptxas not supported on Windows Relying on driver to perform ptx compilation

Versuche:
Treiber downgrade
Anaconda komplett neu installiert
Ideen/Erfahrungen ?
Vielen Dank für eure Hilfe !
MfG Felix
Tensorflow-gpu über pip und CUDA direkt von NVIDIA