# Mask R-CNN arithmetic reference

Run `python examples/maskrcnn.py` or append `--json`. No packages required.
Regions: `bilinear`, `roi`, `mask`. Source: [Mask R-CNN v3](https://arxiv.org/pdf/1703.06870v3),
§3, Figure 3 and mask-loss definition. The crop manifest pins the PDF hash.

Integer coordinates identify feature-grid centers. Boxes use continuous feature
coordinates without quantization, a half-pixel shift, or legacy `+1` extent.
Each bin averages four regular bilinear samples; values outside the grid are
clamped to its final centers. This is an explicit teaching convention, not a
claim of bitwise equivalence to every framework's RoIAlign. Detectron2's
`aligned=True` introduces a -0.5 shift; legacy kernels may clamp minimum extent.

The mask loss selects the ground-truth class and computes independent sigmoid
BCE, not a cross-class pixel softmax. There is no RPN, learned backbone, box
regression, mask head, NMS, COCO checkpoint or benchmark in this program.
The self-check tests interpolation at integer/boundary locations, affine-field
exactness, stable extreme logits and independence from unmatched classes.
