---
title: "ai-generated-image-detection"
publisher: "hive"
type: "endpoint"
updated: "2025-03-22T01:54:24.079Z"
description: "Robust image classification model for detecting and managing AI-generated content."
canonical: "https://build.nvidia.com/hive/ai-generated-image-detection"
---

# Model Overview

## Description:
Hive’s AI-Generated Image Classification model is optimized for use with the kind of media generated by popular AI generative engines such as DALL-E, Midjourney, and Stable Diffusion. 

The model has two heads. The first head gives a binary classification for all images, identifying whether or not they were AI generated and the accompanying confidence score. The second head provides further details as to the image's source, with support for the most popular AI art generators currently in use. If the model cannot identify a source, it will return none under the source head.

This model is ready for commercial and non-commercial use. <br>

## Third-Party Community Consideration
This model is not owned or developed by NVIDIA. This model has been developed and built to a third-party’s requirements for this application and use case.

### License/Terms of Use: 
https://thehive.ai/terms-of-use

## Model Architecture: 
**Architecture Type:** Convolution Neural Network (CNN)]  <br>
**Network Architecture:** EfficientNet-B4 <br>

## Input:
**Input Type(s):** Ensemble Gradient Boosted (EGB) Image  <br>
**Input Format(s):** PNG, JPEG, or JPG <br>
**Input Parameters:** Two-Dimensional (2D) <br>

## Output:
**Output Type(s):** Text <br>
**Output Format:** String <br>
**Output Parameters:** One Dimensional (1D) <br>

## Software Integration:

**Supported Hardware Microarchitecture Compatibility:** <br>
* NVIDIA Ampere <br>
* NVIDIA Jetson  <br>
* NVIDIA Hopper <br>
* NVIDIA Lovelace <br>
* NVIDIA Volta <br> 

**[Preferred/Supported] Operating System(s):** Linux <br>

## Model Version(s): 
v1.0 <br>

# Training Dataset: 

## Training Dataset:

**Data Collection Method by dataset**<br>
* Unknown <br>

**Labeling Method by dataset**<br>
* Unknown <br>

**Properties (Quantity, Dataset Descriptions, Sensor(s)):** Trained on a large dataset comprising millions of artificially generated images and human-created images such as photographs, digital and traditional art, and memes sourced from across the web. <br>

## Inference:
**Engine:** TensorRT <br>
**Test Hardware:** L40 <br>

## Ethical Considerations (For NVIDIA Models Only):
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications.  When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.  

Please report security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).

## Prototype

```javascript
import fs from 'fs';
import fetch from 'node-fetch';

const header_auth = "Bearer $NVIDIA_API_KEY";
const invoke_url = "https://ai.api.nvidia.com/v1/cv/hive/ai-generated-image-detection"
const input_image_path = "YOUR_IMAGE_FILE.png"

async function upload_asset(input, description) {
const assets_url = "https://api.nvcf.nvidia.com/v2/nvcf/assets";

const headers = {
"Authorization": header_auth,
"Content-Type": "application/json",
"accept": "application/json",
};

const s3_headers = {
"x-amz-meta-nvcf-asset-description": description,
"content-type": "image/jpeg",
};

const payload = {
"contentType": "image/jpeg",
"description": description
};

const response = await fetch(
assets_url, { method: 'POST', body: JSON.stringify(payload), headers: headers }
);

const data = await response.json();

const asset_url = data["uploadUrl"];
const asset_id = data["assetId"];

const fileData = fs.readFileSync(input);

await fetch(
asset_url,
{ method: 'PUT', body: fileData, headers: s3_headers }
);

return asset_id.toString();
}

const data = fs.readFileSync(input_image_path);
const imageB64 = Buffer.from(data).toString('base64');

var payload;
var headers;

if (imageB64.length < 180_000) {
payload = {
"input": [`data:image/jpeg;base64,${imageB64}`]
};
headers = {
"Content-Type": "application/json",
"Authorization": header_auth,
"Accept": "application/json"
};  
} else {
const asset_id = await upload_asset(input_image_path, "Input Image");

payload = {
"input": [`data:image/jpeg;asset_id,${asset_id}`]
};
headers = {
"Content-Type": "application/json",
"NVCF-INPUT-ASSET-REFERENCES": asset_id,
"Authorization": header_auth
};
}

const response = await fetch(invoke_url, {
method: 'POST', body: JSON.stringify(payload), headers: headers
});
const output = await response.json();
console.log(JSON.stringify(output));
```

```python
import requests, base64

header_auth = f"Bearer $NVIDIA_API_KEY"
invoke_url = "https://ai.api.nvidia.com/v1/cv/hive/ai-generated-image-detection"
input_image_path = "YOUR_IMAGE_FILE.png"

def upload_asset(path, desc):
assets_url = "https://api.nvcf.nvidia.com/v2/nvcf/assets"
headers = {
"Content-Type": "application/json",
"Authorization": header_auth,
"accept": "application/json",
}
payload = {
"contentType": "image/png",
"description": desc
}
response = requests.post(assets_url, headers=headers, json=payload, timeout=30)
print("assets response", response, flush=True)

current_pre_signed_url = response.json()["uploadUrl"]

asset_id = response.json()["assetId"]

headers = {
"Content-Type": "image/png",
"x-amz-meta-nvcf-asset-description": desc,
}

input_data = open(path, "rb")
response = requests.put(
current_pre_signed_url,
data=input_data,
headers=headers,
timeout=300,
)
return asset_id

with open(input_image_path, "rb") as f:
image_b64 = base64.b64encode(f.read()).decode()

if len(image_b64) < 180_000:
payload = {
"input": [f"data:image/png;base64,{image_b64}"]
}
headers = {
"Content-Type": "application/json",
"Authorization": header_auth,
"Accept": "application/json",
}
else:
asset_id = upload_asset(input_image_path, "Input Image")

payload = {
"input": [f"data:image/png;asset_id,{asset_id}"]
}
headers = {
"Content-Type": "application/json",
"NVCF-INPUT-ASSET-REFERENCES": asset_id,
"Authorization": header_auth,
}

response = requests.post(invoke_url, headers=headers, json=payload)
print(response.json())
```

```bash
header_auth="Bearer $NVIDIA_API_KEY"
invoke_url="https://ai.api.nvidia.com/v1/cv/hive/ai-generated-image-detection"
input_image_path="YOUR_IMAGE_FILE.png"

image_b64=$(base64 $input_image_path)
length=${#image_b64}

if [ $length -gt 180000 ]; then
echo "To upload larger images, use the assets API (see docs)"
else
echo '{
"input": ["data:image/png;base64,'${image_b64}'"]
}' > payload.json

curl $invoke_url \
-H "Authorization: ${header_auth}" \
-H "Content-Type: application/json" \
-d @payload.json
fi
```