-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to ultralytics/yolov5 24.04.21 (#19)
* update to v5.0.1 * update to ultralytics/yolo 24.04.21 * update readme * remove redundant file * update onnx coremltools export workflow
- Loading branch information
Showing
29 changed files
with
373 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
from yolov5.helpers import YOLOv5 | ||
from yolov5.helpers import load_model as load | ||
|
||
|
||
__version__ = "5.0.0" | ||
__version__ = "5.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# VisDrone2019-DET dataset https://github.com/VisDrone/VisDrone-Dataset | ||
# Train command: python train.py --data visdrone.yaml | ||
# Default dataset location is next to YOLOv5: | ||
# /parent_folder | ||
# /VisDrone | ||
# /yolov5 | ||
|
||
|
||
# train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/] | ||
train: ../VisDrone/VisDrone2019-DET-train/images # 6471 images | ||
val: ../VisDrone/VisDrone2019-DET-val/images # 548 images | ||
test: ../VisDrone/VisDrone2019-DET-test-dev/images # 1610 images | ||
|
||
# number of classes | ||
nc: 10 | ||
|
||
# class names | ||
names: [ 'pedestrian', 'people', 'bicycle', 'car', 'van', 'truck', 'tricycle', 'awning-tricycle', 'bus', 'motor' ] | ||
|
||
|
||
# download command/URL (optional) -------------------------------------------------------------------------------------- | ||
download: | | ||
import os | ||
from pathlib import Path | ||
from utils.general import download | ||
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('../VisDrone') # dataset directory | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.