Spaces:
Sleeping
Sleeping
File size: 925 Bytes
fb91fdc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Preprocessing
`generate_masks.py` produces the guarded background masks used by the
hand-crafted feature extractor.
Museum photographs often include a backdrop, mount or frame around the
artwork. Removing it helps color/light statistics — but salient-object
segmentation (U^2-Net) applied blindly also eats painted borders, halos and
dark backgrounds that ARE the artwork. So every mask must pass five checks
before it is applied (see the module docstring); otherwise the full image is
used. On the gold set this accepts ~10% of images.
Downstream use (in `features/extract_handcrafted.py`):
- **applied** images: spatial features see the mask's bounding-box crop;
color/light statistics additionally exclude background pixels inside it.
Background is never zero-filled — that would create fake edges.
- **rejected** images: full image everywhere.
Outputs: `data/masks/<stem>.png` + `data/masks/verdicts.csv`.
|