updates
This commit is contained in:
parent
f7a517d72c
commit
504d3b3f71
|
@ -1,6 +0,0 @@
|
|||
classes=80
|
||||
train=./data/coco_100img.txt
|
||||
valid=./data/coco_100img.txt
|
||||
names=data/coco.names
|
||||
backup=backup/
|
||||
eval=coco
|
|
@ -1,100 +0,0 @@
|
|||
../coco/images/train2014/COCO_train2014_000000000009.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000025.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000030.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000034.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000036.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000049.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000061.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000064.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000071.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000072.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000077.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000078.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000081.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000086.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000089.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000092.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000094.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000109.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000110.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000113.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000127.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000138.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000142.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000144.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000149.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000151.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000154.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000165.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000194.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000201.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000247.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000260.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000263.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000307.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000308.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000309.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000312.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000315.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000321.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000322.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000326.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000332.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000349.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000368.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000370.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000382.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000384.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000389.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000394.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000404.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000419.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000431.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000436.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000438.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000443.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000446.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000450.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000471.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000490.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000491.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000510.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000514.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000529.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000531.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000532.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000540.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000542.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000560.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000562.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000572.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000575.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000581.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000584.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000595.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000597.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000605.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000612.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000620.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000625.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000629.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000634.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000643.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000650.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000656.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000659.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000670.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000671.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000673.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000681.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000684.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000690.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000706.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000714.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000716.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000722.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000723.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000731.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000735.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000753.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000754.jpg
|
|
@ -1,6 +0,0 @@
|
|||
classes=80
|
||||
train=./data/coco_10img.txt
|
||||
valid=./data/coco_10img.txt
|
||||
names=data/coco.names
|
||||
backup=backup/
|
||||
eval=coco
|
|
@ -1,10 +0,0 @@
|
|||
../coco/images/train2014/COCO_train2014_000000000009.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000025.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000030.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000034.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000036.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000049.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000061.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000064.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000071.jpg
|
||||
../coco/images/train2014/COCO_train2014_000000000072.jpg
|
16
train.py
16
train.py
|
@ -3,6 +3,7 @@ import time
|
|||
|
||||
import torch.distributed as dist
|
||||
import torch.optim as optim
|
||||
import torch.optim.lr_scheduler as lr_scheduler
|
||||
from torch.utils.data import DataLoader
|
||||
|
||||
import test # Import test.py to get mAP after each epoch
|
||||
|
@ -60,9 +61,9 @@ def train(
|
|||
data_cfg,
|
||||
img_size=416,
|
||||
resume=False,
|
||||
epochs=273, # 500200 batches at bs 64, dataset length 117263
|
||||
epochs=68, # 500200 batches at bs 4, dataset length 117263
|
||||
batch_size=16,
|
||||
accumulate=1,
|
||||
accumulate=4, # effective bs = 64 = batch_size * accumulate
|
||||
multi_scale=False,
|
||||
freeze_backbone=False,
|
||||
transfer=False # Transfer learning (train only YOLO layers)
|
||||
|
@ -121,9 +122,10 @@ def train(
|
|||
# Scheduler https://github.com/ultralytics/yolov3/issues/238
|
||||
# lf = lambda x: 1 - x / epochs # linear ramp to zero
|
||||
# lf = lambda x: 10 ** (hyp['lrf'] * x / epochs) # exp ramp
|
||||
lf = lambda x: 1 - 10 ** (hyp['lrf'] * (1 - x / epochs)) # inverse exp ramp
|
||||
scheduler = optim.lr_scheduler.LambdaLR(optimizer, lr_lambda=lf, last_epoch=start_epoch - 1)
|
||||
# scheduler = optim.lr_scheduler.MultiStepLR(optimizer, milestones=[218, 245], gamma=0.1, last_epoch=start_epoch-1)
|
||||
# lf = lambda x: 1 - 10 ** (hyp['lrf'] * (1 - x / epochs)) # inverse exp ramp
|
||||
# scheduler = lr_scheduler.LambdaLR(optimizer, lr_lambda=lf)
|
||||
scheduler = lr_scheduler.MultiStepLR(optimizer, milestones=[round(opt.epochs * x) for x in (0.8, 0.9)], gamma=0.1)
|
||||
scheduler.last_epoch = start_epoch - 1
|
||||
|
||||
# # Plot lr schedule
|
||||
# y = []
|
||||
|
@ -303,9 +305,9 @@ if __name__ == '__main__':
|
|||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--epochs', type=int, default=273, help='number of epochs')
|
||||
parser.add_argument('--batch-size', type=int, default=16, help='size of each image batch')
|
||||
parser.add_argument('--accumulate', type=int, default=1, help='accumulate gradient x batches before optimizing')
|
||||
parser.add_argument('--accumulate', type=int, default=4, help='accumulate gradient x batches before optimizing')
|
||||
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='cfg file path')
|
||||
parser.add_argument('--data-cfg', type=str, default='data/coco.data', help='coco.data file path')
|
||||
parser.add_argument('--data-cfg', type=str, default='data/coco_64img.data', help='coco.data file path')
|
||||
parser.add_argument('--multi-scale', action='store_true', help='random image sizes per batch 320 - 608')
|
||||
parser.add_argument('--img-size', type=int, default=416, help='inference size (pixels)')
|
||||
parser.add_argument('--resume', action='store_true', help='resume training flag')
|
||||
|
|
Loading…
Reference in New Issue