大家好,
抱歉,这是我第一次使用任何类型的对象检测,实际上我第一次使用 python。 在尝试训练我的数据集时,我得到的结果是 nan。
我收到的错误是:
运行时警告:在 sqrt 中遇到无效值
obj[4] = np.sqrt(obj[4])
示例注释 xml 文件
<annotation>
<folder>images</folder>
<filename>000006.png</filename>
<segmented>0</segmented>
<size>
<width>225</width>
<height>225</height>
<depth>3</depth>
</size>
<object>
<name>person</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>35</xmin>
<ymin>93</ymin>
<xmax>45</xmax>
<ymax>45</ymax>
</bndbox>
</object>
<object>
<name>person</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>69</xmin>
<ymin>94</ymin>
<xmax>77</xmax>
<ymax>77</ymax>
</bndbox>
</object>
<object>
<name>person</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>129</xmin>
<ymin>85</ymin>
<xmax>136</xmax>
<ymax>136</ymax>
</bndbox>
</object>
<object>
<name>person</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>145</xmin>
<ymin>98</ymin>
<xmax>153</xmax>
<ymax>153</ymax>
</bndbox>
</object>
<object>
<name>person</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>81</xmin>
<ymin>143</ymin>
<xmax>92</xmax>
<ymax>92</ymax>
</bndbox>
</object>
<object>
<name>person</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>185</xmin>
<ymin>188</ymin>
<xmax>195</xmax>
<ymax>195</ymax>
</bndbox>
</object>
<object>
<name>person</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>77</xmin>
<ymin>189</ymin>
<xmax>93</xmax>
<ymax>93</ymax>
</bndbox>
</object>
<object>
<name>person</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>75</xmin>
<ymin>204</ymin>
<xmax>89</xmax>
<ymax>89</ymax>
</bndbox>
</object>
</annotation>
配置文件
[net]
batch=64
subdivisions=8
width=416
height=416
channels=3
momentum=0.9
decay=0.0005
angle=0
saturation = 1.5
exposure = 1.5
hue=.1
learning_rate=0.001
max_batches = 40100
policy=steps
steps=-1,100,20000,30000
scales=.1,10,.1,.1
[convolutional]
batch_normalize=1
filters=16
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[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
[maxpool]
size=2
stride=2
[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
[maxpool]
size=2
stride=1
[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]
size=1
stride=1
pad=1
filters=30
activation=linear
[region]
anchors = 1.08,1.19, 3.42,4.41, 6.63,11.38, 9.42,5.11, 16.62,10.52
bias_match=1
classes=1
coords=4
num=5
softmax=1
jitter=.2
rescore=1
object_scale=5
noobject_scale=1
class_scale=1
coord_scale=1
absolute=1
thresh = .5
random=1
我希望有人能指出我正确的方向。 这是我第一次尝试训练自己的模型。
谢谢,
李
如果训练使用您的自定义数据集,则为初始训练。
您应该使用“burn_in”,因为初始训练中的梯度和损失非常不稳定。
检查代码并在https://github.com/marvis/pytorch-yolo2/blob/master/train.py 中搜索“seen”
我有同样的问题...你对此有什么想法吗?
这个脚本显然可以帮助您确定 Nans 何时开始发生
https://gist.github.com/yuq-1s/ce63a306f1d39d1c0c80d33f7855f3b5
但我不确定如何将它与 darkflow 一起使用 - 如果你解决了,请告诉我
你得到 nan 因为 Ymin 比 Ymax 大:
<bndbox>
<xmin>69</xmin>
<ymin>94</ymin>
<xmax>77</xmax>
<ymax>77</ymax>
</bndbox>
确保 X 和 Y 的 Min 都小于 Max。
最有用的评论
你得到 nan 因为 Ymin 比 Ymax 大:
确保 X 和 Y 的 Min 都小于 Max。