{"id":24127,"library":"nudenet","title":"NudeNet","description":"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.","status":"active","version":"3.4.2","language":"python","source_language":"en","source_url":"https://github.com/notAI-tech/nudenet","tags":["nudity-detection","safety","deep-learning","image-classification"],"install":[{"cmd":"pip install nudenet","lang":"bash","label":"Install the library (minimal)"}],"dependencies":[],"imports":[{"note":"Correct for v3.x. In v2.x the import was from nudenet import NudeDetector","symbol":"Detector","correct":"from nudenet import Detector"},{"note":"For v2.x only; v3.x uses Detector","wrong":"from nudenet import Detector","symbol":"NudeDetector","correct":"from nudenet import NudeDetector"}],"quickstart":{"code":"from nudenet import Detector\n\n# Initialize detector (auto-downloads weights)\ndetector = Detector()\n\n# Classify an image\nresult = detector.detect('path/to/image.jpg')\nprint(result)\n# Example output: [{'box': [0.0, 0.0, 100, 100], 'score': 0.99, 'label': 'EXPOSED_BREAST_F'}]","lang":"python","description":"Initialize the detector and classify an image. The detect method returns a list of detections with bounding boxes, scores, and labels."},"warnings":[{"fix":"Change import to `from nudenet import Detector`. The NudeDetector class was removed.","message":"Import path changed in v3: Use `from nudenet import Detector` instead of `from nudenet import NudeDetector`.","severity":"breaking","affected_versions":"v3.0.0 and later"},{"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}.","message":"Method `classify()` replaced with `detect()` in v3. The new method returns a different data structure (list of dicts vs simple labels).","severity":"breaking","affected_versions":"v3.0.0 and later"},{"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.","message":"Weights are downloaded on first import/detector init. The download may fail in restricted environments or behind proxies.","severity":"gotcha","affected_versions":"All"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":"All"},{"fix":"Specify the model path explicitly during Detector initialization: `Detector(model_path='path/to/model.onnx')`.","message":"The package includes multiple model variants (e.g., 'v1', 'v2', 'v3'). Loading the wrong version can give poor accuracy.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install nudenet`. If behind a proxy, use `pip install nudenet --proxy=...`.","cause":"Library not installed or installed incorrectly.","error":"ModuleNotFoundError: No module named 'nudenet'"},{"fix":"Check installed version: `pip show nudenet`. For v2 use `from nudenet import NudeDetector`, for v3 use `from nudenet import Detector`.","cause":"Using NudeDetector (v2) code with an older version that doesn't have Detector, or vice versa.","error":"AttributeError: module 'nudenet' has no attribute 'Detector'"},{"fix":"Initialize the detector, which triggers download. Or manually download from https://github.com/notAI-tech/nudenet/releases and place in ~/.nudenet/.","cause":"Model weights not downloaded.","error":"OSError: [Errno 2] No such file or directory: '.../.nudenet/nudenet.onnx'"},{"fix":"Use `from nudenet import Detector` for v3. If you need v2, install `pip install nudenet==2.0.9`.","cause":"Using v3 import pattern with v2 code.","error":"ImportError: cannot import name 'NudeDetector' from 'nudenet'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}