A deep learning-based model to distinguish between AI-generated and human-created images. This repository includes data preprocessing, model training (ConVitX with ConvNeXt Large and Swin Transformer), evaluation using F1-score, and real-time deployment. Built for the Kaggle competition "Can You Tell the Difference?"
- Introduction
- Dataset
- Model Architecture
- Training
- Evaluation
- Deployment
- Usage
- Files
- Contributing
- License
- Contact
The goal of this project is to develop a deep learning model capable of distinguishing between images generated by AI and those created by humans. This is achieved using a combination of ConvNeXt Large and Swin Transformer architectures, named ConVitX.
The dataset used for this project is provided by the Kaggle competition "Can You Tell the Difference?". The dataset includes a variety of images, both AI-generated and human-created.
The model architecture consists of:
- ConVitX: A custom model constructed by combining ConvNeXt Large and Swin Transformer architectures.
- ConvNeXt Large: A convolutional network architecture designed for high performance on image classification tasks.
- Swin Transformer: A transformer architecture with shifted windows for efficient image processing.
The model is trained using the following steps:
- Data preprocessing
- Model training with ConVitX
- Hyperparameter tuning
The model is evaluated using the F1-score metric to ensure a balanced measure of precision and recall.
The trained model is deployed for real-time image classification, allowing users to input images and receive predictions on whether they are AI-generated or human-created.
To use the model for image classification, follow these steps:
- Clone the repository:
git clone https://github.com/SheemaMasood381/Detect_AI_vs_Human_Generated_Image.git - Install the required dependencies:
pip install -r requirements.txt - Run the classification script:
python classify_image.py --image_path path_to_image
README.md: Project overview and instructionsapp.py: Main application script for deploymentinference.py: Script for making inferences with the trained modellb.PNG: Leaderboard snapshot showing 28th positionload_model.py: Script for loading the trained modelmodel.py: Model architecture definitionnotebooks/: Directory containing Jupyter notebooks for experimentationrequirements.txt: List of dependencies required for the project
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository
- Create a new branch:
git checkout -b feature-branch - Make your changes
- Commit your changes:
git commit -m 'Add new feature' - Push to the branch:
git push origin feature-branch - Create a pull request
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to reach out to me on LinkedIn for any queries or collaborations.

