Hailo8 Conversion of other models such as U_Net

Hello, I asked whether the hailo_dataflow_compiler model conversion tool only supports the model shown in the following figure, and whether other models such as u_net can be converted with this tool and deployed on the Raspberry PI 5 AI Kit. If yes, what should I do and what needs to be modified

Hey @zhao_yj ,
Yes we do :slight_smile:
Please take a look here: hailo_model_zoo/docs/public_models/HAILO8/HAILO8_semantic_segmentation.rst at master · hailo-ai/hailo_model_zoo

1 Like

Sorry, I only see unet_mobilenet_v2, I think I need the original Unet network, can I modify it according to unet_mobilenet_v2? What files do I need to modify

It depends. If you have the same Unet arch, but only a different backbone (e.g. resnet), then probabaly the change would be in adapting the alls for correct normalization. If it’s a bigger change, it might be just easier running directly the DFC, rather then through the MZ.

1 Like

sorry. Can you explain that in more detail? Thank you

What is the specific UNET model that you’re interested in?

1 Like

The original U-Net is shown here, and the U-Net structure I am trying to convert is the same as the original U-Net
I’m just changing some convolution algorithms, maybe pruning, reducing the number of layers, and of course changing the size of the input and middle layers,
Thank you very much for your reply!

OK, I suggest to simply use the DataFlow-Compiler (DFC) for compiling that network for running on Hailo.

You can follow the tutorial that we have, either in the DFC user guide (4.2. Parsing Tutorial, 4.3. Model Optimization Tutorial, 4.4. Compilation Tutorial), or after you have installed the DFC use the hailo tutorial command to launch the Jupyter notebooks.

1 Like

Hello, thank you very much for your previous help.
I have now successfully installed DFC and launched Jupyter. I followed the tutorial and completed the first step to obtain the HAR file.

In the second step, when performing quantization and configuring the calibration set, I encountered a problem. The example provided is for ResNet, and I assume that the file name is the label, so the calibration set format is four-dimensional, that is, calib_dataset[idx, :, :, :].

However, for my own UNet network, both the labels and the data are in the format of (1,1,480,640) (batch_size, channels, height, width), which is also four-dimensional. What should I do? Does the runner.optimize() operation support input data with eight dimensions?If not, what should I do?

Thank you very much for your help. I have successfully converted the .hef model. Next, I will try to run it on the Raspberry Pi 5 AI Kit(hailo8 26TOPS). If I encounter any problems, I hope you can continue to help me.