mdietrichstein / tensorflow-open_nsfw

Tensorflow Implementation of Yahoo's Open NSFW Model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Converting to tflite

restys opened this issue · comments

Been struggling to convert the model to tflite.
I've used export_savedmodel.py to freeze it and then try to following to convert:
toco \ --graph_def_file=frozen_open_nsfw.pb --output_file=optimized_graph.tflite \ --output_format=TFLITE \ --input_arrays=input \ --output_arrays=predictions \

This results the following errors:
2018-08-16 01:54:39.677658: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1096] Converting unsupported operation: TensorArrayV3 2018-08-16 01:54:39.677802: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1096] Converting unsupported operation: TensorArrayScatterV3 2018-08-16 01:54:39.677834: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1096] Converting unsupported operation: TensorArrayV3 2018-08-16 01:54:39.677847: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1096] Converting unsupported operation: Enter

Any ideas?

Thanks a lot

Hello,
Did you manage to convert it to TFlite ?

Nop ):

I have the same problem when using the command line.
But i generated the tflite using python API. by modifying the export_savedmodel.py.

with tf.Session() as sess:
    model.build(weights_path=weights_path,input_type=InputType.TENSOR)

    sess.run(tf.global_variables_initializer())

    converter = tf.contrib.lite.TocoConverter.from_session(sess, [model.input], [model.predictions])
    tflite_model = converter.convert()
    open("converted_model.tflite", "wb").write(tflite_model)

I have added a new script (tools/export_tflite.py) which exports a tflite model. There are some limitations though. Please check the README file.