realtime_object_detection icon indicating copy to clipboard operation
realtime_object_detection copied to clipboard

Error with the splitting of the Faster RCNN Inception-V2

Open PoissonChasseur opened this issue 3 years ago • 1 comments

Hello,

I'm trying to use your code to split into 2 a "Faster RCNN Inception-V2" that I trained with the standard code from the "Object Detection API of Tensorflow" with Tensorflow 1.12.0.

When I try to use your code with my "frozen_inference_graph.pb" file, I have an error in the "load_graph_faster_v2.py" file because of the "Squeeze_2" and "Squeeze_3" keys (defined in "SPLIT_TARGET_NAME") which are not present in the "name_to_node_map" variable.

I looked at the contents of the "name_to_node_map" variable (that I put in a text file), but there are several squeeze layers that could relate to which one should be selected, so I'm not sure which ones should be selected in order to do it correctly.

Note: I'm a newbie to Tensorflow and object detection models.

PoissonChasseur avatar May 10 '22 20:05 PoissonChasseur

By using Tensorboard, I saw that the correct names are probably: ["Squeeze" and "Squeeze_1"] instead of ["Squeeze_2" and "Squeeze_3"].

But I then got another error:

Building Graph
Traceback (most recent call last):
  File "C:\Users\vincentrm\Miniconda3\envs\obj_detect_4\lib\site-packages\tensorflow\python\framework\importer.py", line 418, in import_graph_def
    graph._c_graph, serialized, options)  # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: Node 'SecondStageBoxPredictor/AvgPool_1': Unknown input node 'SecondStageFeatureExtractor/InceptionV2/Mixed_5c/concat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Obj_detection_3\naisy - realtime_object_detection-master\run_image.py", line 147, in main
    detection.start(cfg)
  File "D:\Obj_detection_3\naisy - realtime_object_detection-master\lib\detection_faster_v2.py", line 74, in start
    graph = load_frozen_graph.load_graph()
  File "D:\Obj_detection_3\naisy - realtime_object_detection-master\lib\load_graph_faster_v2.py", line 35, in load_graph
    return self.load_frozen_graph_with_split()
  File "D:\Obj_detection_3\naisy - realtime_object_detection-master\lib\load_graph_faster_v2.py", line 312, in load_frozen_graph_with_split
    tf.import_graph_def(remove, name='')
  File "C:\Users\vincentrm\Miniconda3\envs\obj_detect_4\lib\site-packages\tensorflow\python\util\deprecation.py", line 488, in new_func
    return func(*args, **kwargs)
  File "C:\Users\vincentrm\Miniconda3\envs\obj_detect_4\lib\site-packages\tensorflow\python\framework\importer.py", line 422, in import_graph_def
    raise ValueError(str(e))
ValueError: Node 'SecondStageBoxPredictor/AvgPool_1': Unknown input node 'SecondStageFeatureExtractor/InceptionV2/Mixed_5c/concat'

However, I clearly see that it seem correct in the original graph with Tensorboard, so I don't understand how to solve this error.

The code also work well without the splitting.

PoissonChasseur avatar May 10 '22 21:05 PoissonChasseur