-1

我训练了 YoloV3进行物体检测。我训练达到 Avg Recall:批次中所有图像的几乎 1.0,并且 Avg IOU 高于 0.9。但是,当我使用未包含在训练中的图像(但它们与那些经过训练的图像非常相似)进行测试时,检测阈值需要设置为 0.1。但是用训练中使用的那些图像进行测试,它们的检测率阈值可以设置得很高,比如 0.7。什么可能是错误的或者我需要在培训中改变什么?我的训练 cfg 是

[net]
# Testing
#batch=1
#subdivisions=1
# Training
 batch=16
 subdivisions=8
height=416
width=416
channels=3
momentum=0.9
decay=0.0005
angle=0
saturation = 1.5
exposure = 1.5
hue=.1

learning_rate=0.001
burn_in=1000
max_batches = 20000
policy=steps
steps=5000,10000
scales=.1,.1

[convolutional]
batch_normalize=1
filters=32
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=64
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=128
size=3
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=64
size=1
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=128
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=128
size=1
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=512
size=1
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=512
size=1
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky


#######

[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=1024
activation=leaky

[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=1024
activation=leaky

[route]
layers=-9

[convolutional]
batch_normalize=1
size=1
stride=1
pad=1
filters=64
activation=leaky

[reorg]
stride=2

[route]
layers=-1,-4

[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=1024
activation=leaky

[convolutional]
size=1
stride=1
pad=1
filters=30
activation=linear


[region]
anchors =  2.00,1.24, 2.75,0.93, 2.84,1.75, 3.72,1.21, 4.63,1.59
bias_match=1
classes=1
coords=4
num=5
softmax=1
jitter=.3
rescore=1

object_scale=5
noobject_scale=1
class_scale=1
coord_scale=1

absolute=1
thresh = .6
random=1
4

2 回答 2

2

我在将 Yolo 用于非方形图像时遇到了这样的问题。是你的情况吗?在训练阶段,Yolo 将图像大小调整为需要的大小(即您的网络中的 416x416):https ://github.com/pjreddie/darknet/blob/master/src/data.c#L971 但在测试阶段它会调整图像保留方面的大小比率并将所需的边框添加到图像:https ://github.com/pjreddie/darknet/blob/master/examples/detector.c#L587 (下面评论了带有哑调整大小的替代代码行)。自然,如果输入图像不是方形的,它们看起来与训练中的完全不同 :) 我使用https://github.com/AlexeyAB/darknet fork,这个问题最近在那儿得到了修复(https://github.com /AlexeyAB/darknet/commit/efaf684cb20b996db0cd6d99d20fabb4bc26859a)。但看起来,原来的Yolo还是有的。PS。虽然 Yolo 是一个很棒的工具,但它的代码有很多这样的东西,使用它时查看源代码和调试器是个好主意:)

于 2018-06-21T15:23:47.520 回答
1

取消注释 batch = 1 和 subdivisions=1 并注释最后一行:

# Testing
#batch=1
#subdivisions=1
# Training  
batch=16  
subdivisions=8
于 2018-08-10T19:02:28.723 回答