mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-06-09 01:16:08 +02:00
Fix case where model path is set but not labelmap path (#10215)
This commit is contained in:
parent
1441a83151
commit
fa0f509e18
@ -9,7 +9,7 @@ import urllib.parse
|
|||||||
from collections import Counter
|
from collections import Counter
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Tuple
|
from typing import Any, Optional, Tuple
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pytz
|
import pytz
|
||||||
@ -139,7 +139,7 @@ def get_ffmpeg_arg_list(arg: Any) -> list:
|
|||||||
return arg if isinstance(arg, list) else shlex.split(arg)
|
return arg if isinstance(arg, list) else shlex.split(arg)
|
||||||
|
|
||||||
|
|
||||||
def load_labels(path, encoding="utf-8", prefill=91):
|
def load_labels(path: Optional[str], encoding="utf-8", prefill=91):
|
||||||
"""Loads labels from file (with or without index numbers).
|
"""Loads labels from file (with or without index numbers).
|
||||||
Args:
|
Args:
|
||||||
path: path to label file.
|
path: path to label file.
|
||||||
@ -147,6 +147,9 @@ def load_labels(path, encoding="utf-8", prefill=91):
|
|||||||
Returns:
|
Returns:
|
||||||
Dictionary mapping indices to labels.
|
Dictionary mapping indices to labels.
|
||||||
"""
|
"""
|
||||||
|
if path is None:
|
||||||
|
return {}
|
||||||
|
|
||||||
with open(path, "r", encoding=encoding) as f:
|
with open(path, "r", encoding=encoding) as f:
|
||||||
labels = {index: "unknown" for index in range(prefill)}
|
labels = {index: "unknown" for index in range(prefill)}
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
|
Loading…
Reference in New Issue
Block a user