mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
* Update LICENSE to AGPL-3.0 This pull request updates the license of the YOLOv5 project from GNU General Public License v3.0 (GPL-3.0) to GNU Affero General Public License v3.0 (AGPL-3.0). We at Ultralytics have decided to make this change in order to better protect our intellectual property and ensure that any modifications made to the YOLOv5 source code will be shared back with the community when used over a network. AGPL-3.0 is very similar to GPL-3.0, but with an additional clause to address the use of software over a network. This change ensures that if someone modifies YOLOv5 and provides it as a service over a network (e.g., through a web application or API), they must also make the source code of their modified version available to users of the service. This update includes the following changes: - Replace the `LICENSE` file with the AGPL-3.0 license text - Update the license reference in the `README.md` file - Update the license headers in source code files We believe that this change will promote a more collaborative environment and help drive further innovation within the YOLOv5 community. Please review the changes and let us know if you have any questions or concerns. Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> * Update headers to AGPL-3.0 --------- Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
71 lines
2.9 KiB
YAML
71 lines
2.9 KiB
YAML
# YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
|
|
# VisDrone2019-DET dataset https://github.com/VisDrone/VisDrone-Dataset by Tianjin University
|
|
# Example usage: python train.py --data VisDrone.yaml
|
|
# parent
|
|
# ├── yolov5
|
|
# └── datasets
|
|
# └── VisDrone ← downloads here (2.3 GB)
|
|
|
|
|
|
# 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: ../datasets/VisDrone # dataset root dir
|
|
train: VisDrone2019-DET-train/images # train images (relative to 'path') 6471 images
|
|
val: VisDrone2019-DET-val/images # val images (relative to 'path') 548 images
|
|
test: VisDrone2019-DET-test-dev/images # test images (optional) 1610 images
|
|
|
|
# Classes
|
|
names:
|
|
0: pedestrian
|
|
1: people
|
|
2: bicycle
|
|
3: car
|
|
4: van
|
|
5: truck
|
|
6: tricycle
|
|
7: awning-tricycle
|
|
8: bus
|
|
9: motor
|
|
|
|
|
|
# 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, curl=True, threads=4)
|
|
|
|
# Convert
|
|
for d in 'VisDrone2019-DET-train', 'VisDrone2019-DET-val', 'VisDrone2019-DET-test-dev':
|
|
visdrone2yolo(dir / d) # convert VisDrone annotations to YOLO labels
|