Skip to main content

Crate sightloom_host

Crate sightloom_host 

Source
Expand description

Host model package for sightloom.

§Product boundary

SightLoom does not turn photos into embeddings. This crate is the host side of the killer path:

photo / frame
  → host detect / embed (reference or ONNX)
  → SightLoom IndexSession (rank / memory / tracks)

Weights, GPU runtimes, and model download policies live here (or in a private host binary), never inside sightloom-core.

§Features

FeatureWhat
std (default)host package + reference models
onnxtract ONNX backends ([OnnxEmbedder], [OnnxDetector])
download[HttpModelFetcher] for ModelSpec.uri
image-decodeJPEG/PNG → RGB for encoded photos
fullonnx + download + image-decode

§Steps

  1. Config, preprocess, reference models, HostPipeline (enroll_photo / search_photo_jpeg / ingest_frame / save_package)
  2. ONNX load from cache / ModelSpec.local_path (HostPipeline::from_onnx_cache / from_manifest, feature onnx) (YOLO detect: PreprocessConfig::yolo_detect + decode_detector_output)
  3. Evidence packs — MOT / re-id / redaction / anomaly FAR
  4. FAR + scoped anomaly baselines
  5. Download + image decode + analysis day-of-week seasonality
  6. Weights cookbook — ModelManifest, SHA-256 integrity, host docs
  7. TrackEval bridge — parse/export MOTChallenge, import host summaries

Re-exports§

pub use evidence::AnomalyEvidence;
pub use evidence::EvidencePack;
pub use evidence::EvidencePackPaths;
pub use evidence::MotEvidence;
pub use evidence::RedactionEvidence;
pub use evidence::ReidEvidence;
pub use evidence::build_synthetic_anomaly_evidence;
pub use evidence::build_synthetic_evidence_pack;
pub use evidence::build_synthetic_mot_evidence;
pub use evidence::build_synthetic_redaction_evidence;
pub use evidence::build_synthetic_reid_evidence;
pub use evidence::write_evidence_pack;

Modules§

evidence
Step-3 evidence packs: portable MOT / re-id / redaction reports.

Structs§

DecodedRgb
Decoded RGB8 raster ready for preprocess / embed.
DeferredDownloadFetcher
Fetcher that records requested downloads but does not fetch (offline stub).
DetectorDecodeConfig
Thresholds for decode + NMS.
FilesystemFetcher
Only uses local_path or cache_dir / id; never hits the network.
FrameView
Re-export facade types commonly used by host binaries. Borrowed view of one host frame (pixels stay with the host).
HostBundleConfig
Full host bundle: which models participate in photo search / ingest.
HostPipeline
Runs the killer path with host embedders + SightLoom ranking.
IndexSession
Re-export facade types commonly used by host binaries. Host-facing session: multi-source tracker + identity gallery + VisionIndex.
Letterbox
Maps network-space boxes back to the source frame.
ModelManifest
Versioned list of host models (download / local placement policy).
ModelSpec
One model the host may load (weights not shipped in SightLoom core).
PhotoView
Re-export facade types commonly used by host binaries. Borrowed photo / crop buffer for embedding (host owns decode).
PreprocessConfig
ImageNet-style or custom normalize + resize plan.
RawBox
One decoded box in network pixel space (x1,y1,x2,y2).
ReferenceEmbedder
Deterministic embedding from RGB (or encoded bytes fingerprint).
ReferenceFaceDetector
Face detector stub: smaller centered box when pixels present.
ReferenceHostModels
Bundled reference detectors + embedders for e2e demos.
ReferencePersonDetector
Deterministic person detector: one full-frame box when any non-zero pixel exists.
ResolvedModel
Result of materializing one model for logging / evidence.

Enums§

DevicePreference
Where the host prefers to run a model.
EmbeddingTask
Re-export facade types commonly used by host binaries. Kind of embedding a host model produces.
HostError
Errors from host model config, registry, preprocess, or adapters.
ModelTask
High-level model task in the host package.
PixelFormat
Re-export facade types commonly used by host binaries. Pixel layout of a host frame buffer (no decode ownership).

Traits§

DetectorAdapter
Re-export facade types commonly used by host binaries. Host-implemented detector: one frame stamp + pixel view → detections.
ModelFetcher
Resolves a ModelSpec to a local file path.
PhotoEmbeddingAdapter
Re-export facade types commonly used by host binaries. Host-implemented photo → embedding vector adapter.
TrackEmbeddingAdapter
Re-export facade types commonly used by host binaries. Host track re-id embedder for continuous per-frame track vectors.

Functions§

crop_rgb8
Crops an axis-aligned box from packed RGB8 (clamped to image).
decode_detector_output
Decodes a flattened detector tensor into network-space boxes.
decode_encoded_rgb
Stub when image-decode is off.
decode_photo_rgb
Decodes a photo into RGB8.
detections_from_raw_boxes
Maps network-space boxes to source-frame Detections and applies NMS.
ensure_cache_dir
Creates cache directory if needed.
file_sha256_hex
Computes lowercase hex SHA-256 of a file.
frame_to_rgb8
Converts a FrameView into packed RGB8 (host preprocess helper).
letterbox_rgb8
Letterbox packed RGB8 into net_w × net_h with a constant pad.
maybe_verify_sha256
When expected is Some, verifies; otherwise no-op.
prepare_rgb8_nchw
Resize then normalize in one shot.
prepare_rgb8_nchw_with_meta
Resize (or letterbox) then normalize. Returns the mapping used for boxes.
resize_rgb8_nearest
Nearest-neighbor resize of packed RGB8 → packed RGB8 at out_w × out_h.
resolve_manifest
Resolves all models and returns structured results.
rgb8_to_chw_f32
RGB8 packed → CHW f32 with mean/std (and optional /255).
verify_file_sha256
Verifies path against an expected lowercase (or mixed-case) hex SHA-256.
write_cache_readme
Writes a placeholder marker file documenting where real weights go.