About this project

NSFWJS is a powerful JavaScript library designed to detect indecent or NSFW (Not Safe For Work) images directly on the client-side using TensorFlow.js. It allows developers to integrate image classification into web applications without sending sensitive images to a server. The library classifies images into five distinct categories: Drawing (safe for work drawings including anime), Neutral (safe for work neutral images), Porn (pornographic images), Sexy (sexually explicit but not pornographic), and Hentai (pornographic drawings). Key features include: - **Client-Side Execution**: Runs entirely in the user's browser, ensuring privacy and reducing server load. - **High Accuracy**: Achieves approximately 90% accuracy with small models and 93% with mid-sized models. - **Multiple Backends**: Supports WebGPU, WebGL, WASM, and CPU backends via TensorFlow.js for cross-browser compatibility and performance. - **Flexible Model Loading**: Offers built-in models like MobileNetV2, MobileNetV2Mid, and InceptionV3, or allows users to host their own custom models to reduce bundle size. - **Simple API**: Provides straightforward methods like `load()` to initialize the model, `classify()` to analyze images (accepting `<img>`, `<video>`, or `<canvas>` elements), and `dispose()` to free up memory. - **Node.js Support**: Can also be utilized in server-side Node.js applications using `@tensorflow/tfjs-node`. The library is MIT licensed and widely used in open-source projects, such as browser extensions for filtering NSFW content.