diff --git a/README.md b/README.md index 3c16806..b826dbd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,83 @@ -# Hailo +# Introduction +These installation and setup instructions are aimed for yolov5 deployment on a PCIe connected Hailo device. +If you want to deploy a different network, check the [other networks](Other Networks) section. + +# Preemptive Note + +The Hailo pipeline is constantly updating and changing, so it might not be ideal to follow these instructions as they are not updated regularly. I would +recommend following the hailo tutorials from the [hailo model zoo](https://github.com/hailo-ai/hailo_model_zoo/blob/master/docs/RETRAIN_ON_CUSTOM_DATASET.md) +and go through the docs on hailo.ai. +guide + +# Requirements + +For deployment +- access to [hailo.ai developer zone](https://hailo.ai/developer-zone) +- Hailo PCIe Device +- Ubuntu 18.04 or 20.4 + + +For taining +- GPU enabled device (recommended) +- [hailo.ai](www.hailo.ai) developer account +- [docker](https://docs.docker.com/engine/install/ubuntu/) +- [nvidia docker](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) + +# Installation Tutorial + +This is split into the 'deploy device' (which has your Hailo PCIe Device connected) and the 'training device' which you'll use for network training and network to hailo quantization. Skip this if you already have a `.har` file +you would like to deploy. + +## For your (GPU enabled) training Device + +You'll need a way to train your network (yielding a .pb file from it) and the hailo software suite to generate the Hailo File from that. + + - always download the newest version of the [hailo software suite](https://hailo.ai/developer-zone/sw-downloads) from the [hailo.ai software download zone](https://hailo.ai/developer-zone/sw-downloads/) + which are getting monthly updates at the time of writing. This of course means that these notes are rapidly aging into inaccuracy. + - clone the [hailo model zoo](https://github.com/hailo-ai/hailo_model_zoo), which has some convenient yolov5 + Docker containers. + +### Setup + + - unzip the `hailo software suite` and run inside `./hailo_sw_suite_docker_run.sh`. If this is your fist time running, the container will set up. + Otherwise, you'll have to either `--resume` or `--override` + +## For your Device with a Hailo Chip attached + - downloads the newest hailo rt from the [hailo.ai software download zone](https://hailo.ai/developer-zone/sw-downloads/) + - extract the file and run the installer. Once you're done, reboot. + - Source the virtual environment under `/path/to/hailo_rt/Installer/hailo_platform_venv/bin/activate` + - test virtual environment by running `hailo` + + +# Setup Example for a custom Yolov5m + + +## Train your own Yolov5m + - For yolov5 we'll be using hailo Docker containers, which are based on the [ultralytics yolov5 containers](https://github.com/ultralytics/yolov5) + - hailo model zoo now has a [guide how to train yolov5 for hailo](https://github.com/hailo-ai/hailo_model_zoo/blob/master/docs/RETRAIN_ON_CUSTOM_DATASET.md) follow that one. Some notes: + - You'll need to create your own dataset structure for the training process. [This guide](https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data) + explains well on how to create that. + - There's a minimal example dataset in this repository under `/dataset` + - To mount this, use eg.: `docker run -it --gpus all -ipc=host -v /path/to/dataset/:/dataset yolov5:v0` + - For training, make sure you target the correct `--model` and use the correct `--weights` (which are now conveniently already in the hailo docker) + - once you've saved the best.pb onnx file, you can exit this docker container + - once you are done with the steps 'training and exporting to ONNX', move on to the next step. + + +## Create Hailo representation (hef) + + - in `hailo_sw_suite_docker_run.sh` add a volume so you can access your best.pb onnx file, for example + in the `DOCKER_ARGS` you could add -v /home/user/files:/files + - run `./hailo_sw_suite_docker_run.sh --resume` to get into the docker container + - follow the rest of the tutorial from [the hailo model zoo](https://github.com/hailo-ai/hailo_model_zoo/blob/master/docs/RETRAIN_ON_CUSTOM_DATASET.md) + - Note, that for yolov5m, Hailo provides a configuration yaml which defines the quantization levels for the various networks. If you have a custom network + you will have to define your custom yaml file. I liked using [netron](https://github.com/lutzroeder/Netron) to visualize the network for that. + +## run inference + + + +# Other Networks + +- what other networks can I deploy on Hailo? diff --git a/dataset/dataset/dataset.yaml b/dataset/dataset/dataset.yaml new file mode 100644 index 0000000..75ad190 --- /dev/null +++ b/dataset/dataset/dataset.yaml @@ -0,0 +1,7 @@ +path: /my_dataset/dataset/dataset/ +train: /my_dataset/dataset/dataset/images +val: /my_dataset/dataset/dataset/images + +nc: 4 + +names: [Product_Front, Label, Pallet_Front, skip] diff --git a/dataset/dataset/dataset/images/watt_1_0001.jpg b/dataset/dataset/dataset/images/watt_1_0001.jpg new file mode 100644 index 0000000..4996b5e Binary files /dev/null and b/dataset/dataset/dataset/images/watt_1_0001.jpg differ diff --git a/dataset/dataset/dataset/images/watt_1_0002.jpg b/dataset/dataset/dataset/images/watt_1_0002.jpg new file mode 100644 index 0000000..f76f9d8 Binary files /dev/null and b/dataset/dataset/dataset/images/watt_1_0002.jpg differ diff --git a/dataset/dataset/dataset/images/watt_1_0003.jpg b/dataset/dataset/dataset/images/watt_1_0003.jpg new file mode 100644 index 0000000..ede9d9d Binary files /dev/null and b/dataset/dataset/dataset/images/watt_1_0003.jpg differ diff --git a/dataset/dataset/dataset/images/watt_1_0004.jpg b/dataset/dataset/dataset/images/watt_1_0004.jpg new file mode 100644 index 0000000..b715d25 Binary files /dev/null and b/dataset/dataset/dataset/images/watt_1_0004.jpg differ diff --git a/dataset/dataset/dataset/images/watt_1_0005.jpg b/dataset/dataset/dataset/images/watt_1_0005.jpg new file mode 100644 index 0000000..2e76893 Binary files /dev/null and b/dataset/dataset/dataset/images/watt_1_0005.jpg differ diff --git a/dataset/dataset/dataset/images/watt_1_0006.jpg b/dataset/dataset/dataset/images/watt_1_0006.jpg new file mode 100644 index 0000000..ef6369b Binary files /dev/null and b/dataset/dataset/dataset/images/watt_1_0006.jpg differ diff --git a/dataset/dataset/dataset/images/watt_1_0007.jpg b/dataset/dataset/dataset/images/watt_1_0007.jpg new file mode 100644 index 0000000..2e35165 Binary files /dev/null and b/dataset/dataset/dataset/images/watt_1_0007.jpg differ diff --git a/dataset/dataset/dataset/images/watt_1_0008.jpg b/dataset/dataset/dataset/images/watt_1_0008.jpg new file mode 100644 index 0000000..6a4f90a Binary files /dev/null and b/dataset/dataset/dataset/images/watt_1_0008.jpg differ diff --git a/dataset/dataset/dataset/images/watt_1_0009.jpg b/dataset/dataset/dataset/images/watt_1_0009.jpg new file mode 100644 index 0000000..7afed7c Binary files /dev/null and b/dataset/dataset/dataset/images/watt_1_0009.jpg differ diff --git a/dataset/dataset/dataset/labels.cache b/dataset/dataset/dataset/labels.cache new file mode 100644 index 0000000..1f8dc6a Binary files /dev/null and b/dataset/dataset/dataset/labels.cache differ diff --git a/dataset/dataset/dataset/labels/watt_1_0001.txt b/dataset/dataset/dataset/labels/watt_1_0001.txt new file mode 100644 index 0000000..5073d48 --- /dev/null +++ b/dataset/dataset/dataset/labels/watt_1_0001.txt @@ -0,0 +1,7 @@ +0 0.951948 0.434119 0.086990 0.188237 +0 0.482964 0.427400 0.528741 0.233950 +0 0.963295 0.170675 0.068840 0.341350 +0 0.096435 0.176056 0.192869 0.352112 +0 0.498091 0.158575 0.375942 0.317150 +0 0.103991 0.430094 0.201962 0.201688 +1 0.057859 0.235131 0.115717 0.185538 diff --git a/dataset/dataset/dataset/labels/watt_1_0002.txt b/dataset/dataset/dataset/labels/watt_1_0002.txt new file mode 100644 index 0000000..f1dd08b --- /dev/null +++ b/dataset/dataset/dataset/labels/watt_1_0002.txt @@ -0,0 +1 @@ +3 0.486515 0.464781 0.372918 0.422188 diff --git a/dataset/dataset/dataset/labels/watt_1_0003.txt b/dataset/dataset/dataset/labels/watt_1_0003.txt new file mode 100644 index 0000000..85fac20 --- /dev/null +++ b/dataset/dataset/dataset/labels/watt_1_0003.txt @@ -0,0 +1 @@ +3 0.487880 0.436812 0.357039 0.427575 diff --git a/dataset/dataset/dataset/labels/watt_1_0004.txt b/dataset/dataset/dataset/labels/watt_1_0004.txt new file mode 100644 index 0000000..ddef63c --- /dev/null +++ b/dataset/dataset/dataset/labels/watt_1_0004.txt @@ -0,0 +1,2 @@ +0 0.507169 0.499269 0.410738 0.896963 +0 0.073358 0.500000 0.143720 1.000000 diff --git a/dataset/dataset/dataset/labels/watt_1_0005.txt b/dataset/dataset/dataset/labels/watt_1_0005.txt new file mode 100644 index 0000000..01b67c5 --- /dev/null +++ b/dataset/dataset/dataset/labels/watt_1_0005.txt @@ -0,0 +1,4 @@ +0 0.503766 0.278763 0.301062 0.525850 +2 0.502630 0.593456 0.286681 0.100838 +2 0.042722 0.766231 0.079423 0.215138 +0 0.044241 0.333369 0.088481 0.666737 diff --git a/dataset/dataset/dataset/labels/watt_1_0006.txt b/dataset/dataset/dataset/labels/watt_1_0006.txt new file mode 100644 index 0000000..e001b32 --- /dev/null +++ b/dataset/dataset/dataset/labels/watt_1_0006.txt @@ -0,0 +1 @@ +3 0.485612 0.410600 0.514374 0.388575 diff --git a/dataset/dataset/dataset/labels/watt_1_0007.txt b/dataset/dataset/dataset/labels/watt_1_0007.txt new file mode 100644 index 0000000..906ef55 --- /dev/null +++ b/dataset/dataset/dataset/labels/watt_1_0007.txt @@ -0,0 +1,3 @@ +1 0.759817 0.396475 0.121786 0.139825 +0 0.456487 0.500000 0.905450 1.000000 +1 0.341132 0.899250 0.234487 0.201500 diff --git a/dataset/dataset/dataset/labels/watt_1_0008.txt b/dataset/dataset/dataset/labels/watt_1_0008.txt new file mode 100644 index 0000000..c7b4e43 --- /dev/null +++ b/dataset/dataset/dataset/labels/watt_1_0008.txt @@ -0,0 +1,2 @@ +2 0.438710 0.344712 0.748868 0.216475 +0 0.453840 0.120925 0.686835 0.241850 diff --git a/dataset/dataset/dataset/labels/watt_1_0009.txt b/dataset/dataset/dataset/labels/watt_1_0009.txt new file mode 100644 index 0000000..afa4f7b --- /dev/null +++ b/dataset/dataset/dataset/labels/watt_1_0009.txt @@ -0,0 +1,11 @@ +0 0.491283 0.758069 0.571104 0.483862 +0 0.042352 0.515381 0.084705 0.969237 +0 0.518892 0.178594 0.111948 0.118462 +0 0.332813 0.185312 0.122546 0.126525 +2 0.523812 0.260675 0.124810 0.051100 +1 0.284241 0.735975 0.139508 0.337475 +1 0.474599 0.164544 0.026554 0.060512 +2 0.355503 0.262694 0.087743 0.038987 +1 0.282887 0.162525 0.024212 0.061850 +1 0.332433 0.210256 0.034037 0.052438 +1 0.937208 0.101431 0.125584 0.202863