Code Monkey home page Code Monkey logo

isadult's Introduction

IsAdult

IsAdult is a script that detects whether or not an image is an adult image based on a given image element.

Based on ml5, which is a machine learning framework written in JavaScript with TensorFlow, isAdult aim is to be as accurate as possible in its detection.

IsAdult is very easy to use, just add the isAdult.js or isAdult.min.js file into your project and you're done!

IsAdult has only one function for now, which is called checkAdultImage. This function should receive one parameter, this parameter is the image HTML element where the image is shown.
This function will return a promise so its response should be treated as such using then/catch or async/await.
When the promise is resolved, the response object will contain a status and a msg properties.
The status may contain 3 different statuses with a type of integer:

  • 1 - Image is clear and there is no risk of adult content shown
  • 2 - Low risk of adult content in this image
  • 3 - High risk of adult image showing. With this status the image most likely contains an adult content

The msg property is the verbal explanation of the status.

A few notes before you start:

  • It is recommended that the <image> tag will contain a crossorigin="anonymous" attribute, especially if you are dealing with external image sources. Unfortunately, ml5 can not process images from sources that are blocking cross-origin access.
  • the <script src="isAdult.js"></script> should be placed at the bottom of the body tag and not in the header. Since this scripts also injects the ml5 script in the HTML, by adding this script to the body it will reserve the correct hierarchy of the scripts.

Example can be shown in the example.html file attached to this repository.
A live example is also available here


Created by Shay Kintzlinger :)

isadult's People

Contributors

kshayk avatar gioragutt avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.