Compiling custom yolov8

I am getting an error during compilation:

hailomz compile --ckpt runs/detect/train11/weights/best.onnx --calib-path nabirds/images/0349/ --start-node-names images --classes 1011 yolov8x


[info] Model Optimization Algorithm Quantization-Aware Fine-Tuning is done (completion time is 00:15:36.66)
[info] Starting Layer Noise Analysis
Full Quant Analysis: 100%|██████████| 2/2 [08:42<00:00, 261.03s/iterations]
[info] Model Optimization Algorithm Layer Noise Analysis is done (completion time is 00:08:52.67)
[info] Model Optimization is done
[info] Saved HAR to: /workspace/work/yolov8x.har
[info] Loading model script commands to yolov8x from /workspace/hailo_model_zoo/hailo_model_zoo/cfg/alls/generic/yolov8x.alls
[info] To achieve optimal performance, set the compiler_optimization_level to “max” by adding performance_param(compiler_optimization_level=max) to the model script. Note that this may increase compilation time.
[error] Failed to produce compiled graph
[error] TypeError: expected str, bytes or os.PathLike object, not NoneType

Is there a way to set logging level to get more detail?

it should be 101 and not 1011

hello Erez,

Thank you for taking a look. I retrained yolov8x with a custom dataset using the following:

!yolo task=detect
mode=train
model=yolov8x.pt
data=./nabirds/data.yaml
epochs=100
batch=4
imgsz=640

My dataset contains 1011 classes. The last Epoch of the process gives me the checkpoint file “best.pt”

Why should I be using 101 and not 1011?

i got this error when i had a miss match between the number of classes to the actual classes in the model

I’ve made sure that the number of classes in my case is 1011. This error is very generic and could be caused by a variety of possibilities. The error handling code should provide more specifics about what it’s actually parsing.

Does anyone know if there are debug/trace levels that can be set? It’s not even giving me a stack trace.

I’ve submitted an issue here: Compiling custom Yolov8x fails with an ambiguous error. · Issue #160 · hailo-ai/hailo_model_zoo · GitHub

Check the format of your calibration data and what the model is expecting. It is luckily that the dataset is not fed the right way ( a dictionary that matches the export keys) if you share how you are feeding your calibration data i might be able to help better

hello @Heatdh - I have followed this example and get the same error message. hailo-rpi5-examples/doc/retraining-example.md at main · hailo-ai/hailo-rpi5-examples · GitHub Are you able to compile following this example? Perhaps my issue is environment related but without better try/catch error handling it’s too hard to determine.

I have been able to move past this error by moving the DFC work to a different computer. I am now able to compile the HEF file.

However, not when I try to run in a basic detection pipeline using the sample as reference, I get an error coming from parsing my labels json file.

Hailo Detection App: /usr/include/hailo/tappas/sources/rapidjson/include/rapidjson/document.h:1154: rapidjson::GenericValue<Encoding, Allocator>::MemberIterator rapidjson::GenericValue<Encoding, Allocator>::FindMember(const rapidjson::GenericValue<Encoding, SourceAllocator>&) [with SourceAllocator = rapidjson::MemoryPoolAllocator<>; Encoding = rapidjson::UTF8<>; Allocator = rapidjson::MemoryPoolAllocator<>; MemberIterator = rapidjson::GenericMemberIterator<false, rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator<> >]: Assertion `IsObject()’ failed.

I have 1011 classes. Through processing of elimination it looks like the app can’t handle more than about 158 classes.

Is there any guidance about the number of classes Hailo can handle on RPI5 with hailo8l ?