# 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/.png` + `data/masks/verdicts.csv`.