updates
This commit is contained in:
parent
bab855507a
commit
3bac3c63b1
2
test.py
2
test.py
|
@ -213,7 +213,7 @@ if __name__ == '__main__':
|
||||||
parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch')
|
parser.add_argument('--batch-size', type=int, default=32, help='size of each image batch')
|
||||||
parser.add_argument('--img-size', type=int, default=416, help='inference size (pixels)')
|
parser.add_argument('--img-size', type=int, default=416, help='inference size (pixels)')
|
||||||
parser.add_argument('--conf-thres', type=float, default=0.001, help='object confidence threshold')
|
parser.add_argument('--conf-thres', type=float, default=0.001, help='object confidence threshold')
|
||||||
parser.add_argument('--iou-thres', type=float, default=0.5, help='IOU threshold for NMS')
|
parser.add_argument('--iou-thres', type=float, default=0.6, help='IOU threshold for NMS')
|
||||||
parser.add_argument('--save-json', action='store_true', help='save a cocoapi-compatible JSON results file')
|
parser.add_argument('--save-json', action='store_true', help='save a cocoapi-compatible JSON results file')
|
||||||
parser.add_argument('--task', default='test', help="'test', 'study', 'benchmark'")
|
parser.add_argument('--task', default='test', help="'test', 'study', 'benchmark'")
|
||||||
parser.add_argument('--device', default='', help='device id (i.e. 0 or 0,1) or cpu')
|
parser.add_argument('--device', default='', help='device id (i.e. 0 or 0,1) or cpu')
|
||||||
|
|
16
train.py
16
train.py
|
@ -52,7 +52,7 @@ if f:
|
||||||
def train():
|
def train():
|
||||||
cfg = opt.cfg
|
cfg = opt.cfg
|
||||||
data = opt.data
|
data = opt.data
|
||||||
img_size = opt.img_size
|
img_size, img_size_test = opt.img_size if len(opt.img_size) == 2 else opt.img_size * 2 # train, test sizes
|
||||||
epochs = opt.epochs # 500200 batches at bs 64, 117263 images = 273 epochs
|
epochs = opt.epochs # 500200 batches at bs 64, 117263 images = 273 epochs
|
||||||
batch_size = opt.batch_size
|
batch_size = opt.batch_size
|
||||||
accumulate = opt.accumulate # effective bs = batch_size * accumulate = 16 * 4 = 64
|
accumulate = opt.accumulate # effective bs = batch_size * accumulate = 16 * 4 = 64
|
||||||
|
@ -191,7 +191,7 @@ def train():
|
||||||
collate_fn=dataset.collate_fn)
|
collate_fn=dataset.collate_fn)
|
||||||
|
|
||||||
# Testloader
|
# Testloader
|
||||||
testloader = torch.utils.data.DataLoader(LoadImagesAndLabels(test_path, opt.img_size, batch_size * 2,
|
testloader = torch.utils.data.DataLoader(LoadImagesAndLabels(test_path, img_size_test, batch_size * 2,
|
||||||
hyp=hyp,
|
hyp=hyp,
|
||||||
rect=True,
|
rect=True,
|
||||||
cache_labels=True,
|
cache_labels=True,
|
||||||
|
@ -221,7 +221,7 @@ def train():
|
||||||
|
|
||||||
# Prebias
|
# Prebias
|
||||||
if prebias:
|
if prebias:
|
||||||
if epoch < 1: # prebias
|
if epoch < 3: # prebias
|
||||||
ps = 0.1, 0.9 # prebias settings (lr=0.1, momentum=0.9)
|
ps = 0.1, 0.9 # prebias settings (lr=0.1, momentum=0.9)
|
||||||
else: # normal training
|
else: # normal training
|
||||||
ps = hyp['lr0'], hyp['momentum'] # normal training settings
|
ps = hyp['lr0'], hyp['momentum'] # normal training settings
|
||||||
|
@ -314,10 +314,10 @@ def train():
|
||||||
results, maps = test.test(cfg,
|
results, maps = test.test(cfg,
|
||||||
data,
|
data,
|
||||||
batch_size=batch_size * 2,
|
batch_size=batch_size * 2,
|
||||||
img_size=opt.img_size,
|
img_size=img_size_test,
|
||||||
model=model,
|
model=model,
|
||||||
conf_thres=0.001 if final_epoch else 0.1, # 0.1 for speed
|
conf_thres=0.001 if final_epoch and is_coco else 0.1, # 0.1 for speed
|
||||||
iou_thres=0.6 if final_epoch and is_coco else 0.5,
|
iou_thres=0.6,
|
||||||
save_json=final_epoch and is_coco,
|
save_json=final_epoch and is_coco,
|
||||||
single_cls=opt.single_cls,
|
single_cls=opt.single_cls,
|
||||||
dataloader=testloader)
|
dataloader=testloader)
|
||||||
|
@ -402,7 +402,7 @@ if __name__ == '__main__':
|
||||||
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='*.cfg path')
|
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='*.cfg path')
|
||||||
parser.add_argument('--data', type=str, default='data/coco2017.data', help='*.data path')
|
parser.add_argument('--data', type=str, default='data/coco2017.data', help='*.data path')
|
||||||
parser.add_argument('--multi-scale', action='store_true', help='adjust (67% - 150%) img_size every 10 batches')
|
parser.add_argument('--multi-scale', action='store_true', help='adjust (67% - 150%) img_size every 10 batches')
|
||||||
parser.add_argument('--img-size', type=int, default=416, help='inference size (pixels)')
|
parser.add_argument('--img-size', nargs='+', type=int, default=[416], help='train and test image-sizes')
|
||||||
parser.add_argument('--rect', action='store_true', help='rectangular training')
|
parser.add_argument('--rect', action='store_true', help='rectangular training')
|
||||||
parser.add_argument('--resume', action='store_true', help='resume training from last.pt')
|
parser.add_argument('--resume', action='store_true', help='resume training from last.pt')
|
||||||
parser.add_argument('--nosave', action='store_true', help='only save final checkpoint')
|
parser.add_argument('--nosave', action='store_true', help='only save final checkpoint')
|
||||||
|
@ -425,7 +425,7 @@ if __name__ == '__main__':
|
||||||
mixed_precision = False
|
mixed_precision = False
|
||||||
|
|
||||||
# scale hyp['obj'] by img_size (evolved at 320)
|
# scale hyp['obj'] by img_size (evolved at 320)
|
||||||
# hyp['obj'] *= opt.img_size / 320.
|
# hyp['obj'] *= opt.img_size[0] / 320.
|
||||||
|
|
||||||
tb_writer = None
|
tb_writer = None
|
||||||
if not opt.evolve: # Train normally
|
if not opt.evolve: # Train normally
|
||||||
|
|
|
@ -308,8 +308,10 @@ n=209 && t=ultralytics/yolov3:v$n && sudo docker pull $t && sudo docker run --gp
|
||||||
n=210 && t=ultralytics/yolov3:v$n && sudo docker pull $t && sudo docker run --gpus all -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 1000 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc defaultpw --pre --multi --bucket ult/wer --name $n --nosave --cache --device 1 --cfg yolov3-tiny-3cls.cfg
|
n=210 && t=ultralytics/yolov3:v$n && sudo docker pull $t && sudo docker run --gpus all -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 1000 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc defaultpw --pre --multi --bucket ult/wer --name $n --nosave --cache --device 1 --cfg yolov3-tiny-3cls.cfg
|
||||||
n=216 && t=ultralytics/yolov3:v$n && sudo docker pull $t && sudo docker run --gpus all -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 1000 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc defaultpw --pre --multi --bucket ult/wer --name $n --nosave --cache --device 0 --cfg yolov3-tiny-3cls.cfg
|
n=216 && t=ultralytics/yolov3:v$n && sudo docker pull $t && sudo docker run --gpus all -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 1000 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc defaultpw --pre --multi --bucket ult/wer --name $n --nosave --cache --device 0 --cfg yolov3-tiny-3cls.cfg
|
||||||
n=218 && t=ultralytics/yolov3:v$n && sudo docker pull $t && sudo docker run --gpus all --ipc=host -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 1000 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc default --pre --multi --bucket ult/wer --name $n --nosave --cache --device 7 --cfg yolov3-tiny-3cls.cfg
|
n=218 && t=ultralytics/yolov3:v$n && sudo docker pull $t && sudo docker run --gpus all --ipc=host -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 1000 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc default --pre --multi --bucket ult/wer --name $n --nosave --cache --device 7 --cfg yolov3-tiny-3cls.cfg
|
||||||
n=230 && t=ultralytics/yolov3:v$n && sudo docker pull $t && sudo docker run --gpus all --ipc=host -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 100 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc default --multi --bucket ult/wer --name $n --nosave --cache --device 0 --cfg yolov3-tiny-1cls.cfg --single
|
n=230 && t=ultralytics/athena:v$n && sudo docker pull $t && sudo docker run --gpus all --ipc=host -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 100 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc defaultpw --multi --bucket ult/wer --name $n --nosave --cache --device 0 --cfg yolov3-tiny-1cls.cfg --single
|
||||||
n=231 && t=ultralytics/yolov3:v$n && sudo docker pull $t && sudo docker run --gpus all --ipc=host -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 100 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc default --multi --bucket ult/wer --name $n --nosave --cache --device 1 --cfg yolov3-tiny-1cls.cfg --single
|
n=231 && t=ultralytics/athena:v$n && sudo docker pull $t && sudo docker run --gpus all --ipc=host -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 100 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc defaultpw --multi --bucket ult/wer --name $n --nosave --cache --device 1 --cfg yolov3-tiny-1cls.cfg --single
|
||||||
|
n=232 && t=ultralytics/athena:v$n && sudo docker pull $t && sudo docker run --gpus all --ipc=host -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 100 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc defaultpw --multi --bucket ult/wer --name $n --nosave --cache --device 0 --cfg yolov3-tiny-1cls.cfg --single
|
||||||
|
n=233 && t=ultralytics/athena:v$n && sudo docker pull $t && sudo docker run --gpus all --ipc=host -it -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 100 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc defaultpw --multi --bucket ult/wer --name $n --nosave --cache --device 0 --cfg yolov3-tiny-1cls.cfg --single
|
||||||
|
|
||||||
|
|
||||||
n=206 && t=ultralytics/yolov3:v$n && sudo docker pull $t && sudo docker run --gpus all -it --ipc=host -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 10 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc defaultpw --pre --multi --nosave --cache --device 0 --cfg yolov3-tiny-3cls.cfg
|
n=206 && t=ultralytics/yolov3:v$n && sudo docker pull $t && sudo docker run --gpus all -it --ipc=host -v "$(pwd)"/data:/usr/src/data $t python3 train.py --data ../data/sm4/out.data --img-size 320 --epochs 10 --batch 64 --accum 1 --weights yolov3-tiny.pt --arc defaultpw --pre --multi --nosave --cache --device 0 --cfg yolov3-tiny-3cls.cfg
|
||||||
|
|
Loading…
Reference in New Issue