1. 手写数字识别
1.1. 训练配置设定
from easydict import EasyDict as edict
__C = edict()
# Consumers can get config by: from config import cfg
cfg = __C
# YOLO options
__C.YOLO = edict()
# Set the class name
__C.YOLO.CLASSES = "./data/classes/yymnist.names"
__C.YOLO.ANCHORS = "./data/anchors/basline_anchors.txt"
__C.YOLO.STRIDES = [8, 16, 32]
__C.YOLO.ANCHOR_PER_SCALE = 3
__C.YOLO.IOU_LOSS_THRESH = 0.5
# Train options
__C.TRAIN = edict()
__C.TRAIN.ANNOT_PATH = "./data/dataset/yymnist_train.txt"
__C.TRAIN.BATCH_SIZE = 2
# __C.TRAIN.INPUT_SIZE = [320, 352, 384, 416, 448, 480, 512, 544, 576, 608]
__C.TRAIN.INPUT_SIZE = [416]
__C.TRAIN.DATA_AUG = True
__C.TRAIN.LR_INIT = 1e-3
__C.TRAIN.LR_END = 1e-6
__C.TRAIN.WARMUP_EPOCHS = 2
__C.TRAIN.EPOCHS = 5
# TEST options
__C.TEST = edict()
__C.TEST.ANNOT_PATH = "./data/dataset/yymnist_test.txt"
__C.TEST.BATCH_SIZE = 2
__C.TEST.INPUT_SIZE = 416
__C.TEST.DATA_AUG = False
__C.TEST.DECTECTED_IMAGE_PATH = "./data/detection/"
__C.TEST.SCORE_THRESHOLD = 0.3
__C.TEST.IOU_THRESHOLD = 0.45
-
batch_size
改为2,太大会导致内存溢出
- 为了减少训练的总量和避免过拟合,将
epochs
设置为5
- 训练过程开启了
数据增强
1.2. 数据集设置
- 训练集
1000
张,测试集200
张,训练总数为1000/2*5=2500回合
- 训练时长2h
2. ;两类机器人识别
2.1. 训练配置设定
from easydict import EasyDict as edict
__C = edict()
# Consumers can get config by: from config import cfg
cfg = __C
# YOLO options
__C.YOLO = edict()
# Set the class name
# __C.YOLO.CLASSES = "./data/classes/coco.names"
# __C.YOLO.CLASSES = "./data/classes/yymnist.names"
# __C.YOLO.CLASSES = "./data/classes/robot2.names"
__C.YOLO.CLASSES = "./data/classes/robot.names"
__C.YOLO.ANCHORS = "./data/anchors/basline_anchors.txt"
__C.YOLO.STRIDES = [8, 16, 32]
__C.YOLO.ANCHOR_PER_SCALE = 3
__C.YOLO.IOU_LOSS_THRESH = 0.5
# Train options
__C.TRAIN = edict()
__C.TRAIN.ANNOT_PATH = "./data/dataset/train.txt"
__C.TRAIN.BATCH_SIZE = 2
# __C.TRAIN.INPUT_SIZE = [320, 352, 384, 416, 448, 480, 512, 544, 576, 608]
__C.TRAIN.INPUT_SIZE = [416]
__C.TRAIN.DATA_AUG = True
__C.TRAIN.LR_INIT = 1e-3
__C.TRAIN.LR_END = 1e-6
__C.TRAIN.WARMUP_EPOCHS = 2
__C.TRAIN.EPOCHS = 2
# TEST options
__C.TEST = edict()
__C.TEST.ANNOT_PATH = "./data/dataset/test.txt"
__C.TEST.BATCH_SIZE = 2
__C.TEST.INPUT_SIZE = 416
__C.TEST.DATA_AUG = False
__C.TEST.DECTECTED_IMAGE_PATH = "./data/detection/"
__C.TEST.SCORE_THRESHOLD = 0.3
__C.TEST.IOU_THRESHOLD = 0.45
-
batch_size
改为2,太大会导致内存溢出
- 为了减少训练的总量和避免过拟合,将
epochs
设置为5
1.2. 数据集设置
- 每一类训练集
1500
张,一共3000张,测试集250
张,一共500张,训练总数为3000/3*2=2000回合
3. 实验技巧
3.1. 需要修改的文件
# 配置文件的参数
D:\JupyterProjects\TensorFlow2.0-Examples-master\4-Object_Detection\YOLOV3\core\config.py
# 修改输入图片的尺寸
D:\JupyterProjects\TensorFlow2.0-Examples-master\4-Object_Detection\YOLOV3\test.py