open_nsfw | Not Suitable for Work classification | Machine Learning library
kandi X-RAY | open_nsfw Summary
kandi X-RAY | open_nsfw Summary
Not Suitable for Work (NSFW) classification using deep neural network Caffe models.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Preprocess the image .
- Command line parser .
- Resize an image
open_nsfw Key Features
open_nsfw Examples and Code Snippets
docker build -t caffe:cpu ./docker/Dockerfile
docker run caffe:cpu caffe --version
caffe version 1.0.0-rc3
git clone https://github.com/yahoo/open_nsfw.git
cd open_nsfw
docker run -p 8080:8080 --volume=$(pwd):/workspace --volume=/data/tmp/image:/da
from open_nsfw_python3 import NSFWClassifier
classifier = NSFWClassifier()
score = classifier.get_score('image.jpg')
print(score)
0.8041712045669556
nsfw_score(img,
nsfw_pkl_path="/home/u/nsfw.pkl",
deploy_prototxt_path="/opt/deploy.prototxt")
Community Discussions
Trending Discussions on open_nsfw
QUESTION
Project I'm looking at is: https://github.com/mdietrichstein/tensorflow-open_nsfw
I pulled the code and when I run it I get the following error (specific file being run below as well):
Traceback (most recent call last):
File "classify_nsfw.py", line 58, in
main(sys.argv)
File "classify_nsfw.py", line 37, in main with tf.Session() as sess:
AttributeError: module 'tensorflow' has no attribute 'Session'
...ANSWER
Answered 2019-Dec-01 at 07:10The reason is you are using old TensorFlow 1.X syntax. tf.Session()
was deprecated in TensorFlow 2.0.0.
The module tf.compat.v1
brings in all of the public TensorFlow interface. If you still want to use tf.Session()
, use the syntax tf.compat.v1.Session()
instead.
QUESTION
I am working to understand CoreML. For a starter model, I've downloaded Yahoo's Open NSFW caffemodel. You give it an image, it gives you a probability score (between 0 and 1) that the image contains unsuitable content.
Using coremltools, I've converted the model to a .mlmodel and brought it into my app. It appears in Xcode like so:
In my app, I can successfully pass an image, and the output appears as a MLMultiArray. Where I am having trouble is understanding how to use this MLMultiArray to obtain my probability score. My code is like so:
...ANSWER
Answered 2017-Jun-21 at 05:58It seems like you are not transforming the input image in the same way the model expects.
Most caffe models expects "mean subtracted" images as input, so does this model. If you inspect the python code provided with Yahoo's Open NSFW (classify_nsfw.py
):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install open_nsfw
You can use open_nsfw like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page