# tflite_support.task.processor.NearestNeighbor

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/python/task/processor/proto/search_result.proto) |

A single nearest neighbor.

```python
tflite_support.task.processor.NearestNeighbor(
    metadata: bytearray, distance: float
)
```

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `metadata` | User-defined metadata about the result. This could be a label, a unique ID, a serialized proto of some sort, etc. |
| `distance` | The distance score indicating how confident the result is. Lower is better. |

<br />

## Methods

### `create_from_pb2`

[View source](https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/python/task/processor/proto/search_result.proto)

```python
@classmethod
create_from_pb2(
    pb2_obj: _NearestNeighborProto
) -> 'NearestNeighbor'
```

Creates a `NearestNeighbor` object from the given protobuf object.

### `to_pb2`

[View source](https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/python/task/processor/proto/search_result.proto)

```python
to_pb2() -> _NearestNeighborProto
```

Generates a protobuf object to pass to the C++ layer.

### `__eq__`

[View source](https://github.com/tensorflow/tflite-support/blob/v0.4.4/tensorflow_lite_support/python/task/processor/proto/search_result.proto)

```python
__eq__(
    other: Any
) -> bool
```

Checks if this object is equal to the given object.

<br />

<br />

<br />

| Args ||
|---|---|
| `other` | The object to be compared with. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| True if the objects are equal. ||

<br />