Hello, (sorry for my English)
I’m trying to adapt a custom model from data in YOLO format (v8n), and to use it on my raspberry pi 5 with a HAILO 8L chip.
I found this great tutorial: Tutorial of AI Kit with Raspberry Pi 5 about YOLOv8n object detection | Seeed Studio Wiki
but it doesn’t work, and I’ve really tried every possible approach, nothing ever works.
I’ve been through a lot of tutorials and topics, and I really don’t know what to do anymore.
I train my model with YOLO (which works well for detection):
model.train(
data=os.getenv(‘TRAIN_DATASET_PATH’),
epochs=50,
imgsz=1024,
name=os.getenv(‘TRAIN_DATASET_NAME’),
verbose=True,
save=False,
project=runs_dir,
exist_ok=True,
device=os.getenv(‘TRAIN_DEVICE’), # GPU
workers=8
)`
I’ve managed to convert my PyTorch model (.pt) to ONNX :
.export(format=“onnx”, opset=11, imgsz=1024)
I even tried to quantize it
quant_pre_process(input_model_path=onnx_model_path, output_model_path=onnx_preprocessed_model_path) quantize_dynamic(model_input=onnx_preprocessed_model_path, model_output=onnx_quantized_model_path, per_channel=False, weight_type=QuantType.QUInt8)
I can even convert the original ONNX to HAR:
hailo parser onnx --hw-arch hailo8l --har-path guinea-pig-chons-v12.har -y guinea-pig-chons-v12.onnx
On the other hand, if I try with “quantized”, I get this Warning and then it crashes:
WARNING: failed to run “Reshape” op (name is “/model.9/cv2/conv/Conv_output_0_bias_reshape_output”), skip…
File “/local/workspace/hailo_virtualenv/lib/python3.8/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_graph.py”, line 2908, in _is_spatial_flatten_with_features_to_heads_reshape
pred = next(iter(self.graph.predecessors(self)))
StopIteration
And if I try to convert HAR to HEF it doesn’t work either:
hailo compiler --hw-arch hailo8l guinea-pig-chons-v12.har
I have this: “Model requires quantized weights in order to run on HW, but none were given. Did you forget to quantize?”
I tried the “optimize
hailomz optimize yolov8n --hw-arch hailo8l --har guinea-pig-chons-v12.har
which returns this:
hailo_sdk_common.hailo_nn.exceptions.HailoNNException: The layer named yolov8n/conv41 doesn’t exist in the HN
Or this: “hailomz compile yolov8n --hw-arch hailo8l --har ./yolov8n.har ”
I tried the “compile” command
hailomz compile --ckpt guinea-pig-chons-v12.onnx --calib-path data --yaml hailo_model_zoo/hailo_model_zoo/cfg/networks/yolov8n.yaml
or this
hailomz compile yolov8n --hw-arch hailo8l --har guinea-pig-chons-v12_2.har
which returns this to me:
ValueError: Tried to convert ‘input’ to a tensor and failed. Error: None values not supported.