Guides/Advanced/12 Read a model's configuration

Read a model's configuration

1from lynx import LYNX
2
3model = LYNX("lynx-basic")
4
5print(model.channel_order) # "rgb" or "bgr"
6print(model.resize_mode) # "stretch" or "letterbox"
7print(model.normalize_mean) # [r, g, b] floats
8print(model.default_conf_threshold) # float or None
9print(model.per_class_conf) # {class_name: float}
10print(model.metadata) # full resolved snapshot (debug)

Historically, using a model meant reading the trainer's prose: "make sure to use RGB", "letterbox to 640", "subtract these ImageNet means". Get one wrong and detections silently go to garbage. With v2 metadata, the artifact carries that information directly — the SDK reads it, the preprocess path uses it, you can introspect it.

The SDK does this automatically. You only touch these properties when you're:

  • Debugging detection quality — first thing to check when results look wrong is whether your input format matches channel_order (cv2 loads BGR; PIL loads RGB)
  • Building model-aware tooling — admin UIs that show "this model expects RGB letterboxed at 640, ImageNet normalize"
  • Validating consistency — comparing two artifacts to confirm they expect identical preprocessing
  • Writing support ticketsmodel.metadata dumps everything; paste it in the ticket and there's no "what model do you have loaded" round-trip

v1 artifacts (no v2 block) return sensible defaults — RGB, stretch resize, ImageNet normalize, 114 letterbox pad. Old models keep working. New models stamped with v2 metadata light up these properties with the real values. No migration required; nothing breaks.

model.metadata is the dictionary view of everything — v2 fields, v1 fields (class_names, img_size, strides), plus producer provenance (model_slug, model_version, producer, export_timestamp). The "which model do I have loaded" question becomes a one-line answer.

Next
Run the LYNX CLI from Python
Exact CLI behavior from inside Python — useful for reproducing CI runs in a notebook.