# inferer

Python API: `modelconverter.platforms.rvc2.inferer`

Inference with models converted for the RVC2 platform.

RVC2 conversions produce an OpenVINO IR (an `.xml` topology next to a `.bin` weights file). This module runs such an IR on the CPU
through the OpenVINO inference engine, which is available inside the RVC2 container, so that the converted model can be fed the
same images as the original one.

## Classes

### RVC3Inferer

Inferer for RVC2 models, using the OpenVINO inference engine.

#### Methods

##### infer

```python
def infer(inputs: dict[str, Path]) -> dict[str, np.ndarray]:
```

Run the network on one image per input.

Every image is read in the layout the network expects and gets a batch dimension prepended when it comes out one dimension short
of the input shape.

Parameters

 * `inputs` (`dict[str, Path]`): Mapping from input name to the image file to feed to it.

Returns

 * `dict[str, np.ndarray]`: Mapping from output name to the array the network produced.

##### setup

```python
def setup(self):
```

Load the IR model and prepare it for inference on the CPU.

Reads the `.xml` topology together with the `.bin` weights sitting next to it, takes the input shapes from the IR and guesses the
layout of every 4-D input -- `NCHW` when the second dimension is 1, 3 or 4, `NHWC` otherwise -- then loads the network onto the
CPU.
