Coder Social home page Coder Social logo

notai-tech / nudenet Goto Github PK

View Code? Open in Web Editor NEW
1.6K 68.0 328.0 34.91 MB

Lightweight nudity detection

Home Page: https://nudenet.notai.tech/

License: GNU Affero General Public License v3.0

Python 57.77% JavaScript 31.32% HTML 4.48% CSS 6.44%
nsfw-recognition censorship object-detection keras nsfw-data machinelearning nudity-detection nudity-detector nudity javascript

nudenet's Introduction

NudeNet: lightweight Nudity detection

https://nudenet.notai.tech/ in-browser demo (the detector is run client side, i.e: in your browser, images are not sent to a server)

pip install --upgrade nudenet
from nudenet import NudeDetector
nude_detector = NudeDetector()
nude_detector.detect('image.jpg') # Returns list of detections
detection_example = [
 {'class': 'BELLY_EXPOSED',
  'score': 0.799403190612793,
  'box': [64, 182, 49, 51]},
 {'class': 'FACE_FEMALE',
  'score': 0.7881264686584473,
  'box': [82, 66, 36, 43]},
 ]
nude_detector.censor('image.jpg') # returns censored image output path

# optional censor(self, image_path, classes=[], output_path=None) classes and output_path can be passed
all_labels = [
    "FEMALE_GENITALIA_COVERED",
    "FACE_FEMALE",
    "BUTTOCKS_EXPOSED",
    "FEMALE_BREAST_EXPOSED",
    "FEMALE_GENITALIA_EXPOSED",
    "MALE_BREAST_EXPOSED",
    "ANUS_EXPOSED",
    "FEET_EXPOSED",
    "BELLY_COVERED",
    "FEET_COVERED",
    "ARMPITS_COVERED",
    "ARMPITS_EXPOSED",
    "FACE_MALE",
    "BELLY_EXPOSED",
    "MALE_GENITALIA_EXPOSED",
    "ANUS_COVERED",
    "FEMALE_BREAST_COVERED",
    "BUTTOCKS_COVERED",
]

Docker

docker run -it -p8080:8080 ghcr.io/notai-tech/nudenet:latest
curl -F f1=@"images.jpeg" "http://localhost:8080/infer"

{"prediction": [[{"class": "BELLY_EXPOSED", "score": 0.8511635065078735, "box": [71, 182, 31, 50]}, {"class": "FACE_FEMALE", "score": 0.8033977150917053, "box": [83, 69, 21, 37]}, {"class": "FEMALE_BREAST_EXPOSED", "score": 0.7963727712631226, "box": [85, 137, 24, 38]}, {"class": "FEMALE_BREAST_EXPOSED", "score": 0.7709134817123413, "box": [63, 136, 20, 37]}, {"class": "ARMPITS_EXPOSED", "score": 0.7005534172058105, "box": [60, 127, 10, 20]}, {"class": "FEMALE_GENITALIA_EXPOSED", "score": 0.6804671287536621, "box": [81, 241, 14, 24]}]], "success": true}⏎

Some interesting projects based on NudeNet

1 - by https://github.com/w-e-w, censor extension ps://github.com//issues/131

nudenet's People

Contributors

bedapudi6788 avatar brettkoonce avatar darksunium avatar drygdryg avatar enkeejunior1 avatar johnnyurosevic avatar pa4y avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nudenet's Issues

Train our Model

Hello i saw your project in Reddit so i came here to ask by any chance you're going to share with us how you train your Model to train ours with our data-set? I hope if you're going to share with us the method it will be a big help to the community!

file signature not found

Describe the bug and error messages

Error 'file signature not found' occurs when trying to load model to Classifier & Detector

The code snippet which gave this error

Classifier Usage

classifier = NudeClassifier('./NudeNet-models/v1/classifier_model')


OSError Traceback (most recent call last)
in ()
----> 1 classifier = NudeClassifier('./NudeNet-models/v1/classifier_model')

4 frames
/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
140 if swmr and swmr_support:
141 flags |= h5f.ACC_SWMR_READ
--> 142 fid = h5f.open(name, flags, fapl=fapl)
143 elif mode == 'r+':
144 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/h5f.pyx in h5py.h5f.open()

OSError: Unable to open file (file signature not found)

Detector Usage

detector = NudeDetector('./NudeNet-models/v1/detector_model')


OSError Traceback (most recent call last)
in ()
----> 1 detector = NudeDetector('./NudeNet-models/v1/detector_model')

5 frames
/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
140 if swmr and swmr_support:
141 flags |= h5f.ACC_SWMR_READ
--> 142 fid = h5f.open(name, flags, fapl=fapl)
143 elif mode == 'r+':
144 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/h5f.pyx in h5py.h5f.open()

OSError: Unable to open file (file signature not found)

Specify versions of the following libraries

Environment : Colab
tf.version : '1.14.0'
👇🏻👇🏻Check the link to see in Colab
Run in Colab

Expected behavior

Is there something wrong with the pre-trained model?
Hope to run it correctly
P.S: Wishing tflite version which was mentioned in README as ToDo release soon😃😃

Screenshots

Just see Colab

Keras requirement

As an update request, can you make it work/require with latest Keras? keras-2.3.1.

Right now it complains:

ERROR: nudenet 1.0.5 has requirement keras==2.2.4, but you'll have keras 2.3.1 which is incompatible.

Multiple warnings and errors pointing out to a CPU and model issue

Describe the bug and error messages (if any)
I have many warnings concerning tensorflow, numpy and CPU related things.
You can see the output in the file below:
errorOutput.txt

The code snippet which gave this error

from nudenet import NudeDetector detector = NudeDetector('Models/detector_model') detector.detect('path_to_image')

path_to_image is correctly filled in the real code snippet.

Specify versions of the following libraries

  1. nudenet - latest
  2. tensorflow/ tensorflow-gpu - 1.14.0
  3. keras - 2.2.4

Expected behavior
Weirdly enough, I struggle to simply use a test code... It just have a simple output.

Any leads to resolve this issue please?

No training configuration found in save file: the model was *not* compiled. Compile it manually.

Describe the bug and error messages (if any)

