Unable to run model script with nms_postprocessing in DFC

Hi, I have trained a custom yolov5m_vehicles.onnx model and wanted to add in the nms_postprocessing feature so that it can be run on the tappas example. However, I was unable to run the code on DFC successfully, returning me an error of wrong input shape shown as below:

ValueError: Dimension size must be evenly divisible by 115200 but is 2150400 for ‘{{node yolov5m_vehicles/yolov5_nms_postprocess/Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT32](yolov5m_vehicles/yolov5_nms_postprocess/transpose, yolov5m_vehicles/yolov5_nms_postprocess/Reshape/shape)’ with input shapes: [8,42,80,80], [3] and with input tensors computed as partial shapes: input[1] = [?,18,6400].

    Call arguments received by layer 'yolov5_nms_postprocess' (type HailoPostprocess):
      • inputs=['tf.Tensor(shape=(8, 80, 80, 42), dtype=float32)', 'tf.Tensor(shape=(8, 40, 40, 42), dtype=float32)', 'tf.Tensor(shape=(8, 20, 20, 42), dtype=float32)']
      • training=False
      • kwargs={'encoding_tensors': 'None'}


Call arguments received by layer 'yolov5m_vehicles' (type HailoModel):
  • inputs=tf.Tensor(shape=(8, 640, 640, 3), dtype=float32)
  • layer_postproc_cb=None
  • training=False
  • save_internal_list=None
  • ignore_preproc=False
  • skip_encoding=False
  • kwargs=<class 'inspect._empty'>

May I know how to solve this issue? I want to run the LPR example but I only have Hailo8L accelerator, hence I decided to retrain the model myself to the Hailo8L architecture. Please help, thanks!

Hi @junyi.cheok,

The nms_postprocess receives a JSON configuration file that you can customize for the model you’ve trained.
You can find this JSON here.
It seems that the number of classes in your model is different from the one in our Model Zoo. Based on the error message, I see that the channel count is 42, which is calculated using the formula:NUMBER_OF_CLASSES×NUMBER_OF_ANCHORS

Based on the calculation, it seems like your model has 14 classes. You can try changing the "classes" value in the JSON to match the number of classes in your model.

Hi @lihis ,

Thanks for the reply, after changing the classes to the correct number. I managed to compile the onnx file to hef file now. However, I faced another problem when trying to run the license plates recognition example. My PC is able to detect the vehicles but the license plate number never show up. Is this because the license plate number which I used to compile the lprnet.onnx is different with the license plate of the car in the video? The results I obtained is as follows: