gustavz / realtime_object_detection

Plug and Play Real-Time Object Detection App with Tensorflow and OpenCV
MIT License
281 stars 148 forks source link

ValueError: graph_def is invalid #8

Closed paolomanchisi closed 6 years ago

paolomanchisi commented 6 years ago

Hi , I trained my own model using original tensorflow object detection, but I get this error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/importer.py", line 633, in import_graph_def
    source_op = name_to_op[operation_name]
KeyError: 'Preprocessor/map/strided_slice'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "object_detection.py", line 301, in <module>
    main()
  File "object_detection.py", line 295, in main
    graph, score, expand = load_frozenmodel()
  File "object_detection.py", line 161, in load_frozenmodel
    tf.import_graph_def(remove, name='')
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 316, in new_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/importer.py", line 640, in import_graph_def
    % (input_name,)))
ValueError: graph_def is invalid at node 'Preprocessor/map/TensorArray_2': Input tensor 'Preprocessor/map/strided_slice:0' not found in graph_def..
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/importer.py", line 633, in import_graph_def
    source_op = name_to_op[operation_name]
KeyError: 'Preprocessor/map/strided_slice'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "object_detection.py", line 301, in <module>
    main()
  File "object_detection.py", line 295, in main
    graph, score, expand = load_frozenmodel()
  File "object_detection.py", line 161, in load_frozenmodel
    tf.import_graph_def(remove, name='')
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 316, in new_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/importer.py", line 640, in import_graph_def
    % (input_name,)))
ValueError: graph_def is invalid at node 'Preprocessor/map/TensorArray_2': Input tensor 'Preprocessor/map/strided_slice:0' not found in graph_def..

Is there something special to do when training with my own dataset? Thank you, your code is great!

gustavz commented 6 years ago

You are probably using split_model = True This only works for ssd_mobilenet based models! As it is a hard coded split of the graph in a cpu and gpu session, you need to set it toFalse if you use other models/graphs.

Did that answer your question?

paolomanchisi commented 6 years ago

I've tried and it works, but it's strange because it's an ssd_mobilenet model! I will investigate further. Thank you very much!