A repository for building, testing, and deploying an object detection model for TFLite to the Viam registry. From the registry, the script can be used in the Viam custom training scripts flow for training ML models in the Viam cloud.
We test this when you cut a PR by running scripts/test.sh
. This in turn just runs the model and then runs pytest
which will run everything in tests/
. Our testing here isn't overly complex and we have no code coverage or anything so please keep up good hygiene and if you make a change to training.py
that would requires a test (i.e. you've made a change and you had to manually test something different), add that test condition somewhere to tests/
In order to submit this script with custom arguments, you must use the Viam CLI. One such example is included below:
viam train submit custom with-upload --dataset-id=<DATASET-ID> --model-org-id=<ORG-ID> --model-name=detection --model-type=object_detection --framework=tflite --path=<REPO-TAR-PATH> --script-name=detection_script --args=num_epochs=3,labels="'green_square blue_star'"
Be sure to note that labels is surrounded with single quotes then enclosed with double quotes to ensure it is submitted properly. If you are running the script from a previous version or from the website, you will not be able to use custom arguments.
When you submit a pull request a workflow will run using our common workflows that will lint check your code, build it in the docker image we use in production for training and run the test file you specify.
The default test files is scripts/test.sh
. If this changes you will need to update .github/workflows/pull_request.yaml
so that it's
jobs:
build:
uses: viam-modules/common-workflows/.github/workflows/lint_and_test.yaml
with:
test_script_name: NEW_TEST_FILE_NAME
Upon merging to main
a workflow will automatically update the module in viam-dev
allowing for people to use your latest changes. The configs you can (but shouldn't!) play with are:
- framework -- DO NOT CHANGE THIS! This is a tflite script and will always be (see: repo name)
- script_name -- This is what the name will be in the registry. If you change this, it will make a new training script in the registry. Be aware
- model_type -- object_detection