notAI-tech / NudeNet

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

ImportError: cannot import name 'NudeDetector' #14

Closed lxknvlk closed 5 years ago

lxknvlk commented 5 years ago

I have followed the instructions and get this error.

Here is the console output

ubuntu@ip-172-30-9-119:~/NudeNet$ pip3 install git+https://github.com/bedapudi6788/NudeNet
Collecting git+https://github.com/bedapudi6788/NudeNet
  Cloning https://github.com/bedapudi6788/NudeNet to /tmp/pip-req-build-abmny10t
  Running command git clone -q https://github.com/bedapudi6788/NudeNet /tmp/pip-req-build-abmny10t
Requirement already satisfied (use --upgrade to upgrade): NudeNet==1.0.5 from git+https://github.com/bedapudi6788/NudeNet in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: keras-retinanet==0.5.0 in /usr/local/lib/python3.6/dist-packages (from NudeNet==1.0.5) (0.5.0)
Requirement already satisfied: keras==2.2.4 in /usr/local/lib/python3.6/dist-packages (from NudeNet==1.0.5) (2.2.4)
Requirement already satisfied: opencv-python==4.0.0.21 in /usr/local/lib/python3.6/dist-packages (from NudeNet==1.0.5) (4.0.0.21)
Requirement already satisfied: keras-resnet in /usr/local/lib/python3.6/dist-packages (from keras-retinanet==0.5.0->NudeNet==1.0.5) (0.2.0)
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (from keras-retinanet==0.5.0->NudeNet==1.0.5) (5.1.0)
Requirement already satisfied: scipy in /usr/lib/python3/dist-packages (from keras-retinanet==0.5.0->NudeNet==1.0.5) (0.19.1)
Requirement already satisfied: cython in /usr/lib/python3/dist-packages (from keras-retinanet==0.5.0->NudeNet==1.0.5) (0.26.1)
Requirement already satisfied: progressbar2 in /usr/local/lib/python3.6/dist-packages (from keras-retinanet==0.5.0->NudeNet==1.0.5) (3.42.0)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from keras-retinanet==0.5.0->NudeNet==1.0.5) (1.11.0)
Requirement already satisfied: numpy>=1.9.1 in /usr/local/lib/python3.6/dist-packages (from keras==2.2.4->NudeNet==1.0.5) (1.16.4)
Requirement already satisfied: keras-preprocessing>=1.0.5 in /usr/local/lib/python3.6/dist-packages (from keras==2.2.4->NudeNet==1.0.5) (1.1.0)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (from keras==2.2.4->NudeNet==1.0.5) (3.12)
Requirement already satisfied: h5py in /usr/lib/python3/dist-packages (from keras==2.2.4->NudeNet==1.0.5) (2.7.1)
Requirement already satisfied: keras-applications>=1.0.6 in /usr/local/lib/python3.6/dist-packages (from keras==2.2.4->NudeNet==1.0.5) (1.0.8)
Requirement already satisfied: python-utils>=2.3.0 in /usr/local/lib/python3.6/dist-packages (from progressbar2->keras-retinanet==0.5.0->NudeNet==1.0.5) (2.3.0)
Building wheels for collected packages: NudeNet
  Building wheel for NudeNet (setup.py) ... done
  Created wheel for NudeNet: filename=NudeNet-1.0.5-cp36-none-any.whl size=7741 sha256=4c8b8a5ef4a01e447eda653e45efcc4a506c4c6a5f3c3048cdd8c0609d46d1b9
  Stored in directory: /tmp/pip-ephem-wheel-cache-cfzk9vau/wheels/34/0e/81/b084279dbf7ca80c2648dc54e9425930d68b909743c02f7556
Successfully built NudeNet
ubuntu@ip-172-30-9-119:~/NudeNet$ python3 nudenet.py
Traceback (most recent call last):
  File "nudenet.py", line 7, in <module>
    from nudenet import NudeDetector
  File "/home/ubuntu/NudeNet/nudenet.py", line 7, in <module>
    from nudenet import NudeDetector
ImportError: cannot import name 'NudeDetector'
ubuntu@ip-172-30-9-119:~/NudeNet$

Here is the nudenet.py file im trying to run

#!/usr/bin/env python

#from nudenet import NudeClassifier
#classifier = NudeClassifier('/home/ubuntu/NudeNet/classifier_model')
#classifier.classify('/home/ubuntu/image/image_small.jpg')

from nudenet import NudeDetector
detector = NudeDetector('/home/ubuntu/NudeNet/detector_model')
detector.detect('/home/ubuntu/image/image_small.jpg')

Cant seem to find the problem. I get the same with NudeClassifier.

bedapudi6788 commented 5 years ago

Looks like you are new to using python. Change your filename to anything else but "nudenet".

lxknvlk commented 5 years ago

Yes, thanks, that fixed the problem