RMBG-1.4 / README.md
FerrisMind's picture
Upload 6 files
7017382 verified
|
Raw History Blame Contribute Delete
5.25 kB
---
license: other
license_name: bria-rmbg-1.4
license_link: https://bria.ai/bria-huggingface-model-license-agreement/
pipeline_tag: image-segmentation
base_model: briaai/RMBG-1.4
tags:
- lux3d
- rust
- candle
- safetensors
- canonical-weights
- background-removal
- matting
- rmbg
---
# Lux3D RMBG-1.4 Canonical Weights
This repository contains the canonicalized `safetensors` export of BRIA RMBG-1.4 used by the Lux3D TripoSG preprocessing runtime.
## Model Details
- Model family: `rmbg` (auxiliary package, not a Lux3D output family)
- Architecture: `BriaRMBG` / IS-Net
- Canonical file: `model.safetensors` (176,381,952 bytes)
- Tensor count: `798` (686 F32 parameters + 112 int64 `num_batches_tracked` buffers)
- SHA-256: `fb54c81529b99336009dd76de98e11491fe85a956c937814e8178f17c04891aa`
- Source checkpoint SHA-256: `46ef7fe46f2ae284d8f1aaa24bfa5fca5ef25a34e2c7caa890a0029eb100e87f`
- Primary runtime target: Lux3D TripoSG preprocessing
- Typical output: single-channel foreground mask
RMBG-1.4 is the background-removal network used by the reference TripoSG `scripts/image_process.py` when an input image has no valid alpha channel. Lux3D runs the same path:
1. cap the longest source side at 2000 pixels;
2. resize RGB to 1024x1024 with torchvision-compatible bilinear antialiasing;
3. normalize with mean `[0.5, 0.5, 0.5]` and std `[1.0, 1.0, 1.0]`;
4. run BriaRMBG and take the first sigmoid side output;
5. resize the mask back, min-max normalize, quantize to uint8, and apply Otsu thresholding;
6. remove 8-connected components smaller than 200 pixels;
7. composite the largest foreground component over white and pad it to a square with 10% padding.
## Why This Package Is Separate
TripoSG is MIT licensed, while RMBG-1.4 is **source-available for non-commercial use only** under the BRIA RMBG 1.4 license. Keeping RMBG in a separate canonical package makes the license boundary explicit and lets the TripoSG package remain MIT.
RMBG is **not** part of `oxide-lab/TripoSG` and must be obtained separately.
## Included Files
- `model.safetensors` — canonical F32/int64 weights, names unchanged from the upstream checkpoint
- `resolved_config.json` — architecture and preprocessing metadata
- `manifest.json` — provenance, source checksums, tensor count, and raw-file list
- `checksums.json` — SHA-256 and size for every file in this package
## Usage With Lux3D
Pass the package to the TripoSG CLI:
```powershell
cargo run -p lux3d-cli --features cuda -- run triposg `
--model-path <canonical-triposg-dir> `
--rmbg-model-path <canonical-rmbg-dir> `
--source <input-image> `
--output <output-file.obj>
```
If `--rmbg-model-path` is omitted, the CLI looks for a sibling `rmbg-1.4` directory next to an explicit `--model-path`. The HTTP server accepts `--rmbg-model-path` or `LUX3D_RMBG_MODEL_PATH` and performs the same sibling discovery.
The package is only needed when the input has no valid alpha channel. RGBA inputs with a usable alpha channel take the native alpha path and never load these weights.
## Provenance
- Upstream source model: [`briaai/RMBG-1.4`](https://huggingface.co/briaai/RMBG-1.4)
- Reference architecture: [`xuebinqin/DIS`](https://github.com/xuebinqin/DIS) (IS-Net), as modified by BRIA
- Canonicalization flow: `tools/python_baseline/normalize_weights.py`
- Raw source files: `model.safetensors`, `config.json`, `preprocessor_config.json`
The upstream `model.safetensors` is copied tensor-for-tensor; no values or names are modified. BatchNorm `num_batches_tracked` buffers remain int64.
## Validation
The Lux3D Rust/Candle implementation was validated against the reference PyTorch execution of TripoSG's exact preprocessing path on the RGB golden sample:
| Check | Result |
|---|---:|
| BriaRMBG sigmoid max abs delta | 1.311e-6 |
| preprocess uint8 `pixel_values` | exact |
| normalized `pixel_values` max abs delta | 2.384e-7 |
The reference baseline and the Rust runtime both reproduce the upstream `load_image` output exactly at the uint8 conditioning stage.
## Limitations
- **License:** RMBG-1.4 is source-available for non-commercial use. Commercial use requires a separate agreement with BRIA. See `LICENSE.md` and the upstream license link.
- The model is implemented for CPU, CUDA, Vulkan, and WGPU; Metal is build-supported but untested in this repository.
- Inference is F32-only in the current Lux3D runtime.
- The canonical package contains no trained weights beyond the upstream checkpoint and no upstream demo/training stack.
- Lux3D does not redistribute the source repository; only the canonicalized weights and metadata are included here.
## License
- Upstream model page: [`briaai/RMBG-1.4`](https://huggingface.co/briaai/RMBG-1.4)
- License: [BRIA RMBG 1.4](https://bria.ai/bria-huggingface-model-license-agreement/)
- The model is released under a Creative Commons license for **non-commercial use**.
- Commercial use is subject to a commercial agreement with BRIA: <https://go.bria.ai/3B4Asxv>
This package does not grant any rights beyond the upstream license.
## Citation
```bibtex
@misc{rmbg14,
title={BRIA Background Removal v1.4},
author={{BRIA AI}},
year={2024},
howpublished={\url{https://huggingface.co/briaai/RMBG-1.4}}
}
```