# base_parser

Python API: `depthai_nodes.node.parsers.base_parser`

## Classes

### BaseMeta

### BaseParser

Base class for neural network output parsers. This class serves as a foundation for specific parser implementations used to
postprocess the outputs of neural network models. Each parser is attached to a model "head" that governs the parsing process as it
contains all the necessary information for the parser to function correctly. Subclasses should implement `build` method to
correctly set all parameters of the parser and the `run` method to define the parsing logic.

#### Methods

##### init

```python
def __init__(self):
```

Create NNData input and parsed-message output ports and initialize logging.

##### build

```python
def build(head_config: dict[str, Any]) -> BaseParser:
```

Configures the parser based on the specified head configuration.

Parameters

 * `head_config` (`dict[str, Any]`): A dictionary containing configuration details relevant to the parser, including parameters
   and settings required for output parsing.

Returns

 * `BaseParser`: The parser object with the head configuration set.

##### input.setter

```python
def input.setter(node: dai.Node.Input):
```

Replace the stored parser port.

Parameters

 * `node` (`dai.Node.Input`): Input port to store as the parser input.

##### out.setter

```python
def out.setter(node: dai.Node.Output):
```

Replace the stored parser port.

Parameters

 * `node` (`dai.Node.Output`): Output port to store as the parsed-message output.

##### run

```python
def run(self):
```

Read neural network outputs and send parsed messages through `out`.

Subclasses implement their processing loop here. The pipeline invokes this method when the threaded host node starts.

#### Attributes

##### input

Input port accepting neural-network output messages.

##### out

Output port carrying parsed native DepthAI messages.
