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
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: agpl-3.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: agpl-3.0
|
| 3 |
+
tags:
|
| 4 |
+
- image-segmentation
|
| 5 |
+
- background-removal
|
| 6 |
+
- onnx
|
| 7 |
+
- browser
|
| 8 |
+
- clip-art
|
| 9 |
+
- print-on-demand
|
| 10 |
+
- t-shirt-design
|
| 11 |
+
library_name: onnxruntime
|
| 12 |
+
pipeline_tag: image-segmentation
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# βοΈ CrispCut β AI Background Removal for Designs
|
| 16 |
+
|
| 17 |
+
**Purpose-built background removal for clip art, t-shirt designs, and print-on-demand assets.**
|
| 18 |
+
|
| 19 |
+
Both models trained at **1024Γ1024** on design-specific content (not photos). Exported as INT8-quantized ONNX for browser deployment via [ONNX Runtime Web](https://onnxruntime.ai/).
|
| 20 |
+
|
| 21 |
+
## Models
|
| 22 |
+
|
| 23 |
+
| File | Architecture | Size | WASM (CPU) | WebGL (GPU) |
|
| 24 |
+
|------|-------------|------|------------|-------------|
|
| 25 |
+
| `onnx/crispcut-fast.onnx` | MobileNetV2 + UNet (distilled) | **6.5 MB** | ~5β10s | ~1β2s |
|
| 26 |
+
| `onnx/crispcut-quality.onnx` | EfficientNet-b5 + UNet++ + SCSE | **30.8 MB** | ~25β45s | ~5β10s |
|
| 27 |
+
|
| 28 |
+
Both models:
|
| 29 |
+
- Trained at **1024Γ1024** resolution
|
| 30 |
+
- INT8 dynamic quantization
|
| 31 |
+
- ONNX opset 17
|
| 32 |
+
- ImageNet normalisation (mean: `[0.485, 0.456, 0.406]`, std: `[0.229, 0.224, 0.225]`)
|
| 33 |
+
- Single input tensor: `input` β shape `[1, 3, 1024, 1024]` (NCHW, float32)
|
| 34 |
+
- Single output tensor: `output` β shape `[1, 1, 1024, 1024]` (logits β apply sigmoid)
|
| 35 |
+
|
| 36 |
+
## Usage with the npm package
|
| 37 |
+
|
| 38 |
+
```bash
|
| 39 |
+
npm install @crispcut/background-removal onnxruntime-web
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
```js
|
| 43 |
+
import { removeBackground } from '@crispcut/background-removal';
|
| 44 |
+
|
| 45 |
+
// Fast mode (default) β downloads crispcut-fast.onnx from this repo
|
| 46 |
+
const result = await removeBackground(file);
|
| 47 |
+
img.src = result.url;
|
| 48 |
+
|
| 49 |
+
// Quality mode with GPU
|
| 50 |
+
const result = await removeBackground(file, {
|
| 51 |
+
quality: 'quality',
|
| 52 |
+
executionProvider: 'webgl',
|
| 53 |
+
});
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
Models are fetched automatically from this repo at runtime. No server needed β everything runs in the browser.
|
| 57 |
+
|
| 58 |
+
π¦ **npm:** [@crispcut/background-removal](https://www.npmjs.com/package/@crispcut/background-removal)
|
| 59 |
+
π» **GitHub:** [bowespublishing/crispcut](https://github.com/bowespublishing/crispcut)
|
| 60 |
+
|
| 61 |
+
## Self-hosting
|
| 62 |
+
|
| 63 |
+
Download the `.onnx` files from the `onnx/` folder and serve them from your own CDN:
|
| 64 |
+
|
| 65 |
+
```js
|
| 66 |
+
removeBackground(file, {
|
| 67 |
+
modelUrl: '/models/crispcut-fast.onnx',
|
| 68 |
+
});
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Training Details
|
| 72 |
+
|
| 73 |
+
- **Dataset:** Design-specific content (clip art, illustrations, t-shirt graphics, POD assets)
|
| 74 |
+
- **Resolution:** 1024Γ1024
|
| 75 |
+
- **Fast model:** Distilled from the quality model using knowledge distillation
|
| 76 |
+
- **Quality model:** Full EfficientNet-b5 encoder with UNet++ decoder and SCSE attention
|
| 77 |
+
- **Quantization:** INT8 dynamic (via ONNX Runtime)
|
| 78 |
+
|
| 79 |
+
## License
|
| 80 |
+
|
| 81 |
+
**AGPL-3.0** for open-source and personal use.
|
| 82 |
+
|
| 83 |
+
**Commercial license** required for closed-source or commercial products.
|
| 84 |
+
|
| 85 |
+
π© Contact: [bowespublishing@gmail.com](mailto:bowespublishing@gmail.com)
|