mdietrichstein / tensorflow-open_nsfw

Tensorflow Implementation of Yahoo's Open NSFW Model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dtype for the input placeholder

aayux opened this issue · comments

commented

I exported the model serving with export_savedmodel.py and then wrote a Java program for deploying the model on end devices. The main part of the code is as follows:

SavedModelBundle savedModelBundle = SavedModelBundle.load( ... );
Tensor result = savedModelBundle.session().runner()
                .feed("input", normalizedImageTensor) // error here
                .fetch("predictions")
                .run().get(0);

normalizedImageTensor is the input image loaded and transformed as in __tf_jpeg_process and then casted to a tensor.

The error pertaining to the commented line is

Exception in thread "main" java.lang.IllegalArgumentException: Expects arg[0] to be string but float is provided
	at org.tensorflow.Session.run(Native Method)
	at org.tensorflow.Session.access$100(Session.java:48)
	at org.tensorflow.Session$Runner.runHelper(Session.java:298)
	at org.tensorflow.Session$Runner.run(Session.java:248)
	at com.paralleldots.lava.api.main(api.java:59)

This is saying that normalizedImageTensor is of type string.

What then is the dtype for the input placeholder in your actual graph? What kind of input is expected?

commented

The default input_type when building the model graph is InputType.BASE64_JPEG as seen in this line which results in self.input being initialized to type tf.string.