SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1905.04899 · 2019

CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features

Seong Oh, Sanghyuk Chun, Sangdoo Yun, Dongyoon Han, Junsuk Choe, Youngjoon Yoo

arXiv · PDF · Open in the Atlas

Code that ran

17 of 24 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 7 failures of our instrument; 7 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1905.04899.json · badge: /api/ran/1905.04899.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
toshi-k/kaggle-bengaliai-handwritten-grapheme-classification community
Papers with Code archive
5 ran · 1 no recorded run
ildoonet/cutmix community
Papers with Code archive
2 ran · 1 no recorded run
Westlake-AI/openmixup community
Papers with Code archive
2 ran · 0 no recorded run
xden2331/attentive_cutmix community
Papers with Code archive
1 ran · 1 no recorded run
sangHa0411/VIT community
Papers with Code archive
1 ran · 0 no recorded run
DevBruce/CutMixImageDataGenerator_For_Keras community
Papers with Code archive
1 ran · 0 no recorded run
wangermeng2021/FastClassification community
Papers with Code archive
1 ran · 0 no recorded run
IlyaDobrynin/GridMixup community
Papers with Code archive
1 ran · 0 no recorded run
pytorch/vision community
Papers with Code archive
1 ran · 0 no recorded run
hysts/pytorch_cutmix community
Papers with Code archive
1 ran · 0 no recorded run
PsorTheDoctor/microarray-data community
Papers with Code archive
1 ran · 0 no recorded run
airplane2230/keras_cutmix community
Papers with Code archive
0 ran · 1 no recorded run
liuch37/image-processing community
Papers with Code archive
0 ran · 1 no recorded run
copy not recorded community
not in the paper's declared repositories
0 ran · 1 no recorded run
jis478/Tensorflow community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
BengaliCutMixDataset Ran
ran on a synthesized input · constructed an object; no result was computed
toshi-k/kaggle-bengaliai-handwritten-grapheme-classification/source/02_nn_solution/debug_dataset.py
code served (permissive licence) · get_code("692f9c66ea826dc6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BengaliCutMixDataset: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from pathlib import Path
import tempfile
import os
import cv2
import pandas as pd

torch.manual_seed(0)
np.random.seed(0)

# Create a temporary directory with dummy images
temp_dir = tempfile.mkdtemp()
dir_img = Path(temp_dir)

# Create a few dummy image files
for i in range(3):
    img = np.random.randint(0, 256, (137, 236), dtype=np.uint8)
    cv2.imwrite(str(dir_img / f"image_{i:05d}.png"), img)

# Create a dummy CSV with labels
train_data = {
    'image_id': ['image_00000', 'image_00001', 'image_00002'],
    'grapheme_root': [0, 1, 2],
    'vowel_diacritic': [0, 1, 2],
    'consonant_diacritic': [0, 1, 2]
}
train_csv = pd.DataFrame(train_data)

# Define a simple augmenter function
def get_augmenter_func():
    class SimpleAugmenter:
        def __call__(self, image):
            return {'image': image}
    return SimpleAugmenter()

# Build arguments for BengaliCutMixDataset
ARGS = {
    'alpha': 1.0,
    'dir_img': dir_img,
    'list_images': ['image_00000.png', 'image_00001.png', 'image_00002.png'],
    'train_csv': train_csv,
    'images_array': None,
    'is_aug': False,
    'get_augmenter_func': get_augmenter_func
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy, pandas, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BengaliCutMixDataset — the run constructed an instance of its own class and did not call it; no shape is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
BengaliDataset Ran
ran on a synthesized input · constructed an object; no result was computed
toshi-k/kaggle-bengaliai-handwritten-grapheme-classification/source/02_nn_solution/debug_dataset.py
code served (permissive licence) · get_code("5c69813c92b3303b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BengaliDataset: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
import cv2
from pathlib import Path
import pandas as pd
import torchvision.transforms as transforms

torch.manual_seed(0)

# Define constants used in the module
HEIGHT = 137
WIDTH = 236
SIZE = 128
NUM_CONSONANT = 7
NUM_GRAPHEME_ROOT = 168
NUM_VOWEL = 11

# Create a small stand-in augmenter function that returns identity transforms
def get_augmenter_func():
    class SimpleAugmenter:
        def __call__(self, image=None, **kwargs):
            return {'image': image}
    return SimpleAugmenter()

# Create a small sample train_csv dataframe
train_csv = pd.DataFrame({
    'image_id': ['image_001', 'image_002'],
    'grapheme_root': [5, 10],
    'vowel_diacritic': [2, 4],
    'consonant_diacritic': [1, 3]
})

# Create a small images_array with shape (2, 137, 236, 1) containing grayscale images
images_array = np.random.randint(0, 256, size=(2, HEIGHT, WIDTH, 1), dtype=np.uint8)

# Create list of image file names
list_images = ['image_001.png', 'image_002.png']

# Create a temporary directory path (not actually used in this setup)
dir_img = Path('/tmp/bengali_images')

ARGS = {
    'dir_img': dir_img,
    'list_images': list_images,
    'train_csv': train_csv,
    'images_array': images_array,
    'is_aug': False,
    'get_augmenter_func': get_augmenter_func
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy, pandas, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BengaliDataset — the run constructed an instance of its own class and did not call it; no shape is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
CutMix Ran
ran on a synthesized input · constructed an object; no result was computed
ildoonet/cutmix/cutmix/cutmix.py
code served (permissive licence) · get_code("88fd3e4e4d1fa77c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, CutMix: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
import random
from torch.utils.data.dataset import Dataset

torch.manual_seed(0)
np.random.seed(0)

# Create a minimal dataset class with the required interface
class SimpleDataset(Dataset):
    def __init__(self, num_samples=4, num_classes=3):
        self.num_samples = num_samples
        self.num_classes = num_classes
    
    def __getitem__(self, index):
        # Return (image, label)
        # Image: 3 channels, 8x8 spatial dimensions
        img = torch.randn(3, 8, 8, dtype=torch.float32)
        label = index % self.num_classes
        return (img, label)
    
    def __len__(self):
        return self.num_samples

# Instantiate the base dataset
base_dataset = SimpleDataset(num_samples=4, num_classes=3)

# Define arguments for CutMix
ARGS = {
    "dataset": base_dataset,
    "num_class": 3,
    "num_mix": 1,
    "beta": 1.0,
    "prob": 1.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CutMix — the run constructed an instance of its own class and did not call it; no shape is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
CutMix Ran
ran on a synthesized input
sangHa0411/VIT/cutmix.py
pointer only (licence: NONE) · get_code("ba67dfd90f9a6f3a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sangHa0411/VIT when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

CutMixImageDataGenerator Ran
ran on a synthesized input · constructed an object; no result was computed
DevBruce/CutMixImageDataGenerator_For_Keras/cutmix_keras.py
code served (permissive licence) · get_code("feb9e03bf1c29e48")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, CutMixImageDataGenerator: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import random

random.seed(0)
np.random.seed(0)

class MockImageDataGenerator:
    """Mock data generator that mimics Keras ImageDataGenerator behavior"""
    def __init__(self, samples, class_indices, img_size, batch_size):
        self.samples = samples
        self.class_indices = class_indices
        self.img_size = img_size
        self.batch_size = batch_size
        self.index_array = np.arange(self.samples)
        self.current_index = 0
    
    def _set_index_array(self):
        self.index_array = np.arange(self.samples)
        self.current_index = 0
    
    def reset(self):
        self.current_index = 0
    
    def next(self):
        # Return batch of images and labels
        batch_size = min(self.batch_size, self.samples - self.current_index)
        
        # Generate random images of shape (batch, img_size, img_size, 3)
        X = np.random.randint(0, 256, size=(batch_size, self.img_size, self.img_size, 3), dtype=np.uint8).astype(np.float32)
        
        # Generate random labels (one-hot or class indices)
        y = np.random.rand(batch_size, 10).astype(np.float32)  # 10 classes
        
        self.current_index += batch_size
        return X, y

# Set up mock generators
img_size = 8
batch_size = 2
num_samples = 5

class_indices = {'class_0': 0, 'class_1': 1}

generator1 = MockImageDataGenerator(
    samples=num_samples,
    class_indices=class_indices,
    img_size=img_size,
    batch_size=batch_size
)

generator2 = MockImageDataGenerator(
    samples=num_samples,
    class_indices=class_indices,
    img_size=img_size,
    batch_size=batch_size
)

ARGS = {
    'generator1': generator1,
    'generator2': generator2,
    'img_size': img_size,
    'batch_size': batch_size
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CutMixImageDataGenerator — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a CutMixImageDataGenerator output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Cutmix Ran
ran on a synthesized input
wangermeng2021/FastClassification/augment/cutmix.py
code served (permissive licence) · get_code("30fde01cef8dc1cb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

class Cutmix:

    def __init__(self, beta=1, prob=1.0):
        self.beta = beta
        self.prob = prob

    def get_random_box(self, img_size, area_ratio):
        box_w, box_h = (np.sqrt(area_ratio) * np.array(img_size)).astype(np.int32)
        box_cx, box_cy = (np.random.randint(0, img_size[0]), np.random.randint(0, img_size[1]))
        x1 = max(box_cx - box_w // 2, 0)
        x2 = min(box_cx + box_w // 2, img_size[0])
        y1 = max(box_cy - box_h // 2, 0)
        y2 = min(box_cy + box_h // 2, img_size[1])
        return (x1, y1, x2, y2)

    def distort(self, batch_imgs, one_hot_batch_labels):
        if np.random.uniform() < self.prob:
            batch_size = batch_imgs.shape[0]
            random_batch_indexes = np.random.choice(batch_size, batch_size, replace=False)
            cut_ratio = np.random.beta(self.beta, self.beta)
            box = self.get_random_box(batch_imgs.shape[1:3][::-1], cut_ratio)
            batch_imgs_copy = batch_imgs.copy()
            batch_imgs[:, box[1]:box[3], box[0]:box[2]] = batch_imgs_copy[random_batch_indexes, box[1]:box[3], box[0]:box[2]]
            one_hot_batch_labels = (1.0 - cut_ratio) * one_hot_batch_labels + cut_ratio * one_hot_batch_labels[random_batch_indexes]
        return (batch_imgs, one_hot_batch_labels)


INIT_ARGS = {
    'beta': 1.0,
    'prob': 0.9
}

ARGS = {
    'batch_imgs': np.random.rand(2, 8, 6, 3).astype(np.float32),
    'one_hot_batch_labels': np.random.rand(2, 10).astype(np.float32)
}

METHOD = 'distort'

cutmix = Cutmix(**INIT_ARGS)
result = cutmix.distort(**ARGS)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
GridMixupLoss Ran
ran on a synthesized input · constructed an object; no result was computed
IlyaDobrynin/GridMixup/gridmix/gridmix_pytorch.py
code served (permissive licence) · get_code("fe1a906546003ac6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, GridMixupLoss: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from torch import nn

torch.manual_seed(0)
np.random.seed(0)

# Define arguments for GridMixupLoss
ARGS = {
    'alpha': (0.1, 0.9),
    'n_holes_x': (15, 25),
    'hole_aspect_ratio': (0.8, 1.2),
    'crop_area_ratio': (0.5, 1.0),
    'crop_aspect_ratio': (0.9, 1.1),
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GridMixupLoss — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a GridMixupLoss output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
RandomCutMix Ran
ran on a synthesized input · constructed an object; no result was computed
pytorch/vision/references/classification/transforms.py
code served (permissive licence) · get_code("d4b0790e48bdd732")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, RandomCutMix: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F
import math

torch.manual_seed(0)

# Create valid arguments for RandomCutMix
ARGS = {
    'num_classes': 10,
    'p': 0.5,
    'alpha': 1.0,
    'inplace': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RandomCutMix — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a RandomCutMix output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_no_repeat_shuffle_idx Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Westlake-AI/openmixup/openmixup/models/augments/cutmix.py
code served (permissive licence) · get_code("ccc813c9ad477514")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)
np.random.seed(0)

# The function takes batch_size_this and ignore_failure as parameters
# batch_size_this should be an integer representing the batch size
# ignore_failure should be a boolean

ARGS = {
    "batch_size_this": 5,
    "ignore_failure": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family int — no output shape is stated: observe_signature.py could not observe it (call:AssertionError)
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
bbox Ran
ran, honoured the contract we drafted
toshi-k/kaggle-bengaliai-handwritten-grapheme-classification/source/02_nn_solution/debug_dataset.py
code served (permissive licence) · get_code("7e848e7faedb674a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# The bbox function takes an image (2D numpy array) and finds the bounding box
# of non-zero elements. We need to create a small test image with some non-zero values.

# Create a simple 2D image with some structure
img = np.zeros((8, 6), dtype=np.uint8)
# Add some non-zero pixels to create a bounding box region
img[2:5, 1:4] = 255

ARGS = {
    "img": img
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
crop_resize Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
toshi-k/kaggle-bengaliai-handwritten-grapheme-classification/source/02_nn_solution/debug_dataset.py
code served (permissive licence) · get_code("7406ca7275b897ae")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family int, shape (128, 128) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import cv2

HEIGHT = 137
SIZE = 128
WIDTH = 236

def bbox(img):
    """ Iafoss / Image preprocessing (128x128)
        https://www.kaggle.com/iafoss/image-preprocessing-128x128
    """
    rows = np.any(img, axis=1)
    cols = np.any(img, axis=0)
    rmin, rmax = np.where(rows)[0][[0, -1]]
    cmin, cmax = np.where(cols)[0][[0, -1]]
    return (rmin, rmax, cmin, cmax)

def crop_resize(img0, size=SIZE, pad=16):
    """ Iafoss / Image preprocessing (128x128)
        https://www.kaggle.com/iafoss/image-preprocessing-128x128
    """
    ymin, ymax, xmin, xmax = bbox(img0[5:-5, 5:-5] > 80)
    xmin = xmin - 13 if xmin > 13 else 0
    ymin = ymin - 10 if ymin > 10 else 0
    xmax = xmax + 13 if xmax < WIDTH - 13 else WIDTH
    ymax = ymax + 10 if ymax < HEIGHT - 10 else HEIGHT
    img = img0[ymin:ymax, xmin:xmax]
    img[img < 28] = 0
    lx, ly = (xmax - xmin, ymax - ymin)
    l = max(lx, ly) + pad
    img = np.pad(img, [((l - ly) // 2,), ((l - lx) // 2,)], mode='constant')
    return cv2.resize(img, (size, size))

# Create a sample image with shape (HEIGHT, WIDTH) containing some non-zero values
img0 = np.zeros((HEIGHT, WIDTH), dtype=np.uint8)
# Add some white pixels to ensure bbox finds valid regions
img0[20:100, 30:150] = 100
img0[50:80, 60:120] = 200

ARGS = {
    'img0': img0,
    'size': SIZE,
    'pad': 16
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family int, shape (128, 128) — shape (128, 128) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cutmix Ran
ran; our contract draft was wrong, not the code
hysts/pytorch_cutmix/cutmix.py
code served (permissive licence) · get_code("de3489ea88a14549")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)
np.random.seed(0)

# Create a small batch of image data
# Shape: (batch_size, channels, height, width)
batch_size = 2
channels = 3
height = 8
width = 8

data = torch.randn(batch_size, channels, height, width)
targets = torch.tensor([0, 1])

batch = (data, targets)
alpha = 1.0

ARGS = {
    "batch": batch,
    "alpha": alpha,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cutmix Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Westlake-AI/openmixup/openmixup/models/augments/cutmix.py
code served (permissive licence) · get_code("ed79cd2e87b6c30d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)
np.random.seed(0)

# Create small tensors for testing
batch_size = 2
channels = 3
height = 4
width = 4

# Input image tensor (N, C, H, W)
img = torch.randn(batch_size, channels, height, width)

# Ground-truth labels (one-hot encoded, shape N x num_classes)
num_classes = 5
gt_label = torch.zeros(batch_size, num_classes)
gt_label[0, 1] = 1.0
gt_label[1, 3] = 1.0

ARGS = {
    'img': img,
    'gt_label': gt_label,
    'alpha': 1.0,
    'lam': None,
    'dist_mode': False,
    'return_mask': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cutmix Ran
ran; our contract draft was wrong, not the code
PsorTheDoctor/microarray-data/utils/augmentation.py
pointer only (licence: NONE) · get_code("bdf0f6543801b45c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, PsorTheDoctor/microarray-data when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_augmenter Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
toshi-k/kaggle-bengaliai-handwritten-grapheme-classification/source/02_nn_solution/debug_dataset.py
code served (permissive licence) · get_code("5d040cba7a3612d3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Compose. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import cv2
from albumentations import ElasticTransform, Compose, RandomGamma

# The function get_augmenter takes a single parameter 'p' which is a probability value
# It constructs and returns a Compose object with augmentation transforms
# The parameter 'p' controls the overall probability of applying the augmentation pipeline

ARGS = {
    "p": 1.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
albumentations, cv2 — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Compose — a Compose output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Compose output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
onehot Ran
ran, honoured the contract we drafted
ildoonet/cutmix/cutmix/cutmix.py
code served (permissive licence) · get_code("a2847ea5f23c1e07")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (5,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "size": 5,
    "target": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (5,) — shape (5,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
replace_attentive_regions Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xden2331/attentive_cutmix/attentive_image.py
code served (permissive licence) · get_code("bc4cc5323c8e7811")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Image. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from PIL import Image

# Create a random image (rand_img parameter)
# Using a small 128x128 image (4 grid cells x 4 grid cells with grid_size=32)
rand_img_array = np.random.randint(0, 256, (128, 128, 3), dtype=np.uint8)
rand_img = Image.fromarray(rand_img_array)

# Create the source image (image parameter)
# Same size as rand_img
image_array = np.random.randint(0, 256, (128, 128, 3), dtype=np.uint8)
image = Image.fromarray(image_array)

# Create attentive regions (attentive_regions parameter)
# Each region is a tuple (x, y) representing grid coordinates
# With grid_size=32 and 128x128 image, we have 4x4 grid cells
# Valid coordinates are 0-3 for both x and y
attentive_regions = [(0, 0), (1, 2), (2, 1)]

ARGS = {
    "rand_img": rand_img,
    "image": image,
    "attentive_regions": attentive_regions,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
CutMixGenerator Not yet run
unverified (harvested, no recorded run)
airplane2230/keras_cutmix/cutmix_generator.py
pointer only (licence: NONE) · get_code("793e8454c053efa6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, airplane2230/keras_cutmix when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

cutmix Not yet run
unverified (harvested, no recorded run)
liuch37/image-processing/augmentation/cutmix_pytorch.py
code served (permissive licence) · get_code("8c13b211bd42a04c")
How it ran

no invocation recorded.

debug_cutmix Not yet run
unverified (harvested, no recorded run)
toshi-k/kaggle-bengaliai-handwritten-grapheme-classification/source/02_nn_solution/debug_dataset.py
code served (permissive licence) · get_code("04e6604fd0b16404")
How it ran

no invocation recorded.

rand_bbox Not yet run
unverified (harvested, no recorded run)
this paper's copy was not recorded; identical code first harvested from deeplearning-wisc/dream-ood
pointer only; the stored copy get_code serves, from deeplearning-wisc/dream-ood, is pointer only (licence: NOASSERTION) · get_code("d34a085d71b8f4b5")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

rand_bbox Not yet run
unverified (harvested, no recorded run)
jis478/Tensorflow/TF2.0/Cutmix/Functions.py
pointer only (licence: NONE) · get_code("c5224b4839efbc28")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, jis478/Tensorflow when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

rand_bbox Not yet run
unverified (harvested, no recorded run)
ildoonet/cutmix/cutmix/cutmix.py
code served (permissive licence) · get_code("b3d09a4dd10e16e3")
How it ran

no invocation recorded.

replace_attentive_region Not yet run
unverified (harvested, no recorded run)
xden2331/attentive_cutmix/attentive_image.py
code served (permissive licence) · get_code("49ab4c6f3305f3c0")
How it ran

no invocation recorded.

Also present in other papers' code

Of 24 samples lifted from this paper's linked repositories, 24 carry a function identity and 0 do not. Of the 24 distinct functions with an identity, 7 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 3 later) and 17 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
rand_bbox
brick of this paper's assembly: helper
13 other papers
13 later
2002.11102 (2020-02)
On Feature Normalization and Data Augmentation
2003.05438 (2020-03)
Un-Mix: Rethinking Image Mixtures for Unsupervised Visual Representation Learning
2007.00992 (2020-07)
Rethinking Channel Dimensions for Efficient Model Design
and 10 more not named here
onehot
brick of this paper's assembly: helper
2 other papers
2 later
2303.08500 (2023-03)
The Devil's Advocate: Shattering the Illusion of Unexploitable Data using Diffusion Models
2403.19600 (2024-03)
Enhance Image Classification via Inter-Class Image Mixup with Diffusion Model
BengaliDataset
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
1710.09412 (2017-10)
mixup: BEYOND EMPIRICAL RISK MINIMIZATION
bbox
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
1710.09412 (2017-10)
mixup: BEYOND EMPIRICAL RISK MINIMIZATION
crop_resize
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
1710.09412 (2017-10)
mixup: BEYOND EMPIRICAL RISK MINIMIZATION
get_augmenter
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
1710.09412 (2017-10)
mixup: BEYOND EMPIRICAL RISK MINIMIZATION
rand_bbox
brick of this paper's assembly: helper
1 other paper
1 later
2303.08500 (2023-03)
The Devil's Advocate: Shattering the Illusion of Unexploitable Data using Diffusion Models

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Regional dropout strategies have been proposed to enhance the performance of convolutional neural network classifiers. They have proved to be effective for guiding the model to attend on less discriminative parts of objects (e.g. leg as opposed to head of a person), thereby letting the network generalize better and have better object localization capabilities. On the other hand, current methods for regional dropout remove informative pixels on training images by overlaying a patch of either black pixels or random noise. Such removal is not desirable because it leads to information loss and inefficiency during training. We therefore propose the CutMix augmentation strategy: patches are cut and pasted among training images where the ground truth labels are also mixed proportionally to the area of the patches. By making efficient use of training pixels and retaining the regularization effect of regional dropout, CutMix consistently outperforms the state-of-the-art augmentation strategies on CI-FAR and ImageNet classification tasks, as well as on the Im-ageNet weakly-supervised localization task. Moreover, unlike previous augmentation methods, our CutMix-trained ImageNet classifier, when used as a pretrained model, results in consistent performance gains in Pascal detection and MS-COCO image captioning benchmarks. We also show that CutMix improves the model robustness against input corruptions and its out-of-distribution detection performances. Source code and pretrained models are available at https://github.com/clovaai/CutMix-PyTorch.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("1905.04899")
get_code_for_paper("1905.04899")
have("1905.04899")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/1905.04899.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/1905.04899.svg)](https://syntology.ai/paper/1905.04899)

Connect an agent — have() is free.