I have successfully converted the ONNX YOLOv12 model to yolo_no_nms_6classes.rvc2.tar.xz, but when I run code in this notebook for on device inference then it is giving me a parser error. Depthai node is looking for a "YoloParser" because that parser name is in the configuration of rvc2.tar.xz file. I saw the library has YoloExtendedParser and DetectionParser. So , how do I run this rvc2 weight on the Oak D pro PoE camera?
The configuration is :
{
"config_version": "1.0",
"model": {
"metadata": {
"name": "yolo_no_nms_6classes",
"path": "yolo_no_nms.onnx",
"precision": "float32"
},
"inputs": [
{
"name": "images",
"dtype": "float32",
"input_type": "image",
"shape": [
1,
3,
640,
640
],
"layout": "NCHW",
"preprocessing": {
"mean": [
0.0,
0.0,
0.0
],
"scale": [
255.0,
255.0,
255.0
],
"reverse_channels": null,
"interleaved_to_planar": null,
"dai_type": null
}
}
],
"outputs": [
{
"name": "output0",
"dtype": "float32",
"shape": [
1,
10,
8400
],
"layout": "NCW"
}
],
"heads": [
{
"name": null,
"parser": "YoloParser",
"metadata": {
"postprocessor_path": null,
"classes": [
"B",
"L",
"c",
"N",
"Ni",
"La"
],
"n_classes": 6,
"iou_threshold": 0.45,
"conf_threshold": 0.25,
"max_det": 300,
"anchors": [],
"nc": 6,
"input_width": 640,
"input_height": 640,
"no_objectness": true
},
"outputs": [
"output0"
]
}
]
}
}
The error is :
ValueError Traceback (most recent call last)
Cell In[24], line 32
28 # Try to create neural network with available parsers
29 try:
30 # The ParsingNeuralNetwork should automatically detect the right parser
31 # based on your model's metadata
---> 32 nn_with_parser = pipeline.create(ParsingNeuralNetwork).build(
33 cam.requestOutput((2048, 1024), type=img_frame_type, fps=30),
34 nn_archive
35 )
36 print("Successfully created neural network with parser")
37 except Exception as e:
File c:\Users\ssharm21\depthai-core\venv\lib\site-packages\depthai_nodes\node\parsing_neural_network.py:278, in ParsingNeuralNetwork.build(self, input, nn_source, fps)
275 kwargs = {"fps": fps} if fps else {}
276 self._nn.build(input, self._nn_archive, **kwargs)
--> 278 self._updateParsers(self._nn_archive)
280 if len(self._parsers) > 1:
281 self._createSyncNode()
File c:\Users\ssharm21\depthai-core\venv\lib\site-packages\depthai_nodes\node\parsing_neural_network.py:311, in ParsingNeuralNetwork._updateParsers(self, nnArchive)
309 def _updateParsers(self, nnArchive: dai.NNArchive) -> None:
310 self._removeOldParserNodes()
--> 311 self._parsers = self._getParserNodes(nnArchive)
File c:\Users\ssharm21\depthai-core\venv\lib\site-packages\depthai_nodes\node\parsing_neural_network.py:321, in ParsingNeuralNetwork._getParserNodes(self, nnArchive)
319 def _getParserNodes(self, nnArchive: dai.NNArchive) -> Dict[int, BaseParser]:
320 parser_generator = self._pipeline.create(ParserGenerator)
--> 321 parsers = self._generateParsers(parser_generator, nnArchive)
322 for parser in parsers.values():
323 self._nn.out.link(
324 parser.input
325 ) # TODO: once NN node has output dictionary, link to the correct output
File c:\Users\ssharm21\depthai-core\venv\lib\site-packages\depthai_nodes\node\parsing_neural_network.py:332, in ParsingNeuralNetwork._generateParsers(self, parserGenerator, nnArchive)
329 def _generateParsers(
330 self, parserGenerator: ParserGenerator, nnArchive: dai.NNArchive
331 ) -> Dict[int, BaseParser]:
--> 332 return parserGenerator.build(nnArchive)
File c:\Users\ssharm21\depthai-core\venv\lib\site-packages\depthai_nodes\node\parser_generator.py:66, in ParserGenerator.build(self, nn_archive, head_index, host_only)
63 parser = globals().get(parser_name)
65 if parser is None:
---> 66 raise ValueError(f"Parser {parser_name} not a valid parser class.")
67 elif not issubclass(parser, BaseParser):
68 raise ValueError(
69 f"Parser {parser_name} does not inherit from BaseParser class."
70 )
ValueError: Parser YoloParser not a valid parser class.
I have also tried YoloExtendedParser and DetectionParser, but was not able to make it work with this weight.