fix(trt): drop explicit shapes for static TransNetV2; gallery over-fetch + dedup

trtexec rejects --minShapes/--optShapes/--maxShapes for a fully static model
("Static model does not take explicit shapes"). TransNetV2's input is fixed at
1x100x27x48x3, so the shape comes from the model itself.

Gallery build now over-fetches TMDB/Wikidata candidates by a configurable
factor: near-duplicate stills (the same photo at different crops or
resolutions) are discarded after embedding, so downloading exactly
images_per_actor left actors short of that many *distinct* embeddings.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-30 17:32:08 +02:00
co-authored by Claude Opus 5
parent 2ea5737bbd
commit 458116f118
5 changed files with 117 additions and 26 deletions
+12 -5
View File
@@ -32,16 +32,23 @@ struct FaceEmbedResult {
class FaceEmbedderEngine {
public:
// detector_engine/arcface_engine are optional paths to pre-built TensorRT
// engines. They are required when built with SAE_INFERENCE_BACKEND=TRT
// (which cannot load .onnx directly) and ignored by the ORT backend.
FaceEmbedderEngine(const std::string& detector_model,
const std::string& arcface_model,
float conf = 0.5f, float nms = 0.4f, int max_side = 500)
float conf = 0.5f, float nms = 0.4f, int max_side = 500,
const std::string& detector_engine = "",
const std::string& arcface_engine = "")
: max_side_(max_side)
{
Config cfg;
cfg.detector_model = detector_model;
cfg.arcface_model = arcface_model;
cfg.detector_conf = conf;
cfg.detector_nms = nms;
cfg.detector_model = detector_model;
cfg.arcface_model = arcface_model;
cfg.detector_engine = detector_engine;
cfg.arcface_engine = arcface_engine;
cfg.detector_conf = conf;
cfg.detector_nms = nms;
detector_ = make_face_detector(cfg);
embedder_ = make_face_embedder(cfg);
}
+4 -2
View File
@@ -30,9 +30,11 @@ NB_MODULE(sae_embed, m) {
});
nb::class_<FaceEmbedderEngine>(m, "FaceEmbedder")
.def(nb::init<std::string, std::string, float, float, int>(),
.def(nb::init<std::string, std::string, float, float, int,
std::string, std::string>(),
"detector_model"_a, "arcface_model"_a,
"conf"_a = 0.5f, "nms"_a = 0.4f, "max_side"_a = 500)
"conf"_a = 0.5f, "nms"_a = 0.4f, "max_side"_a = 500,
"detector_engine"_a = "", "arcface_engine"_a = "")
.def("embed", &FaceEmbedderEngine::embed_path, "path"_a,
nb::call_guard<nb::gil_scoped_release>(),
"Detect the highest-confidence face in the image, align it, and "