4

暗网训练命令不产生任何输出并且过早退出(与其他 CNN 训练项目相比)

我已按照“如何训练(检测您的自定义对象)”的说明进行操作。
yolo-obj.cfg 已相应配置。
darknet.exe 已使用 MSVS 2017 成功编译和构建。

我有 3 个新的自定义类:

obj.data 文件:

classes= 3  
train = data/train.txt  
valid = data/train.txt  
names = data/obj.names  
backup = backup/  

obj.names 文件:

ring  
watch  
necklace  

我为每个类运行了大约 500 个图像的 yolo_mark,生成了相应的 *.txt 文件。
我把所有的jpg和txt文件都放在了obj目录下。
train.txt 文件包含 *.jpg 文件的路径,例如:“data/obj/necklace 013311.jpg”

下载并将darknet53.conv.74文件放在“x64”目录下

以管理员身份运行命令(从虚拟机,因此没有 GPU):

C:\Users\claw\Downloads\darknet-master\darknet-master\build\darknet\x64>darknet_no_gpu.exe detector train data/obj.data yolo-obj.cfg darknet53.conv.74
yolo-obj

命令行输出:

layer filters size input output  
0 conv 32 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 32 0.299 BF  
1 conv 64 3 x 3 / 2 416 x 416 x 32 -> 208 x 208 x 64 1.595 BF  
2 conv 32 1 x 1 / 1 208 x 208 x 64 -> 208 x 208 x 32 0.177 BF  
3 conv 64 3 x 3 / 1 208 x 208 x 32 -> 208 x 208 x 64 1.595 BF  
4 Shortcut Layer: 1  
5 conv 128 3 x 3 / 2 208 x 208 x 64 -> 104 x 104 x 128 1.595 BF  
6 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64 0.177 BF  
7 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 1.595 BF  
8 Shortcut Layer: 5  
9 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64 0.177 BF  
10 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 1.595 BF  
11 Shortcut Layer: 8  
12 conv 256 3 x 3 / 2 104 x 104 x 128 -> 52 x 52 x 256 1.595 BF  
13 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF  
14 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF  
15 Shortcut Layer: 12  
16 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF  
17 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF  
18 Shortcut Layer: 15  
19 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF  
20 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF  
21 Shortcut Layer: 18  
22 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF  
23 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF  
24 Shortcut Layer: 21  
25 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF  
26 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF  
27 Shortcut Layer: 24  
28 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF  
29 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF  
30 Shortcut Layer: 27  
31 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF  
32 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF  
33 Shortcut Layer: 30  
34 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF  
35 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF  
36 Shortcut Layer: 33  
37 conv 512 3 x 3 / 2 52 x 52 x 256 -> 26 x 26 x 512 1.595 BF  
38 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF  
39 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF  
40 Shortcut Layer: 37  
41 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF  
42 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF  
43 Shortcut Layer: 40  
44 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF  
45 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF  
46 Shortcut Layer: 43  
47 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF  
48 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF  
49 Shortcut Layer: 46  
50 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF  
51 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF  
52 Shortcut Layer: 49  
53 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF  
54 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF  
55 Shortcut Layer: 52  
56 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF  
57 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF  
58 Shortcut Layer: 55  
59 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF  
60 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF  
61 Shortcut Layer: 58  
62 conv 1024 3 x 3 / 2 26 x 26 x 512 -> 13 x 13 x1024 1.595 BF  
63 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF  
64 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF  
65 Shortcut Layer: 62  
66 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF  
67 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF  
68 Shortcut Layer: 65  
69 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF  
70 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF  
71 Shortcut Layer: 68  
72 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF  
73 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF  
74 Shortcut Layer: 71  
75 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF  
76 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF  
77 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF  
78 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF  
79 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF  
80 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF  
81 conv 24 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 24 0.008 BF  
82 yolo  
83 route 79  
84 conv 256 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 256 0.044 BF  
85 upsample 2x 13 x 13 x 256 -> 26 x 26 x 256  
86 route 85 61  
87 conv 256 1 x 1 / 1 26 x 26 x 768 -> 26 x 26 x 256 0.266 BF  
88 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF  
89 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF  
90 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF  
91 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF  
92 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF  
93 conv 24 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 24 0.017 BF  
94 yolo  
95 route 91  
96 conv 128 1 x 1 / 1 26 x 26 x 256 -> 26 x 26 x 128 0.044 BF  
97 upsample 2x 26 x 26 x 128 -> 52 x 52 x 128  
98 route 97 36  
99 conv 128 1 x 1 / 1 52 x 52 x 384 -> 52 x 52 x 128 0.266 BF  
100 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF  
101 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF  
102 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF  
103 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF  
104 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF  
105 conv 24 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 24 0.033 BF  
106 yolo  

Total BFLOPS 65.304  
Loading weights from darknet53.conv.74...  
seen 64  
Done!  

Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005  
If error occurs - run training with flag: -dont_show  
Resizing  
416 x 416  

