Yolov9c convertion to hef

Do we currently have a possibility to convert some of yolo9 models?
I found yolov9c.yaml file so tried to convert onnx to hef.
But after running this command have an error

pi@NewUB:~$ hailomz compile yolov9c --ckpt best.onnx --calib-path calibration640x640/ --classes 80 --hw-arch hailo8l

Start run for network yolov9c
Initializing the hailo8l runner…
Hailo8L support is currently at Preview on Hailo Model Zoo
[info] Translation started on ONNX model yolov9c
[info] Restored ONNX model yolov9c (completion time: 00:00:01.21)
[info] Extracted ONNXRuntime meta-data for Hailo model (completion time: 00:00:09.06)
[info] Simplified ONNX model for a parsing retry attempt (completion time: 00:00:19.04)
Traceback (most recent call last):
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py”, line 179, in translate_onnx_model
parsing_results = self._parse_onnx_model_to_hn(onnx_model, valid_net_name, start_node_names,
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py”, line 237, in _parse_onnx_model_to_hn
return self.parse_model_to_hn(onnx_model, None, net_name, start_node_names, end_node_names,
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py”, line 255, in parse_model_to_hn
converter = ONNXConverter(model=model,
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py”, line 77, in init
super(ONNXConverter, self).init(
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/model_translator/translator.py”, line 48, in init
self._calculate_valid_subgraph_scope()
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/model_translator/translator.py”, line 422, in _calculate_valid_subgraph_scope
current_vertex.in_valid_subgraph = True
AttributeError: ‘NoneType’ object has no attribute ‘in_valid_subgraph’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/pi/.local/bin/hailomz”, line 33, in
sys.exit(load_entry_point(‘hailo-model-zoo’, ‘console_scripts’, ‘hailomz’)())
File “/home/pi/nn/hailo_model_zoo/hailo_model_zoo/main.py”, line 122, in main
run(args)
File “/home/pi/nn/hailo_model_zoo/hailo_model_zoo/main.py”, line 111, in run
return handlersargs.command
File “/home/pi/nn/hailo_model_zoo/hailo_model_zoo/main_driver.py”, line 219, in compile
_ensure_optimized(runner, logger, args, network_info)
File “/home/pi/nn/hailo_model_zoo/hailo_model_zoo/main_driver.py”, line 57, in _ensure_optimized
_ensure_parsed(runner, logger, network_info, args)
File “/home/pi/nn/hailo_model_zoo/hailo_model_zoo/main_driver.py”, line 83, in _ensure_parsed
parse_model(runner, network_info, ckpt_path=args.ckpt_path, results_dir=args.results_dir, logger=logger)
File “/home/pi/nn/hailo_model_zoo/hailo_model_zoo/core/main_utils.py”, line 95, in parse_model
model_name = translate_model(runner, network_info, ckpt_path, tensor_shapes=start_node_shapes)
File “/home/pi/nn/hailo_model_zoo/hailo_model_zoo/utils/parse_utils.py”, line 28, in translate_model
runner.translate_onnx_model(ckpt_path, model_name,
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_common/states/states.py”, line 16, in wrapped_func
return func(self, *args, **kwargs)
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/runner/client_runner.py”, line 876, in translate_onnx_model
parser.translate_onnx_model(model=model, net_name=net_name, start_node_names=start_node_names,
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py”, line 211, in translate_onnx_model
parsing_results = self._parse_onnx_model_to_hn(simplified_model, valid_net_name,
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py”, line 237, in _parse_onnx_model_to_hn
return self.parse_model_to_hn(onnx_model, None, net_name, start_node_names, end_node_names,
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/sdk_backend/parser/parser.py”, line 255, in parse_model_to_hn
converter = ONNXConverter(model=model,
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/model_translator/onnx_translator/onnx_translator.py”, line 77, in init
super(ONNXConverter, self).init(
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/model_translator/translator.py”, line 48, in init
self._calculate_valid_subgraph_scope()
File “/home/pi/.local/lib/python3.8/site-packages/hailo_sdk_client/model_translator/translator.py”, line 422, in _calculate_valid_subgraph_scope
current_vertex.in_valid_subgraph = True
AttributeError: ‘NoneType’ object has no attribute ‘in_valid_subgraph’

It could mean that the node names have either changed, or that your YOLOv9 has a slight different structure. Do you think that you can share or post here a netron image of the last conv layers in the model?

in such format will be ok?

Actually, can you show the names of the 2 convs above it?

Ok, so make sure that these node names are in the yaml

if my yaml should looks like this
nodes:

  • null
    • Conv_1058
    • Conv_1065
    • Conv_1088
    • Conv_1095
    • Conv_1118
    • Conv_1125
    • /model.21/cv4/conv/Conv (added)
    • /model.21/cv3/cv3.1/conv/Conv (added)

it didnt change the error

Hi @bodiareva,

It seems like the layers have different names in your model.

Try the following:

  1. Open the pre trained onnx on netron
  2. Also open your onnx on netron
  3. Search for the ModelZoo end-node-names on the original onnx and find the equivalent layer names on your version
  4. Replace the end-node-names in the yaml file