EdjeElectronics / TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10

How to train a TensorFlow Object Detection Classifier for multiple object detection on Windows
Apache License 2.0
2.92k stars 1.3k forks source link

Error while importing the Frozen model created in inference_graph folder into tensorflow.js #493

Open saastechops1 opened 4 years ago

saastechops1 commented 4 years ago

Dear community members,

I am trying to import the created frozen_inference_graph.pb to create tensorflow.js equivalent model , so as to consume the same in web browser . To do the same , as per the tensorflow.js standard documentation , we have to use the tensorflowjs_converter . On performing the steps mentioned, I am coming across errors.

tensorflowjs_converter --input_format=tf_frozen_model --output_node_names='detection_boxes,detection_scores,detection_classes,num_detections' C:\tensorflow5\models\research\object_detection\inference_graph\saved_model\saved_model.pb C:/model_conv/inference_graph/web_model

I got below error for the above conversion Traceback (most recent call last): File "c:\users\punitupadhyay.conda\envs\tensorflowjs3\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\punitupadhyay.conda\envs\tensorflowjs3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\PunitUpadhyay.conda\envs\tensorflowjs3\Scripts\tensorflowjs_converter.exe__main__.py", line 7, in File "c:\users\punitupadhyay.conda\envs\tensorflowjs3\lib\site-packages\tensorflowjs\converters\converter.py", line 671, in pip_main main([' '.join(sys.argv[1:])]) File "c:\users\punitupadhyay.conda\envs\tensorflowjs3\lib\site-packages\tensorflowjs\converters\converter.py", line 675, in main convert(argv[0].split(' ')) File "c:\users\punitupadhyay.conda\envs\tensorflowjs3\lib\site-packages\tensorflowjs\converters\converter.py", line 658, in convert weight_shard_size_bytes=weight_shard_size_bytes) File "c:\users\punitupadhyay.conda\envs\tensorflowjs3\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py", line 393, in convert_tf_frozen_model weight_shard_size_bytes=weight_shard_size_bytes) File "c:\users\punitupadhyay.conda\envs\tensorflowjs3\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py", line 134, in optimize_graph graph.add_to_collection('train_op', graph.get_operation_by_name(name)) File "c:\users\punitupadhyay.conda\envs\tensorflowjs3\lib\site-packages\tensorflow\python\framework\ops.py", line 3640, in get_operation_by_name return self.as_graph_element(name, allow_tensor=False, allow_operation=True) File "c:\users\punitupadhyay.conda\envs\tensorflowjs3\lib\site-packages\tensorflow\python\framework\ops.py", line 3512, in as_graph_element return self._as_graph_element_locked(obj, allow_tensor, allow_operation) File "c:\users\punitupadhyay.conda\envs\tensorflowjs3\lib\site-packages\tensorflow\python\framework\ops.py", line 3572, in _as_graph_element_locked "graph." % repr(name)) KeyError: 'The name "num_detections\'" refers to an Operation not in the graph.'

Kindly help me here , as i want to use the trained model in web using tensorflow.js . I also want to know if at all this is feasible , since tensorflow.js is @1.7.4.post1 which I have used and is the latest , which should make it compatible to do the conversion.

Kindly Help !

Thanks & Awaiting Reply from community !

Tylersuard commented 4 years ago

Same! I am trying to do the exact same thing. Have you made any progress?