# Preliminary model-package check

Example version: 1.0, 27 September 2026. Python 3.9+, standard library only.
Status: structure check. The model has not been executed or uploaded to the platform.

## Result

The program reads `model_info.json` and `coco_categories.json` from an extracted directory and prints JSON lists of `errors` and `warnings`. Errors return exit code 1; otherwise it returns 0. `structure_checked` means only that the listed local checks passed, not that the package is ready to upload or run.

## Run

In the extracted example directory:

```sh
python3 check_package.py sample-package
python3 check_example.py
```

The first command matches `expected.json`: no errors and four warnings. Angle brackets in `model_type`, `task_type` and `profiles` are intentional placeholders. `weights/fixture.txt` is plain text, **not a model**. Do not upload the training `sample-package` to BOX.

## What is checked

- Two JSON objects at the directory root.
- String values for `model_type` and `task_type`.
- Positive integer input dimensions; booleans do not count as integers.
- A nonempty `profiles` list containing `default_profile`.
- A relative `weights_path`, an existing file and no escape from the package directory.
- A `categories` array: unique integer IDs, string names, a finite threshold, three RGB integers from 0 to 255 and boolean flags.

The selected schema comes from the public Custom model package guide. This checker implements only that subset. Check the full rules, optional fields, defaults and constraints for your particular `model_type` and runtime. Extra fields are allowed and not validated. Some runtimes support a template in `weights_path`; the checker warns about templates without confirming that matching weights exist. An empty categories array is not rejected because its applicability depends on the task. Contract keys such as `ru_name` and `full_ru_name` are retained exactly; their synthetic values are English for this fixture.

## Check your own package

Pass a separate working copy of the extracted package. The program only reads files; it does not import or execute model code. Then check support for your model type, task type and profiles, `model.py` and dependencies required by the selected protocol, real weights and results on an asset. The script does not check ONNX/TensorRT formats or model outputs. It supplements platform validation; it is not a complete official package validator.

## Tests

`check_example.py` checks the reference output, paths escaping the package, missing weights, boolean input dimensions, a profile mismatch and duplicate category IDs. BOX 5.0 / Platform 4.0 compatibility requires a test on the actual build. The example ZIP contains no working weights.

Guides:
- https://viewlogic.ai/technology/custom-model-package/
- https://viewlogic.ai/technology/model-lifecycle/
