7#include "reusex/vision/sam3/EngineBuildProfiles.hpp"
33 using std::runtime_error::runtime_error;
73 const std::atomic<bool> *
cancel =
nullptr;
104std::vector<std::string>
113std::vector<std::string>
115 const std::filesystem::path &engine_dir);
131std::vector<std::string>
stale_engines(
const std::filesystem::path &onnx_dir,
132 const std::filesystem::path &engine_dir);
138std::vector<std::string>
150std::vector<std::string>
152 const std::filesystem::path &engine_dir);
Thrown by prepare_sam3_model() when Sam3AssetOptions::cancel was raised.
std::filesystem::path prepare_sam3_model(const Sam3AssetOptions &opts, const ProgressCallback &cb={})
Ensure the managed SAM3 model is ready and return a directory that vision::create_model_from_path can...
std::vector< std::string > fallback_engines_to_retry(const std::filesystem::path &onnx_dir, const std::filesystem::path &engine_dir)
The fallback_engines() whose recipe profile is worth building again: the ONNX it failed against has c...
std::function< void(const PrepProgress &)> ProgressCallback
std::vector< std::string > stale_engines(const std::filesystem::path &onnx_dir, const std::filesystem::path &engine_dir)
Built engines (names, without .engine) whose recipe differs from the one load_engine_build_profiles()...
std::filesystem::path sam3_engine_dir(const Sam3AssetOptions &opts)
The device-specific engine cache directory for the managed SAM3 model (keyed by GPU + TensorRT versio...
PrepProgress sam3_status(const Sam3AssetOptions &opts)
Non-blocking status probe: is the managed model already loadable, and in what state?
std::vector< std::string > missing_engine_files(const std::filesystem::path &onnx_dir, const std::filesystem::path &engine_dir)
Files the engine directory still lacks before it is loadable (empty ⟹ ready): the required_engines(),...
std::filesystem::path resolve_models_dir(const std::filesystem::path &explicit_dir={})
Resolve the base models directory: explicit models_dir > $REUSEX_MODELS_DIR > $XDG_CACHE_HOME/reusex/...
std::filesystem::path sam3_onnx_dir(const Sam3AssetOptions &opts)
The directory holding the portable ONNX + tokenizer.json + tracker-meta.json.
EngineBuildProfiles load_engine_build_profiles(const std::filesystem::path &onnx_dir)
The engine-build recipe for an ONNX dir: its own engine-build.json when present and at least as new (...
std::vector< std::string > missing_onnx_files(const std::filesystem::path &onnx_dir)
Files the ONNX directory still lacks before it counts as a complete bundle (empty ⟹ complete).
const char * to_string(PrepState state)
PrepState
Lifecycle state of the managed SAM3 model on this device.
@ building
compiling GPU-specific TensorRT engines from ONNX
@ not_built
ONNX present, device engines not built, no build running.
@ downloading
fetching the portable ONNX bundle
@ ready
engines (or ONNX, for CPU) present and loadable
@ absent
the (complete) ONNX bundle is not on disk yet
std::vector< std::string > fallback_engines(const std::filesystem::path &engine_dir)
Engines (names, without .engine) the engine directory's stamp records as built text-only because thei...
const std::vector< std::string > & required_engines()
The detector engines every SAM3 model needs (vision encoder, text encoder, geometry encoder,...
void error(fmt::format_string< Args... > format, Args &&...args)
The full set of per-engine build recipes.
Best-effort progress report emitted during preparation.
float fraction
0..1 within the current phase (best-effort)
std::vector< std::string > update_engines
Only from sam3_status() in state not_built: when the engines are all there and the only gap is engine...
std::string message
human-readable detail
Controls where the managed SAM3 model lives and how it is fetched.
bool allow_download
If true, missing ONNX may be downloaded.
std::string manifest_url
URL of the release manifest (JSON listing the ONNX bundle files + sha256).
const std::atomic< bool > * cancel
Optional cooperative-cancellation flag (not owned).
std::filesystem::path models_dir
Base models directory.
bool use_cuda
Build engines for CUDA (true) or leave the ONNX in place for the CPU/ONNX runtime backend (false).