CoolFace
Modelpublic

arman-chopikyan/generated-image-quality-assessment

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
Model Card

Report: Generated Image Quality Assessment Model

1. Introduction

This report details the development of a model for evaluating the quality of AI-generated human images. The evaluation criteria include:

  • Relevance to the text prompt
  • Visual quality and aesthetics
  • Presence of artifacts and distortions
  • Overall Quality

The workflow consists of three key stages:

  1. 1.Dataset Preparation using ChatGPT VLM and CLIP embeddings.
  2. 2.Model Training of distilled model leveraging CLIP features.
  3. 3.Evaluation of model performance.

2. Dataset Preparation (Dataset.ipynb)

Due to cost and resource constraints, only 10,000 images were sourced from DiffusionDB, filtered to retain only human-related images. After removing invalid or problematic images, the final dataset size was 9,432.

Data Processing Workflow

  1. 1.Filtering Prompts: Extracting images with human-related keywords (e.g., "man", "woman", "child").
  2. 2.Downloading Images: Retrieving images from DiffusionDB based on filtered metadata.
  3. 3.Generating Annotations Using ChatGPT VLM:
  4. 4.GPT-4o Mini was used to assess:
  5. 5.Relevance to the prompt (0.0 - 1.0 scale)
  6. 6.Visual quality (composition, clarity, aesthetics)
  7. 7.Presence of artifacts (missing parts, distortions, unnatural anatomy). Important note: 1 indicates artifact presence, 0 indicates absence. This approach was chosen as detecting artifact presence is significantly easier for the network compared to detecting their absence.
  8. 8.Generating CLIP Embeddings:
  9. 9.Image and text embeddings were extracted using CLIP ViT-B/32.
  10. 10.Dataset Splitting:
  11. 11.80% training, 15% validation, and 5% test split.

Dataset Analysis

A histogram-based analysis was performed to examine score distributions. The dataset exhibited high imbalance, with some quality scores appearing far more frequently than others. To address this, weighted binary cross-entropy was employed during training.

The final dataset used in this study can be accessed at:


3. Model Training (Training.ipynb)

A lightweight regression model was trained using CLIP embeddings to predict quality scores for new images.

Model Architecture

  • Input: Concatenated CLIP image and text embeddings.
  • Output: Predictions for four quality metrics.
Network Structure:
plaintext
Linear(1024, 256) → ReLU
Linear(256, 4) → Sigmoid

Training Setup

  • Optimizer: Adam (learning rate = 1e-4)
  • Loss Function: Weighted Binary Cross-Entropy (compensating for class imbalance)
  • Epochs: 100 (early stopping applied)
  • Batch Size: 512

4. Evaluation (Evaluation.ipynb)

The trained model was tested on a held-out test dataset, and its performance was analyzed across multiple metrics.

Model Performance Metrics

The evaluation was conducted using multiple metrics to assess accuracy, precision, recall, and F1-score across different categories.

Training Results
MetricOverall
Accuracy0.8326
Precision0.9930
Recall0.9576
F1 Score0.9746
Per-Category Metrics:
CategoryAccuracyPrecisionRecallF1 Score
Relevance0.96330.98870.97120.9799
Visual Quality0.98950.99900.99030.9947
Artifacts0.88600.98950.88810.9360
Final Probability0.97650.99480.98080.9878
Validation Results
MetricOverall
Accuracy0.7603
Precision0.9699
Recall0.9466
F1 Score0.9579
Per-Category Metrics:
CategoryAccuracyPrecisionRecallF1 Score
Relevance0.91510.95530.95080.9530
Visual Quality0.96820.98830.97900.9836
Artifacts0.85710.96070.88400.9208
Final Probability0.95050.97550.97260.9740

Test Results

Overall Metrics
MetricValue
Accuracy0.7611
Precision0.9741
Recall0.9480
F1 Score0.9606
Per-Category Metrics
CategoryAccuracyPrecisionRecallF1 Score
Relevance0.92810.96520.95630.9607
Visual Quality0.97670.99130.98480.9881
Artifacts0.84780.95770.87500.9145
Final Probability0.95980.98220.97570.9790

The model corresponding to the reported results can be accessed at:


5. Conclusion

The model achieved promising results given the imposed constraints on cost, time and computational resources. Despite these limitations, the evaluation metrics indicate that the approach is effective for assessing AI-generated human images.

Constraints and Future Improvements

  • GPT-4o Mini was chosen over GPT-4o due to its significantly lower cost and faster processing speed. However, GPT-4o is a much more powerful model and could improve results significantly if used.
  • The dataset size was capped at 10,000 images due to computational and financial constraints. A larger dataset would likely enhance performance.
  • A lightweight head network was selected to balance computational feasibility with effective learning. A more complex model could further improve results but requires more computational power.

By addressing these areas, the model can achieve significantly better results in real-world applications.