ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
sam3_assets.hpp File Reference
#include "reusex/vision/sam3/EngineBuildProfiles.hpp"
#include <atomic>
#include <filesystem>
#include <functional>
#include <stdexcept>
#include <string>
#include <vector>
Include dependency graph for sam3_assets.hpp:

Go to the source code of this file.

Classes

class  reusex::vision::sam3::Sam3PrepCancelled
 Thrown by prepare_sam3_model() when Sam3AssetOptions::cancel was raised. More...
struct  reusex::vision::sam3::PrepProgress
 Best-effort progress report emitted during preparation. More...
struct  reusex::vision::sam3::Sam3AssetOptions
 Controls where the managed SAM3 model lives and how it is fetched. More...

Namespaces

namespace  reusex
namespace  reusex::vision
namespace  reusex::vision::sam3

Typedefs

using reusex::vision::sam3::ProgressCallback = std::function<void(const PrepProgress &)>

Enumerations

enum class  reusex::vision::sam3::PrepState {
  reusex::vision::sam3::absent , reusex::vision::sam3::not_built , reusex::vision::sam3::downloading , reusex::vision::sam3::building ,
  reusex::vision::sam3::ready , reusex::vision::sam3::error
}
 Lifecycle state of the managed SAM3 model on this device. More...

Functions

const char * reusex::vision::sam3::to_string (PrepState state)
const std::vector< std::string > & reusex::vision::sam3::required_engines ()
 The detector engines every SAM3 model needs (vision encoder, text encoder, geometry encoder, decoder).
std::filesystem::path reusex::vision::sam3::resolve_models_dir (const std::filesystem::path &explicit_dir={})
 Resolve the base models directory: explicit models_dir > $REUSEX_MODELS_DIR > $XDG_CACHE_HOME/reusex/models (falling back to $HOME/.cache/reusex/models).
std::filesystem::path reusex::vision::sam3::sam3_onnx_dir (const Sam3AssetOptions &opts)
 The directory holding the portable ONNX + tokenizer.json + tracker-meta.json.
std::filesystem::path reusex::vision::sam3::sam3_engine_dir (const Sam3AssetOptions &opts)
 The device-specific engine cache directory for the managed SAM3 model (keyed by GPU + TensorRT version).
std::vector< std::string > reusex::vision::sam3::missing_onnx_files (const std::filesystem::path &onnx_dir)
 Files the ONNX directory still lacks before it counts as a complete bundle (empty ⟹ complete).
std::vector< std::string > reusex::vision::sam3::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(), an engine for every optional graph whose ONNX is present, tokenizer.json, and — when a tracker engine is present and the ONNX dir carries one — tracker-meta.json.
EngineBuildProfiles reusex::vision::sam3::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 (recipe_version) as the canonical recipe embedded at build time, else that built-in recipe (EngineBuildProfiles::builtin()).
std::vector< std::string > reusex::vision::sam3::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() now selects.
std::vector< std::string > reusex::vision::sam3::fallback_engines (const std::filesystem::path &engine_dir)
 Engines (names, without .engine) the engine directory's stamp records as built text-only because their geometry-prompt profile failed with a shape error (EngineBuildProfiles::fallback_engines).
std::vector< std::string > reusex::vision::sam3::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 changed since (its sha256 differs from the stamp's fallback_onnx_sha256, or the stamp predates fingerprints).
PrepProgress reusex::vision::sam3::sam3_status (const Sam3AssetOptions &opts)
 Non-blocking status probe: is the managed model already loadable, and in what state?
std::filesystem::path reusex::vision::sam3::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 load: