gustavz / realtime_object_detection

Plug and Play Real-Time Object Detection App with Tensorflow and OpenCV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: Node 'Preprocessor/map/TensorArray_2': Unknown input node 'Preprocessor/map/strided_slice'

David-Lee-1990 opened this issue · comments

@gustavz
Hi, I am new to tensorflow. I trained Tensorflow's object detection api with my own data using ssd_mobilenet_v2_coco model. When I use this 'realtime_object_detection' code, I get the error stated as follows:

File "run_objectdetection.py", line 178, in <module> config.NUM_CLASSES,config.SPLIT_MODEL, config.SSD_SHAPE).prepare_od_model() File "D:\realtime_object_detection_2\rod\model.py", line 163, in prepare_od_model self.load_frozenmodel() File "D:\realtime_object_detection_2\rod\model.py", line 135, in load_frozenmodel tf.import_graph_def(remove, name='') File "C:\Users\bubblelab\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\util\deprecation.py", line 432, in new_func return func(*args, **kwargs) File "C:\Users\bubblelab\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\importer.py", line 493, in import_graph_def raise ValueError(str(e)) *ValueError: Node 'Preprocessor/map/TensorArray_2': Unknown input node 'Preprocessor/map/strided_slice'*

The error comes from the model.py file line 130 when importing remove graph:
` keep = graph_pb2.GraphDef()
for n in nodes_to_keep_list:
keep.node.extend([copy.deepcopy(name_to_node_map[n])])

                remove = graph_pb2.GraphDef()
                remove.node.extend([score_def])
                remove.node.extend([expand_def])
                for n in nodes_to_remove_list:
                    remove.node.extend([copy.deepcopy(name_to_node_map[n])])

                with tf.device('/gpu:0'):
                    tf.import_graph_def(keep, name='')
                with tf.device('/cpu:0'):
                    tf.import_graph_def(remove, name='')`

I checked that the node named "Preprocessor/map/strided_slice" is really in the frozenmodel:
name: "Preprocessor/map/strided_slice" op: "StridedSlice" input: "Preprocessor/map/Shape" input: "Preprocessor/map/strided_slice/stack" input: "Preprocessor/map/strided_slice/stack_1" input: "Preprocessor/map/strided_slice/stack_2" attr { key: "Index" value { type: DT_INT32 } } attr { key: "T" value { type: DT_INT32 } } attr { key: "begin_mask" value { i: 0 } } attr { key: "ellipsis_mask" value { i: 0 } } attr { key: "end_mask" value { i: 0 } } attr { key: "new_axis_mask" value { i: 0 } } attr { key: "shrink_axis_mask" value { i: 1 } }

i found there is another node named 'Preprocessor/map/TensorArray_1' also has the node 'Preprocessor/map/strided_slice' as its input:

name: "Preprocessor/map/TensorArray_1" op: "TensorArrayV3" input: "Preprocessor/map/strided_slice" attr { key: "clear_after_read" value { b: true } } attr { key: "dtype" value { type: DT_FLOAT } } attr { key: "dynamic_size" value { b: false } } attr { key: "element_shape" value { shape { unknown_rank: true } } } attr { key: "identical_element_shapes" value { b: true } } attr { key: "tensor_array_name" value { s: "" } }

I can not fix this error. Any help would be appreciated!