-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathtrain_v8.py
32 lines (24 loc) · 836 Bytes
/
train_v8.py
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
import sys
import argparse
import os
sys.path.append(r'E:\GitHubRepo\PR\ultralyticsPro-mango') # Path
from ultralytics import YOLO
def main(opt):
yaml = opt.cfg
model = YOLO(yaml)
model.info()
results = model.train(data='coco128.yaml',
epochs=2,
imgsz=320,
workers=0,
batch=1,
)
def parse_opt(known=False):
parser = argparse.ArgumentParser()
parser.add_argument('--cfg', type=str, default= r'ultralytics\cfg\models\v8\yolov8.yaml', help='initial weights path')
parser.add_argument('--weights', type=str, default='', help='')
opt = parser.parse_known_args()[0] if known else parser.parse_args()
return opt
if __name__ == "__main__":
opt = parse_opt()
main(opt)