On this page
models.set
Creates an ONNX source-model value with readable name/path members.
Syntax
Atlas Script
models.set(path_or_name, path?)Parameters
path_or_name- With one argument, the ONNX model path; with two, the model name to register, followed by its path.
pathOptional- Project-relative path or model name accepted by the method.
Return value
Returns model.
Remarks
Creates an ONNX source-model value with readable name/path members. The one-argument form derives the name from the filename but does not add a legacy registry entry. The two-argument form models.set(name, path) also stores that name for models.path(name) and models.all().
Examples
Configure an ONNX detector.atlas
model objectSource = models.set("models/object_detector.onnx");
model objectDetector;
const scanRadius = 0.18;
const scanRoi = [0.5 - scanRadius, 0.5 - scanRadius, scanRadius * 2, scanRadius * 2];
event on_start() {
objectDetector = vision.model(objectSource, "object", scanRoi, 0.50, true, vision.auto);
}
event on_frame() {
ui.circle(0.5, 0.5, scanRadius, rgb.cyan, 2, false);
target detectedObject = objectDetector.target;
if (detectedObject == null) {
ui.status("No object detected");
return;
}
ui.rect(detectedObject.box.x, detectedObject.box.y, detectedObject.box.width, detectedObject.box.height, rgb.lime, 3, false);
ui.status(string.format("Object {}", detectedObject.confidence));
}