Skip to content

Build tool and notebooks to create the Yolov7 App for the Teknoir Platform.

Notifications You must be signed in to change notification settings

teknoir/yolov7_app

Repository files navigation

Teknoir YOLOv7 App

Build tool and notebooks to create the Yolov7 App for the Teknoir Platform

Base Images

Public images Device Alias tags
gcr.io/teknoir/yolov7 Generic
amd64 / arm64
(CPU)
cpu-latest
gcr.io/teknoir/yolov7 Generic
amd64 / arm64
(Nvidia GPU)
nv-latest
gcr.io/teknoir/yolov7 NVidia L4T
Jetson Nano/Xavier NX/Orin
l4tr32.7.1
l4tr32.7.2
l4tr34.1.1
gcr.io/teknoir/yolov7 Raspberry Pi 4 (64bit OS) TBD

Example Images including the vanilla Yolov7 model

In vanilla.Dockerfile and build_vanilla.sh there is a full example of a Yolov7 app for the Teknoir platform with the vanilla model trained on COCOA dataset.

Public example images Device Alias tags
gcr.io/teknoir/yolov7-vanilla Generic
amd64 / arm64
(CPU)
cpu-latest
gcr.io/teknoir/yolov7-vanilla Generic
amd64 / arm64
(Nvidia GPU)
nv-latest
gcr.io/teknoir/yolov7-vanilla NVidia L4T
Jetson Nano/Xavier NX/Orin
l4tr32.7.1
l4tr32.7.2
l4tr34.1.1
gcr.io/teknoir/yolov7-vanilla Raspberry Pi 4 (64bit OS) TBD

Kubeflow Pipelines

In the notebooks dir there are 2 notebooks that create Pipeline Templates.

Train Yolov7

Running the train_yolov7.ipynb notebook in the Teknoir Platform creates a pipeline that is prepared to take input from Labelstudio. See notebook for more information.

The notebook creates model artifacts that gets pushed to couldstorage and can be viewed in the Artifact Browser.

Build a custom Yolov7

Running the build_yolov7_app.ipynb notebook in the Teknoir Platform creates a pipeline that is prepared to take input from the pipeline created by train_yolov7.ipynb. See notebook for more information.

The notebook creates docker image artifact that gets pushed to the private Artifact Registry us-central1-docker.pkg.dev/{project_id}/{namespace}/{image_name}. Where {namespace} is your projects name and {image_name} is specified in the Devstudio triggering the build.

Teknoir Devstudio

When the pipelines are created there is an example flow in the flows folder that can be imported in a Devstudio.

Local Testing

Assuming you have a MQTT broker on your local network and a device that is emitting MQTT messages (possibly the same device), the following can be used to test this repository:

  1. Download a model artifact from GCS (like ppe-bbox-clean-20220821000000146).

  2. Run eclipse-mosquitto (in separate terminal window)

docker pull eclipse-mosquitto

docker run -it --name mosquitto -p 1883:1883 eclipse-mosquitto

  1. Execute code below with configuration modifications to reflect your system, data, etc.

MQTT_IN_0="camera/images" MQTT_SERVICE_HOST=192.168.68.104 MQTT_SERVICE_PORT=31883 WEIGHTS=weights/best_weights.pt IMG_SIZE=640 CLASS_NAMES=ppe-bbox-clean-20220821000000146/dataset/object.names python3 app.py

Start a build

To start a cloudbuild for the CPU version of the image run:

gcloud --project=teknoir builds submit . --config=cloudbuild_cpu.yaml --substitutions=SHORT_SHA="build-my-local-changes",BRANCH_NAME="test"