mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Cleanup Detector labelmap (#4932)
* Add missing labels to default labelmap. Fill any holes with "unknown". Remove unique labelmap for tensorrt. * Replace "truck" with "car" on Openvino labelmap
This commit is contained in:
parent
740d932848
commit
8ac3114f9a
@ -91,7 +91,8 @@ RUN wget -qO cpu_model.tflite https://github.com/google-coral/test_data/raw/rele
|
|||||||
COPY labelmap.txt .
|
COPY labelmap.txt .
|
||||||
# Copy OpenVino model
|
# Copy OpenVino model
|
||||||
COPY --from=ov-converter /models/public/ssdlite_mobilenet_v2/FP16 openvino-model
|
COPY --from=ov-converter /models/public/ssdlite_mobilenet_v2/FP16 openvino-model
|
||||||
RUN wget -q https://github.com/openvinotoolkit/open_model_zoo/raw/master/data/dataset_classes/coco_91cl_bkgr.txt -O openvino-model/coco_91cl_bkgr.txt
|
RUN wget -q https://github.com/openvinotoolkit/open_model_zoo/raw/master/data/dataset_classes/coco_91cl_bkgr.txt -O openvino-model/coco_91cl_bkgr.txt && \
|
||||||
|
sed -i 's/truck/car/g' openvino-model/coco_91cl_bkgr.txt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,6 +32,3 @@ do
|
|||||||
python3 onnx_to_tensorrt.py -m ${model}
|
python3 onnx_to_tensorrt.py -m ${model}
|
||||||
cp /tensorrt_demos/yolo/${model}.trt ${OUTPUT_FOLDER}/${model}.trt;
|
cp /tensorrt_demos/yolo/${model}.trt ${OUTPUT_FOLDER}/${model}.trt;
|
||||||
done
|
done
|
||||||
|
|
||||||
# Download Labelmap
|
|
||||||
wget -q https://github.com/openvinotoolkit/open_model_zoo/raw/master/data/dataset_classes/coco_91cl.txt -O ${OUTPUT_FOLDER}/coco_91cl.txt
|
|
@ -228,7 +228,6 @@ detectors:
|
|||||||
|
|
||||||
model:
|
model:
|
||||||
path: /trt-models/yolov7-tiny-416.trt
|
path: /trt-models/yolov7-tiny-416.trt
|
||||||
labelmap_path: /trt-models/coco_91cl.txt
|
|
||||||
input_tensor: nchw
|
input_tensor: nchw
|
||||||
input_pixel_format: rgb
|
input_pixel_format: rgb
|
||||||
width: 416
|
width: 416
|
||||||
|
@ -706,15 +706,17 @@ def load_labels(path, encoding="utf-8"):
|
|||||||
Dictionary mapping indices to labels.
|
Dictionary mapping indices to labels.
|
||||||
"""
|
"""
|
||||||
with open(path, "r", encoding=encoding) as f:
|
with open(path, "r", encoding=encoding) as f:
|
||||||
|
labels = {index: "unknown" for index in range(91)}
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
if not lines:
|
if not lines:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
if lines[0].split(" ", maxsplit=1)[0].isdigit():
|
if lines[0].split(" ", maxsplit=1)[0].isdigit():
|
||||||
pairs = [line.split(" ", maxsplit=1) for line in lines]
|
pairs = [line.split(" ", maxsplit=1) for line in lines]
|
||||||
return {int(index): label.strip() for index, label in pairs}
|
labels.update({int(index): label.strip() for index, label in pairs})
|
||||||
else:
|
else:
|
||||||
return {index: line.strip() for index, line in enumerate(lines)}
|
labels.update({index: line.strip() for index, line in enumerate(lines)})
|
||||||
|
return labels
|
||||||
|
|
||||||
|
|
||||||
def clean_camera_user_pass(line: str) -> str:
|
def clean_camera_user_pass(line: str) -> str:
|
||||||
|
13
labelmap.txt
13
labelmap.txt
@ -9,6 +9,7 @@
|
|||||||
8 boat
|
8 boat
|
||||||
9 traffic light
|
9 traffic light
|
||||||
10 fire hydrant
|
10 fire hydrant
|
||||||
|
11 street sign
|
||||||
12 stop sign
|
12 stop sign
|
||||||
13 parking meter
|
13 parking meter
|
||||||
14 bench
|
14 bench
|
||||||
@ -22,8 +23,11 @@
|
|||||||
22 bear
|
22 bear
|
||||||
23 zebra
|
23 zebra
|
||||||
24 giraffe
|
24 giraffe
|
||||||
|
25 hat
|
||||||
26 backpack
|
26 backpack
|
||||||
27 umbrella
|
27 umbrella
|
||||||
|
28 shoe
|
||||||
|
29 eye glasses
|
||||||
30 handbag
|
30 handbag
|
||||||
31 tie
|
31 tie
|
||||||
32 suitcase
|
32 suitcase
|
||||||
@ -38,6 +42,7 @@
|
|||||||
41 surfboard
|
41 surfboard
|
||||||
42 tennis racket
|
42 tennis racket
|
||||||
43 bottle
|
43 bottle
|
||||||
|
44 plate
|
||||||
45 wine glass
|
45 wine glass
|
||||||
46 cup
|
46 cup
|
||||||
47 fork
|
47 fork
|
||||||
@ -58,8 +63,12 @@
|
|||||||
62 couch
|
62 couch
|
||||||
63 potted plant
|
63 potted plant
|
||||||
64 bed
|
64 bed
|
||||||
|
65 mirror
|
||||||
66 dining table
|
66 dining table
|
||||||
|
67 window
|
||||||
|
68 desk
|
||||||
69 toilet
|
69 toilet
|
||||||
|
70 door
|
||||||
71 tv
|
71 tv
|
||||||
72 laptop
|
72 laptop
|
||||||
73 mouse
|
73 mouse
|
||||||
@ -71,10 +80,12 @@
|
|||||||
79 toaster
|
79 toaster
|
||||||
80 sink
|
80 sink
|
||||||
81 refrigerator
|
81 refrigerator
|
||||||
|
82 blender
|
||||||
83 book
|
83 book
|
||||||
84 clock
|
84 clock
|
||||||
85 vase
|
85 vase
|
||||||
86 scissors
|
86 scissors
|
||||||
87 teddy bear
|
87 teddy bear
|
||||||
88 hair drier
|
88 hair drier
|
||||||
89 toothbrush
|
89 toothbrush
|
||||||
|
90 hair brush
|
Loading…
Reference in New Issue
Block a user