Examples¶
The examples/ directory contains runnable scripts demonstrating AutoTimm features.
Examples Organization¶
graph LR
A[<b>AutoTimm<br/>Examples</b>] --> B[<b>Getting Started</b><br/>Classification,<br/>data loading]
A --> C[<b>Computer Vision</b><br/>Detection,<br/>segmentation]
A --> D[<b>HuggingFace</b><br/>Hub integration,<br/>model sharing]
A --> E[<b>Training</b><br/>HPO, multi-GPU,<br/>auto-tuning]
A --> F[<b>Understanding</b><br/>GradCAM, attention,<br/>feature maps]
A --> G[<b>CLI</b><br/>YAML configs,<br/>command line]
style A fill:#1565C0,stroke:#0D47A1
style B fill:#1976D2,stroke:#1565C0
style C fill:#1565C0,stroke:#0D47A1
style D fill:#1976D2,stroke:#1565C0
style E fill:#1565C0,stroke:#0D47A1
style F fill:#1976D2,stroke:#1565C0
style G fill:#1565C0,stroke:#0D47A1
Quick Reference¶
Getting Started¶
- Classification - Start with CIFAR-10 and custom datasets
- HuggingFace Hub Basics - Load and use HF Hub models
Computer Vision Tasks¶
- Object Detection - FCOS, YOLOX, RT-DETR, and transformers
- Semantic Segmentation - DeepLabV3+ and FCN
- Instance Segmentation - Mask R-CNN style
HuggingFace Advanced¶
- Model Interpretation - GradCAM, attention visualization, metrics
- Transfer Learning - LLRD, progressive unfreezing
- Ensemble & Distillation - Model ensembles and knowledge distillation
- Deployment - ONNX, quantization, serving
- Custom Data - Advanced augmentation and data handling
- Hyperparameter Tuning - Optuna integration
Training & Optimization¶
- Training Utilities - Auto-tuning, multi-GPU, presets
- Data Handling - Balanced sampling, augmentation
- Logging & Metrics - TensorBoard, MLflow, evaluation
CLI¶
- CLI Examples - Train from YAML configs on the command line
Model Understanding¶
- Interpretation Methods - Comprehensive interpretation toolkit
- Backbone Utilities - Discover and compare models
All Examples by Category¶
Getting Started¶
| Script | Description |
|---|---|
getting_started/classify_cifar10.py |
ResNet-18 on CIFAR-10 with MetricManager |
getting_started/classify_custom_folder.py |
Train on custom ImageFolder dataset with W&B |
getting_started/vit_finetuning.py |
Two-phase ViT fine-tuning |
Computer Vision Tasks¶
Object Detection:
| Script | Description |
|---|---|
computer_vision/object_detection_coco.py |
FCOS-style object detection on COCO |
computer_vision/object_detection_yolox.py |
YOLOX object detection |
computer_vision/object_detection_rtdetr.py |
RT-DETR transformer detection |
computer_vision/object_detection_transformers.py |
Vision Transformers for detection |
computer_vision/explore_yolox_models.py |
Explore YOLOX model variants |
computer_vision/yolox_official.py |
Official YOLOX implementation |
Segmentation:
| Script | Description |
|---|---|
computer_vision/semantic_segmentation.py |
DeepLabV3+ semantic segmentation |
computer_vision/instance_segmentation.py |
Mask R-CNN style instance segmentation |
HuggingFace Hub Integration¶
Basic Integration:
| Script | Description |
|---|---|
huggingface/huggingface_hub_models.py |
Introduction to HF Hub |
huggingface/hf_hub_classification.py |
Classification with HF Hub |
huggingface/hf_hub_segmentation.py |
Segmentation with HF Hub |
huggingface/hf_hub_object_detection.py |
Detection with HF Hub |
huggingface/hf_hub_instance_segmentation.py |
Instance segmentation with HF Hub |
huggingface/hf_hub_advanced.py |
Advanced HF Hub features |
huggingface/hf_hub_lightning_integration.py |
Lightning compatibility |
huggingface/hf_direct_models_lightning.py |
Direct HF Transformers models |
Advanced HF Hub:
| Script | Description |
|---|---|
huggingface/hf_interpretation.py |
Model interpretation (GradCAM, attention, metrics) |
huggingface/hf_transfer_learning.py |
LLRD, progressive unfreezing |
huggingface/hf_ensemble.py |
Ensembles and knowledge distillation |
huggingface/hf_deployment.py |
ONNX export, quantization, serving |
Data & Augmentation¶
| Script | Description |
|---|---|
data_training/balanced_sampling.py |
Weighted sampling for imbalanced data |
data_training/albumentations_cifar10.py |
Albumentations strong augmentation |
data_training/albumentations_custom_folder.py |
Custom albumentations pipeline |
data_training/multilabel_classification.py |
Multi-label classification with CSV data |
data_training/csv_classification.py |
Classification from CSV files |
data_training/csv_detection.py |
Object detection from CSV annotations |
data_training/csv_segmentation.py |
Semantic segmentation from CSV |
data_training/csv_instance_segmentation.py |
Instance segmentation from CSV |
data_training/hf_custom_data.py |
Advanced augmentation, multi-label, validation |
Training & Optimization¶
| Script | Description |
|---|---|
data_training/auto_tuning.py |
Automatic LR and batch size finding |
data_training/multi_gpu_training.py |
Multi-GPU and distributed training |
data_training/preset_manager.py |
Training presets and configurations |
data_training/performance_optimization_demo.py |
Performance optimization techniques |
data_training/hf_hyperparameter_tuning.py |
Optuna hyperparameter optimization |
Model Interpretation¶
| Script | Description |
|---|---|
interpretation/interpretation_demo.py |
Basic interpretation and visualization |
interpretation/interpretation_metrics_demo.py |
Interpretation with metrics analysis |
interpretation/interpretation_phase2_demo.py |
Advanced techniques (Phase 2) |
interpretation/interpretation_phase3_demo.py |
Advanced techniques (Phase 3) |
interpretation/interactive_visualization_demo.py |
Interactive Plotly visualizations |
interpretation/comprehensive_interpretation_tutorial.ipynb |
Comprehensive tutorial (Notebook) |
Logging & Experiment Tracking¶
| Script | Description |
|---|---|
logging_inference/multiple_loggers.py |
TensorBoard + CSV logging |
logging_inference/mlflow_tracking.py |
MLflow experiment tracking |
logging_inference/detailed_evaluation.py |
Confusion matrix and per-class metrics |
CLI¶
| Config | Description |
|---|---|
cli/classification.yaml |
CLI config for image classification |
cli/detection.yaml |
CLI config for object detection |
cli/segmentation.yaml |
CLI config for semantic segmentation |
Deployment & Export¶
| Script | Description |
|---|---|
deployment/export_to_onnx.py |
Export models to ONNX for cross-platform deployment |
deployment/export_to_torchscript.py |
Export models to TorchScript for production |
deployment/deploy_torchscript_cpp.py |
C++ and mobile deployment |
Inference & Utilities¶
| Script | Description |
|---|---|
logging_inference/inference.py |
Model inference and batch prediction |
logging_inference/inference_without_metrics.py |
Inference without metrics |
logging_inference/multilabel_inference.py |
Multi-label inference and per-label probabilities |
logging_inference/detection_inference.py |
Object detection inference |
logging_inference/segmentation_inference.py |
Segmentation inference |
logging_inference/backbone_discovery.py |
Explore timm backbones |
Getting Started¶
To run any example:
# Clone the repository
git clone https://github.com/theja-vanka/AutoTimm.git
cd AutoTimm
# Install AutoTimm with all dependencies
pip install -e ".[all]"
# Run an example
python examples/getting_started/classify_cifar10.py
Example Categories Summary¶
Getting Started (3 examples)¶
Start your journey with CIFAR-10 classification and custom datasets.
Computer Vision Tasks (8 examples)¶
- Classification - Basic to advanced classification
- Object Detection - FCOS, YOLOX, RT-DETR, transformers (6 examples)
- Segmentation - Semantic and instance segmentation (2 examples)
HuggingFace Hub (12 examples)¶
- Basic Integration - 8 task-specific examples
- Advanced Techniques - Interpretation, transfer learning, ensemble, deployment (4 examples)
Data & Training (14 examples)¶
- Data & Augmentation - Balanced sampling, augmentation, multi-label, CSV loading (9 examples)
- Training & Optimization - Auto-tuning, multi-GPU, HPO (5 examples)
CLI (3 configs)¶
Train from the command line with YAML configuration files.
Understanding & Deployment (13 examples)¶
- Model Interpretation - GradCAM, attention, interactive viz (6 examples)
- Logging & Tracking - TensorBoard, MLflow, evaluation (3 examples)
- Inference & Utilities - Model inference, multi-label inference, and backbone discovery (4 examples)
Total: 50+ runnable examples and configs