File size: 596 Bytes
bf69e73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
ID2LABEL = {0: "person", 1: "bicycle", 2:"car", 3:"motocycle", 5:"bus", 7:"truck"} 
PALETTE = (2 ** 11 - 1, 2 ** 15 - 1, 2 ** 20 - 1)

MODEL_PATH = "model_data/yolov8m.pt"

AUTHEN_ACCOUNT = 'accountService.json'

def compute_color_for_labels(label):

    if label == 0: # person
        color = (85, 45, 255)
    elif label == 2: # Car
        color = (222, 82, 175)
    elif label == 3: # Motobike
        color = (0, 204, 255)
    elif label == 5: # Bus
        color = (0, 149, 255)
    else:
        color = [int((p * (label ** 2 - label + 1)) % 255) for p in PALETTE]
    return tuple(color)