# Model Parameters

When loading a model with **`zoo.loadModel()`** you can supply an **`options`** object that lets you control various functionalities of the model. You can also set these parameters on a model instance after it has been loaded.

## Model Parameters

The following parameters can be configured to control the behavior of the model, including preprocessing, post-processing, and connection settings. Parameters are categorized by their effect:

* **JSON-only parameters**: These are passed directly to the server as model configuration and do not directly alter the JavaScript SDK's model class behavior.
* **Model-only parameters**: These exclusively affect the model class's behavior within the JavaScript SDK and are not sent to the server.
* **Hybrid parameters**: These both influence the model class's functionality in JavaScript and are also set in the model parameter JSON sent to the server.

| Parameter Name                 | Description                                                                                                                                                                                                                                                                                | Type                                      | Valid Values / Constraints                                                                                                                                                                                                                                                                                                                                          | Category   |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `deviceType`                   | Specifies the target device type for inference. This can be a single device or an array of preferred devices. The SDK will attempt to use the first supported device in the list.                                                                                                          | `string` or `Array<string>`               | Examples: `'RUNTIME/DEVICE'` (e.g., `'OPENVINO/CPU'`) or `['RUNTIME1/DEVICE1', 'RUNTIME2/DEVICE2']`. Must be a device type supported by the model and available on the system.                                                                                                                                                                                      | Hybrid     |
| `labelWhitelist`               | An array of strings. If set, only detection labels present in this list will be displayed in the overlay.                                                                                                                                                                                  | `Array<string>`                           | An array of strings, e.g., `['person', 'car']`.                                                                                                                                                                                                                                                                                                                     | Model-only |
| `labelBlacklist`               | An array of strings. If set, detection labels present in this list will be excluded from the overlay.                                                                                                                                                                                      | `Array<string>`                           | An array of strings, e.g., `['background', 'noise']`.                                                                                                                                                                                                                                                                                                               | Model-only |
| `overlayColor`                 | Sets the color(s) used for drawing bounding boxes, labels, and segmentation masks. Can be a single RGB triplet `[R, G, B]` or an array of such triplets `[[R1, G1, B1], [R2, G2, B2]]` for cycling through colors. Defaults to auto-generated colors.                                      | `Array<number>` or `Array<Array<number>>` | Numbers between 0 and 255 for RGB components. Example: `[255, 0, 0]` for red, or `[[255, 0, 0], [0, 255, 0]]`.                                                                                                                                                                                                                                                      | Model-only |
| `overlayLineWidth`             | Sets the line width (in pixels) for drawing bounding boxes and connections in pose detection.                                                                                                                                                                                              | `number`                                  | A positive number, e.g., `3`.                                                                                                                                                                                                                                                                                                                                       | Model-only |
| `overlayShowLabels`            | A boolean value. If `true`, labels (e.g., class names) will be displayed in the overlay.                                                                                                                                                                                                   | `boolean`                                 | `true` or `false`.                                                                                                                                                                                                                                                                                                                                                  | Model-only |
| `overlayShowProbabilities`     | A boolean value. If `true`, probabilities or confidence scores will be displayed alongside labels in the overlay.                                                                                                                                                                          | `boolean`                                 | `true` or `false`.                                                                                                                                                                                                                                                                                                                                                  | Model-only |
| `overlayAlpha`                 | Sets the transparency percentage of the overlay elements (bounding boxes, masks, etc.).                                                                                                                                                                                                    | `number`                                  | A number between 0 (fully transparent) and 1 (fully opaque).                                                                                                                                                                                                                                                                                                        | Model-only |
| `overlayFontScale`             | Sets the scaling factor for the font size of text displayed in the overlay.                                                                                                                                                                                                                | `number`                                  | A positive number, e.g., `1.5` for 150% size.                                                                                                                                                                                                                                                                                                                       | Model-only |
| `inputLetterboxFillColor`      | Sets the RGB fill color used for letterboxing when the `inputPadMethod` is set to `'letterbox'`.                                                                                                                                                                                           | `Array<number>`                           | An array of 3 numbers between 0 and 255, e.g., `[0, 0, 0]` for black.                                                                                                                                                                                                                                                                                               | Model-only |
| `inputPadMethod`               | Specifies the method used to resize and pad the input image to match the model's expected input dimensions.                                                                                                                                                                                | `string`                                  | One of: `'stretch'`, `'letterbox'`, `'crop-first'`, or `'crop-last'`.                                                                                                                                                                                                                                                                                               | Model-only |
| `saveModelImage`               | A boolean value. If `true`, the preprocessed image (as a Blob) that was sent to the model will be included in the result object.                                                                                                                                                           | `boolean`                                 | `true` or `false`.                                                                                                                                                                                                                                                                                                                                                  | Model-only |
| `inputCropPercentage`          | For `'crop-first'` and `'crop-last'` padding methods, this specifies the percentage of the image to crop.                                                                                                                                                                                  | `number`                                  | A number between 0 and 1.                                                                                                                                                                                                                                                                                                                                           | Model-only |
| `autoScaleDrawing`             | A boolean value. If `true`, overlay elements like font size and line width will automatically scale based on the display canvas size to maintain visual consistency.                                                                                                                       | `boolean`                                 | `true` or `false`.                                                                                                                                                                                                                                                                                                                                                  | Model-only |
| `targetDisplayWidth`           | Reference width (in pixels) used for `autoScaleDrawing`. This helps determine the scaling factor for overlay elements.                                                                                                                                                                     | `number`                                  | A number representing the target width, defaults to `1920`.                                                                                                                                                                                                                                                                                                         | Model-only |
| `targetDisplayHeight`          | Reference height (in pixels) used for `autoScaleDrawing`. This helps determine the scaling factor for overlay elements.                                                                                                                                                                    | `number`                                  | A number representing the target height, defaults to `1080`.                                                                                                                                                                                                                                                                                                        | Model-only |
| `cloudToken`                   | Sets the authentication token required for connecting to the DeGirum cloud inference service.                                                                                                                                                                                              | `string`                                  | A valid authentication token string.                                                                                                                                                                                                                                                                                                                                | JSON-only  |
| `cloudURL`                     | Sets the base URL for the DeGirum cloud server.                                                                                                                                                                                                                                            | `string`                                  | A valid URL string, e.g., `'https://cloud.degirum.com'`.                                                                                                                                                                                                                                                                                                            | JSON-only  |
| `outputConfidenceThreshold`    | Sets the minimum confidence score (probability) for a detection or classification to be included in the model's output. Results below this threshold are filtered out.                                                                                                                     | `number`                                  | A number between 0 and 1.                                                                                                                                                                                                                                                                                                                                           | JSON-only  |
| `outputMaxDetections`          | Sets the maximum total number of detections that the model should return for a single inference.                                                                                                                                                                                           | `number`                                  | An integer.                                                                                                                                                                                                                                                                                                                                                         | JSON-only  |
| `outputMaxDetectionsPerClass`  | Sets the maximum number of detections allowed per individual class.                                                                                                                                                                                                                        | `number`                                  | An integer.                                                                                                                                                                                                                                                                                                                                                         | JSON-only  |
| `outputMaxClassesPerDetection` | Sets the maximum number of classes to report for each detected object. Useful for models that can classify a single detection into multiple categories.                                                                                                                                    | `number`                                  | An integer.                                                                                                                                                                                                                                                                                                                                                         | JSON-only  |
| `outputNmsThreshold`           | Sets the Non-Maximum Suppression (NMS) Intersection Over Union (IOU) threshold. This parameter is used to filter overlapping bounding boxes, keeping only the most confident ones.                                                                                                         | `number`                                  | A number between 0 and 1.                                                                                                                                                                                                                                                                                                                                           | JSON-only  |
| `outputPostprocessType`        | Specifies the type of post-processing to apply to the model's raw output. This dictates how the model's predictions are interpreted and formatted.                                                                                                                                         | `string`                                  | One of: `'None'`, `'Base'`, `'Classification'`, `'MultiLabelClassification'`, `'Detection'`, `'DetectionYolo'`, `'DetectionYoloV8'`, `'DetectionYoloV10'`, `'DetectionYoloPlates'`, `'DetectionYoloV8Plates'`, `'FaceDetection'`, `'PoseDetection'`, `'PoseDetectionYoloV8'`, `'HandDetection'`, `'Segmentation'`, `'SegmentationYoloV8`, `Dequantization`, `Null`. | JSON-only  |
| `outputTopK`                   | For classification models, this parameter specifies the number of top predictions (classes with the highest confidence scores) to return.                                                                                                                                                  | `number`                                  | An integer.                                                                                                                                                                                                                                                                                                                                                         | JSON-only  |
| `outputUseRegularNms`          | A boolean value. If `true`, the model will use regular Non-Maximum Suppression (NMS); otherwise, it may use a faster, approximate NMS algorithm.                                                                                                                                           | `boolean`                                 | `true` or `false`.                                                                                                                                                                                                                                                                                                                                                  | JSON-only  |
| `measureTime`                  | A boolean value. If `true`, enables detailed performance timing statistics for various stages of the inference process (client-side preprocessing, server-side inference, client-side post-processing). These statistics can be retrieved using `getTimeStats()` and `printLatencyInfo()`. | `boolean`                                 | `true` or `false`.                                                                                                                                                                                                                                                                                                                                                  | Hybrid     |
| `eagerBatchSize`               | Sets the batch size for eager execution, influencing how many frames are processed together in a single batch.                                                                                                                                                                             | `number`                                  | A positive integer.                                                                                                                                                                                                                                                                                                                                                 | JSON-only  |
| `outputPoseThreshold`          | Sets the confidence threshold for individual keypoints in pose detection results. Keypoints with scores below this threshold may be filtered out.                                                                                                                                          | `number`                                  | A number between 0 and 1.                                                                                                                                                                                                                                                                                                                                           | JSON-only  |
| `inputShape`                   | Defines the expected input shape(s) for the model. This can be an array of arrays, where each inner array represents the dimensions (N, H, W, C) for a specific input.                                                                                                                     | `Array<Array<number>>`                    | An array of integer arrays, e.g., `[[1, 224, 224, 3]]` for a single input of batch size 1, height 224, width 224, and 3 channels.                                                                                                                                                                                                                                   | Hybrid     |
