How To Detect Nudity From Video or Image Using Python | Python Nudity Detector

Published: 17 October 2021
on channel: AIOC all in one code
7,918
101

#python #nudity #api #detector #tensorflow #numpy #nuditydetector #pythonadultcontentdetector #adult #content #detector

AIOC : https://allinonecode.com/
Install : pip install --upgrade nudenet

#code
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}}

Classify video
batch_size is optional; defaults to 4
classifier.classify_video('path_to_video', batch_size=BATCH_SIZE)
Returns {"metadata": {"fps": FPS, "video_length": TOTAL_N_FRAMES, "video_path": 'path_to_video'},
"preds": {frame_i: {'safe': PROBABILITY, 'unsafe': PROBABILITY}, ....}}


On this page of the site you can watch the video online How To Detect Nudity From Video or Image Using Python | Python Nudity Detector with a duration of hours minute second in good quality, which was uploaded by the user AIOC all in one code 17 October 2021, share the link with friends and acquaintances, this video has already been watched 7,918 times on youtube and it was liked by 101 viewers. Enjoy your viewing!