Registry / ai-ml / nudenet

nudenet

JSON →
library3.4.2pypypi✓ verified 80d ago

A lightweight nudity detection library for Python that provides deep learning-based classifiers for detecting nudity in images. As of version 3.4.2 (weights updated separately), the package supports labeling images as 'safe' or 'unsafe' and includes support for both CPU and GPU inference. The major v3 series introduced a new detector API and breaking import changes. Releases are intermittent with version bumps tied to model weights.

pip install nudenet
INSTALL
IMPORT
SIG · NUDENET
N
nudenet
ai-mlpythonv3.4.2
Install
8.6s avg
Import
Disk
335MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.4.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 8.6s · import 0.000s · 370MB
335MB installed
● package 335MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

NudeDetector
from nudenet import NudeDetector
from nudenet import Detector

Initialize the detector and classify an image. The detect method returns a list of detections with bounding boxes, scores, and labels.

from nudenet import Detector # Initialize detector (auto-downloads weights) detector = Detector() # Classify an image result = detector.detect('path/to/image.jpg') print(result) # Example output: [{'box': [0.0, 0.0, 100, 100], 'score': 0.99, 'label': 'EXPOSED_BREAST_F'}]
Debug
Known issues
breakingImport path changed in v3: Use `from nudenet import Detector` instead of `from nudenet import NudeDetector`.
fix
Change import to `from nudenet import Detector`. The NudeDetector class was removed.
affects: v3.0.0 and later
breakingMethod `classify()` replaced with `detect()` in v3. The new method returns a different data structure (list of dicts vs simple labels).
fix
Use `detect()`. If you need simple safe/unsafe, call `detect()` and check if any detection has label starting with 'EXPOSED_'. The old classify returned {'safe': prob, 'unsafe': prob}.
affects: v3.0.0 and later
gotchaWeights are downloaded on first import/detector init. The download may fail in restricted environments or behind proxies.
fix
Manually download the weights from the GitHub releases (e.g., 'v3.4-weights') and place them in the default cache directory (~/.nudenet/) or set environment variable NUDENET_DIR.
affects: All
gotchaThe default detector uses a model that only detects female breast exposure ('EXPOSED_BREAST_F'). It does not detect male nudity or other body parts in the default config.
fix
Use a custom model if needed, or understand the label scope. The library has separate models for other categories but they are not default.
affects: All
gotchaThe package includes multiple model variants (e.g., 'v1', 'v2', 'v3'). Loading the wrong version can give poor accuracy.
fix
Specify the model path explicitly during Detector initialization: `Detector(model_path='path/to/model.onnx')`.
affects: All
Upgrade
Version history
3.4.2latest on PyPI · released Jul 3, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
Resources
nudenet — pip install nudenet · libregistry