-
Notifications
You must be signed in to change notification settings - Fork 4
/
NPS.yaml
62 lines (53 loc) · 2.82 KB
/
NPS.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: /home/tu666280/NPS-Data-Uncompressed/AllFrames # dataset root dir
train: train # train images (relative to 'path') 6471 images
val: val # val images (relative to 'path') 548 images
test: test # test images (optional) 1610 images
inference: val
annotation_path: /home/tu666280/NPSvisdroneStyle
annotation_train: train/labels
annotation_val: val/labels
annotation_test: test/labels
video_root_path: /home/tu666280/NPS/Videos
video_root_path_train: train
video_root_path_val: val
video_root_path_test: test
video_root_path_inference: val
# Classes
nc: 1 # number of classes
names: ['drone']
# Download script/URL (optional) ---------------------------------------------------------------------------------------
# download: |
# from utils.general import download, os, Path
# def visdrone2yolo(dir):
# from PIL import Image
# from tqdm import tqdm
# def convert_box(size, box):
# # Convert VisDrone box to YOLO xywh box
# dw = 1. / size[0]
# dh = 1. / size[1]
# return (box[0] + box[2] / 2) * dw, (box[1] + box[3] / 2) * dh, box[2] * dw, box[3] * dh
# (dir / 'labels').mkdir(parents=True, exist_ok=True) # make labels directory
# pbar = tqdm((dir / 'annotations').glob('*.txt'), desc=f'Converting {dir}')
# for f in pbar:
# img_size = Image.open((dir / 'images' / f.name).with_suffix('.jpg')).size
# lines = []
# with open(f, 'r') as file: # read annotation.txt
# for row in [x.split(',') for x in file.read().strip().splitlines()]:
# if row[4] == '0': # VisDrone 'ignored regions' class 0
# continue
# cls = int(row[5]) - 1
# box = convert_box(img_size, tuple(map(int, row[:4])))
# lines.append(f"{cls} {' '.join(f'{x:.6f}' for x in box)}\n")
# with open(str(f).replace(os.sep + 'annotations' + os.sep, os.sep + 'labels' + os.sep), 'w') as fl:
# fl.writelines(lines) # write label.txt
# # Download
# dir = Path(yaml['path']) # dataset root dir
# urls = ['https://github.com/ultralytics/yolov5/releases/download/v1.0/VisDrone2019-DET-train.zip',
# 'https://github.com/ultralytics/yolov5/releases/download/v1.0/VisDrone2019-DET-val.zip',
# 'https://github.com/ultralytics/yolov5/releases/download/v1.0/VisDrone2019-DET-test-dev.zip',
# 'https://github.com/ultralytics/yolov5/releases/download/v1.0/VisDrone2019-DET-test-challenge.zip']
# download(urls, dir=dir)
# # Convert
# for d in 'VisDrone2019-DET-train', 'VisDrone2019-DET-val', 'VisDrone2019-DET-test-dev':
# visdrone2yolo(dir / d) # convert VisDrone annotations to YOLO labels