Image Classification --- Data Diagnostics & Baseline Modeling
Table of Contents
Open-source skill.
Scope Boundary
Use this skill when:
- The task is supervised image classification with labeled folders or label metadata.
- A reproducible baseline is needed before transfer learning, ViT, or ensembles.
Do not use this skill when:
- The task is detection, segmentation, captioning, retrieval, video understanding, or generation.
- The dataset is so small that any result should be treated only as a smoke test, not a benchmark.
- The main signal is tabular metadata rather than image pixels.
Workflow
Read each step file in workflow/ before executing that step.
| Step |
Responsibility |
Executor |
Document |
Input |
Output |
| Collect |
Collect Inputs |
Main Agent |
workflow/step01-collect-inputs.md |
User input |
Structured input summary |
| Diagnose |
Check Distribution |
Main Agent |
workflow/step02-check-distribution.md |
Prior step output |
PART 1 code block |
| Baseline |
Run Primary Test |
Main Agent |
workflow/step03-run-primary-test.md |
Prior step output |
PART 2-3 code blocks + T1 track artifacts |
Decision Tree
1. CHECK CLASS BALANCE
├── Balanced (minority ≥ 10%) → standard methods
└── Imbalanced (minority < 10%) → weighted loss, data augmentation note
2. IMAGE SIZE STRATEGY
├── Uniform size → use directly
└── Variable size → resize to common dimension (224x224 default)
3. BASELINE MODEL SELECTION
├── N ≥ 1000 → Simple CNN (train from scratch)
└── N < 1000 → Pre-trained feature extractor (ResNet18) + LogReg
# N=1000 threshold: below this, from-scratch CNNs typically overfit (too few examples
# per parameter). ResNet18 is deliberately the smallest modern ResNet — large enough
# to carry useful ImageNet features, small enough that feature-extraction + LogReg is
# tractable on CPU. Larger backbones (ResNet50, ViT) are reserved for the analyzing skill.
Required Inputs
| Role |
What to collect |
| Image source |
Directory path, dataset name, or file format |
| Label source |
Subdirectory names, CSV mapping, or metadata |
| Image format |
PNG, JPEG, DICOM, etc. |
| Number of classes |
Binary or multi-class |
Code Structure
PART 0: Setup & Data Loading
PART 1: Data Diagnostics → plot_01_data_overview.png
PART 2: Baseline Classification → plot_02_confusion_roc.png
PART 3: Recommendation Block → text pointing to analysis workflow
Reporting Standards
- Metrics: weighted F1 and macro AUC (OVR) — always with 95% bootstrapped CIs
- For imbalanced classes (minority < 10%): also report PR-AUC (Average Precision) — primary discrimination metric under imbalance.
- Format: "F1 = 0.XXX, 95% CI [0.XXX, 0.XXX]"; "PR-AUC = 0.XXX, 95% CI [..., ...]"
- AUC: "AUC = 0.XXX, 95% CI [0.XXX, 0.XXX]"
- Decimal places: 3 for F1/AUC, 1 for percentages, 0 for counts
- Image dimensions: report as HxWxC
- Sample size: report final analytic N (train/val/test split sizes)
- Data augmentation: always report what augmentations were applied
- Bootstrapped CIs: 1000 iterations, 2.5th/97.5th percentiles
Models Available
| Status |
Models |
| Implemented in this skill |
Simple CNN (larger datasets) or ResNet18 feature extractor + Logistic Regression (small datasets) |
Implemented downstream in vera-ai-image-generating |
ResNet50, EfficientNet-B0, VGG16 (legacy replication only), DenseNet121, ViT-B/16, soft voting, stacking, GradCAM, attention maps |
| Planned but not yet shipped |
ConvNeXt-Tiny is a roadmap item only; there is no open-source src/ module for it yet |
Example Dataset
torchvision built-ins: CIFAR10, FashionMNIST, MNIST.
Python: from torchvision.datasets import CIFAR10
Configuration Defaults
Pipeline constants live in config/default.json. Read it before generation. Key knobs:
alpha, ci_level — inference thresholds
plot_dpi, plot_width, plot_height — figure dimensions
bootstrap_iterations — bootstrap CIs for metrics
split.{test_size, val_size_of_train, random_state} — data-split reproducibility
image.{resize, normalize_mean, normalize_std} — preprocessing (ImageNet norms by default)
baseline.{N_threshold, small_N_model, large_N_model} — N-dependent baseline choice (ResNet18 feature extractor for small N; simple CNN for large N)
augmentation.* — train-time augmentation pipeline
class_balance_threshold — minority-class rare-event threshold
To override: create config/local.json; the runtime merges local over default.
Why These Defaults
baseline.N_threshold = 1000 is a practical overfitting guardrail, not a formal cutoff. Below that scale, frozen transfer features usually behave more predictably than a from-scratch CNN in open-source baseline runs.
image.resize = 224x224 and ImageNet normalization are defaults because they align with the shipped torchvision backbones and make the baseline comparable to the downstream transfer-learning models.
- PR-AUC is promoted under class imbalance for the same reason as the NLP and structured skills: ROC-AUC often looks healthier than the positive-class retrieval story when negatives dominate.
Minimal Smoke Test
- Smoke-test prompt: "Run
vera-ai-image-reviewing on a 2-4 class subset of CIFAR-10 or an equivalent ImageFolder dataset. Produce the standard T1 artifacts."
- Suggested fixture: 20-100 images per class for a CPU-only smoke test; use the ResNet18 feature-extractor branch if the sample is small.
- Expected pass condition: the run writes one runnable Python script,
methods.md, results.md, tables/, references.bib, and the two baseline figures listed below.
Cross-Skill Interface
Output:
├── code_python → .py script
├── methods_md → methods.md baseline fragment
├── results_md → results.md baseline results fragment
├── tables/ → Markdown/CSV tables for dataset stats + metrics
├── figures/ → 2 PNGs (data overview + confusion/ROC)
├── references_bib → .bib with baseline/evaluation citations
└── recommendations → text block (what analysis workflow produces)
When this skill is used as T1_baseline inside vera-ai-application-pipelining,
the standardized track artifacts above are REQUIRED, not optional.
1---2name: vera-ai-image-reviewing3description: Runs data quality diagnostics and baseline image classification. Produces class distribution tables, sample image grids, image size and channel statistics, a baseline CNN or pre-trained feature extractor with Logistic Regression, weighted F1 and macro AUC (bootstrapped 95% CIs), confusion matrix, and ROC curves. Ends with a recommendation block listing additional models available in the analysis workflow. Outputs Python scripts with 2 publication-quality plots. Triggered when user has image data and says "image classification," "computer vision," "CNN," "object recognition," "medical imaging," "image detection," "visual recognition," "photo classification," "X-ray classification," or describes a task involving classifying images into categories. Does not handle free-text NLP or tabular-only data.4---56# Image Classification --- Data Diagnostics & Baseline Modeling78## Table of Contents910- [Scope Boundary](#scope-boundary)11- [Workflow](#workflow)12- [Decision Tree](#decision-tree)13- [Required Inputs](#required-inputs)14- [Code Structure](#code-structure)15- [Reporting Standards](#reporting-standards)16- [Models Available](#models-available)17- [Example Dataset](#example-dataset)18- [Configuration Defaults](#configuration-defaults)19- [Why These Defaults](#why-these-defaults)20- [Minimal Smoke Test](#minimal-smoke-test)21- [Cross-Skill Interface](#cross-skill-interface)222324Open-source skill.2526## Scope Boundary2728Use this skill when:29- The task is supervised image classification with labeled folders or label metadata.30- A reproducible baseline is needed before transfer learning, ViT, or ensembles.3132Do not use this skill when:33- The task is detection, segmentation, captioning, retrieval, video understanding, or generation.34- The dataset is so small that any result should be treated only as a smoke test, not a benchmark.35- The main signal is tabular metadata rather than image pixels.3637## Workflow3839Read each step file in `workflow/` before executing that step.4041| Step | Responsibility | Executor | Document | Input | Output |42|---|---|---|---|---|---|43| Collect | Collect Inputs | Main Agent | `workflow/step01-collect-inputs.md` | User input | Structured input summary |44| Diagnose | Check Distribution | Main Agent | `workflow/step02-check-distribution.md` | Prior step output | PART 1 code block |45| Baseline | Run Primary Test | Main Agent | `workflow/step03-run-primary-test.md` | Prior step output | PART 2-3 code blocks + T1 track artifacts |4647## Decision Tree4849```501. CHECK CLASS BALANCE51 ├── Balanced (minority ≥ 10%) → standard methods52 └── Imbalanced (minority < 10%) → weighted loss, data augmentation note53542. IMAGE SIZE STRATEGY55 ├── Uniform size → use directly56 └── Variable size → resize to common dimension (224x224 default)57583. BASELINE MODEL SELECTION59 ├── N ≥ 1000 → Simple CNN (train from scratch)60 └── N < 1000 → Pre-trained feature extractor (ResNet18) + LogReg61 # N=1000 threshold: below this, from-scratch CNNs typically overfit (too few examples62 # per parameter). ResNet18 is deliberately the smallest modern ResNet — large enough63 # to carry useful ImageNet features, small enough that feature-extraction + LogReg is64 # tractable on CPU. Larger backbones (ResNet50, ViT) are reserved for the analyzing skill.65```6667## Required Inputs6869| Role | What to collect |70|---|---|71| **Image source** | Directory path, dataset name, or file format |72| **Label source** | Subdirectory names, CSV mapping, or metadata |73| **Image format** | PNG, JPEG, DICOM, etc. |74| **Number of classes** | Binary or multi-class |7576## Code Structure7778```79PART 0: Setup & Data Loading80PART 1: Data Diagnostics → plot_01_data_overview.png81PART 2: Baseline Classification → plot_02_confusion_roc.png82PART 3: Recommendation Block → text pointing to analysis workflow83```8485## Reporting Standards86871. Metrics: weighted F1 and macro AUC (OVR) — always with 95% bootstrapped CIs882. **For imbalanced classes (minority < 10%)**: also report **PR-AUC (Average Precision)** — primary discrimination metric under imbalance.893. Format: "F1 = 0.XXX, 95% CI [0.XXX, 0.XXX]"; "PR-AUC = 0.XXX, 95% CI [..., ...]"904. AUC: "AUC = 0.XXX, 95% CI [0.XXX, 0.XXX]"915. Decimal places: 3 for F1/AUC, 1 for percentages, 0 for counts926. Image dimensions: report as HxWxC937. Sample size: report final analytic N (train/val/test split sizes)948. Data augmentation: always report what augmentations were applied959. Bootstrapped CIs: 1000 iterations, 2.5th/97.5th percentiles9697## Models Available9899| Status | Models |100|---|---|101| Implemented in this skill | Simple CNN (larger datasets) or ResNet18 feature extractor + Logistic Regression (small datasets) |102| Implemented downstream in `vera-ai-image-generating` | ResNet50, EfficientNet-B0, VGG16 (legacy replication only), DenseNet121, ViT-B/16, soft voting, stacking, GradCAM, attention maps |103| Planned but not yet shipped | ConvNeXt-Tiny is a roadmap item only; there is no open-source `src/` module for it yet |104105## Example Dataset106107torchvision built-ins: `CIFAR10`, `FashionMNIST`, `MNIST`.108Python: `from torchvision.datasets import CIFAR10`109110## Configuration Defaults111112Pipeline constants live in `config/default.json`. Read it before generation. Key knobs:113114- `alpha`, `ci_level` — inference thresholds115- `plot_dpi`, `plot_width`, `plot_height` — figure dimensions116- `bootstrap_iterations` — bootstrap CIs for metrics117- `split.{test_size, val_size_of_train, random_state}` — data-split reproducibility118- `image.{resize, normalize_mean, normalize_std}` — preprocessing (ImageNet norms by default)119- `baseline.{N_threshold, small_N_model, large_N_model}` — N-dependent baseline choice (ResNet18 feature extractor for small N; simple CNN for large N)120- `augmentation.*` — train-time augmentation pipeline121- `class_balance_threshold` — minority-class rare-event threshold122123To override: create `config/local.json`; the runtime merges local over default.124125## Why These Defaults126127- `baseline.N_threshold = 1000` is a practical overfitting guardrail, not a formal cutoff. Below that scale, frozen transfer features usually behave more predictably than a from-scratch CNN in open-source baseline runs.128- `image.resize = 224x224` and ImageNet normalization are defaults because they align with the shipped torchvision backbones and make the baseline comparable to the downstream transfer-learning models.129- PR-AUC is promoted under class imbalance for the same reason as the NLP and structured skills: ROC-AUC often looks healthier than the positive-class retrieval story when negatives dominate.130131## Minimal Smoke Test132133- Smoke-test prompt: "Run `vera-ai-image-reviewing` on a 2-4 class subset of CIFAR-10 or an equivalent `ImageFolder` dataset. Produce the standard T1 artifacts."134- Suggested fixture: 20-100 images per class for a CPU-only smoke test; use the ResNet18 feature-extractor branch if the sample is small.135- Expected pass condition: the run writes one runnable Python script, `methods.md`, `results.md`, `tables/`, `references.bib`, and the two baseline figures listed below.136137## Cross-Skill Interface138139```140Output:141├── code_python → .py script142├── methods_md → methods.md baseline fragment143├── results_md → results.md baseline results fragment144├── tables/ → Markdown/CSV tables for dataset stats + metrics145├── figures/ → 2 PNGs (data overview + confusion/ROC)146├── references_bib → .bib with baseline/evaluation citations147└── recommendations → text block (what analysis workflow produces)148```149150When this skill is used as `T1_baseline` inside `vera-ai-application-pipelining`,151the standardized track artifacts above are REQUIRED, not optional.