GantMan / nsfw_model

Keras model of NSFW detector
Other
1.77k stars 274 forks source link

ModuleNotFoundError: No module named 'nsfw_detector' #24

Closed flashultra closed 5 years ago

flashultra commented 5 years ago

I'm trying to run example and just for test I created file with only one row inside: from nsfw_detector import NSFWDetector but I've got the error No module named 'nsfw_detector' I have tensorflow ( 1.13.1 ) , keras ( 2.2.4 ) and also use setup.py install for nsfw_model repository. What I miss ?

Thank you.

GantMan commented 5 years ago

@bedapudi6788 does this look easy for you?

bedapudi6788 commented 5 years ago

@GantMan @flashultra will check this and update you in a few hours.

flashultra commented 5 years ago

Thank you for looking for that. Do you have any progress / update ?

bedapudi6788 commented 5 years ago

@flashultra I couldn't reproduce the issue. Please take a look at https://colab.research.google.com/drive/1xxiTYyEsW1w1RpG3rco72eMNpB3A-0nh

flashultra commented 5 years ago

Thank you. It works with latest git git clone https://github.com/GantMan/nsfw_model Not have any problem with nsfw.299x299.h5 model , but give error when I tried with nsfw_mobilenet2.224x224.h5. The warrning is keras-2.2.4-py3.6.egg\keras\engine\saving.py:327: UserWarning: Error in loading the saved optimizer state. As a result, your model is starting with a freshly initialized optimizer. warnings.warn('Error in loading the saved optimizer ' and the error is ValueError: Error when checking input: expected input_1 to have shape (224, 224, 3) but got array with shape (299, 299, 3) It's expecting 224 , but receive 299.

bedapudi6788 commented 5 years ago

@flashultra that means, the model is expecting a different image size. just pass the correct image size to the predict function

predict(image_paths = [], image_size = (224, 224))

bedapudi6788 commented 5 years ago

@GantMan I think you can go ahead and close this issue.

flashultra commented 5 years ago

Thank you.

MichealJl commented 4 years ago

I have the same problem. How did you solve it

MiilouDz commented 2 years ago

I have this problem @GantMan ! from nsfw_detector import NSFWDetector

ImportError: cannot import name 'NSFWDetector' from 'nsfw_detector' (/content/nsfw_detector/init.py)

nsfw