Metadata-Version: 2.1
Name: NudeNetUpdated
Version: 2.2.4
Summary: 
Author: ELoiselle
Author-email: emile.loiselle@hotmail.com
Requires-Python: >=3.11,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: numpy (>=1.25.2,<2.0.0)
Requires-Dist: onnxruntime (>=1.15.1,<2.0.0)
Requires-Dist: opencv-python-headless (>=4.5.1.48)
Requires-Dist: pillow (>=10.0.0,<11.0.0)
Requires-Dist: progressbar (>=2.5,<3.0)
Requires-Dist: pydload (>=1.0.9,<2.0.0)
Requires-Dist: scikit-image (>=0.21.0,<0.22.0)
Description-Content-Type: text/markdown

# NudeNet: Neural Nets for Nudity Classification, Detection and selective censoring

**Classifier classes:**
|class name | Description |
|--------|:--------------:
|safe | Image is not sexually explicit |
|unsafe | Image is sexually explicit|

**Detector classes:**
|class name | Description |
|--------|:-------------------------------------:
|EXPOSED_ANUS | Exposed Anus; Any gender |
|EXPOSED_ARMPITS | Exposed Armpits; Any gender |
|COVERED_BELLY | Provocative, but covered Belly; Any gender |
|EXPOSED_BELLY | Exposed Belly; Any gender |
|COVERED_BUTTOCKS | Provocative, but covered Buttocks; Any gender |
|EXPOSED_BUTTOCKS | Exposed Buttocks; Any gender |
|FACE_F | Female Face|
|FACE_M | Male Face|
|COVERED_FEET |Covered Feet; Any gender |
|EXPOSED_FEET | Exposed Feet; Any gender|
|COVERED_BREAST_F | Provocative, but covered Breast; Female |
|EXPOSED_BREAST_F | Exposed Breast; Female |
|COVERED_GENITALIA_F |Provocative, but covered Genitalia; Female|
|EXPOSED_GENITALIA_F |Exposed Genitalia; Female |
|EXPOSED_BREAST_M |Exposed Breast; Male |
|EXPOSED_GENITALIA_M |Exposed Genitalia; Male |

## Usage

### As Python module

**Installation**:

```bash
pip install --upgrade nudenetupdated
```

**Classifier Usage**:

```python
# Import module
from nudenet import NudeClassifier

# initialize classifier (downloads the checkpoint file automatically the first time)
classifier = NudeClassifier()

# Classify single image
classifier.classify('path_to_image_1')
# Returns {'path_to_image_1': {'safe': PROBABILITY, 'unsafe': PROBABILITY}}
# Classify multiple images (batch prediction)
# batch_size is optional; defaults to 4
classifier.classify(['path_to_image_1', 'path_to_image_2'], batch_size=BATCH_SIZE)
# Returns {'path_to_image_1': {'safe': PROBABILITY, 'unsafe': PROBABILITY},
#          'path_to_image_2': {'safe': PROBABILITY, 'unsafe': PROBABILITY}}

```

**Detector Usage**:

```python
# Import module
from nudenet import NudeDetector

# initialize detector (downloads the checkpoint file automatically the first time)
detector = NudeDetector() # detector = NudeDetector('base') for the "base" version of detector.

# Detect single image
detector.detect('path_to_image')
# fast mode is ~3x faster compared to default mode with slightly lower accuracy.
detector.detect('path_to_image', mode='fast')
# Returns [{'box': LIST_OF_COORDINATES, 'score': PROBABILITY, 'label': LABEL}, ...]
```

## Developpers

To get started, simply clone the repository and install the dependencies:

```
poetry install
```

Once the dependencies are installed, you can start developing your project.

| Command     |       Description        |
| ----------- | :----------------------: |
| make test   |   Run your unit tests    |
| make lint   |      Lint your code      |
| make format |     Format your code     |
| make mypy   | Run static type checking |

### Notes

- Current version of NudeDetector is trained on 160,000 entirely auto-labelled (using classification heat maps and various other hybrid techniques) images.
- The entire data for the classifier is available at https://archive.org/details/NudeNet_classifier_dataset_v1
- A part of the auto-labelled data (Images are from the classifier dataset above) used to train the base Detector is available at https://github.com/notAI-tech/NudeNet/releases/download/v0/DETECTOR_AUTO_GENERATED_DATA.zip

### Fork notes

- The original project made by notAI-tech is [here](https://github.com/notAI-tech/NudeNet)
- The forked version made by platelminto taken for this project is [here](https://github.com/platelminto/NudeNetClassifier)

### Contributing

If you have any suggestions for improvements, please feel free to open an issue or submit a pull request.

### License

This project is licensed under the MIT License.

