tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.47k stars 1.93k forks source link

TensorFlowJS Unsupported Ops needed for Yahoo's Open NSFW Model #433

Closed tomslick closed 3 years ago

tomslick commented 6 years ago

To get help from the community, check out our Google group.

TensorFlow.js version

tensorflowjs 0.4.1 (installed via pip install tensorflowjs on June 13, 2018)

Browser version

N/A

Describe the problem or feature request

I attempted to convert the TensorFlow model of Yahoo's Open NSFW model found here with tensorflowjs-convert. (First, I exported the TensorFlow .npy file into a Frozen Model and also a Saved Model.)

For the Frozen Model, I ran:

tensorflowjs_converter --input_format=tf_frozen_model --output_node_names='fc_nsfw/BiasAdd' --saved_model_tags=serve frozen_open_nsfw.pb web_model

and received the following message:

Unsupported Ops in the model
TensorArrayWriteV3, TensorArrayV3, DecodeBase64, TensorArrayScatterV3, TensorArrayReadV3, EncodeJpeg, Assert, All, TensorArraySizeV3, DecodeJpeg, Unpack, TensorArrayGatherV3

Running on the Saved Model also results in the same Unsupported Ops list.

Request: Please add my vote to support these Ops

Thanks!

pyu10055 commented 6 years ago

The TensorArray related ops are almost ready, see https://github.com/tensorflow/tfjs-converter/pull/170 All op has been added. The ops left are: DecodedBase64, EncodeJpeg, Assert We will add those to our priority list.

tomslick commented 6 years ago

Thanks! That's amazing progress!

Also, don't forget DecodeJpeg please.

rstml commented 6 years ago

Same issue here. The only outstanding ops are: DecodeBase64, DecodeJpeg, EncodeJpeg

xue160709 commented 5 years ago

Same issue here. The only outstanding ops are: DecodeBase64, DecodeJpeg, EncodeJpeg

SSaishruthi commented 5 years ago

Working on it.

rstml commented 5 years ago

@SSaishruthi Frankly, if OpenNSFW is the only reason for supporting those operations, you may reconsider it.

For everyone else requesting this:

OpenNSFW has not been updated since its announcement in 2016. There are now alternative models which you can use.

We trained our alternative, MobileNetV2 based model which you can find here: https://github.com/purify-ai/geacc-models TFJS example using this model is available here: https://github.com/purify-ai/geacc-tfjs-demo Chrome extension which uses TFJS and our model: https://github.com/purify-ai/geacc-crx We plan to release updated dataset and model soon (potentially 100K images).

There's also NsfwJS which is based on InceptionV3: https://github.com/infinitered/nsfwjs

pyu10055 commented 3 years ago

DecodeJpeg op has been added in tfjs-node.