# Third-party notice — U²-Net (Portable / P variant)

This directory contains an unmodified pretrained model checkpoint, exported to ONNX by a
third-party maintainer from the original author's own released weights, redistributed under
its original license.

- **Model**: U²-Net Portable (U2NETP) — a lightweight variant of U²-Net for salient-object
  detection, used here to separate a photo's foreground subject from its background
- **Paper**: [U²-Net: Going Deeper with Nested U-Structure for Salient Object Detection](https://arxiv.org/abs/2005.09007)
  (Qin et al., Pattern Recognition 2020)
- **Original repository**: https://github.com/xuebinqin/U-2-Net
- **License**: Apache License 2.0 — verified via the GitHub API `/license` endpoint for
  `xuebinqin/U-2-Net` (`spdx_id: Apache-2.0`) (see `LICENSE` in this directory, fetched verbatim
  from the original GitHub repository).
- **Commercial use**: Permitted. Apache-2.0 has no non-commercial restriction; it only requires
  retaining the license/copyright notice and stating any changes made to the source.
- **ONNX export source**: `danielgatis/rembg` — the most widely used background-removal tool
  built on this model, which publishes a stable, canonical ONNX export of the official
  `u2netp.pth` checkpoint as a GitHub release asset. The weights themselves are unmodified from
  the original author's release; only the export format changed (PyTorch checkpoint -> ONNX
  graph). rembg's own wrapper code is MIT-licensed, but that license applies to rembg's code,
  not to the model weights, which remain Apache-2.0 per the original U-2-Net repository.
- **Asset source**: https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2netp.onnx
- **File size**: 4,574,861 bytes
- **SHA-256**: `309c8469258dda742793dce0ebea8e6dd393174f89934733ecc8b14c76f4ddd8`

Preprocessing/postprocessing logic used in this site's `background-removal.js` was independently
implemented in JavaScript from rembg's published reference implementation (resize to 320x320,
scale each channel by the image's own maximum pixel value rather than a fixed 255, ImageNet
mean/std normalization, then take only the first of the model's 7 outputs, min-max normalize it
to [0,1], and resize back up as an alpha mask) and verified against real ONNX Runtime inference
on a real photo before shipping — the resulting mask cleanly isolated the subject's silhouette
(including ears, legs, and tail) from its background. This is original code, not redistributed
from the upstream repository.
