Skip to main content

Model Parameters (model_params)

In plain terms: a few models have optional settings you can pass per request — without recreating the store. Right now this is only for the face models (e.g. "how confident must a detection be?"). Everything else ignores it, so you can skip this section unless you're doing face detection.

Some AI models accept optional runtime parameters via model_params — a map<string, string> field available on Set, GetSimN, and ConvertStoreInputToEmbeddings requests. These parameters let you tune model behavior at inference time without changing store configuration.

When model_params is empty (or omitted), models use their built-in defaults. Models that don't support any parameters simply ignore the field.

Supported Parameters by Model

ModelParameterTypeDefaultDescription
Buffalo_Lconfidence_thresholdfloat (0.0–1.0)0.5Minimum detection confidence for a face to be included. Higher values = fewer but more confident detections.
Buffalo_Lattributesstring (comma-separated)(empty)Optional attributes to compute. Use genderage to enable age and gender predictions. When omitted, only face embeddings and bounding boxes are computed.
SFace+YuNetconfidence_thresholdfloat (0.0–1.0)0.6Minimum detection confidence for a face to be included. Higher values = fewer but more confident detections.

Text embedding models (MiniLM, BGE), image models (ResNet, CLIP), and audio models (CLAP) do not currently use model_params.

Usage Examples

Rust — setting a high confidence threshold for face detection:

Rust
use std::collections::HashMap;

let mut model_params = HashMap::new();
model_params.insert("confidence_threshold".to_string(), "0.9".to_string());

let set_params = Set {
store: "faces_store".to_string(),
inputs: vec![/* ... */],
preprocess_action: PreprocessAction::NoPreprocessing as i32,
execution_provider: None,
model_params,
};

Python — using default parameters (empty dict):

Python
await client.set(
ai_query.Set(
store="faces_store",
inputs=[...],
preprocess_action=preprocess.PreprocessAction.NoPreprocessing,
model_params={} # uses model defaults
)
)

Python — custom confidence threshold:

Python
await client.set(
ai_query.Set(
store="faces_store",
inputs=[...],
preprocess_action=preprocess.PreprocessAction.NoPreprocessing,
model_params={"confidence_threshold": "0.9"}
)
)

When to Tune model_params

  • Inclusive detection (e.g., group photos where you want all faces): Use a lower threshold like 0.3
  • Standard detection (balanced): Use the model default (0.5 for Buffalo_L, 0.6 for SFace+YuNet)
  • Strict detection (e.g., ID verification where only clear faces matter): Use a higher threshold like 0.9