Practical overview
When it fits
Use it when you need a modifiable TensorFlow implementation and can work with the documented Python and TensorFlow 1.x environment. It is relevant for building an image-scoring component, not for obtaining a hosted review service.
Who it is for
- Developers evaluating JPEG images for SFW and NSFW scores.
- Teams adapting an image classifier into a moderation or review workflow.
- TensorFlow developers preparing model exports for serving, mobile, or IoT inference.
Documented uses
- Classify an individual JPEG and inspect its SFW and NSFW scores.
- Compare the documented Yahoo and TensorFlow image-loading approaches, noting that scores may differ.
- Export the model as SavedModel, TensorFlow Lite, or a frozen graph for a supported inference path.
Requirements & limits
The project is available as a public GitHub repository. The repository states that its code should be compatible with Python 3.6 and TensorFlow 1.x, and cites TensorFlow 1.12 as tested.
- JPEG is the only documented input image format.
- The default Yahoo image loader aims to replicate the original preprocessing; the TensorFlow-only loader differs in decoding and resizing, and results may vary.
- The default model input is a float tensor shaped [None, 224, 224, 3]; base64_jpeg input forces use of the TensorFlow image loader.
- The base64_jpeg input type is unsupported in the TFLite export because required TensorFlow operations are absent from the standard runtime.
- SavedModel, TFLite, and frozen-graph export utilities are included, but deployment setup is not specified.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Classify a JPEG image with the TensorFlow Open NSFW model
Run the classifier on a JPEG image and read its SFW and NSFW scores.
Before you start
- Python 3.6 and TensorFlow 1.x; the README reports testing with TensorFlow 1.12.
- The repository's model weights file at
data/open_nsfw-weights.npy. - A JPEG image to classify; other image formats are not supported.
Steps
From the repository, provide
classify_nsfw.py, the model weights path, and the JPEG image path to the documented command: the command below.python classify_nsfw.py -m data/open_nsfw-weights.npy test.jpgRead the reported SFW and NSFW scores in the command output.
Expected outcome
The tool prints SFW and NSFW scores for the input JPEG image.
Guide limitations
- Only JPEG images are supported.
- Classification results may vary depending on the image loader.
- The README describes compatibility with Python 3.6 and TensorFlow 1.x, tested with TensorFlow 1.12.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 14 November 2026
- Original website title
- mdietrichstein/tensorflow-open_nsfw · Official homepage title · retained in its source language

