npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nsfwspy/node

v1.2.0

Published

A nudity/pornography image classifier built for Node.js.

Downloads

50

Readme

Introduction

NsfwSpy.js is a nudity/pornography image classifier built for Node.js, based on our parent .NET project, to aid in moderating user-generated content for various different application types, written in TypeScript. The machine learning model has been trained against the MobileNetV2 neural net architecture with 537,000 images (186GB), from 4 different categories:

| Label | Description | Files | | ----------- | ----------- | ----- | | Pornography | Images that depict sexual acts and nudity. | 108,000 | | Sexy | Images of people in their underwear and men who are topless. | 76,000 | | Hentai | Drawings or animations of sexual acts and nudity. | 83,000 | | Neutral | Images that are not sexual in nature. | 268,000 |

Performance

NsfwSpy isn't perfect, but the accuracy should be good enough to detect approximately 96% of Nsfw images, those being images that are classed as pornography, sexy or hentai.

| | Pornography | Sexy | Hentai | Neutral | | --- | --- | --- | --- | --- | | Is Nsfw (pornography + sexy + hentai >= 0.5) | 95.0% | 97.3% | 93.3% | 3.7% | | Correctly Predicted Label | 85.0% | 81.0% | 89.8% | 96.4% |

Quick Start

Want to see how NsfwSpy.js performs? Try it now on our test site.

This project is available as a npm package and can be installed with the following commands:

npm install @nsfwspy/node

Import NsfwSpy at the top of your JavaScript or TypeScript file:

JavaScript

const { NsfwSpy } = require('@nsfwspy/node');

TypeScript

import { NsfwSpy } from '@nsfwspy/node';

Load the Model

Before starting to use NsfwSpy, the model should be loaded from your hosted site or as local files on your system.

Hosted files

const nsfwSpy = new NsfwSpy("./model/model.json");

Local files

const nsfwSpy = new NsfwSpy("file://./model/model.json");

Classify an Image File

const filePath = "C:\\Users\\username\\Documents\\flower.jpg";
const nsfwSpy = new NsfwSpy();
await nsfwSpy.load();
const result = await nsfwSpy.classifyImageFile(filePath);

Classify an Image from a Byte Array

const imageBuffer = await fs.readFileSync(filePath);
const nsfwSpy = new NsfwSpy("file://./model/model.json");
await nsfwSpy.load();
const result = await nsfwSpy.classifyImageFromByteArray(imageBuffer);

Contact Us

Interested to get involved in the project? Whether you fancy adding features, providing images to train NsfwSpy with or something else, feel free to contact us via email at [email protected] or find us on Twitter at @nsfw_spy.

Notes

Using NsfwSpy? Let us know! We're keen to hear how the technology is being used and improving the safety of applications.

Got a feature request or found something not quite right? Report it here on GitHub and we'll try to help as best as possible.