Hailo 8: YOLOv8n HEF export succeeds, but accuracy drops significantly after conversion. Looking for help debugging the conversion pipeline.

Hailo 8: YOLOv8n HEF export succeeds, but accuracy drops significantly after conversion. Looking for help debugging the conversion pipeline.

Hello everyone,

I am working on an ANPR project using a Raspberry Pi 5 with a Hailo 8 accelerator. One part of the pipeline involves detecting vehicles using a custom trained YOLOv8n model.

I have been able to successfully export the model to HEF using the Ultralytics and Hailo conversion workflow. The compilation completes successfully, but I am facing a significant and inconsistent drop in detection accuracy after conversion.

In our recent Hailo export and validation experiments, mAP@0.50 has been around 0.29, with mAP@0.50:0.95 around 0.19. This is substantially lower than expected.

I have tried full calibration, changed export confidence thresholds, and repeated the export with the same model weights, but have not been able to resolve the issue.

I would appreciate guidance from anyone who has worked with custom YOLO models and Hailo 8.

1. Model details

Model: Ultralytics YOLOv8n

Task: Object detection

Classes:

  1. Car

  2. Bus

  3. Bike

  4. Truck

  5. Auto

The original PyTorch model reported approximately 0.85 mAP@0.50 on its native validation setup.

The checkpoint used for the conversion was best.pt.

We also verified that the checkpoint copied for the first full calibration export was byte identical to best.pt using SHA256.

SHA256:
03a4f6909b48df812587d750954a7fbe2d022a9a0304f67e86f50b9496cd981d

2. Hailo conversion environment

Hailo Dataflow Compiler: 3.33.0

Target architecture: Hailo 8

Conversion framework: Ultralytics YOLO export workflow with Hailo support

Input resolution: 640 × 640

Number of classes: 5

The HEF files were generated on the IIT Delhi HPC environment. The resulting HEFs are intended to run on a Raspberry Pi 5 with a Hailo 8 accelerator.

3. Calibration dataset

We prepared a dedicated calibration dataset containing 3,963 images.

The calibration images are stored in:

/scratch/design/phd/ddz248303/hailo_conversion/mix_calib_png

The calibration YAML specifies the following class mapping:

names:
  0: car
  1: bus
  2: bike
  3: truck
  4: auto

We used:

  • Image size: 640 × 640

  • Calibration fraction: 1.0

  • Calibration images: 3,963

  • Full calibration dataset

The calibration dataset was successfully loaded during the export process.

4. Conversion experiments

We have performed two recent full calibration exports using the same underlying trained model checkpoint.

Experiment 1: Full calibration export v1

Export settings:

model.export(
    format="hailo",
    imgsz=640,
    conf=0.2,
    iou=0.7,
    data="hailo_calib.yaml",
    fraction=1.0,
    device="cpu"
)

The export completed successfully.

Generated HEF:

hpc_export_4sep_ultralytics_fullcal_v1.hef

HEF size: 4,501,744 bytes

The log reported successful mapping and successful compilation.

Experiment 2: Full calibration export v2

We repeated the export with a lower confidence threshold to investigate whether the confidence setting was affecting the resulting detections.

Changed settings:

conf=0.001
iou=0.7
imgsz=640
fraction=1.0

The rest of the model and calibration setup remained the same.

Generated HEF:

hpc_export_4sep_ultralytics_conf001_v2.hef

HEF size: 4,500,762 bytes

The export log reported:

Successful Mapping
Successful Compilation
FULL CALIBRATION EXPORT PASSED
Export complete

Both exports generated their corresponding metadata.yaml and nms_config.json files.

However, successful compilation has not translated into the accuracy we expect.

5. Evaluation results from earlier HEF experiments

We also have an earlier evaluation workbook containing results for four HEF models.

Evaluation information recorded in that workbook:

  • Images evaluated: 5,000

  • Ground truth objects: 59,311

  • Input resolution: 640 × 640

  • Confidence threshold: 0.2

  • Classes: Car, Bus, Bike, Truck, Auto

The results are as follows:

