# Neural

### detect

```python
def detect(self, image: np.ndarray, conf: float = None) -> Dict[str, List[Tuple[List[float], float]]]:
```

<table><thead><tr><th width="133">Название</th><th width="125">Тип</th><th>Описание</th></tr></thead><tbody><tr><td>image</td><td>np.array</td><td>Изображение на котором будет искать объекты</td></tr><tr><td>conf</td><td>float</td><td>Минимальная уверенность нейросети от 0 до 1.</td></tr></tbody></table>

```python
img = screen.capture(x1, y1, x2, y2)
result = neural.detect(img)
heads = result['heads']
bodys = result['bodys']

for head in heads:
    print(f'Голова - координаты: {head[0]}, уверенность: {head[1]}')
for body in bodys:
    print(f'Тело - координаты: {head[0]}, уверенность: {head[1]}'
```

{% hint style="info" %}
В нашем случае, head\[0] = \[x1, y1, x2, y2], где x1, y1 - координаты левого верхнего угла, а x2, y2 - координаты правого нижнего угла.
{% endhint %}

{% hint style="warning" %}
Вы можете использовать только модель, которую пользователь использовал на момент запуска вашего скрипта .napi.
{% endhint %}

### compare\_images

```python
def compare_images(self, img1: np.ndarray, img2: np.ndarray, mode: str = "fast") -> float:
```

<table><thead><tr><th width="133">Название</th><th width="125">Тип</th><th>Описание</th></tr></thead><tbody><tr><td>img1, img2</td><td>np.array</td><td>Изображения которые сравниваем</td></tr><tr><td>mode</td><td>str</td><td>Кол-во извлекаемых признаков ["fast", "medium", "accurate"]</td></tr></tbody></table>

{% hint style="warning" %}
Рекомендуем использовать compare\_embedding, если у вас не меняются оба изображения каждый раз.
{% endhint %}

### embedding

```python
def embedding(self, image: np.ndarray, mode: str = "fast") -> np.ndarray:
```

<table><thead><tr><th width="133">Название</th><th width="125">Тип</th><th>Описание</th></tr></thead><tbody><tr><td>image</td><td>np.array</td><td>Изображение у которого считаем признаки</td></tr><tr><td>mode</td><td>str</td><td>Кол-во извлекаемых признаков ["fast", "medium", "accurate"]</td></tr></tbody></table>

{% hint style="info" %}
fast - самый быстрый режим, позволяет достичь нескольких сотен тысяч фпс. accurate - самый точный режим.
{% endhint %}

### compare\_embedding

```python
def compare_embedding(self, embed1: np.ndarray, embed2: np.ndarray) -> float:
```

<table><thead><tr><th width="133">Название</th><th width="125">Тип</th><th>Описание</th></tr></thead><tbody><tr><td>embed1, embed2</td><td>np.array</td><td>Embedding (признаки) изображений</td></tr></tbody></table>

{% hint style="info" %}
Compare функции возвращают % схожести для изображений и признаков.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.neuralaim.ru/napi/dokumentaciya-or-api/neural.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
