Hey guys, firstly id like to commend you all because Degirum is definetly a step in the right direction when it comes to AI deployment, simplifying the code down to a dozen lines.
So i have been learning AI for a bit now, and for me the Raspberry Pi and Hailo 8L are the focus of my studies, as i have been developing a few computer vision and such apps, a few of which i am open to sharing as tutorials on here to help inspire a few more tools and projects.
The current hurdle on my journey is the following error:
degirum.exceptions.DegirumException: [ERROR]Execution failed
Condition 'input_tensor->shape()[ 1 ] == 4 + m_OutputNumClasses' is not met: input_tensor->shape()[ 1 ] is 1, 4 + m_OutputNumClasses is 5
dg_postprocess_detection.cpp: 1307 [DG::DetectionPostprocessYoloV8::inputDataProcessBaseline]
When running model 'custom'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/swt/MVP1.2.0/AI_Vision.py", line 232, in update_camera_view
for result in self.model.predict_batch(self.frame_gen()):
File "/home/swt/MVP1.2.0/venv/lib/python3.11/site-packages/degirum/model.py", line 289, in predict_batch
for res in self._predict_impl(source):
File "/home/swt/MVP1.2.0/venv/lib/python3.11/site-packages/degirum/model.py", line 1206, in _predict_impl
raise DegirumException(
degirum.exceptions.DegirumException: Failed to perform model 'custom' inference: [ERROR]Execution failed
Condition 'input_tensor->shape()[ 1 ] == 4 + m_OutputNumClasses' is not met: input_tensor->shape()[ 1 ] is 1, 4 + m_OutputNumClasses is 5
dg_postprocess_detection.cpp: 1307 [DG::DetectionPostprocessYoloV8::inputDataProcessBaseline]
When running model 'custom'
./MyScript.sh: line 21: 4764 Aborted sudo /home/swt/MVP1.2.0/venv/bin/python entry_point.py
For the context of this i trained a custom Yolov8n model on my pc, converted it to onnx, and converted it to hef following this tutorial, my model only detects a single class, misplaced components on a defective pcb, and it was trained in the standard 640x640, on images i took from my HQ Raspberry pi Camera, and i am running it on my RPI 5 with 8GB of ram, and the hailo8l hat.
Software details also include a hailo 4.19.0 version and a degirum PySDK 0.15.0
My JSON file is as follows:
{
"ConfigVersion": 10,
"DEVICE": [
{
"DeviceType": "HAILO8L",
"RuntimeAgent": "HAILORT",
"SupportedDeviceTypes": "HAILORT/HAILO8L"
}
],
"PRE_PROCESS": [
{
"InputType": "Image",
"ImageBackend": "opencv",
"InputPadMethod": "letterbox",
"InputResizeMethod": "bilinear",
"InputN": 1,
"InputH": 640,
"InputW": 640,
"InputC": 3,
"InputQuantEn": true
}
],
"MODEL_PARAMETERS": [
{
"ModelPath": "custom.hef"
}
],
"POST_PROCESS": [
{
"OutputPostprocessType": "DetectionYoloV8",
"OutputTopK": 1,
"OutputNumClasses": 1,
"OutputClassIDAdjustment": 1,
"LabelsPath": "labels.json"
}
]
}
Running both
hailortcli run custom.hef
and
hailortcli parse-hef custom.hef
works correctly, however when attempting to run it with the mvp code, using a real time image from the hq camera is when i get the error posted.
I have posted the files to the following git in case there are more tests you can run which i am unaware of.
Thank you for your help, and i am sorry if this is user error, i am still rather new to this, and it seems so is Degirum as far as troubleshooting.