/home/negonix/anaconda3/envs/nude-net-github/lib/python3.6/site-packages/keras/engine/saving.py:292: UserWarning: No training configuration found in save file: the model was not compiled. Compile it manually.
warnings.warn('No training configuration found in save file: '

Specify versions of the following libraries

  1. nudenet = 2.0.1
  2. tensorflow/ tensorflow-gpu 1.14
  3. keras 2.2.4

This happened with this code:

from nudenet import NudeDetector
detector = NudeDetector()

model architecture

hi, thanks for the excellent work, can you please explain what model did you use?

Error when using NudeNet

This is the stack trace I'm getting when trying to instanciate a NudeClassifier. A pretty much identical error occurs when trying to instanciate a NudeDetector.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-7465e1bf88d0> in <module>
----> 1 classifier = NudeClassifier()

~\Python\portable\python\Lib\site-packages\nudenet\classifier.py in __init__(self)
    137             pydload.dload(url, save_to_path=model_path, max_time=None)
    138 
--> 139         self.nsfw_model = keras.models.load_model(model_path)
    140 
    141     def classify_video(

~\Python\portable\python\Lib\site-packages\keras\engine\saving.py in load_model(filepath, custom_objects, compile)
    417     f = h5dict(filepath, 'r')
    418     try:
--> 419         model = _deserialize_model(f, custom_objects, compile)
    420     finally:
    421         if opened_new_file:

~\Python\portable\python\Lib\site-packages\keras\engine\saving.py in _deserialize_model(f, custom_objects, compile)
    223         raise ValueError('No model found in config.')
    224     model_config = json.loads(model_config.decode('utf-8'))
--> 225     model = model_from_config(model_config, custom_objects=custom_objects)
    226     model_weights_group = f['model_weights']
    227 

~\Python\portable\python\Lib\site-packages\keras\engine\saving.py in model_from_config(config, custom_objects)
    456                         '`Sequential.from_config(config)`?')
    457     from ..layers import deserialize
--> 458     return deserialize(config, custom_objects=custom_objects)
    459 
    460 

~\Python\portable\python\Lib\site-packages\keras\layers\__init__.py in deserialize(config, custom_objects)
     50     globs['Model'] = models.Model
     51     globs['Sequential'] = models.Sequential
---> 52     return deserialize_keras_object(config,
     53                                     module_objects=globs,
     54                                     custom_objects=custom_objects,

~\Python\portable\python\Lib\site-packages\keras\utils\generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
    140             custom_objects = custom_objects or {}
    141             if has_arg(cls.from_config, 'custom_objects'):
--> 142                 return cls.from_config(
    143                     config['config'],
    144                     custom_objects=dict(list(_GLOBAL_CUSTOM_OBJECTS.items()) +

~\Python\portable\python\Lib\site-packages\keras\engine\network.py in from_config(cls, config, custom_objects)
   1020         # First, we create all layers and enqueue nodes to be processed
   1021         for layer_data in config['layers']:
-> 1022             process_layer(layer_data)
   1023         # Then we process nodes in order of layer depth.
   1024         # Nodes that cannot yet be processed (if the inbound node

~\Python\portable\python\Lib\site-packages\keras\engine\network.py in process_layer(layer_data)
   1005             from ..layers import deserialize as deserialize_layer
   1006 
-> 1007             layer = deserialize_layer(layer_data,
   1008                                       custom_objects=custom_objects)
   1009             created_layers[layer_name] = layer

~\Python\portable\python\Lib\site-packages\keras\layers\__init__.py in deserialize(config, custom_objects)
     50     globs['Model'] = models.Model
     51     globs['Sequential'] = models.Sequential
---> 52     return deserialize_keras_object(config,
     53                                     module_objects=globs,
     54                                     custom_objects=custom_objects,

~\Python\portable\python\Lib\site-packages\keras\utils\generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
    145                                         list(custom_objects.items())))
    146             with CustomObjectScope(custom_objects):
--> 147                 return cls.from_config(config['config'])
    148         else:
    149             # Then `cls` may be a function returning a class.

~\Python\portable\python\Lib\site-packages\keras\engine\base_layer.py in from_config(cls, config)
   1107             A layer instance.
   1108         """
-> 1109         return cls(**config)
   1110 
   1111     def count_params(self):

~\Python\portable\python\Lib\site-packages\keras\legacy\interfaces.py in wrapper(*args, **kwargs)
     89                 warnings.warn('Update your `' + object_name + '` call to the ' +
     90                               'Keras 2 API: ' + signature, stacklevel=2)
---> 91             return func(*args, **kwargs)
     92         wrapper._original_function = func
     93         return wrapper

~\Python\portable\python\Lib\site-packages\keras\engine\input_layer.py in __init__(self, input_shape, batch_size, batch_input_shape, dtype, input_tensor, sparse, name)
     82         if input_tensor is None:
     83             self.is_placeholder = True
---> 84             input_tensor = K.placeholder(shape=batch_input_shape,
     85                                          dtype=dtype,
     86                                          sparse=self.sparse,

~\Python\portable\python\Lib\site-packages\keras\backend\tensorflow_backend.py in placeholder(shape, ndim, dtype, sparse, name)
    515         x = tf.sparse_placeholder(dtype, shape=shape, name=name)
    516     else:
--> 517         x = tf.placeholder(dtype, shape=shape, name=name)
    518     x._keras_shape = shape
    519     x._uses_learning_phase = False

AttributeError: module 'tensorflow' has no attribute 'placeholder'

I've googled around and these seem to be issues with Keras that have since been fixed? Basically, when I use keras==2.2.4 (which is listed in this library's setup.py) I can't get past this stage.

I've tried upgrading to the latest version of keras for my own curiosity (keras==2.4.3) and the NudeClassifier then works perfectly! However, the NudeDetector now errors like this when I try to instanciate it:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-c0ac40df705b> in <module>
----> 1 detector = NudeDetector()

~\Python\portable\python\Lib\site-packages\nudenet\detector.py in __init__(self, model_name)
     76             pydload.dload(classes_url, save_to_path=classes_path, max_time=None)
     77 
---> 78         self.detection_model = models.load_model(
     79             checkpoint_path, backbone_name="resnet50"
     80         )

~\Python\portable\python\Lib\site-packages\keras_retinanet\models\__init__.py in load_model(filepath, backbone_name)
     81     """
     82     import keras.models
---> 83     return keras.models.load_model(filepath, custom_objects=backbone(backbone_name).custom_objects)
     84 
     85 

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\saving\save.py in load_model(filepath, custom_objects, compile, options)
    180     if (h5py is not None and (
    181         isinstance(filepath, h5py.File) or h5py.is_hdf5(filepath))):
--> 182       return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
    183 
    184     filepath = path_to_string(filepath)

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\saving\hdf5_format.py in load_model_from_hdf5(filepath, custom_objects, compile)
    175       raise ValueError('No model found in config file.')
    176     model_config = json.loads(model_config.decode('utf-8'))
--> 177     model = model_config_lib.model_from_config(model_config,
    178                                                custom_objects=custom_objects)
    179 

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\saving\model_config.py in model_from_config(config, custom_objects)
     53                     '`Sequential.from_config(config)`?')
     54   from tensorflow.python.keras.layers import deserialize  # pylint: disable=g-import-not-at-top
---> 55   return deserialize(config, custom_objects=custom_objects)
     56 
     57 

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\layers\serialization.py in deserialize(config, custom_objects)
    169   """
    170   populate_deserializable_objects()
--> 171   return generic_utils.deserialize_keras_object(
    172       config,
    173       module_objects=LOCAL.ALL_OBJECTS,

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\utils\generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
    352 
    353       if 'custom_objects' in arg_spec.args:
--> 354         return cls.from_config(
    355             cls_config,
    356             custom_objects=dict(

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\training.py in from_config(cls, config, custom_objects)
   2236     # be constructed for FunctionalModel
   2237     from tensorflow.python.keras.engine import functional  # pylint: disable=g-import-not-at-top
-> 2238     return functional.Functional.from_config(
   2239         config, custom_objects=custom_objects)
   2240 

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\functional.py in from_config(cls, config, custom_objects)
    614         ValueError: In case of improperly formatted config dict.
    615     """
--> 616     input_tensors, output_tensors, created_layers = reconstruct_from_config(
    617         config, custom_objects)
    618     model = cls(inputs=input_tensors, outputs=output_tensors,

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\functional.py in reconstruct_from_config(config, custom_objects, created_layers)
   1202   # First, we create all layers and enqueue nodes to be processed
   1203   for layer_data in config['layers']:
-> 1204     process_layer(layer_data)
   1205   # Then we process nodes in order of layer depth.
   1206   # Nodes that cannot yet be processed (if the inbound node

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\functional.py in process_layer(layer_data)
   1184       from tensorflow.python.keras.layers import deserialize as deserialize_layer  # pylint: disable=g-import-not-at-top
   1185 
-> 1186       layer = deserialize_layer(layer_data, custom_objects=custom_objects)
   1187       created_layers[layer_name] = layer
   1188 

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\layers\serialization.py in deserialize(config, custom_objects)
    169   """
    170   populate_deserializable_objects()
--> 171   return generic_utils.deserialize_keras_object(
    172       config,
    173       module_objects=LOCAL.ALL_OBJECTS,

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\utils\generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
    352 
    353       if 'custom_objects' in arg_spec.args:
--> 354         return cls.from_config(
    355             cls_config,
    356             custom_objects=dict(

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\training.py in from_config(cls, config, custom_objects)
   2236     # be constructed for FunctionalModel
   2237     from tensorflow.python.keras.engine import functional  # pylint: disable=g-import-not-at-top
-> 2238     return functional.Functional.from_config(
   2239         config, custom_objects=custom_objects)
   2240 

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\functional.py in from_config(cls, config, custom_objects)
    614         ValueError: In case of improperly formatted config dict.
    615     """
--> 616     input_tensors, output_tensors, created_layers = reconstruct_from_config(
    617         config, custom_objects)
    618     model = cls(inputs=input_tensors, outputs=output_tensors,

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\functional.py in reconstruct_from_config(config, custom_objects, created_layers)
   1212       if layer in unprocessed_nodes:
   1213         for node_data in unprocessed_nodes.pop(layer):
-> 1214           process_node(layer, node_data)
   1215 
   1216   input_tensors = []

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\functional.py in process_node(layer, node_data)
   1160     if input_tensors is not None:
   1161       input_tensors = base_layer_utils.unnest_if_single_tensor(input_tensors)
-> 1162       output_tensors = layer(input_tensors, **kwargs)
   1163 
   1164       # Update node index map.

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\base_layer.py in __call__(self, *args, **kwargs)
    923     # >> model = tf.keras.Model(inputs, outputs)
    924     if _in_functional_construction_mode(self, inputs, args, kwargs, input_list):
--> 925       return self._functional_construction_call(inputs, args, kwargs,
    926                                                 input_list)
    927 

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\base_layer.py in _functional_construction_call(self, inputs, args, kwargs, input_list)
   1096         # Build layer if applicable (if the `build` method has been
   1097         # overridden).
-> 1098         self._maybe_build(inputs)
   1099         cast_inputs = self._maybe_cast_inputs(inputs, input_list)
   1100 

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\base_layer.py in _maybe_build(self, inputs)
   2641         # operations.
   2642         with tf_utils.maybe_init_scope(self):
-> 2643           self.build(input_shapes)  # pylint:disable=not-callable
   2644       # We must set also ensure that the layer is marked as built, and the build
   2645       # shape is stored since user defined build functions may not be calling

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\layers\convolutional.py in build(self, input_shape)
    204         dtype=self.dtype)
    205     if self.use_bias:
--> 206       self.bias = self.add_weight(
    207           name='bias',
    208           shape=(self.filters,),

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\base_layer.py in add_weight(self, name, shape, dtype, initializer, regularizer, trainable, constraint, partitioner, use_resource, synchronization, aggregation, **kwargs)
    595         caching_device = None
    596 
--> 597     variable = self._add_variable_with_custom_getter(
    598         name=name,
    599         shape=shape,

~\Python\portable\python\Lib\site-packages\tensorflow\python\training\tracking\base.py in _add_variable_with_custom_getter(self, name, shape, dtype, initializer, getter, overwrite, **kwargs_for_getter)
    743         initializer = checkpoint_initializer
    744         shape = None
--> 745     new_variable = getter(
    746         name=name,
    747         shape=shape,

~\Python\portable\python\Lib\site-packages\tensorflow\python\keras\engine\base_layer_utils.py in make_variable(name, shape, dtype, initializer, trainable, caching_device, validate_shape, constraint, use_resource, collections, synchronization, aggregation, partitioner)
    131   # can remove the V1.
    132   variable_shape = tensor_shape.TensorShape(shape)
--> 133   return tf_variables.VariableV1(
    134       initial_value=init_val,
    135       name=name,

~\Python\portable\python\Lib\site-packages\tensorflow\python\ops\variables.py in __call__(cls, *args, **kwargs)
    258   def __call__(cls, *args, **kwargs):
    259     if cls is VariableV1:
--> 260       return cls._variable_v1_call(*args, **kwargs)
    261     elif cls is Variable:
    262       return cls._variable_v2_call(*args, **kwargs)

~\Python\portable\python\Lib\site-packages\tensorflow\python\ops\variables.py in _variable_v1_call(cls, initial_value, trainable, collections, validate_shape, caching_device, name, variable_def, dtype, expected_shape, import_scope, constraint, use_resource, synchronization, aggregation, shape)
    204     if aggregation is None:
    205       aggregation = VariableAggregation.NONE
--> 206     return previous_getter(
    207         initial_value=initial_value,
    208         trainable=trainable,

~\Python\portable\python\Lib\site-packages\tensorflow\python\ops\variables.py in <lambda>(**kwargs)
    197                         shape=None):
    198     """Call on Variable class. Useful to force the signature."""
--> 199     previous_getter = lambda **kwargs: default_variable_creator(None, **kwargs)
    200     for _, getter in ops.get_default_graph()._variable_creator_stack:  # pylint: disable=protected-access
    201       previous_getter = _make_getter(getter, previous_getter)

~\Python\portable\python\Lib\site-packages\tensorflow\python\ops\variable_scope.py in default_variable_creator(next_creator, **kwargs)
   2581   if use_resource:
   2582     distribute_strategy = kwargs.get("distribute_strategy", None)
-> 2583     return resource_variable_ops.ResourceVariable(
   2584         initial_value=initial_value,
   2585         trainable=trainable,

~\Python\portable\python\Lib\site-packages\tensorflow\python\ops\variables.py in __call__(cls, *args, **kwargs)
    262       return cls._variable_v2_call(*args, **kwargs)
    263     else:
--> 264       return super(VariableMetaclass, cls).__call__(*args, **kwargs)
    265 
    266 

~\Python\portable\python\Lib\site-packages\tensorflow\python\ops\resource_variable_ops.py in __init__(self, initial_value, trainable, collections, validate_shape, caching_device, name, dtype, variable_def, import_scope, constraint, distribute_strategy, synchronization, aggregation, shape)
   1505       self._init_from_proto(variable_def, import_scope=import_scope)
   1506     else:
-> 1507       self._init_from_args(
   1508           initial_value=initial_value,
   1509           trainable=trainable,

~\Python\portable\python\Lib\site-packages\tensorflow\python\ops\resource_variable_ops.py in _init_from_args(self, initial_value, trainable, collections, caching_device, name, dtype, constraint, synchronization, aggregation, distribute_strategy, shape)
   1649           with ops.name_scope("Initializer"), device_context_manager(None):
   1650             initial_value = ops.convert_to_tensor(
-> 1651                 initial_value() if init_from_fn else initial_value,
   1652                 name="initial_value", dtype=dtype)
   1653           if shape is not None:

~\Python\portable\python\Lib\site-packages\keras_retinanet\initializers.py in __call__(self, shape, dtype)
     35     def __call__(self, shape, dtype=None):
     36         # set bias to -log((1 - p)/p) for foreground
---> 37         result = np.ones(shape, dtype=dtype) * -math.log((1 - self.probability) / self.probability)
     38 
     39         return result

~\Python\portable\python\Lib\site-packages\numpy\core\numeric.py in ones(shape, dtype, order)
    205 
    206     """
--> 207     a = empty(shape, dtype, order)
    208     multiarray.copyto(a, 1, casting='unsafe')
    209     return a

TypeError: data type not understood

Do you know why this is happening? I'd love to play around with this library but I can't figure out how to get past these errors.

If it helps, I'm running Python 3.8.2

Thanks in advance!

AttributeError: module 'tensorflow' has no attribute 'placeholder'

Describe the bug and error messages (if any)
When I try to run my code I get the following error:
AttributeError: module 'tensorflow' has no attribute 'placeholder'

Here is the full trace:

$ python test.py
2020-02-16 12:25:55.443845: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-02-16 12:25:55.444326: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Using TensorFlow backend.
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    classifier = NudeClassifier()
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\nudenet\classifier.py", line 56, in __init__
    Classifier.nsfw_model = keras.models.load_model(model_path)
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\engine\saving.py", line 419, in load_model
    model = _deserialize_model(f, custom_objects, compile)
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\engine\saving.py", line 225, in _deserialize_model
    model = model_from_config(model_config, custom_objects=custom_objects)
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\engine\saving.py", line 458, in model_from_config
    return deserialize(config, custom_objects=custom_objects)
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\layers\__init__.py", line 55, in deserialize
    printable_module_name='layer')
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\utils\generic_utils.py", line 145, in deserialize_keras_object
    list(custom_objects.items())))
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\engine\network.py", line 1022, in from_config
    process_layer(layer_data)
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\engine\network.py", line 1008, in process_layer
    custom_objects=custom_objects)
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\layers\__init__.py", line 55, in deserialize
    printable_module_name='layer')
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\utils\generic_utils.py", line 147, in deserialize_keras_object
    return cls.from_config(config['config'])
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\engine\base_layer.py", line 1109, in from_config
    return cls(**config)
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\engine\input_layer.py", line 87, in __init__
    name=self.name)
  File "C:\Users\Nicol\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\backend\tensorflow_backend.py", line 517, in placeholder
    x = tf.placeholder(dtype, shape=shape, name=name)
AttributeError: module 'tensorflow' has no attribute 'placeholder'

The code snippet which gave this error*

This is the script I am trying to run:

from nudenet import NudeClassifier
classifier = NudeClassifier()
classifier.classify('https://images.unsplash.com/photo-1450778869180-41d0601e046e?ixlib=rb-1.2.1&auto=format&fit=crop&w=1150&q=80')

Here's how I am running it:
python test.py

Specify versions of the following libraries

  1. nudenet-1.1.0
  2. tensorflow-2.1.0-cp37-cp37m-win_amd64
  3. keras-2.2.4
  4. Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)]

Expected behavior
I was expecting a JSON response like this: {'path_to_nude_image': {'safe': 5.8822202e-08, 'unsafe': 1.0}}

No training configuration found in the detector model

Hey mate,
Docker running tensorflow 1.15.3 (python3) and your code.

When I try and run that example python script (detector):

# detector.py

from nudenet import NudeDetector
detector = NudeDetector()

# Performing detection
detector.detect('one.jpg')

it complains at this point:

/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py:292: UserWarning: No training configuration found in save file: the model was *not* compiled. Compile it manually. 
warnings.warn('No training configuration found in save file: '

Any pointers as to what might be happening here? Should I be running a specific version of tensorflow? The classify script works a treat but I cant seem to get detector to work.

Cheers,

"_run.sh: line 52: 6 Illegal instruction (core dumped) python3 -u _loop.py" error on docker version of detector and classifier

Describe the bug and error messages (if any)
The docker container for the detector and classifier image never fully start.

2020-08-15:00:56:25,236 INFO [_utils.py:129] AVAILABLE FREE MEMORY: 78120.62890625; CACHE: 3906.0314453125 MB
2020-08-15:00:56:25,474 INFO [_utils.py:129] AVAILABLE FREE MEMORY: 78120.625; CACHE: 3906.03125 MB
Using TensorFlow backend.
_run.sh: line 52: 6 Illegal instruction (core dumped) python3 -u _loop.py
Waiting for prediction loop to begin.

System Specs:
ESXi VM, Ubuntu 18.04, 2x2.261GHz Intel Xeon L5640, 4GB RAM, GPU: svgadrmfb, Kernel: x86_64 Linux 5.4.0-42-generic

The code snippet which gave this error*
docker run -it -p8081:8080 notaitech/nudenet:classifier

Specify versions of the following libraries
Latest docker image

Expected behavior
It should work? Never exits whatever loop generates "Waiting for prediction loop to begin".

OSError: Unable to open file (file signature not found)

I used model classifier_model at https://github.com/bedapudi6788/nudenet-models
But I got an error, my code:
from nudenet import NudeClassifier
classifier = NudeClassifier('C:/Users/anlan/OneDrive/Desktop/NudeNet-models-master/v1/classifier_model')
classifier.classify('C:/Users/anlan/OneDrive/Desktop/1.jpg')

error:
Using TensorFlow backend.
Traceback (most recent call last):
File "test.py", line 2, in
classifier = NudeClassifier('C:/Users/anlan/OneDrive/Desktop/NudeNet-models-master/v1/classifier_model')
File "C:\Users\anlan\Anaconda3\lib\site-packages\nudenet\classifier.py", line 43, in init
Classifier.nsfw_model = keras.models.load_model(model_path)
File "C:\Users\anlan\Anaconda3\lib\site-packages\keras\engine\saving.py", line 417, in load_model
f = h5dict(filepath, 'r')
File "C:\Users\anlan\Anaconda3\lib\site-packages\keras\utils\io_utils.py", line 186, in init
self.data = h5py.File(path, mode=mode)
File "C:\Users\anlan\Anaconda3\lib\site-packages\h5py_hl\files.py", line 269, in init
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "C:\Users\anlan\Anaconda3\lib\site-packages\h5py_hl\files.py", line 99, 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 78, in h5py.h5f.open
OSError: Unable to open file (file signature not found)

Please help me!

Problem using Nudenet to classify image

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)

Detector dataset

Hello!
Do you still have the dataset used to train the detector? I'm trying to build a nsfw detector with some different classes. It would be nice if you can share your dataset

Browser Integration / Extension

What is the possibility / feasibility of using this to create a browser extension? Namely being able to censor only certain things. Probably counter-intuitive to some, but this could have some applications for kinky people with a denial fetish, lol, such as only censoring one gender/parts.

I see something in the readme about in-browser detection, is that the same thing as this? Is that still a plan? Really unique work here and it'd be amazing.

No module named 'tensorflow'

Hi, i try to use your detector section:

>>> from nudenet import NudeDetector
Using TensorFlow backend.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/nudenet/__init__.py", line 1, in <module>
    from .classifier import Classifier as NudeClassifier
  File "/usr/lib/python3.7/site-packages/nudenet/classifier.py", line 1, in <module>
    import keras
  File "/usr/lib/python3.7/site-packages/keras/__init__.py", line 3, in <module>
    from . import utils
  File "/usr/lib/python3.7/site-packages/keras/utils/__init__.py", line 6, in <module>
    from . import conv_utils
  File "/usr/lib/python3.7/site-packages/keras/utils/conv_utils.py", line 9, in <module>
    from .. import backend as K
  File "/usr/lib/python3.7/site-packages/keras/backend/__init__.py", line 89, in <module>
    from .tensorflow_backend import *
  File "/usr/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 5, in <module>
    import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'

Upgrade tensorflow version

Could you please update the model and prediction codes using tensorflow 2.0+, else I'll have to install two different versions of tensorflow for my project.

Unable to install

Describe the bug and error messages (if any)
While trying to install in windows environment running python 3.8.2, I am getting error

The code snippet which gave this error*
pip install nudenet

Specify versions of the following libraries

  1. nudenet - from pip
  2. tensorflow/ tensorflow-gpu - 2.2.0rc1
  3. keras - 2.3.1

Screenshots
error1

OSError: Unable to open file (file signature not found)

When I run the demo. I got an error. Can you help me ?
environment:
keras: 2.3.1
h5py: 2.10.0
tensorflow: 1.14.0

classifier = NudeClassifier()

File "./python3.6/site-packages/nudenet/classifier.py", line 56, in init
Classifier.nsfw_model = keras.models.load_model(model_path)
File "./lib/python3.6/site-packages/keras/engine/saving.py", line 492, in load_wrapper
return load_function(*args, **kwargs)
File "./lib/python3.6/site-packages/keras/engine/saving.py", line 583, in load_model
with H5Dict(filepath, mode='r') as h5dict:
File "./lib/python3.6/site-packages/keras/utils/io_utils.py", line 191, in init
self.data = h5py.File(path, mode=mode)
File "./lib/python3.6/site-packages/h5py/_hl/files.py", line 408, in init
swmr=swmr)
File "./lib/python3.6/site-packages/h5py/_hl/files.py", line 173, 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 88, in h5py.h5f.open
OSError: Unable to open file (file signature not found)

warnings and no result with Python 3.7 windows 64

pip install nudenet - OK
auto download classifier - OK

from nudenet import NudeClassifier
import sys
classifier = NudeClassifier()
classifier.classify(sys.argv[1])

python nude.py file.jpg

Nothing but warnings in stdout/stderr

WARNING:tensorflow:From C:\Programs\Python37\lib\site-packages\keras\backend\tensorflow_backend.py:517: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.
WARNING:tensorflow:From C:\Programs\Python37\lib\site-packages\keras\backend\tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.
WARNING:tensorflow:From C:\Programs\Python37\lib\site-packages\keras\backend\tensorflow_backend.py:245: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.
WARNING:tensorflow:From C:\Programs\Python37\lib\site-packages\keras\backend\tensorflow_backend.py:174: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.
WARNING:tensorflow:From C:\Programs\Python37\lib\site-packages\keras\backend\tensorflow_backend.py:181: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.
2020-01-08 07:14:47.854098: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
WARNING:tensorflow:From C:\Programs\Python37\lib\site-packages\keras\backend\tensorflow_backend.py:1834: The name tf.nn.fused_batch_norm is deprecated. Please use tf.compat.v1.nn.fused_batch_norm instead.
WARNING:tensorflow:From C:\Programs\Python37\lib\site-packages\keras\backend\tensorflow_backend.py:3976: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.
WARNING:tensorflow:From C:\Programs\Python37\lib\site-packages\keras\optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.
WARNING:tensorflow:From C:\Programs\Python37\lib\site-packages\tensorflow\python\ops\math_grad.py:1250: add_dispatch_support..wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where

nudenet 1.1.0
tensorflow/ tensorflow-gpu 1.14.0 no GPU
keras 2.2.4

tensor is not an element of this graph, running with pm2

Running the scrip normally works.

But when i try to run my python server that uses nudenet via pm2, i get this error:

	0|server 1  | Exception happened during processing of request from ('127.0.0.1', 46026)
	0|server 1  | Traceback (most recent call last):
	0|server 1  |   File "/usr/lib/python3.6/socketserver.py", line 654, in process_request_thread
	0|server 1  |     self.finish_request(request, client_address)
	0|server 1  |   File "/usr/lib/python3.6/socketserver.py", line 364, in finish_request
	0|server 1  |     self.RequestHandlerClass(request, client_address, self)
	0|server 1  |   File "/usr/lib/python3.6/socketserver.py", line 724, in __init__
	0|server 1  |     self.handle()
	0|server 1  |   File "/usr/lib/python3.6/http/server.py", line 418, in handle
	0|server 1  |     self.handle_one_request()
	0|server 1  |   File "/usr/lib/python3.6/http/server.py", line 406, in handle_one_request
	0|server 1  |     method()
	0|server 1  |   File "/home/ubuntu/nnserver.py", line 76, in do_POST
	0|server 1  |     handleRequest(self)
	0|server 1  |   File "/home/ubuntu/nnserver.py", line 61, in handleRequest
	0|server 1  |     result = detector.detect('/home/ubuntu/image/image_small.jpg')
	0|server 1  |   File "/usr/local/lib/python3.6/dist-packages/nudenet/detector.py", line 31, in detect
	0|server 1  |     boxes, scores, labels = Detector.detection_model.predict_on_batch(np.expand_dims(image, axis=0))
	0|server 1  |   File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1273, in predict_on_batch
	0|server 1  |     self._make_predict_function()
	0|server 1  |   File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 554, in _make_predict_function
	0|server 1  |     **kwargs)
	0|server 1  |   File "/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py", line 2744, in function
	0|server 1  |     return Function(inputs, outputs, updates=updates, **kwargs)
	0|server 1  |   File "/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py", line 2546, in __init__
	0|server 1  |     with tf.control_dependencies(self.outputs):
	0|server 1  |   File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 5426, in control_dependencies
	0|server 1  |     return get_default_graph().control_dependencies(control_inputs)
	0|server 1  |   File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 4867, in control_dependencies
	0|server 1  |     c = self.as_graph_element(c)
	0|server 1  |   File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 3796, in as_graph_element
	0|server 1  |     return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
	0|server 1  |   File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 3875, in _as_graph_element_locked
	0|server 1  |     raise ValueError("Tensor %s is not an element of this graph." % obj)
	0|server 1  | ValueError: Tensor Tensor("filtered_detections/map/TensorArrayStack/TensorArrayGatherV3:0", shape=(?, 300, 4), dtype=float32) is not an element of this graph.

The pm2 python interpreter seems to be "CPython".

ModuleNotFoundError: No module named 'numpy'

Hi. error when installing nudenet via pip:

sudo pip install nudenet
[sudo] password for linarcx: 
Collecting nudenet
  Downloading https://files.pythonhosted.org/packages/23/04/9183baf731ab4408d940b21e70c71308f1e9bc9fe7a780790f83c526ae2d/NudeNet-1.0.4-py2.py3-none-any.whl
Collecting opencv-python==4.0.0.21 (from nudenet)
  Downloading https://files.pythonhosted.org/packages/45/bd/e0a4391ac105ecf73a6e14372174b05774634c7c6454e49c38750d516eee/opencv_python-4.0.0.21-cp37-cp37m-manylinux1_x86_64.whl (25.4MB)
     |████████████████████████████████| 25.4MB 25kB/s 
Collecting keras-retinanet==0.5.0 (from nudenet)
  Downloading https://files.pythonhosted.org/packages/28/bc/1e926156e950073af90f9347cb74bf4a75e749942e75f398472bad7ef146/keras-retinanet-0.5.0.tar.gz (59kB)
     |████████████████████████████████| 61kB 55kB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-5wyi37hq/keras-retinanet/setup.py", line 3, in <module>
        import numpy as np
    ModuleNotFoundError: No module named 'numpy'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-5wyi37hq/keras-retinanet/

ModuleNotFoundError: No module named 'nudenet'

(tf) C:\nude>nude.py
Traceback (most recent call last):
File "C:\nude\nude.py", line 2, in
from nudenet import NudeClassifier
ModuleNotFoundError: No module named 'nudenet

I am getting this error while trying to use a classifier

now working in tfjs node and browser with few questions

fyi with few quick questions:

i've downloaded checkpoint as noted in the detector.py and converted it to tfjs graph_format using
tensorflowjs_converter --strip_debug_ops=* --control_flow_v2=* --quantize_float16=* saved/ f16/
(quantized to float16 to reduce size by half)

model works in tfjs in nodejs and browser using webgl like a charm using tfjs 2.6.0!

few comments:

  • checkpoint is the training version and references python variables used in model definition
    any chance you can also do a compiled version?
    it should significantly help with size and speed
    i can probably do it as well, but i'd think you'd want to release compiled version for usage and only use dev version for training
  • model is very picky about input image resolution
    any thoughts on that? seems like i get best results if i resize image before inference to a range around 800-1000px
    anything smaller than 700px and it misses things badly and anything bigger than 1100px gets a lot of false positives
  • performance is pretty low compared to any other object detection model out there by 2-5x? any thoughts?
  • model is very memory hungry - it can easily eat up 2gb of gpu memory to process an image with 1k resolution
    which unfortunately quickly leads to out-of-memory situations
    due to general bad behavior of browser garbage collection of webgl objects

this is by far the most advanced nsfw model i've seen - if it weren't for few issues (performance, memory, resolution sensitivity), it would be perfect!

How to train model?

It is a pretty interesting project. I just want to train the model with my existing images. Do you have a training code to train with my own model?

Thanks.

ERROR: File name too long

Describe the bug and error messages (if any)

I needed to recurse directories and after adding that, an error is occurring that states the file is too long.

    files = [os.path.join(dirpath, f)
        for dirpath, dirnames, files in os.walk(args.dir)
        for f in files if f.endswith('.{}'.format(args.ext))]

Could also do it like this

files = glob.glob(os.path.join(args.dir, "**/*." + args.ext), recursive=True)

The code snippet which gave this error*

{'success': False, 'reason': "[Errno 36] File name too long: '/app/diskdisk/8_2020-11-04-17-40-53-886_50607d66-ce1b-413c-ad65-533991f2dfbc.inp/000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.f0008512.jpg'"}
Specify versions of the following libraries
I don't think the problem is with tensorflow or keras.

  1. nudenet: current version in Docker Hub
  2. tensorflow/ tensorflow-gpu:
  3. keras

Expected behavior

Filename not to have a bunch of 0's and cause a filename too long error.

Screenshots
If applicable, add screenshots to help explain your problem.

Dataset

Is there any way i can get the dataset for the object recognition ?

i would like to make make a mobilenet ssd version of your model.

ImportError: cannot import name 'NudeDetector'

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.

V2 detector dataset

Thanks for your excellent work !!

Could you share us latest detector dataset.

TypeError: data type not understood

Describe the bug and error messages (if any)
https://pastebin.ubuntu.com/p/FYmNPbhrC5/

The code snippet which gave this error

from nudenet import NudeDetector


detector = NudeDetector()
print(detector.detect('./88676111_215_ed12.jpg'))

Specify versions of the following libraries

  1. nudenet 2.0.3
  2. tensorflow/ tensorflow-gpu 2.3.0
  3. keras 2.4.3

Expected behavior
detecting nude image or video

i am just trying to execute a sample code but getting this error , everytime i run it., i did this using ubuntu system, run the same code in macbook pro 2016 ,the code is fine and worked also, but in ubuntu getting error

this is my code

from nudenet import NudeClassifier
def image_prediction():
classifier = NudeClassifier()
classifier.classify('/home/vhr/Desktop/abc/abc.jpg')

if name == 'main':
image_prediction()

error is

ile "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 88, in h5py.h5f.open
OSError: Unable to open file (truncated file: eof = 9437184, sblock->base_addr = 0, stored_eof = 223178568)

'classifier_checkpoint_path'

It is unclear, what do i have to put in 'classifier_checkpoint_path' and 'detector_checkpoint_path'?

I have found this code in your repo

m = Detector('/Users/bedapudi/Desktop/inference_resnet50_csv_14.h5')

Can you share the inference_resnet50_csv_14.h5 file?

Are those the models from https://github.com/lxknvlk/NudeNet-models that i have to use in those paths?

Model performance

So the demo page does classification in 1-1.2 seconds. How can the model be sped up?

about detector dataset

Hello, thank you for your work on NSFW. Would really appreciate it if a download link to detector dataset can be provided. My email is [email protected]. Thank you very much!

Issues and errors in detection

Interesting and useful work. I installed it via pip, and was trying it. First, running your sample code shows these errors/warnings. Are these warnings all?! It says Error: Pack node ... inside:
I don't see any output other than this being printed.

  warnings.warn('No training configuration found in save file: '
2019-11-14 13:31:20.566083: W .\tensorflow/core/grappler/optimizers/graph_optimizer_stage.h:241] Failed to run optimizer ArithmeticOptimizer, stage RemoveStackStridedSliceSameAxis node clipped_boxes/strided_slice_2. Error: Pack node (boxes/stack) axis attribute is out of bounds: 2
2019-11-14 13:31:20.581246: W .\tensorflow/core/grappler/optimizers/graph_optimizer_stage.h:241] Failed to run optimizer ArithmeticOptimizer, stage RemoveStackStridedSliceSameAxis node clipped_boxes/strided_slice_3. Error: Pack node (boxes/stack) axis attribute is out of bounds: 2
2019-11-14 13:31:20.597340: W .\tensorflow/core/grappler/optimizers/graph_optimizer_stage.h:241] Failed to run optimizer ArithmeticOptimizer, stage RemoveStackStridedSliceSameAxis node clipped_boxes/strided_slice_4. Error: Pack node (boxes/stack) axis attribute is out of bounds: 2
2019-11-14 13:31:20.619261: W .\tensorflow/core/grappler/optimizers/graph_optimizer_stage.h:241] Failed to run optimizer ArithmeticOptimizer, stage RemoveStackStridedSliceSameAxis node clipped_boxes/strided_slice_5. Error: Pack node (boxes/stack) axis attribute is out of bounds: 2
2019-11-14 13:31:21.044468: W .\tensorflow/core/grappler/optimizers/graph_optimizer_stage.h:241] Failed to run optimizer ArithmeticOptimizer, stage RemoveStackStridedSliceSameAxis node clipped_boxes/strided_slice_2. Error: Pack node (boxes/stack) axis attribute is out of bounds: 2
2019-11-14 13:31:21.068579: W .\tensorflow/core/grappler/optimizers/graph_optimizer_stage.h:241] Failed to run optimizer ArithmeticOptimizer, stage RemoveStackStridedSliceSameAxis node clipped_boxes/strided_slice_3. Error: Pack node (boxes/stack) axis attribute is out of bounds: 2
2019-11-14 13:31:21.098392: W .\tensorflow/core/grappler/optimizers/graph_optimizer_stage.h:241] Failed to run optimizer ArithmeticOptimizer, stage RemoveStackStridedSliceSameAxis node clipped_boxes/strided_slice_4. Error: Pack node (boxes/stack) axis attribute is out of bounds: 2
2019-11-14 13:31:21.132168: W .\tensorflow/core/grappler/optimizers/graph_optimizer_stage.h:241] Failed to run optimizer ArithmeticOptimizer, stage RemoveStackStridedSliceSameAxis node clipped_boxes/strided_slice_5. Error: Pack node (boxes/stack) axis attribute is out of bounds: 2

And second issue is for censoring. It works for front photos. But when a girl is a bit tilted on side (with breasts still well visible), it can not detect/censor anything. Example here.

AttributeError: module 'tensorflow' has no attribute 'placeholder'

Describe the bug and error messages (if any)
A clear and concise description of what the bug is.

AttributeError: module 'tensorflow' has no attribute 'placeholder'

The code snippet which gave this error*
from nudenet import NudeClassifier

for i in glob(pathname=f'{path}/**', recursive=True):
    if i.lower().endswith('.jpg') or i.lower().endswith('.png'):
        classifier = NudeClassifier()
        n = classifier.classify(i)

Specify versions of the following libraries
Keras==2.2.4
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.2
keras-resnet==0.2.0
keras-retinanet==0.5.0
NudeNet==1.1.0
tensorboard==2.2.2
tensorboard-plugin-wit==1.7.0
tensorflow==2.2.0
tensorflow-estimator==2.2.0

Expected behavior
Currently this errors out.

Screenshots
If applicable, add screenshots to help explain your problem.

nudenet_classifier_url

I ran your script on a Debian VPS 9 doing all the following steps:

  1. Update Python to 3.5
  2. git clone https://github.com/bedapudi6788/NudeNet.git
  3. I made sure to run the docker system with port 8500.
  4. I put the following code in a test.py file:
#!/usr/bin/env python3.5
import nudeclient
# Single image prediction
print (nudeclient.predict ( '/home/test/NudeNet/img_5d586cf31de18.jpg'))

As soon as I run it works well
But I was wondering if it was possible to get "nudenet_classifier_url" in order to do like you on your demo to scan directly via URLs with return json.

cordially

Help! Test source code of Detector Usage!

Describe the bug and error messages (if any)
A clear and concise description of what the bug is.
I really like this project, help pls, thanks!
My environment is anaconda3, python=3.6, tensorflow-gpu=1.9, tensorflow=1.9, keras=2.2.4, cython, Pillow, progressbar2, opencv-python=4.0.0.21, pydload, numpy, setuptools==39.1.0, keras-retinanet==0.5.0, nudenet

When I type python detector.py but I get the same picture in output directory and then I execute source code line by line as below.

(trynudenet) C:\Users\Happiness Learning\Desktop\NudeNet-master\NudeNet-master>python
Python 3.6.10 |Anaconda, Inc.| (default, May 7 2020, 19:46:08) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from nudenet import NudeDetector
Using TensorFlow backend.
C:\Anaconda3\envs\trynudenet\lib\site-packages\tensorflow\python\framework\dtypes.py:523: 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)])
C:\Anaconda3\envs\trynudenet\lib\site-packages\tensorflow\python\framework\dtypes.py:524: 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)])
C:\Anaconda3\envs\trynudenet\lib\site-packages\tensorflow\python\framework\dtypes.py:525: 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)])
C:\Anaconda3\envs\trynudenet\lib\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_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Anaconda3\envs\trynudenet\lib\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_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Anaconda3\envs\trynudenet\lib\site-packages\tensorflow\python\framework\dtypes.py:532: 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)])
>>> detector = NudeDetector()
2020-06-10 13:24:30.460748: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-06-10 13:24:30.647062: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1392] Found device 0 with properties:
name: GeForce GTX 1050 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.62
pciBusID: 0000:01:00.0
totalMemory: 4.00GiB freeMemory: 3.30GiB
2020-06-10 13:24:30.657394: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1471] Adding visible gpu devices: 0
2020-06-10 13:25:16.771448: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-06-10 13:25:16.777435: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:958] 0
2020-06-10 13:25:16.781501: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0: N
2020-06-10 13:25:16.784688: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1084] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3024 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
C:\Anaconda3\envs\trynudenet\lib\site-packages\keras\engine\saving.py:292: UserWarning: No training configuration found in save file: the model was not compiled. Compile it manually.
warnings.warn('No training configuration found in save file: '
>>> detector.detect('./Pic/ss4.jpg')
[]

detector.censor('./Pic/ss4.jpg', out_path='./output/ss4.jpg', visualize=False)

The code snippet which gave this error*
detector.detect('./Pic/ss4.jpg')
[]

Specify versions of the following libraries

  1. nudenet 1.1.0
  2. tensorflow/ tensorflow-gpu 1.9
  3. keras 2.2.4

Expected behavior
A clear and concise description of what you expected to happen.
(1)Where the correct directory do I need to put the classifier_model and detector_model?
(2) Do I need to use docker if I want to use the nudeclient.predict in my local computer?
(3) Why nudeclient will install tensorflow 1.14 and remove the tensorflow 1.9 automatically?
(4) When I type https://git-lfs.github.com/spec/v1 and it direct me to the https://git-lfs.github.com/, I install the git-lfs-windows-v2.11.0 and how can I get the detector_model?

Screenshots
If applicable, add screenshots to help explain your problem.
image

Unable to install nudenet module

Hi,

I have lot of errors when trying to install the nudenet module. Let me show you :

pip show tensorflow WARNING: Package(s) not found: tensorflow

pip show keras WARNING: Package(s) not found: keras

`C:\Users\a.\AppData\Local\Programs\Python\Python38\Scripts>pip install nudenet
Collecting nudenet
Using cached NudeNet-2.0.1-py2.py3-none-any.whl (21 kB)
Collecting keras-retinanet==0.5.1
Using cached keras-retinanet-0.5.1.tar.gz (61 kB)
ERROR: Command errored out with exit status 1:
command: 'c:\users\a.
\appdata\local\programs\python\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\a.\AppData\Local\Temp\pip-install-l72vxg_w\keras-retinanet\setup.py'"'"'; file='"'"'C:\Users\a.\AppData\Local\Temp\pip-install-l72vxg_w\keras-retinanet\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\a.\AppData\Local\Temp\pip-pip-egg-info-kpcg3ikb'
cwd: C:\Users\a.
\AppData\Local\Temp\pip-install-l72vxg_w\keras-retinanet
Complete output (193 lines):
Processing numpy/random_bounded_integers.pxd.in
Processing numpy/random\bit_generator.pyx
Processing numpy/random\mtrand.pyx
Processing numpy/random_bounded_integers.pyx.in
Processing numpy/random_common.pyx
Processing numpy/random_generator.pyx
Processing numpy/random_mt19937.pyx
Processing numpy/random_pcg64.pyx
Processing numpy/random_philox.pyx
Processing numpy/random_sfc64.pyx
Cythonizing sources
Could not locate executable g77
Could not locate executable f77
Could not locate executable ifort
Could not locate executable ifl
Could not locate executable f90
Could not locate executable DF
Could not locate executable efl
Could not locate executable gfortran
Could not locate executable f95
Could not locate executable g95
Could not locate executable efort
Could not locate executable efc
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
non-existing path in 'numpy\distutils': 'site.cfg'
Running from numpy source directory.
C:\Users\A26E31.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\setup.py:470: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
run_build = parse_setuppy_commands()
C:\Users\A26E3
1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\system_info.py:1914: UserWarning:
Optimized (vendor) Blas libraries are not found.
Falls back to netlib Blas library which has worse performance.
A better performance should be easily gained by switching
Blas library.
if self._calc_info(blas):
C:\Users\A26E31.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\system_info.py:1914: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
if self._calc_info(blas):
C:\Users\A26E3
1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\system_info.py:1914: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
if self._calc_info(blas):
C:\Users\A26E31.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\system_info.py:1748: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
return getattr(self, 'calc_info{}'.format(name))()
C:\Users\A26E3
1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\system_info.py:1748: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
return getattr(self, 'calc_info{}'.format(name))()
c:\users\a.\appdata\local\programs\python\python38\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
Traceback (most recent call last):
File "c:\users\a.
\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver
return self.find_available_vc_vers()[-1]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\bdist_egg.py", line 163, in run
    self.run_command("egg_info")
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\command\egg_info.py", line 24, in run
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\command\build_src.py", line 144, in run
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\command\build_src.py", line 155, in build_sources
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\command\build_src.py", line 288, in build_library_sources
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\command\build_src.py", line 378, in generate_sources
  File "numpy\core\setup.py", line 650, in get_mathlib_info
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\distutils\command\config.py", line 241, in try_link
    self._check_compiler()
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\command\config.py", line 52, in _check_compiler
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\distutils\_msvccompiler.py", line 224, in initialize
    vc_env = _get_vc_env(plat_spec)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
    return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 843, in __init__
    self.si = SystemInfo(self.ri, vc_ver)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 485, in __init__
    self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver
    raise distutils.errors.DistutilsPlatformError(err)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
    yield saved
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
    yield
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\setup.py", line 499, in <module>
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\setup.py", line 491, in setup_package
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\core.py", line 169, in setup
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\distutils\core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))
SystemExit: error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\easy_install.py", line 1144, in run_setup
    run_setup(setup_script, args)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 253, in run_setup
    raise
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
    yield
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\_vendor\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
    yield saved
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
    yield
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\setup.py", line 499, in <module>
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\setup.py", line 491, in setup_package
  File "C:\Users\A26E3~1.THE\AppData\Local\Temp\easy_install-8i4trsem\numpy-1.19.1\numpy\distutils\core.py", line 169, in setup
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\distutils\core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))
SystemExit: error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\a.******\AppData\Local\Temp\pip-install-l72vxg_w\keras-retinanet\setup.py", line 45, in <module>
    setuptools.setup(
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\__init__.py", line 144, in setup
    _install_setup_requires(attrs)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\__init__.py", line 139, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\dist.py", line 716, in fetch_build_eggs
    resolved_dists = pkg_resources.working_set.resolve(
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\pkg_resources\__init__.py", line 780, in resolve
    dist = best[req.key] = env.best_match(
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\pkg_resources\__init__.py", line 1065, in best_match
    return self.obtain(req, installer)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\pkg_resources\__init__.py", line 1077, in obtain
    return installer(requirement)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\dist.py", line 786, in fetch_build_egg
    return cmd.easy_install(req)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\easy_install.py", line 679, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\easy_install.py", line 705, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\easy_install.py", line 890, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\easy_install.py", line 1158, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "c:\users\a.******\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\easy_install.py", line 1146, in run_setup
    raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.