HEF Precision Recall F1 mAP50 mAP50:95 FPS
hpc.hef 0.7602 0.7037 0.7309 0.6792 0.4987 192.64
undefined ---- ---- ---- ---- ---- ----
bes.hef 0.8089 0.6469 0.7189 0.6288 0.4556 118.15
undefined ---- ---- ---- ---- ---- ----
best_2.hef 0.7472 0.7032 0.7246 0.6774 0.4935 118.22
undefined ---- ---- ---- ---- ---- ----
net_7july_v1.hef 0.7628 0.6988 0.7294 0.6759 0.4985 192.05
undefined ---- ---- ---- ---- ---- ----

The older hpc.hef achieved an mAP@0.50 of approximately 0.679.

The latest Ultralytics based conversion and validation experiments, however, have produced results around 0.29 mAP@0.50.

This is a major discrepancy.

One important caveat: these results may come from different evaluation scripts, preprocessing implementations, or export configurations. We have not yet established that all these figures are directly comparable. We want to understand and eliminate those differences before drawing conclusions.

6. What we have tried so far

  1. Repeated the conversion using the same trained PyTorch checkpoint.

  2. Used the complete calibration dataset rather than a subset.

  3. Verified that the first export checkpoint was identical to the original best.pt.

  4. Changed the export confidence threshold from 0.2 to 0.001.

  5. Kept the input resolution at 640 × 640.

  6. Kept the IoU threshold at 0.7.

  7. Verified that Hailo mapping and compilation complete successfully.

  8. Generated and retained the HEF metadata and NMS configuration files for both exports.

At this stage, the problem does not appear to be a straightforward compilation failure. The main concern is the accuracy of the generated model and whether the conversion or postprocessing pipeline is behaving as expected.

7. What we need help with

I would particularly appreciate guidance on the following:

A. Recommended conversion workflow

For a custom trained Ultralytics YOLOv8n model, what is the currently recommended conversion workflow for Hailo 8 with DFC 3.33.0?

Would you recommend the integrated Ultralytics Hailo export workflow, or manually converting through ONNX, HAR parsing, optimization, and HEF compilation?

B. Calibration

Are 3,963 representative calibration images sufficient for this model?

Are there specific requirements for image normalization, RGB versus BGR ordering, letterboxing, and calibration image preprocessing that are particularly important for YOLOv8?

How can we verify that the calibration images are being interpreted in exactly the same way as the original training pipeline?

C. NMS and confidence thresholds

Can changing the conf argument during export affect the actual NMS configuration embedded in the HEF?

What is the recommended way to verify that the NMS configuration and the postprocessing implementation used during evaluation are consistent with the model’s expected outputs?

D. Debugging accuracy degradation

What is the recommended procedure to compare:

  1. Original PyTorch model

  2. Exported ONNX model

  3. Parsed HAR

  4. Optimized HAR

  5. Final HEF

We would like to identify exactly at which stage the accuracy drops.

Are there recommended Hailo tools or diagnostics for examining quantization errors, activation distributions, and layerwise accuracy degradation?

E. Evaluation methodology

Are there any known differences between Ultralytics validation and Hailo HEF evaluation that could explain a significant difference in mAP?

What is the recommended way to perform a fair comparison using identical input images, preprocessing, confidence thresholds, IoU thresholds, and matching criteria?

8. What would help us most

Our immediate objective is to identify why a model that performs reasonably well in PyTorch produces significantly lower accuracy after conversion to HEF.

We are happy to share relevant export logs, calibration configuration, metadata, NMS configuration, and evaluation results for further investigation.

Any suggestions regarding the recommended conversion procedure, calibration configuration, or debugging methodology would be greatly appreciated.

Thank you!

Hi @Harit_Chhabra,

Thank you for such a detailed write-up. The checksums, export settings, and evaluation table made this much easier to analyze. I can see how frustrating it must be to get a clean “Successful Compilation” every time and still not get the accuracy you need. After this many careful attempts, I completely understand why it’s discouraging. Thank you for bringing this to our attention and working with us to get it sorted out.

