add labelmap customization to the config (fixes #507)

This commit is contained in:
Blake Blackshear
2021-07-07 22:57:19 -05:00
parent a3853af47a
commit 92aa16c556
7 changed files with 111 additions and 16 deletions

View File

@@ -110,10 +110,17 @@ detectors:
### `model`
If using a custom model, the width and height will need to be specified.
The labelmap can be customized to your needs. A common reason to do this is to combine multiple object types that are easily confused when you don't need to be as granular such as car/truck. By default, truck is renamed to car because they are often confused. You cannot add new object types, but you can change the names of existing objects in the model.
```yaml
model:
# Required: height of the trained model
height: 320
# Required: width of the trained model
width: 320
# Optional: labelmap overrides
labelmap:
7: car
```

View File

@@ -4,13 +4,13 @@ title: Default available objects
sidebar_label: Available objects
---
import labels from '../../../labelmap.txt';
import labels from "../../../labelmap.txt";
By default, Frigate includes the following object models from the Google Coral test data.
<ul>
{labels.split('\n').map((label) => (
<li>{label.replace(/^\d+\s+/, '')}</li>
{labels.split("\n").map((label) => (
<li>{label.replace(/^\d+\s+/, "")}</li>
))}
</ul>
@@ -23,14 +23,3 @@ Models for both CPU and EdgeTPU (Coral) are bundled in the image. You can use yo
- Labels: `/labelmap.txt`
You also need to update the model width/height in the config if they differ from the defaults.
### Customizing the Labelmap
The labelmap can be customized to your needs. A common reason to do this is to combine multiple object types that are easily confused when you don't need to be as granular such as car/truck. You must retain the same number of labels, but you can change the names. To change:
- Download the [COCO labelmap](https://dl.google.com/coral/canned_models/coco_labels.txt)
- Modify the label names as desired. For example, change `7 truck` to `7 car`
- Mount the new file at `/labelmap.txt` in the container with an additional volume
```
-v ./config/labelmap.txt:/labelmap.txt
```