Skip to content

shaur-codes/ifnude

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ifnude - nudity detection that just works

A neural nets powered library that can detect nudity in images of both real humans and drawings. It takes an image as input and tells you exactly what NSFW parts of the body are visible. Optionally, you can censor the said parts.

Installation

pip install ifnude

Example

Note: Importing ifnude for the first time will download a 139MB module to "/your/home/dir/.ifnude/", just once.

from ifnude import detect

# use mode="fast" for x3 speed with slightly lower accuracy
print(detect('/path/to/nsfw.png'))

Instead of a path, you can use a variable that contains an image loaded through cv2 (opencv) or PIL (pillow).

Output

[
  {'box': [164, 188, 246, 271], 'score': 0.8253238201141357, 'label': 'EXPOSED_BREAST_F'},
  {'box': [252, 190, 335, 270], 'score': 0.8235630989074707, 'label': 'EXPOSED_BREAST_F'}
]

Censor Video

from ifnude import detector

detector.censor_video(inp_video_path='path/to/video.mp4', out_video_path='path/to/output_video.mp4') #make sure to use forward slash (/)

Output

raw video

https://streamable.com/q8jp8c

censored video

https://streamable.com/su3yko

Credits

This is fork of NudeNet library which doesn't work anymore.

About

nudity detector that works

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%