-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
TensorFlow.js version
tensorflowjs 0.6.7
Dependency versions:
keras 2.2.2
tensorflow 1.12.0
Browser version
N/A
Describe the problem or feature request
Can't convert a freezed mask_rcnn_coco.pb to tensorflowjs using tensorflowjs-converter
Code to reproduce the bug / link to feature request
I first freezed the keras model with :
from tensorflow.python.framework import graph_util
from tensorflow.python.framework import graph_io
from keras import backend as K
K.set_image_data_format('channels_last')
sess = K.get_session()
output_node_names = [node.op.name for node in model.keras_model.outputs]
print(output_node_names)
constant_graph = graph_util.convert_variables_to_constants(
sess,
sess.graph.as_graph_def(),
output_node_names)
graph_io.write_graph(
constant_graph,
'/tmp',
'mask_rcnn_coco.pb',
as_text=False)
The print output_node_names gives :
['mrcnn_detection/Reshape_1',
'mrcnn_class/Reshape_1',
'mrcnn_bbox/Reshape',
'mrcnn_mask/Reshape_1',
'ROI/packed_2',
'rpn_class/concat',
'rpn_bbox/concat']
I then run the tensorflowjs-converter with :
tensorflowjs_converter --input_format=tf_frozen_model --saved_model_tags=serve --output_node_names='mrcnn_detection/Reshape_1,mrcnn_class/Reshape_1,mrcnn_bbox/Reshape,mrcnn_mask/Reshape_1,ROI/packed_2,rpn_class/concat,rpn_bbox/concat' '/tmp/frozen_mask_rcnn_coco.pb' '/tmp/output/fronzen_mask_rcnn_coco_web.pb'
tensorflowjs-converter failed with :
Using TensorFlow backend.
Traceback (most recent call last):
File "/usr/local/bin/tensorflowjs_converter", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/tensorflowjs/converters/converter.py", line 333, in main
strip_debug_ops=FLAGS.strip_debug_ops)
File "/usr/local/lib/python3.6/dist-packages/tensorflowjs/converters/tf_saved_model_conversion.py", line 330, in convert_tf_frozen_model
skip_op_check=skip_op_check, strip_debug_ops=strip_debug_ops)
File "/usr/local/lib/python3.6/dist-packages/tensorflowjs/converters/tf_saved_model_conversion.py", line 117, in optimize_graph
', '.join(unsupported))
ValueError: Unsupported Ops in the model before optimization
Unique, DenseToDenseSetOperation
Any idea ?