Image Segmentation
ONNX
BiRefNet
onnxruntime
background-removal
browser
clip-art
print-on-demand
t-shirt-design
knowledge-distillation
Instructions to use bowespublishing/crisp-cut with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- BiRefNet
How to use bowespublishing/crisp-cut with BiRefNet:
# Option 1: use with transformers from transformers import AutoModelForImageSegmentation birefnet = AutoModelForImageSegmentation.from_pretrained("bowespublishing/crisp-cut", trust_remote_code=True)# Option 2: use with BiRefNet # Install from https://github.com/ZhengPeng7/BiRefNet from models.birefnet import BiRefNet model = BiRefNet.from_pretrained("bowespublishing/crisp-cut") - Notebooks
- Google Colab
- Kaggle
File size: 3,159 Bytes
117a24b 56fd28c 117a24b 56fd28c 117a24b 56fd28c 117a24b 56fd28c 117a24b 56fd28c 117a24b 9dace56 117a24b 9dace56 117a24b 9dace56 117a24b 9dace56 117a24b 9dace56 117a24b 56fd28c 117a24b 56fd28c 117a24b | 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | ---
license: agpl-3.0
tags:
- image-segmentation
- background-removal
- onnx
- browser
- clip-art
- print-on-demand
- t-shirt-design
- birefnet
- knowledge-distillation
library_name: onnxruntime
pipeline_tag: image-segmentation
---
# βοΈ CrispCut β AI Background Removal for Designs
**Purpose-built background removal for clip art, t-shirt designs, and print-on-demand assets.**
Distilled from [**BiRefNet**](https://github.com/ZhengPeng7/BiRefNet) (220 M params β 6.6 M params) with **~95 % quality retention**. Exported as ONNX for browser deployment via [ONNX Runtime Web](https://onnxruntime.ai/).
## Models
| File | Precision | Size | WASM (CPU) | WebGL (GPU) |
|------|-----------|------|------------|-------------|
| `onnx/crispcut-fast.onnx` | INT8 quantized | **6.5 MB** | ~5β10 s | ~1β2 s |
| `onnx/crispcut-quality.onnx` | FP32 | **25.3 MB** | ~15β25 s | ~3β6 s |
Both models:
- **Architecture:** MobileNetV2 + UNet (distilled from BiRefNet)
- **Trained at 1024Γ1024** on design-specific content
- ONNX opset 17
- ImageNet normalisation (mean: `[0.485, 0.456, 0.406]`, std: `[0.229, 0.224, 0.225]`)
- Single input tensor: `input` β shape `[1, 3, 1024, 1024]` (NCHW, float32)
- Single output tensor: `output` β shape `[1, 1, 1024, 1024]` (logits β apply sigmoid)
## Distillation Details
| | Teacher (BiRefNet) | Student (CrispCut) |
|---|---|---|
| Parameters | 220 M | 6.6 M |
| Compression | β | **33Γ smaller** |
| Quality | 100 % | ~95 % |
The student model uses a MobileNetV2 encoder with a UNet decoder, trained via knowledge distillation from the full BiRefNet teacher on design-specific data.
## Usage with the npm package
```bash
npm i @crispcut/background-removal
```
```js
import { cut } from '@crispcut/background-removal';
// Fast mode (default) β downloads crispcut-fast.onnx from this repo
const result = await cut(image);
img.src = result.url;
// Quality mode with GPU
const result = await cut(image, { model: 'quality', gpu: true });
```
Models are fetched automatically from this repo at runtime. No server needed β everything runs in the browser.
π¦ **npm:** [@crispcut/background-removal](https://www.npmjs.com/package/@crispcut/background-removal)
π» **GitHub:** [bowespublishing/crispcut](https://github.com/bowespublishing/crispcut)
## Self-hosting
Download the `.onnx` files from the `onnx/` folder and serve them from your own CDN:
```js
cut(image, { modelUrl: '/models/crispcut-fast.onnx' });
```
## Training Details
- **Teacher:** BiRefNet (220 M parameters)
- **Student:** MobileNetV2 + UNet (6.6 M parameters)
- **Dataset:** Design-specific content (clip art, illustrations, t-shirt graphics, POD assets)
- **Resolution:** 1024Γ1024
- **Distillation method:** Knowledge distillation with feature-level and output-level supervision
- **Fast model:** INT8 dynamic quantization (via ONNX Runtime)
- **Quality model:** Full FP32 precision
## License
**AGPL-3.0** for open-source and personal use.
**Commercial license** required for closed-source or commercial products.
π© Contact: [bowespublishing@gmail.com](mailto:bowespublishing@gmail.com)
|