DEV Community

DEBIX Industrial Computers
DEBIX Industrial Computers

Posted on

Training YOLOv5 Model and Deploying to DEBIX

Installation

Create a virtual environment with Python version greater than 3.10 and install the Ultralytics tool:

conda create -n yolo python=3.10

conda activate yolo

pip install Ultralytics
Enter fullscreen mode Exit fullscreen mode

Training
Launch training using the yolo CLI. If the dataset and pretrained model are not locally available, they will be automatically downloaded from the latest YOLOv5:

yolo train data=coco8.yaml model=yolov5n.pt epochs=100 imgsz=640
Enter fullscreen mode Exit fullscreen mode

Exporting
Export the trained model to a TFLite model.

yolo export model=runs/detect/train/weights/best.pt format=tflite int8=true data=coco8.yaml

Enter fullscreen mode Exit fullscreen mode

Ultralytics will export five types of models: float32, float16, int8, integer_quant, full_integer_quant.

On DEBIX, it is recommended to choose the integer_quant type of model.

Testing

Copy the exported model integer_quant.tflite to DEBIX.
Run the test using the built-in TensorFlow benchmark tool of the system:

/usr/bin/tensorflow-lite-2.16.2/examples/benchmark_model --graph=best_integer_quant.tflite --enable_op_profiling=true --external_delegate_path=/usr/lib/libvx_delegate.so
Enter fullscreen mode Exit fullscreen mode

Top comments (0)