Hello, thank you again for viewing my question. It has been bothering me for several days. I have successfully converted my custom model to yolov8n.onnx
.
Environment:
- Ubuntu: 20.04 LTS
- Hailo Dataflow Compiler: 3.28.0
- Hailo Model Zoo: 2.12.0
In the virtual environment, I executed the command:
hailomz compile --ckpt yolov8n.onnx --hw-arch hailo8 --calib-path download/train/images/ --yaml /home/kun/hailo/lib/python3.8/site-packages/hailo_model_zoo/cfg/networks/yolov8n.yaml --classes 2
My yolov8n.yaml
:
base:
- base/yolov8.yaml
postprocessing:
device_pre_post_layers:
nms: true
hpp: true
network:
network_name: yolov8n
paths:
network_path:- yolov8n.onnx
alls_script: /home/kun/hailo/lib/python3.8/site-packages/hailo_model_zoo/cfg/alls/hailo8/base/yolov8n.alls
parser:
nodes:- null
- /model.22/cv2.0/cv2.0.2/Conv
- /model.22/cv3.0/cv3.0.2/Conv
- /model.22/cv2.1/cv2.1.2/Conv
- /model.22/cv3.1/cv3.1.2/Conv
- /model.22/cv2.2/cv2.2.2/Conv
- /model.22/cv3.2/cv3.2.2/Conv
info:
task: object detection
input_shape: 640x640x3
output_shape: 80x5x100
operations: 8.74G
parameters: 3.2M
framework: pytorch
training_data: coco train2017
validation_data: coco val2017
eval_metric: mAP
full_precision_result: 37.23
source: GitHub - ultralytics/ultralytics: NEW - YOLOv8 đ in PyTorch > ONNX > OpenVINO > CoreML > TFLite
license_url: ultralytics/LICENSE at main ¡ ultralytics/ultralytics ¡ GitHub
license_name: GPL-3.0
My yolov8n.alls
:
quantization_param([conv42, conv53, conv63], force_range_out=[0.0, 1.0])
normalization1 = normalization([0.0, 0.0, 0.0], [255.0, 255.0, 255.0])
change_output_activation(conv42, sigmoid)
change_output_activation(conv53, sigmoid)
change_output_activation(conv63, sigmoid)
performance_param(compiler_optimization_level=max)
model_optimization_flavor(optimization_level=1, compression_level=0, batch_size=2)
post_quantization_optimization(finetune, policy=enabled, learning_rate=0.0001, epochs=20, batch_size=8, dataset_size=1112)
nms_postprocess(â/home/kun/hailo/lib/python3.8/site-packages/hailo_model_zoo/cfg/postprocess_config/yolov8n_nms_config.jsonâ, meta_arch=yolov8, engine=cpu)
My yolov8n_nms_config.json
:
{
âanchorsâ: [
640
],
âmax_proposals_per_classâ: 100,
âclassesâ: 2,
âregression_lengthâ: 16,
âbackground_removalâ: false,
âbackground_removal_indexâ: 0,
âbbox_decodersâ: [
{
ânameâ: âyolov8n/bbox_decoder41â,
âstrideâ: 8,
âreg_layerâ: âyolov8n/conv41â,
âcls_layerâ: âyolov8n/conv42â
},
{
ânameâ: âyolov8n/bbox_decoder52â,
âstrideâ: 16,
âreg_layerâ: âyolov8n/conv52â,
âcls_layerâ: âyolov8n/conv53â
},
{
ânameâ: âyolov8n/bbox_decoder62â,
âstrideâ: 32,
âreg_layerâ: âyolov8n/conv62â,
âcls_layerâ: âyolov8n/conv63â
}
]
}
I have reviewed many solutions from experienced engineers and tried various command scripts and combinations, but I still encounter the following problem. Could you help me figure out where I went wrong?
I sincerely hope I can complete this project just like everyone else.
File "/tmp/autograph_generated_filev_oi1uta.py", line 67, in tf__yolov8_decoding_call
decoded_bboxes = ag.converted_call(ag__.ld(tf).expand_dims, (ag__.ld(decoded_bboxes),), dict(axis=2), fscope)
ValueError: Exception encountered when calling layer âyolov8_nms_postprocessâ (type HailoPostprocess).in user code:
File "/home/kun/hailo/lib/python3.8/site-packages/hailo_model_optimization/acceleras/hailo_layers/base_hailo_none_nn_core_layer.py", line 43, in call * outputs = self.call_core(inputs, training, **kwargs) File "/home/kun/hailo/lib/python3.8/site-packages/hailo_model_optimization/acceleras/hailo_layers/hailo_postprocess.py", line 113, in call_core * inputs, File "/home/kun/hailo/lib/python3.8/site-packages/hailo_model_optimization/acceleras/hailo_layers/hailo_postprocess.py", line 148, in bbox_decoding_and_nms_call * decoded_bboxes, detection_score = self.yolov8_decoding_call(inputs) File "/home/kun/hailo/lib/python3.8/site-packages/hailo_model_optimization/acceleras/hailo_layers/hailo_postprocess.py", line 355, in yolov8_decoding_call * decoded_bboxes = tf.expand_dims(decoded_bboxes, axis=2) ValueError: Tried to convert 'input' to a tensor and failed. Error: None values not supported.
Call arguments received by layer âyolov8_nms_postprocessâ (type HailoPostprocess):
⢠inputs=[âtf.Tensor(shape=(None, 80, 80, 64), dtype=float32)â, âtf.Tensor(shape=(None, 80, 80, 4), dtype=float32)â, âtf.Tensor(shape=(None, 40, 40, 64), dtype=float32)â, âtf.Tensor(shape=(None, 40, 40, 4), dtype=float32)â, âtf.Tensor(shape=(None, 20, 20, 64), dtype=float32)â, âtf.Tensor(shape=(None, 20, 20, 4), dtype=float32)â]
⢠training=False
⢠kwargs=<class âinspect._emptyâ>