MCPcopy Index your code
hub / github.com/andyzoujm/pixmix

github.com/andyzoujm/pixmix @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
80 symbols 190 edges 4 files 13 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

PixMix

This is the repository for "PixMix: Dreamlike Pictures Comprehensively Improve Safety Measures"
by Dan Hendrycks*, Andy Zou*, Mantas Mazeika, Leonard Tang, Bo Li, Dawn Song, and Jacob Steinhardt.

Introduction

In real-world applications of machine learning, reliable and safe systems must consider measures of performance beyond standard test set accuracy. These other goals include out-of-distribution (OOD) robustness, prediction consistency, resilience to adversaries, calibrated uncertainty estimates, and the ability to detect anomalous inputs. However, improving performance towards these goals is often a balancing act that today’s methods cannot achieve without sacrificing performance on other safety axes, raising the question of whether a Pareto improvement on all existing safety measures is possible. To meet this challenge, we design a new data augmentation strategy utilizing the natural structural complexity of pictures such as fractals, which outperforms numerous baselines, is near Pareto-optimal, and comprehensively improves safety measures.

Pseudocode

Contents

pixmix_utils.py includes reference implementation of augmentations and mixings used in PixMix.

We also include PyTorch implementations of PixMix on both CIFAR-10/100 and ImageNet in cifar.py and imagenet.py respectively, which both support training and evaluation on CIFAR-10/100-C and ImageNet-C/R.

Usage

Training recipes used in our paper:

CIFAR: python cifar.py \ --dataset <cifar10 or cifar100> \ --data-path <path/to/cifar and cifar-c> \ --mixing-set <path/to/mixing_set> \ --all-ops

ImageNet 1K: python imagenet.py \ --data-standard <path/to/imagenet_train> \ --data-val <path/to/imagenet_val> \ --imagenet-r-dir <path/to/imagenet_r> \ --imagenet-c-dir <path/to/imagenet_c> \ --mixing-set <path/to/mixing_set> \ --num-classes 1000 \ --all-ops

Mixing Set

The mixing set of fractals and feature visualizations used in the paper can be downloaded here.

Pretrained Models

Weights for a 40x4-WRN CIFAR-10/100 classifier trained with PixMix for 100 epochs are available here.

Weights for a ResNet-50 ImageNet classifier trained with PixMix for 90 and 180 epochs are available here.

Citation

If you find this useful in your research, please consider citing:

@article{hendrycks2022robustness,
  title={PixMix: Dreamlike Pictures Comprehensively Improve Safety Measures},
  author={Dan Hendrycks and Andy Zou and Mantas Mazeika and Leonard Tang and Bo Li and Dawn Song and Jacob Steinhardt},
  journal={CVPR},
  year={2022}
}

Core symbols most depended-on inside this repo

sample_level
called by 11
pixmix_utils.py
update
called by 9
imagenet.py
float_parameter
called by 6
pixmix_utils.py
calib_err
called by 6
calibration_tools.py
int_parameter
called by 5
pixmix_utils.py
test
called by 5
cifar.py
validate
called by 4
imagenet.py
invert
called by 3
pixmix_utils.py

Shape

Function 53
Method 20
Class 7

Languages

Python100%

Modules by API surface

imagenet.py29 symbols
pixmix_utils.py24 symbols
cifar.py20 symbols
calibration_tools.py7 symbols

For agents

$ claude mcp add pixmix \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page