Cannot load image "data/img/ring chic-criss-cross-adjustable-ad-ring.jpg"  
Loaded: 1.143984 seconds  
Used AVX  
Region 82 Avg IOU: 0.333570, Class: 0.602019, Obj: 0.402860, No Obj: 0.528741, .5R: 0.000000, .75R: 0.000000, count: 4  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521660, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.514523, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.329878, Class: 0.570290, Obj: 0.611294, No Obj: 0.528309, .5R: 0.250000, .75R: 0.000000, count: 4  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521499, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.514392, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.575794, Class: 0.539979, Obj: 0.316475, No Obj: 0.528604, .5R: 0.500000, .75R: 0.500000, count: 2  
Region 94 Avg IOU: 0.312451, Class: 0.125449, Obj: 0.238739, No Obj: 0.521500, .5R: 0.000000, .75R: 0.000000, count: 1  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.514025, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.257590, Class: 0.547629, Obj: 0.447064, No Obj: 0.527685, .5R: 0.000000, .75R: 0.000000, count: 3  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521665, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.515411, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.297573, Class: 0.436722, Obj: 0.389306, No Obj: 0.528302, .5R: 0.500000, .75R: 0.000000, count: 4  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521452, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.513978, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.191856, Class: 0.645887, Obj: 0.364560, No Obj: 0.528137, .5R: 0.000000, .75R: 0.000000, count: 5  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521575, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.514143, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.475039, Class: 0.419801, Obj: 0.578539, No Obj: 0.527876, .5R: 0.500000, .75R: 0.500000, count: 2  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521085, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.514371, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.264798, Class: 0.416162, Obj: 0.462117, No Obj: 0.527412, .5R: 0.000000, .75R: 0.000000, count: 5  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521446, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.514205, .5R: -nan(ind), .75R: -nan(ind), count: 0  


1: 1003.093994, 1003.093994 avg loss, 0.000000 rate, 1056.320056 seconds, 64 images  
Loaded: 0.000000 seconds  
Cannot load image "data/img/necklace 570239071_2906.jpg"  
Cannot load image "data/img/necklace 570239072_2906.jpg"  
Cannot load image "data/img/necklace 10019367_no_place_like_roam_necklace_green_main.jpg"  
Region 82 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.527527, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521694, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.514430, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.213376, Class: 0.587271, Obj: 0.565966, No Obj: 0.528763, .5R: 0.000000, .75R: 0.000000, count: 5  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.522077, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.515318, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.314485, Class: 0.501796, Obj: 0.458959, No Obj: 0.528414, .5R: 0.000000, .75R: 0.000000, count: 2  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521397, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.514781, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.278535, Class: 0.518696, Obj: 0.510300, No Obj: 0.528529, .5R: 0.000000, .75R: 0.000000, count: 5  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521170, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.514448, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.270750, Class: 0.498121, Obj: 0.530221, No Obj: 0.528569, .5R: 0.000000, .75R: 0.000000, count: 2  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521003, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.513312, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.235287, Class: 0.480098, Obj: 0.517194, No Obj: 0.527906, .5R: 0.000000, .75R: 0.000000, count: 4  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521571, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.513103, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.368155, Class: 0.552764, Obj: 0.482865, No Obj: 0.528044, .5R: 0.200000, .75R: 0.000000, count: 5  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.521782, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.514365, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 82 Avg IOU: 0.393099, Class: 0.568679, Obj: 0.534074, No Obj: 0.528130, .5R: 0.000000, .75R: 0.000000, count: 2  
Region 94 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.522459, .5R: -nan(ind), .75R: -nan(ind), count: 0  
Region 106 Avg IOU: -nan(ind), Class: -nan(ind), Obj: -nan(ind), No Obj: 0.515186, .5R: -nan(ind), .75R: -nan(ind), count: 0  


2: 1002.576904, 1003.042297 avg loss, 0.000000 rate, 1043.121191 seconds, 128 images  
Loaded: 0.000000 seconds  

在此之后,我检查了备份目录,其中只创建了一个 *.tmp 文件(0 kb)
没有创建重量文件......

我究竟做错了什么 ?

4

3 回答 3

1

我认为您的训练集配置不正确。你的大部分结果是 -nan(ind)

您的 train.txt 可能有问题。

1: 1003.093994, 1003.093994 avg loss, 0.000000 rate, 1056.320056 seconds, 64 images ^ 这是迭代次数。默认情况下,暗网在 100 次迭代后将权重写入备份文件夹。如果您想要在此之前添加权重,请在 src 中打开您的检测器.c 文件并修改

    if (i % 1000 == 0 || (i < 1000 && i % 3 == 0)) {
    //if (i % 100 == 0) {
    //if(i >= (iter_save + 100)) {

就像我为我所做的那样,第 204 行,如果你想在第一次迭代中增加权重,则将数字设为 1(而不是 3),然后再次构建。

尝试在本教程中像 yolo-voc 这样的较小网络上进行训练:https ://timebutt.github.io/static/how-to-train-yolov2-to-detect-custom-objects/ 即使我在遇到问题时也遇到了问题使用基于 yolov3.cfg 的网络(获得相同的输出)

于 2018-09-09T05:09:27.610 回答
1

默认情况下,每 100 次迭代记录一次权重。在使用权重进行推断之前,您必须等待长时间训练 YOLO(尤其是在没有 GPU 的情况下)。

于 2018-08-07T08:41:54.113 回答
0

问题是对象 txt 文件(由 yolomarkup 创建)几乎都是空的。我添加了 3 个新对象;项链、戒指、手表和每个对象大约 500 张 jpg 图像,我在 yolomarkup.exe 中使用。对于许多标记的图像,相应的 txt 文件是空的!我完全放弃了对那些对象的训练

于 2018-09-11T08:05:46.137 回答