Skip to content

Fake Image Classifier

Skymel edited this page Apr 2, 2023 · 11 revisions

Our API identifies artificial or generative AI images, providing accurate detection to combat fake and misleading visuals. Using advanced algorithms, it analyzes and identifies unique patterns to offer an added layer of protection and verification for social media platforms, news organizations, and content creators.

Overview

Welcome to the Generative AI and Artificial Image Detector API documentation. Our API is designed to help developers detect generative AI or artificial images with high accuracy.

We're developing a much more powerful version of our fake image classifier, as the accuracy on the latest mid-journey images is currently low. Our newer version will be able to detect them with improved accuracy. To gain early access, please contact us at contactus@skymel.com and request to be added to the private preview list for our V2.

Making Sense of Model Outputs

Each label in the model is assigned a confidence score between 0 and 1, where a higher score signifies a greater probability. Generally, any score above 0.5 is considered a positive.

Examples

Image - Fake image of pope

Image 2

response Image - Fake image of pope

{
  "error_code": 0,
  "predictions": {
    "artificial-images": 0.71,
    "body-parts_head_lips-mouth": 0.57,
    "safe": 0.96
  }
}

Image - Trump fake arrest

Image 2

response Image - Trump fake arrest

{
  "error_code": 0,
  "predictions": {
    "artificial-images": 0.66,
    "body-parts_head_lips-mouth": 0.66,
    "safe": 1.0
  }
}

Image - AI Generated Nature

Image 3

response Image - AI Generated Nature

{
  "error_code": 0,
  "predictions": {
    "artificial-images": 0.62,
    "safe": 1.0
  }
}

Image - AI generated Indian Female Warrior

Image 3

response Image - AI generated Indian Female Warrior

{
  "error_code": 0,
  "predictions": {
    "appearance_clothing_underwear_lingerie": 0.94,
    "artificial-images": 0.81,
    "body-parts_head_lips-mouth": 0.55,
    "body-parts_upper-body_breasts_partially_or_completely_exposed": 0.85,
    "unsafe": 0.79,
    "wtf": 0.58
  }
}

Usage

To use the Classifier API in your application, you can send a POST request to the API endpoint with the base64 encoded image data as the payload. The API will return a JSON response with the classification label. Here's an example Python script that demonstrates how to use the Classifier API:

python

import base64
import json

import requests

image_url = "https://e7.pngegg.com/pngimages/856/913/png-clipart-female-character-illustration-character-youtube-animated-film-infant-youtube-child-black-hair-thumbnail.png"

encoded_image = base64.b64encode(requests.get(image_url).content).decode('utf-8')

url = 'https://modelpubsub.com/api-v1.0/SafeUnsafeImageWithTags'
data = {
    'api_key': 'test_fake_image_github',
    'base64_image': encoded_image
}
try:
    response = requests.request("POST", url, data=json.dumps(data))
except requests.exceptions.ConnectionError as _:
    response = None

if response is not None:
    print(response.content)

Payload

The payload for the Classifier API should be a base64 encoded image data. example:

{
    'api_key': 'test_fake_image_github',
    'base64_image': encoded_image
}

Response

The response from the Classifier API is a JSON object with the following fields:

label: A binary classification label indicating whether the image is artificial or not. Possible values are 0 for real and 1 for artificial.

score: A confidence score for the classification, ranging from 0 to 1. Higher scores indicate greater confidence in the classification. Authentication The Classifier API requires authentication using an API key. To obtain an API key, please contact our support team at contactus@skymel.com.

Available Labels:

The image classifier produces a probability score for each label it has been trained to detect as its output.

Note: This is still in beta, if you are unhappy with the performance kindly send us feedback at contactus@skymel.com

We hope this developer wiki helps you integrate the Classifier API into your application. Thank you for choosing our API!