The short version is that a drop from 0.85 to 0.29 mAP50 doesn’t look like a quantization problem. With YOLOv8n and in-domain calibration, we normally expect the HEF to retain nearly all of the PyTorch mAP50. Ultralytics reports about 100% retention for YOLOv8n in their Hailo integration docs. A gap this large usually comes from how the model was exported or how it’s being evaluated. Here are the items I’d check first.

Target architecture: please add name="hailo8"
Neither of your export calls sets name. When it’s omitted, the Ultralytics exporter defaults to Hailo-8L. The HEF will still run on your Hailo-8, but it won’t use the full device. You can confirm the target with:

hailortcli parse-hef hpc_export_4sep_ultralytics_fullcal_v1.hef

This affects performance more than accuracy, but please re-export with name="hailo8" so we’re comparing the right thing.

A. Recommended workflow
For a standard YOLOv8n detection model on DFC 3.33, the Ultralytics format="hailo" export is a good choice. It handles the end nodes, normalization, and NMS configuration for you. I’d move to the manual DFC flow (ONNX → parse → optimize → compile) only to debug where accuracy is lost, as described under D.

B. Calibration
Your dataset size is fine. Keep in mind, though, that the number of images matters less than how well they match what the camera will actually see. As the Ultralytics Hailo docs point out, adding calibration images only helps when they come from the deployment domain. Images that don’t match it can lower the quantized accuracy and also make the optimization run longer. Since your calibration folder is a mix, please make sure the images reflect your real ANPR conditions: the same camera viewpoints, lighting (day and night), vehicle types, and backgrounds. A smaller set that matches production well will do better than a larger set that doesn’t.

The exporter adds the normalization step to the model itself, so the HEF expects raw 0–255 RGB images, letterboxed to 640×640, the same way Ultralytics prepares images for training. If your own evaluation or inference script feeds BGR images (OpenCV’s default), already-normalized values, or stretched instead of letterboxed frames, accuracy will drop sharply. That is one of the most common causes of numbers like yours.

C. NMS and confidence thresholds
Yes, the conf value you pass at export time is built into the on-chip NMS. This has two consequences:

  • Your PyTorch result (0.85) was most likely measured with Ultralytics’ default conf=0.001, while your HEF workbook used conf=0.2. Comparing at different thresholds makes the gap look bigger than it really is.
  • With conf=0.001, please check the maximum-proposals-per-class value in nms_config.json. In busy traffic scenes, a low cap can cut off valid detections.

D. Finding where accuracy drops
The DFC user guide covers this in its tutorials. Using the manual flow, you can run the same images through each stage in emulation:

  • SDK_NATIVE: the parsed model, which should match ONNX
  • SDK_FP_OPTIMIZED: after model modifications, still in floating point
  • SDK_QUANTIZED: the emulated INT8 result, which should closely match the HEF

Whichever step shows the big drop tells you where to look. For quantization-specific issues, hailo analyze-noise and the Accuracy tab in the HTML profiler (hailo profiler) show the quantization noise layer by layer.

E. Fair evaluation
The simplest way to get an apples-to-apples comparison is to let Ultralytics validate both models with the same settings. On the Raspberry Pi, run:

python

from ultralytics import YOLO
YOLO("best.pt").val(data="your_data.yaml", imgsz=640, conf=0.2, iou=0.7)
YOLO("path/to/exported_hailo_model_dir").val(data="your_data.yaml", imgsz=640, conf=0.2, iou=0.7)

Copy the whole export folder so metadata.yaml stays next to the HEF. val() applies the same preprocessing, postprocessing, and matching to both models, so the two mAP numbers are directly comparable.

Before running the full validation, you can do a quick sanity check with predict() on a handful of images:

python

YOLO("best.pt").predict("sample.jpg", conf=0.2, save=True)
YOLO("path/to/exported_hailo_model_dir").predict("sample.jpg", conf=0.2, save=True)

If the HEF boxes look shifted, wrongly sized, or carry the wrong class labels compared to PyTorch, that points to a preprocessing or postprocessing issue rather than quantization.

If the two val() results are close, the HEF is fine and the gap was in the earlier evaluation scripts. If they’re still far apart, please share the export log and nms_config.json and we’ll dig in further.

Looking forward to hearing how the re-export goes!