Deep_Captcha / ML_USAGE_GUIDE.md
Knight07's picture
Initial upload: DeepCaptcha dataset with AI resistance levels and analysis image
cab6c03 verified

DeepCaptcha Dataset - ML Usage Guide

📁 Dataset Structure

deepcaptcha_dataset/
├── level_0_baseline/     # 600 images - No AI resistance
├── level_1_basic/        # 600 images - Basic AI resistance (PSNR 44.8dB)
├── level_2_moderate/     # 600 images - Moderate AI resistance (PSNR 39.1dB)
├── level_3_advanced/     # 600 images - Advanced AI resistance (PSNR 40.4dB)
├── mixed_levels/         # 600 images - Mixed resistance levels
└── metadata/             # JSON metadata files

🧠 ML Model Testing Strategies

1. Baseline Evaluation

  • Train on level_0_baseline images only
  • Test on all levels to measure AI resistance effectiveness
  • Expected: High accuracy on Level 0, degraded performance on Levels 1-3

2. Robustness Training

  • Train on mixed_levels for general robustness
  • Test on individual levels to measure specific resistance
  • Expected: Better overall robustness but potentially lower peak accuracy

3. Progressive Difficulty Testing

  • Train on Level 0, test on Levels 1, 2, 3 progressively
  • Measure performance degradation as AI resistance increases
  • Expected: Progressive accuracy decline with resistance level

4. Transfer Learning Evaluation

  • Pre-train on Level 0, fine-tune on higher levels
  • Test adaptation capability of existing models
  • Expected: Improved performance with adaptation

📊 Evaluation Metrics

Primary Metrics

  • Character Accuracy: Per-character recognition accuracy
  • Sequence Accuracy: Complete CAPTCHA sequence accuracy
  • Resistance Effectiveness: Accuracy drop from Level 0 to Level 3

Secondary Metrics

  • Processing Time: Model inference speed per image
  • Memory Usage: Model resource requirements
  • Generalization: Performance on unseen parameter combinations

💡 Suggested Experiments

Experiment 1: CNN Baseline

# Test standard CNN architectures
models = ['ResNet', 'VGG', 'EfficientNet']
for model in models:
    train_on_level_0()
    test_on_all_levels()
    measure_resistance_effectiveness()

Experiment 2: Data Augmentation Impact

# Compare with/without augmentation
augmentation_strategies = ['none', 'standard', 'adversarial']
for strategy in augmentation_strategies:
    train_with_augmentation(strategy)
    evaluate_robustness()

Experiment 3: Multi-Level Training

# Progressive training strategy
for target_level in [0, 1, 2, 3]:
    train_on_level(target_level)
    cross_evaluate_all_levels()
    analyze_specialization_vs_generalization()

🛡️ AI Resistance Analysis

Expected Results

  • Level 0: Vulnerable to all ML attacks
  • Level 1: 10-20% accuracy drop vs baseline
  • Level 2: 30-50% accuracy drop vs baseline
  • Level 3: 50-70% accuracy drop vs baseline

Key Insights to Validate

  1. Imperceptibility: Humans should achieve 95%+ accuracy on all levels
  2. Resistance Gradient: Performance should degrade with resistance level
  3. Attack Specificity: Different AI architectures may show varied susceptibility
  4. Adaptation Potential: Models may learn to overcome lower resistance levels

📋 Implementation Template

import json
from PIL import Image
import torch
import torchvision.transforms as transforms

def load_dataset_split(split_file):
    with open(split_file, 'r') as f:
        metadata = json.load(f)
    
    images, labels = [], []
    for item in metadata:
        img_path = os.path.join('deepcaptcha_dataset', 
                               get_category_dir(item['ai_resistance_level']),
                               item['filename'])
        img = Image.open(img_path)
        images.append(img)
        labels.append(item['text'])
    
    return images, labels

def evaluate_ai_resistance(model, dataset_dir):
    results = {}
    for level in [0, 1, 2, 3]:
        level_accuracy = test_on_level(model, level)
        results[f'level_{level}'] = level_accuracy
    
    resistance_effectiveness = (results['level_0'] - results['level_3']) / results['level_0']
    results['resistance_effectiveness'] = resistance_effectiveness
    
    return results

🎯 Success Criteria

A successful AI resistance validation should demonstrate:

  1. Maintained Human Readability: >95% human accuracy across all levels
  2. Effective AI Confusion: >50% accuracy drop from Level 0 to Level 3
  3. Graduated Resistance: Progressive performance degradation
  4. Practical Applicability: <100ms additional processing time per image

📈 Reporting Template

For each experiment, report:

  • Model architecture and parameters
  • Training data composition and size
  • Accuracy metrics per AI resistance level
  • Processing time and resource usage
  • Resistance effectiveness score
  • Recommendations for production deployment