使用 640m 模型需先从 release 下载 onnx 文件并手动传入 model_path,包内只自带 320n;Docker 镜像默认监听 8080 端口,调用需访问 /infer 路径;README 提到仓库正在寻找维护者,功能迭代可能放缓。
NudeNet
notAI-techAGPL-3.0更新放缓轻量级裸露内容检测模型,可识别图片中的 NSFW 内容,支持 Keras 和 ONNX Runtime 推理,适合做内容审核和过滤。
Lightweight nudity detection
pip install --upgrade "nudenet>=3.4.2"README 未说明显存或 GPU 型号要求;默认 320n 模型随包提供,640m 需自行下载 onnx 并指定 inference_resolution=640。
轻量级裸露内容检测库,基于 YOLOv8 输出 18 类身体部位检测框并支持打码
轻量级裸露内容检测模型,可识别图片中的 NSFW 内容,支持 Keras 和 ONNX Runtime 推理,适合做内容审核和过滤。
核心能力
- 基于 ultralytics YOLOv8n/m 训练,提供 320n 与 640m 两个模型
- detect 与 detect_batch 支持文件路径、OpenCV 图像、字节流和 BufferedIO
- 输出 18 类标签的检测框与置信度,含暴露与遮挡状态
- censor 方法按指定类别对图像自动打码并返回输出路径
- 提供 Docker 镜像与 /infer HTTP 接口,可服务化调用
容易踩的坑
- v3.4-weights最新正式版2024-06-30 · 2024-06-30 17:36 UTC
这个版本没有写更新说明。
- v3.2-weightsv3.22024-06-15 · 2024-06-15 20:49 UTC
查看更新说明
model updates
- v2.0.92021-02-22 · 2021-02-22 14:49 UTC
查看更新说明
- Adds support for
classifier.classify(cv2.imread('image_path'))
- Adds support for
- v0place for checkpoint files.2019-12-19 · 2019-12-19 11:38 UTC
这个版本没有写更新说明。
- v1.0.42019-04-16 · 2019-04-16 15:33 UTC
这个版本没有写更新说明。
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Looking for contributors/ maintainers for this repo: I have become busy with other stuff in the last years, still trying to maintain this repo as it is the current best OSS option for nudity detection, Looking for interested mainttainer, who can add/ work on more features for this repo (with my help of course)
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>=3.4.2"
from nudenet import NudeDetector
detector = NudeDetector()
# the 320n model included with the package will be used
detector.detect('image.jpg') # Returns list of detections
detector.detect_batch(['image_1.jpg', 'image_2.jpg']) # Returns list of [list of detections]
-
detectanddetect_batchaccept file path(s), opencv image(s), image bytes(s), open(image_path, 'rb') (buffereader) objects
Available models
| Model | resolution trained | based on | onnx link | pytorch link |
|---|---|---|---|---|
| 320n | 320x320 | ultralytics yolov8n | link | link |
| 640m | 640x640 | ultralytics yolov8m | link | link |
# To use the 640m model, download the onnx file and pass the path to the model_path argument
detector = NudeDetector(model_path="downloaded_640m.onnx path", inference_resolution=640)
- 320n is the default model and is included in the
nudenetpython package by default
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/notAI-tech/NudeNet/issues/131