-
Notifications
You must be signed in to change notification settings - Fork 21
Home
NsfwSpy was created to aid in the moderation of user-generated content on a social platform I built. Users can upload images, both as profile pictures and as posts, and ensuring that no explicit content was publicly available was critical for the security and well being of the community, particularly as the platform is used by minors. With our backend being developed in .NET, a C# solution was preferred, however there were very few available. I decided to take it upon myself to use ML.NET to train an image classifier to provide a native C# solution.
To put it simply, NsfwSpy takes an image, whether that be a local file, a file hosted online or as a byte array and then will rate how likely it is that it falls into one of the following four categories with a score between 0 and 1:
Label | Description |
---|---|
Pornography | Images that depict sexual acts and nudity. This includes exposed genitals, buttocks and breasts |
Sexy | Images of people in their underwear and men who are topless. |
Hentai | Drawings or animations of sexual acts and nudity. |
Neutral | Images that are not sexual in nature. |
For example, the image below returns the following result:
{
"hentai": 0.02566564828157425,
"neutral": 0.9228940010070801,
"pornography": 0.03906788304448128,
"sexy": 0.012372436001896858,
"predictedLabel" : "neutral",
"isNsfw": false
}