# Organizing Models

## **JSON Model File Naming Conventions**

Each JSON model file in a model zoo follows a structured naming convention to maintain consistency and clarity:

{% code overflow="wrap" %}

```bash
<model family name>--[<resolution>_][<density>_][<precision>_][<agent>_][<hardware>_]<version>.json
```

{% endcode %}

{% hint style="info" %}
**`--`** and **`_`** are used as field separators.

**`<>`** denotes a field with variable contents.

**`[]`** denotes optional fields.
{% endhint %}

### **Field Descriptions**

| Field        | Description                                         | Possible Values                                                                   |
| ------------ | --------------------------------------------------- | --------------------------------------------------------------------------------- |
| model family | The name of the model family                        | See [Model Family Names](#model-family-names) for model family naming conventions |
| resolution   | Input tensor size (optional)                        | `<integer>x<integer>`                                                             |
| density      | Model density (optional)                            | `pruned`, `dense`                                                                 |
| precision    | Model calculation precision (optional)              | `quant`, `float`                                                                  |
| agent        | DeGirum runtime agent type for inference (optional) | `Agent type` or `multi`                                                           |
| hardware     | Hardware for model inference (optional)             | `Device type` or `multi`                                                          |
| version      | Version of the compiled model                       | `<integer>`                                                                       |

### **Model Family Names**

Use the following conventions when naming model families:

* **Do not use dashes (`-`)**. Use underscores (`_`) instead.
* **Do not use capital letters**. All names should be in lowercase.
* **Include the backbone network as a suffix** when applicable. For example:
  * `posenet_mobilenet_v1`
* **Include the network version as a suffix** when applicable. For example:
  * `mobilenet_v1`
* **Different model sizes** (such as small or large) should be defined as a suffix when applicable. For example:
  * `yolo_v5s` (for a small version)

These conventions ensure models are easily identifiable and consistent across AI Hub and local model zoos.

## Model Zoo Directory Structure

Place each model in its own subdirectory with all required files.

Model zoos on the AI Hub follow this structure by default, and local model zoos can use the same approach.

#### Example: Model Directory Structure

{% code overflow="wrap" %}

```
<model_zoo_directory>/
    ├── mobilenet_v2_imagenet--224x224_quant_n2x_orca1_1/
    │   ├── mobilenet_v2_imagenet--224x224_quant_n2x_orca1_1.json
    │   ├── mobilenet_v2_imagenet--224x224_quant_n2x_orca1_1.n2x
    │   └── labels.json  (if required)
    ├── yolov8n_coco--640x640_quant_openvino_1/
    │   ├── yolov8n_coco--640x640_quant_openvino_1.json
    │   ├── yolov8n_coco--640x640_quant_openvino_1.xml
    │   ├── yolov8n_coco--640x640_quant_openvino_1.bin
    │   └── postprocess.py  (if required)
    └── yolov8n_relu6_coco_pose--640x640_quant_tflite_edgetpu_1/
        ├── yolov8n_relu6_coco_pose--640x640_quant_tflite_edgetpu_1.json
        ├── yolov8n_relu6_coco_pose--640x640_quant_tflite_edgetpu_1.tflite
        └── labels.json  (if required)
```

{% endcode %}

Each subdirectory corresponds to a single model and contains all the necessary files to define, load, and execute that model.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.degirum.com/pysdk/user-guide-pysdk/organizing-models.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
