Skip to content

Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN013 · Training method

CutMix

Pastes a region from one training image into another and mixes targets according to the actual replaced area.

Explained here Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Pastes a region from one training image into another and mixes targets according to the actual replaced area.

Question / hypotheses

Does this intervention improve the intended quality, adaptation, resource, or reliability objective under a controlled comparison? It defines a method, not an intrinsic null-hypothesis test.

Architecture / computational structure

A binary spatial mask combines two inputs before the unchanged classification network.

Assumptions

The label-mixing rule assumes the pasted area carries proportional target information. Dense prediction, object detection, and video require appropriately transformed annotations and temporal masks.

Formula / computational definition

x~=M⊙xi+(1−M)⊙xj,y~=λyi+(1−λ)yj,λ=mean⁡(M).\tilde x=M\odot x_i+(1-M)\odot x_j,\quad\tilde y=\lambda y_i+(1-\lambda)y_j,\quad\lambda=\operatorname{mean}(M).

Parameters and notation

Learned: network weights. Hyperparameters: region-size distribution, probability, mask shape, pairing. Recompute lambda after clipping a sampled box to image bounds.

Fitting, fine-tuning, and adaptation

Use only training examples and preserve the evaluation image transform. For transfer, test whether CutMix helps the new task’s localized evidence rather than assuming it is beneficial.

How to use and calibrate

Inspect augmented examples visually and compare clean/occluded performance. Example: adapt an image classifier with small labeled data.

Example application

adapt an image classifier with small labeled data.

Interpretation / pitfalls

Watch out

A small pasted region can contain the entire discriminative object, invalidating area-proportional semantics. Missing label transformations create training noise.

Python and R code examples

Scope: numerical mechanism demonstration. Validation: Python executed successfully on the supplied synthetic inputs; R reviewed but not executed (Rscript unavailable).

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — numerical mechanism demonstration. · needs numpy

import numpy as np
a=np.ones((4,4)); b=np.zeros((4,4)); mask=np.ones((4,4)); mask[1:3,1:3]=0
print(mask*a+(1-mask)*b); print("original-label weight",mask.mean())
R

Component demo, not a trained model — numerical mechanism demonstration.

a <- matrix(1,4,4); b <- matrix(0,4,4); mask <- matrix(1,4,4); mask[2:3,2:3] <- 0
print(mask*a+(1-mask)*b); print(mean(mask))

Sources

From the CodeSplash reference, entry TRN013.