mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-09 12:45:25 +03:00
configure number of cores rather than a core mask for better user experience
This commit is contained in:
parent
4c8c196c32
commit
0f07c2bdc8
@ -406,8 +406,11 @@ This `config.yml` shows all relevant options to configure the detector and expla
|
|||||||
detectors: # required
|
detectors: # required
|
||||||
rknn: # required
|
rknn: # required
|
||||||
type: rknn # required
|
type: rknn # required
|
||||||
# core mask for npu
|
# number of NPU cores used for detection
|
||||||
core_mask: 0b111
|
# 0 means automatic selection, 1 is one core etc
|
||||||
|
# only relevant for SoCs with multicore NPU like rk3588/s
|
||||||
|
# increase to 3 on rk3588 SoC for best performance
|
||||||
|
num_cores: 0
|
||||||
|
|
||||||
model: # required
|
model: # required
|
||||||
# name of yolov8 model or path to your own .rknn model file
|
# name of yolov8 model or path to your own .rknn model file
|
||||||
@ -429,13 +432,6 @@ model: # required
|
|||||||
input_tensor: nhwc
|
input_tensor: nhwc
|
||||||
```
|
```
|
||||||
|
|
||||||
Explanation for rknn specific options:
|
|
||||||
|
|
||||||
- **core mask** controls which cores of your NPU should be used. This option applies only to SoCs with a multicore NPU (at the time of writing this in only the RK3588/S). The easiest way is to pass the value as a binary number. To do so, use the prefix `0b` and write a `0` to disable a core and a `1` to enable a core, whereas the last digit corresponds to core0, the second last to core1, etc. You also have to use the cores in ascending order (so you can't use core0 and core2; but you can use core0 and core1). Enabling more cores can reduce the inference speed, especially when using bigger models (see section below). Examples:
|
|
||||||
- `core_mask: 0b000` or just `core_mask: 0` let the NPU decide which cores should be used.
|
|
||||||
- `core_mask: 0b001` use only core0.
|
|
||||||
- `core_mask: 0b111` use core0, core1 and core2. Fastest and default value.
|
|
||||||
- `core_mask: 0b110` use core1 and core2. **This does not** work, since core0 is disabled.
|
|
||||||
|
|
||||||
### Choosing a model
|
### Choosing a model
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ supported_socs = ["rk3562", "rk3566", "rk3568", "rk3588"]
|
|||||||
|
|
||||||
class RknnDetectorConfig(BaseDetectorConfig):
|
class RknnDetectorConfig(BaseDetectorConfig):
|
||||||
type: Literal[DETECTOR_KEY]
|
type: Literal[DETECTOR_KEY]
|
||||||
core_mask: int = Field(default=7, ge=0, le=7, title="Core mask for NPU.")
|
num_cores: int = Field(default=0, ge=0, le=3, title="Number of NPU cores.")
|
||||||
|
|
||||||
|
|
||||||
class Rknn(DetectionApi):
|
class Rknn(DetectionApi):
|
||||||
@ -29,7 +29,7 @@ class Rknn(DetectionApi):
|
|||||||
self.width = config.model.width
|
self.width = config.model.width
|
||||||
|
|
||||||
soc = self.get_soc()
|
soc = self.get_soc()
|
||||||
core_mask = config.core_mask
|
core_mask = 2**config.num_cores - 1
|
||||||
|
|
||||||
model_properties = self.get_model_properties(
|
model_properties = self.get_model_properties(
|
||||||
config.model.path or "default-yolov8n", soc
|
config.model.path or "default-yolov8n", soc
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user