File size: 1,272 Bytes
5ece709
c3d8cc1
 
 
5ece709
 
 
 
 
a8a94da
 
5ece709
 
e43dbe7
 
a8a94da
e43dbe7
 
 
a8a94da
 
e43dbe7
 
a8a94da
 
e43dbe7
c3d8cc1
e43dbe7
 
 
 
 
 
 
 
 
 
 
 
a8a94da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
title: Shuffle PatchMix
colorFrom: purple
colorTo: red
sdk: gradio
sdk_version: 5.44.1
app_file: app.py
pinned: false
license: mit
emoji: 🔥
short_description: An interactive demo for SPM augmentation.
---

# Shuffle PatchMix (SPM) — Hugging Face Space

An interactive demo for SPM augmentation.

GitHub repo: https://github.com/PrasannaPulakurthi/SPM

arxiv.org/abs/2505.24216

## Parameters
- **Grid (N×N):** Choose one of **2×2, 4×4, 8×8, 16×16**. The image is cropped (top-left) so its width and height are divisible by N.
- **Enable Overlap Patch Blend):** When enabled, each base cell expands by ±overlap pixels (2× at borders to keep areas comparable) and patches are blended with a feather mask.
- **Overlap (px):** Pixel overlap per side. Automatically clipped to `< 1/2 * patch size`.
- **Mix probability:** Per-patch probability to mix original and a shuffled patch.
- **Beta α, β:** Shape parameters for the Beta distribution used for blending weights.
- **Seed:** Optional deterministic seed.

## Batch Mode
Upload a `.zip` containing images (`.png`, `.jpg`, `.jpeg`). The app returns a `.zip` of augmented results with the same folder structure.

## Local Development
```bash
pip install -r requirements.txt
python app.py
```

## License
MIT