infinitered/nsfwjs
NSFW detection on the client-side via TensorFlow.js
What it solves
NSFWJS is a JavaScript library designed to identify indecent or "unseemly" images directly in the client's browser or on a Node.js server. It allows developers to implement content moderation by detecting pornographic or sexually explicit content without needing to send images to a remote server for analysis.
How it works
The library is powered by TensorFlow.js and utilizes pre-trained machine learning models (such as MobileNetV2 and InceptionV3) to categorize images into five distinct classes:
- Drawing: Safe for work drawings, including anime.
- Hentai: Pornographic drawings.
- Neutral: Safe for work neutral images.
- Porn: Pornographic images and sexual acts.
- Sexy: Sexually explicit images that are not pornography.
It can be deployed in various environments, supporting WebGPU, WASM, and WebGL backends for browser-based inference, as well as a dedicated Node.js backend for server-side use.
Who it’s for
Web and mobile developers who need to integrate image moderation tools into their applications to filter out NSFW content while maintaining user privacy by processing images locally.
Highlights
- Client-side processing: Performs classification in the browser, reducing server load and increasing privacy.
- Multiple model options: Includes built-in models like MobileNetV2 (small) and InceptionV3 (larger/more accurate).
- Flexible deployment: Supports browser (via TensorFlow.js), React Native, and Node.js.
- Custom hosting: Allows developers to host their own model files to reduce bundle size and improve load times.
- Hign accuracy: Reports approximately 90% accuracy for small models and 93% for mid-sized models.
Related
- Project
- Project
- Project
- Project
- Project