File size: 466 Bytes
c6c3369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from PIL import Image


def get_label(label_path):
    with open(label_path, "r") as f:
        label = f.readlines()
    label = [line.strip().split(" ") for line in label]
    # label is in yolo format, remove class in the first item of the row
    label = [line[1:] for line in label]

    # convert to float
    label = [[float(item) for item in line] for line in label]

    return label


def get_image(img_path):
    img = Image.open(img_path)
    return img