OsNet from hailo zoo

Dear Hailo team,

Our company would like to test OsNet on hailo8. I use the osneet_x1_0.onnx provided by you to reproduce the hef file:

AI Model Explorer to Find The Best NN Model | Hailo Zoo

however optimization fails with the osnet_x1_0.alls that you provide in the zoo:

hailo_model_zoo/hailo_model_zoo/cfg/alls/generic/osnet_x1_0.alls at master · hailo-ai/hailo_model_zoo · GitHub

Unless I comment out the last three lines of the alls file. But then the accuracy drops from 90% to 30%.

May you please tell what I do wrong?

Please find the run.sh along with error logs (optimization.log) and the model.alls attach via link: https://artifacts.iris-sensing.com/web/client/pubshares/oMtfs7xBGEBcLhXcvZHXdz/upload

With regards,

Ruben

Hi @Ruben_Khachaturyan,

I wasn’t able to access the link that you’ve shared. You can try either sending the files to me through dm, or paste the text here.

Thanks!

1 Like

Dear @nina-vilela , thank you for pointing it out! I fixed the link :slight_smile: Should work now.

P.S. doblicate: https://artifacts.iris-sensing.com/web/client/pubshares/AAvFdGMU4Riq9TiZXQzHzc/download

@Ruben_Khachaturyan,

File “/home/ruben/venv/hailo/lib/python3.10/site-packages/hailo_sdk_client/sdk_backend/script_parser/commands.py”, line 314, in add_scope_to_layer
raise AllocatorScriptParserException(f"Invalid scope name {layer_parts[0]} exists")
hailo_sdk_client.sdk_backend.sdk_backend_exceptions.AllocatorScriptParserException: Invalid scope name osnet_x1_0 exists

The error above points to a mismatch between your net name, and the name in the command in the model script (osnet_x1_0 vs hailo_osnet_x1_0). A simple solution is to remove the scope from the model script, so try these commands instead:

normalization1 = normalization([123.675, 116.28, 103.53], [58.395, 57.12, 57.375])
model_optimization_config(calibration, batch_size=8, calibset_size=1024)
pre_quantization_optimization(equalization, policy=disabled)
pre_quantization_optimization(activation_clipping, layers=[dw51], mode=percentile, clipping_values=[0, 99.75])
pre_quantization_optimization(activation_clipping, layers=[dense_conv79], mode=percentile, clipping_values=[0, 99.75])
post_quantization_optimization(finetune, policy=disabled)
post_quantization_optimization(bias_correction, policy=enabled)

Dear @nina-vilela ,

thank you for the fast reply.

Unfortunately, it results in the similar error:

ValueError: Layer dense_conv79 not found in model

I believe the onnx model does not match the model script that is linked to the zoo. Thus the result is not reproducible.

May you please check the onnx file that you link to: AI Model Explorer to Find The Best NN Model | Hailo Zoo

P.S.
When this particular line is commented out the next error is:
ValueError: For a `build()` method with more than one argument, all arguments should have a `_shape` suffix and match an argument from `call()`. E.g. `build(self, foo_shape, bar_shape)` For layer ‘HailoModel’, Received `build()` argument `self`, which does not end in `_shape`.