Augmentation and scene-safe splits
Quick answer
Image augmentation creates training variations that preserve target meaning. Scene-safe splitting keeps related images, crops or views in one partition to prevent near-duplicate leakage. Examples are static Python snippets tested locally on PyTorch CPU. ByteMind execution is unverified.
Orientation-preserving flip
import torchx=torch.tensor([[0,1,0,0],[0,1,0,0]])print(x.flip(-1).tolist())Expected output (locally tested): [[0, 0, 1, 0], [0, 0, 1, 0]]. Column changes, orientation remains vertical.
How it works
Split by original scene or capture group before augmentation. Apply stochastic label-preserving transforms to training only by default; use fixed evaluation preprocessing. Horizontal flip preserves vertical-versus-horizontal bar labels, whereas 90-degree rotation swaps them. Flips may invalidate left/right labels or text. Detection and segmentation transforms must also update boxes and masks (next chapter). Use seeded choices for reproducibility. Compare architectures with identical scene partitions, batch order, update budgets and augmentation policy; report parameter counts and hyperparameters. Select checkpoints and architecture by validation loss, then open final test labels. Dense networks flatten spatial structure; CNNs share weights and have a spatial inductive bias, not guaranteed superiority. Use generated geometric images, no biometric inference.
Scene separation audit
train=["a","a","b"]; val=["c","c"]; test=["d"]print(not(set(train)&set(val) or set(train)&set(test) or set(val)&set(test)))print(bool(set(train)&{"b","e"}))Expected output (locally tested): True True. First split is valid; second proposed split overlaps b.
Common mistakes
Do not split augmented copies independently. Do not fit normalization on held-out data or apply random training augmentation to ordinary evaluation. Not all transforms preserve labels.
Practice and next steps
Audit scene IDs, flip a vertical bar, then compare CNN and dense models on the same synthetic images.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Augmentation and scene-safe splits — knowledge check
Apply augmentation and scene-safe splits to small examples and debugging scenarios.
When split original scenes?
Which transform changes bar orientation labels?
Where apply stochastic training augmentation?
How compare dense and CNN?
Why share CNN weights?