#pragma once #include "gallery/gallery_report.hpp" #include "types.hpp" #include // Build an ActorGallery from a directory tree: // // gallery_root/ // nm0000093_Brad_Pitt/ // img1.jpg // img2.jpg // ... // nm0000129_Cate_Blanchett/ // ... // // Each subdirectory name is parsed as "_". // For every image: // 1. Detect face with SCRFD-500MF (expect exactly one; warn and skip if 0 or >1). // 2. Align with ArcFace 5-point transform → 112×112 crop. // 3. Embed with ArcFace ONNX → 512-dim L2-normalised embedding. // All embeddings are stored (best-of-N match at query time). // // Returns a gallery ready to pass to save_gallery() / IdentityMatcherFunc. struct BuildConfig { std::string gallery_root; // directory tree described above std::string detector_model; std::string arcface_model; float detector_conf{0.5f}; float detector_nms{0.4f}; int max_side{500}; // downscale source images to this max dimension // before detection — TMDB portraits are ~2k px, // SCRFD trains on smaller faces and detection // confidence drops on huge inputs. 0 = disabled. }; ActorGallery build_gallery(const BuildConfig& cfg);