notAI-tech / NudeNet

Lightweight nudity detection
https://nudenet.notai.tech/
GNU Affero General Public License v3.0
1.73k stars 336 forks source link

Problem using Nudenet to classify image #17

Closed sleekmike closed 5 years ago

sleekmike commented 5 years ago

I have installed Nudenet on my Mac machine using this command: pip install git+https://github.com/bedapudi6788/NudeNet

I am using python 3.7.4 and here is my code:

installing the project

pip install git+https://github.com/bedapudi6788/NudeNet

Using the classifier

from nudenet import NudeClassifier classifier = NudeClassifier('/Users/macbook/Desktop/NudeNet-models/classifier_model') classifier.classify('/Users/macbook/Desktop/censorship api/image-2.jpg') print("working well")

here is the error that I am getting: Using TensorFlow backend. /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) Traceback (most recent call last): File "censor.py", line 5, in classifier = NudeClassifier('/Users/macbook/Desktop/NudeNet-models/classifier_model') File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nudenet/classifier.py", line 43, in init Classifier.nsfw_model = keras.models.load_model(model_path) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/keras/engine/saving.py", line 417, in load_model f = h5dict(filepath, 'r') File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/keras/utils/io_utils.py", line 186, in init self.data = h5py.File(path, mode=mode) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/h5py/_hl/files.py", line 394, in init swmr=swmr) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/h5py/_hl/files.py", line 170, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5f.pyx", line 85, in h5py.h5f.open OSError: Unable to open file (unable to open file: name = '/Users/macbook/Desktop/NudeNet-models/classifier_model', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

bedapudi6788 commented 5 years ago

Your error very clearly shows that the file "/Users/macbook/Desktop/NudeNet-models/classifier_model" is not present. Download that file and pass its correct path.

sleekmike commented 5 years ago

I have downloaded the file but the file doesn't work, I don't know if its because it doesn't come with an extension.

bedapudi6788 commented 5 years ago
OSError: Unable to open file (unable to open file: name = '/Users/macbook/Desktop/NudeNet-models/classifier_model', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

this error message clearly states that the file is not present.