analitics

Pages

Showing posts with label nudepy. Show all posts
Showing posts with label nudepy. Show all posts

Tuesday, January 1, 2019

Detect nudity with nudepy python module.

Today I tested another python module named nudepy.
You can find it here.
This python module is a port of nude.js to Python.
Let's start the tutorial with the installation:
C:\Python364\Scripts>cd ..

C:\Python364>cd Scripts

C:\Python364\Scripts>pip install nudepy
Requirement already satisfied: nudepy in c:\python364\lib\site-packages (0.4)
Requirement already satisfied: pillow in c:\python364\lib\site-packages (from nu
depy) (5.3.0)
To test this python module, I used four images with the idea of a nude image
This image is the result of all images of the test.

This image files are named:
  • test_nude_001.jpg
  • test_nude_002.jpg
  • test_nude_003.jpg
  • test_nude_004.jpg
Let's see the script:
# for select jpeg files
import os, fnmatch
# import nude python module
import nude
from nude import Nude
#
nude_jpegs=fnmatch.filter(os.listdir('.'), '*nude*.jpg')
print(nude_jpegs)
for found_file in nude_jpegs:
    print (found_file)
    print("Nude file: ",nude.is_nude(str(found_file)))
    n = Nude(str(found_file))
    n.parse()
    print("and test result: ", n.result, n.inspect())
    print("====================")
The result of the output script is this:
C:\Python364>python.exe test_nude.py
['test_nude_001.jpg', 'test_nude_002.jpg', 'test_nude_003.jpg', 'test_nude_004.j
pg']
test_nude_001.jpg
Nude file:  False
and test result:  False #
====================
test_nude_002.jpg
Nude file:  False
and test result:  False #
====================
test_nude_003.jpg
Nude file:  False
and test result:  False #
====================
test_nude_004.jpg
Nude file:  True
and test result:  True #
====================