Files
scene-actor-extraction/src/gallery/gallery_builder.hpp
T
dtourolle d753062c6c Initial commit: scene-actor-extraction pipeline
Source (KPN++ pipeline nodes, ArcFace embedders, SCRFD/YuNet detectors,
gallery builder), build scripts, and eval artifacts.

- external/KPN as a git submodule (gitea.tourolle.paris/dtourolle/KPN)
- ONNX models tracked via Git LFS (models/*.onnx)
- generated outputs, TensorRT engines, reference repos, and media ignored
2026-06-12 15:29:01 +02:00

37 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include "types.hpp"
#include <string>
// 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 "<imdb_id>_<Name_With_Underscores>".
// 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);