Closed yowoda closed 3 years ago
# tensorflow/ tensorflow-gpu <= 1.15.4 is required
At the moment I don't support/plan to support newer tensorflow versions.
So it doesn't support python 3.8? Since pip doesn't find that version
Not out of the box. You can always use the docker image and call it as a rest api.
On Wed, 18 Nov 2020, 20:43 Yoda, notifications@github.com wrote:
So it doesn't support python 3.8? Since pip doesn't find that version
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/notAI-tech/NudeNet/issues/62#issuecomment-729744842, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZJQHQF7QINMQWRLEOVV5DSQPQBZANCNFSM4TXJ7Z4A .
Hmm, I would rather not do that. Thanks for answering that quickly though!
I tried to run the model with the following code under TensorFlow 2.3.1, but have got a very inaccurate result -> There is no problem for now! Please see comments below (cf. #62 (comment)).
# !saved_model_cli show --dir ./default/detector_v2_default_checkpoint_tf --tag_set serve --all
import tensorflow as tf
from detector_utils import preprocess_image
import numpy as np
checkpoint_path = './default/detector_v2_default_checkpoint_tf'
image, scale = preprocess_image('./rga6845.jpg')
sample = np.expand_dims(image, axis=0)
with tf.compat.v1.Session() as sess:
model = tf.compat.v1.saved_model.load(sess, ['serve'], checkpoint_path)
x_name = model.signature_def['predict'].inputs['images'].name
x = sess.graph.get_tensor_by_name(x_name)
y1_name = model.signature_def['predict'].outputs['output1'].name
y1 = sess.graph.get_tensor_by_name(y1_name)
y2_name = model.signature_def['predict'].outputs['output2'].name
y2 = sess.graph.get_tensor_by_name(y2_name)
y3_name = model.signature_def['predict'].outputs['output3'].name
y3 = sess.graph.get_tensor_by_name(y3_name)
outPred = sess.run([y1, y2, y3], feed_dict={x: sample})
print(outPred)
The highest score in output2 is just 0.28650957 -> 0.79144394 (cf. https://github.com/notAI-tech/NudeNet/issues/62#issuecomment-756725709).
The same inaccurate result happens when rewriting as following (in TensorFlow 2.3.1).
import tensorflow as tf
from detector_utils import preprocess_image
checkpoint_path = './default/detector_v2_default_checkpoint_tf'
classes_path = './default/classes'
image, scale = preprocess_image('./rga6845.jpg')
model = tf.saved_model.load(checkpoint_path)
infer = model.signatures['predict']
x = tf.keras.preprocessing.image.img_to_array(image)
x = x[tf.newaxis,...]
pred = infer(tf.constant(x))
print(pred)
The highest score in output2 is 0.2620039 -> 0.79144394 (cf. https://github.com/notAI-tech/NudeNet/issues/62#issuecomment-756725709).
But the result looks well when it runs in TensorFlow 1.14.0.
!pip install --upgrade nudenet
!pip install scikit-image==0.16.1
from nudenet import NudeDetector
detector = NudeDetector()
print(detector.detect('./rga6845.jpg'))
output2 contains 0.79144406 as the highest score.
That's a bit strange, and I could not understand why the results are so different among 2.3.1 and 1.14.0. Does it mean that the model is not suggested to use in TF 2.3.1, though it can be loaded and run? -> There is no problem for now! Please see comments below (cf. https://github.com/notAI-tech/NudeNet/issues/62#issuecomment-756725709).
My bad! I forgot that I have amended detector_utils.py for testing. Once I restored detector_utils.py back to your original version, the results all look good now! I'm extremely sorry for being careless. Hope I didn't have wasted your time! And many many thanks for sharing this project. You are a giant, and thus I can stand on your shoulder to look further.
Closing this issue, since it is resolved and newer versions of NudeNet doesn't depend on any version of tensorflow.
Describe the bug and error messages (if any) I keep getting the error, that the tensorflow module, doesn't have an attribute called contrib. I believe this has to do with tensorflow pushing a new version that removes that attribute. Correct me if I'm wrong.
Traceback:
**The code snippet which gave this error***
data
is of the typebytes
Specify versions of the following libraries
Expected behavior No errors, and the coordinates of the boxes being printed