Update README.md
Browse files
README.md
CHANGED
|
@@ -1,37 +1,64 @@
|
|
| 1 |
-
---
|
| 2 |
-
datasets:
|
| 3 |
-
- Hemg/AI-Generated-vs-Real-Images-Datasets
|
| 4 |
-
metrics:
|
| 5 |
-
- accuracy
|
| 6 |
-
base_model:
|
| 7 |
-
- microsoft/resnet-50
|
| 8 |
-
pipeline_tag: image-classification
|
| 9 |
-
tags:
|
| 10 |
-
- art
|
| 11 |
-
---
|
| 12 |
|
| 13 |
# Multi-Task Image Classifier
|
| 14 |
|
| 15 |
-
|
| 16 |
## Model Overview
|
| 17 |
This model is a **Multi-Task Image Classifier** that performs two tasks simultaneously:
|
| 18 |
1. **Object Recognition:** Identifies the primary object in an image (e.g., "cat," "dog," "car," etc.).
|
| 19 |
2. **Authenticity Classification:** Determines whether the image is AI-generated or a real photograph.
|
| 20 |
|
| 21 |
-
The model uses a ResNet-50 backbone with two heads: one for multi-class object recognition (trained on pseudo-labels generated by a Vision Transformer) and another for binary classification (AI-generated vs. Real). It was trained on a subset of the [Hemg/AI-Generated-vs-Real-Images-Datasets](https://huggingface.co/datasets/Hemg/AI-Generated-vs-Real-Images-Datasets).
|
| 22 |
|
| 23 |
## Intended Use
|
| 24 |
This model is designed for:
|
| 25 |
-
- **Digital Content Verification:** Detecting AI-generated images to prevent misinformation.
|
| 26 |
- **Social Media Moderation:** Automatically flagging images that are likely AI-generated.
|
| 27 |
-
- **Content Analysis:**
|
| 28 |
|
| 29 |
## How to Use
|
| 30 |
-
You can use this model locally or via
|
| 31 |
```python
|
| 32 |
import torch
|
| 33 |
-
from model import MultiTaskModel #
|
| 34 |
|
|
|
|
| 35 |
model = MultiTaskModel(...)
|
|
|
|
|
|
|
| 36 |
model.load_state_dict(torch.load("multitask_model_weights.pth", map_location="cpu"))
|
| 37 |
-
model.eval()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
| 2 |
# Multi-Task Image Classifier
|
| 3 |
|
|
|
|
| 4 |
## Model Overview
|
| 5 |
This model is a **Multi-Task Image Classifier** that performs two tasks simultaneously:
|
| 6 |
1. **Object Recognition:** Identifies the primary object in an image (e.g., "cat," "dog," "car," etc.).
|
| 7 |
2. **Authenticity Classification:** Determines whether the image is AI-generated or a real photograph.
|
| 8 |
|
| 9 |
+
The model uses a **ResNet-50** backbone with two heads: one for multi-class object recognition (trained on pseudo-labels generated by a Vision Transformer) and another for binary classification (AI-generated vs. Real). It was trained on a subset of the [Hemg/AI-Generated-vs-Real-Images-Datasets](https://huggingface.co/datasets/Hemg/AI-Generated-vs-Real-Images-Datasets).
|
| 10 |
|
| 11 |
## Intended Use
|
| 12 |
This model is designed for:
|
| 13 |
+
- **Digital Content Verification:** Detecting AI-generated images to help prevent misinformation.
|
| 14 |
- **Social Media Moderation:** Automatically flagging images that are likely AI-generated.
|
| 15 |
+
- **Content Analysis:** Assisting researchers in understanding the prevalence of AI art versus real images in digital media.
|
| 16 |
|
| 17 |
## How to Use
|
| 18 |
+
You can use this model locally or via the provided Hugging Face Space. For local usage, load the state dictionary into the model architecture using PyTorch. For example:
|
| 19 |
```python
|
| 20 |
import torch
|
| 21 |
+
from model import MultiTaskModel # Your model definition
|
| 22 |
|
| 23 |
+
# Instantiate your model architecture (must match training)
|
| 24 |
model = MultiTaskModel(...)
|
| 25 |
+
|
| 26 |
+
# Load the saved state dictionary (trained weights)
|
| 27 |
model.load_state_dict(torch.load("multitask_model_weights.pth", map_location="cpu"))
|
| 28 |
+
model.eval()
|
| 29 |
+
```
|
| 30 |
+
Alternatively, you can test the model directly via our interactive demo:
|
| 31 |
+
[Test the Model Here](https://huggingface.co/spaces/Abdu07/multitask-demo)
|
| 32 |
+
|
| 33 |
+
## Training Data and Evaluation
|
| 34 |
+
- **Dataset:** The model was trained on a subset of the [Hemg/AI-Generated-vs-Real-Images-Datasets](https://huggingface.co/datasets/Hemg/AI-Generated-vs-Real-Images-Datasets) comprising approximately 152k images.
|
| 35 |
+
- **Metrics:**
|
| 36 |
+
- **Authenticity (AI vs. Real):** Validation accuracy reached around 85% after early epochs.
|
| 37 |
+
- **Object Recognition:** Pseudo-label accuracy started at around 38–40% and improved during training.
|
| 38 |
+
- **Evaluation:** Detailed evaluation metrics and loss curves are available in our training logs.
|
| 39 |
+
|
| 40 |
+
## Model Details
|
| 41 |
+
- **Trained by:** [Abdellahi El Moustapha](https://abmstpha.github.io/)
|
| 42 |
+
- **Language:** Not applicable (image model)
|
| 43 |
+
- **Base Model:** ResNet-50
|
| 44 |
+
- **Datasets:** Hemg/AI-Generated-vs-Real-Images-Datasets
|
| 45 |
+
- **Library:** PyTorch
|
| 46 |
+
- **Pipeline Tag:** image-classification
|
| 47 |
+
- **Metrics:** Accuracy for both binary classification and multi-class object recognition
|
| 48 |
+
- **Version:** v1.0
|
| 49 |
+
|
| 50 |
+
## Limitations and Ethical Considerations
|
| 51 |
+
- **Pseudo-Labeling:** The object recognition task uses pseudo-labels generated from a pretrained model, which may introduce noise or bias.
|
| 52 |
+
- **Authenticity Sensitivity:** The binary classifier may face challenges with highly realistic AI-generated images.
|
| 53 |
+
- **Usage:** This model is intended for research and prototyping purposes. Additional validation is recommended before deploying in high-stakes applications.
|
| 54 |
+
|
| 55 |
+
## How to Cite
|
| 56 |
+
If you use this model, please cite:
|
| 57 |
+
```bibtex
|
| 58 |
+
@misc{multitask_classifier,
|
| 59 |
+
title={Multi-Task Image Classifier},
|
| 60 |
+
author={Abdellahi El Moustapha},
|
| 61 |
+
year={2025},
|
| 62 |
+
howpublished={\url{https://huggingface.co/Abdu07/multitask-model}}
|
| 63 |
+
}
|
| 64 |
+
```
|