使用VGG训练Imagenet

来源:互联网 发布:java重写tostring方法 编辑:程序博客网 时间:2024/05/17 22:01

准备数据

具体官网地址,请点击这里

ImageNet官网

训练数据集:ILSVRC2012_img_train.tar

验证数据集:ILSVRC2012_img_val.tar

数据解压

sudo tar –xvf ILSVRC2012_img_train.tar -C ./train 
sudo tar –xvf ILSVRC2012_img_val.tar -C ./val

对于val数据集,解压以后是所有的验证集图片,共50000张,大约6.3G。

对于train数据集,解压后是1000个tar文件,每个tar文件表示1000类里的一个类,共138G,对于1000个子tar,需要再次解压,解压脚本unzip.sh如下

dir=/home/satisfie/imagenet/train #satisfie 是我的用户名for x in `ls *.tar`do    filename=`basename $x .tar`   #注意空格    mkdir $filename    tar -xvf $x -C ./$filenamedone
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

i7 6700K配合我的500G固态硬盘解压超快,到这原始数据就准备好了,分别放在

  • /home/satisfie/imagenet/train:里面有1000个文件夹,每个文件夹下为JPG图片

  • /home/satisfie/imagenet/val :里面有验证集的50000张图片

接下来下载标签等其他说明数据~~~

下载其他数据

进入大caffe根目录,执行/data/ilsvrc12/get_ilsvrc_aux.sh下载其他数据,包括

  • det_synset_words.txt
  • synset_words.txt— 1000个类别的文件夹名称及真是物体的名称,比如 “n01440764 tench Tinca tinca”,在训练中,这些都当做一个类别。
  • synsets.txt — 1000个类别的文件夹名称,比如”n01440764”…
  • train.txt — 1000个类别每张图片的名字及其标签,比如 “n01440764/n01440764_10026.JPEG 0” 共有1281167张图片
  • val.txt — 同上,总共有50000张。比如“ILSVRC2012_val_00000001.JPEG 65”
  • test.txt — 同上,为测试集合,总有100000张
  • imagenet_mean.binaryproto — 模型图片的各个通道均值
  • imagenet.bet.pickle

模型的训练

训练数据准备

由于转化为lmdb数据库格式需要耗费较大的空间,且不支持shuffle等操作,所以这里直接读取原图片,使用的类型是ImageData,具体看下面的prototxt

其中的train_new.txt中对每张图片的加上了绝对值路径,这样才能被读取。 
使用sed命令即可,

sed 's/^/\/home\/satisfie\/imagenet\/val\/&/g' val.txt >val_new.txt
  • 1
  • 1

VGG_train_val.prototxt

name: "VGG_ILSVRC_16_layers"layer {  name: "data"  type: "ImageData"  include {    phase: TRAIN  } transform_param {    #crop_size: 224    mean_value: 104    mean_value: 117    mean_value: 123    mirror: true } image_data_param {    source: "/home/satisfie/imagenet/train_new.txt"    batch_size: 8    new_height: 224    new_width: 224  }  top: "data"  top: "label"}layer {  name: "data"  type: "ImageData"  include {    phase: TEST  } transform_param {    #crop_size: 224    mean_value: 104    mean_value: 117    mean_value: 123    mirror: false } image_data_param {    source: "/home/satisfie/imagenet/val_new.txt"    batch_size: 4    new_height: 224    new_width: 224  }  top: "data"  top: "label"}layer {  bottom: "data"  top: "conv1_1"  name: "conv1_1"  type: "Convolution"  convolution_param {    num_output: 64    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv1_1"  top: "conv1_1"  name: "relu1_1"  type: "ReLU"}layer {  bottom: "conv1_1"  top: "conv1_2"  name: "conv1_2"  type: "Convolution"  convolution_param {    num_output: 64    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv1_2"  top: "conv1_2"  name: "relu1_2"  type: "ReLU"}layer {  bottom: "conv1_2"  top: "pool1"  name: "pool1"  type: "Pooling"  pooling_param {    pool: MAX    kernel_size: 2    stride: 2  }}layer {  bottom: "pool1"  top: "conv2_1"  name: "conv2_1"  type: "Convolution"  convolution_param {    num_output: 128    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 0  }  param {    lr_mult: 0  }}layer {  bottom: "conv2_1"  top: "conv2_1"  name: "relu2_1"  type: "ReLU"}layer {  bottom: "conv2_1"  top: "conv2_2"  name: "conv2_2"  type: "Convolution"  convolution_param {    num_output: 128    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv2_2"  top: "conv2_2"  name: "relu2_2"  type: "ReLU"}layer {  bottom: "conv2_2"  top: "pool2"  name: "pool2"  type: "Pooling"  pooling_param {    pool: MAX    kernel_size: 2    stride: 2  }}layer {  bottom: "pool2"  top: "conv3_1"  name: "conv3_1"  type: "Convolution"  convolution_param {    num_output: 256    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv3_1"  top: "conv3_1"  name: "relu3_1"  type: "ReLU"}layer {  bottom: "conv3_1"  top: "conv3_2"  name: "conv3_2"  type: "Convolution"  convolution_param {    num_output: 256    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv3_2"  top: "conv3_2"  name: "relu3_2"  type: "ReLU"}layer {  bottom: "conv3_2"  top: "conv3_3"  name: "conv3_3"  type: "Convolution"  convolution_param {    num_output: 256    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv3_3"  top: "conv3_3"  name: "relu3_3"  type: "ReLU"}layer {  bottom: "conv3_3"  top: "pool3"  name: "pool3"  type: "Pooling"  pooling_param {    pool: MAX    kernel_size: 2    stride: 2  }}layer {  bottom: "pool3"  top: "conv4_1"  name: "conv4_1"  type: "Convolution"  convolution_param {    num_output: 512    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv4_1"  top: "conv4_1"  name: "relu4_1"  type: "ReLU"}layer {  bottom: "conv4_1"  top: "conv4_2"  name: "conv4_2"  type: "Convolution"  convolution_param {    num_output: 512    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv4_2"  top: "conv4_2"  name: "relu4_2"  type: "ReLU"}layer {  bottom: "conv4_2"  top: "conv4_3"  name: "conv4_3"  type: "Convolution"  convolution_param {    num_output: 512    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv4_3"  top: "conv4_3"  name: "relu4_3"  type: "ReLU"}layer {  bottom: "conv4_3"  top: "pool4"  name: "pool4"  type: "Pooling"  pooling_param {    pool: MAX    kernel_size: 2    stride: 2  }}layer {  bottom: "pool4"  top: "conv5_1"  name: "conv5_1"  type: "Convolution"  convolution_param {    num_output: 512    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv5_1"  top: "conv5_1"  name: "relu5_1"  type: "ReLU"}layer {  bottom: "conv5_1"  top: "conv5_2"  name: "conv5_2"  type: "Convolution"  convolution_param {    num_output: 512    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv5_2"  top: "conv5_2"  name: "relu5_2"  type: "ReLU"}layer {  bottom: "conv5_2"  top: "conv5_3"  name: "conv5_3"  type: "Convolution"  convolution_param {    num_output: 512    pad: 1    kernel_size: 3    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "conv5_3"  top: "conv5_3"  name: "relu5_3"  type: "ReLU"}layer {  bottom: "conv5_3"  top: "pool5"  name: "pool5"  type: "Pooling"  pooling_param {    pool: MAX    kernel_size: 2    stride: 2  }}layer {  bottom: "pool5"  top: "fc6"  name: "fc6"  type: "InnerProduct"  inner_product_param {    num_output: 4096    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "fc6"  top: "fc6"  name: "relu6"  type: "ReLU"}layer {  bottom: "fc6"  top: "fc6"  name: "drop6"  type: "Dropout"  dropout_param {    dropout_ratio: 0.5  }}layer {  bottom: "fc6"  top: "fc7"  name: "fc7"  type: "InnerProduct"  inner_product_param {    num_output: 4096    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  bottom: "fc7"  top: "fc7"  name: "relu7"  type: "ReLU"}layer {  bottom: "fc7"  top: "fc7"  name: "drop7"  type: "Dropout"  dropout_param {    dropout_ratio: 0.5  }}layer {  name: "fc8"  bottom: "fc7"  top: "fc8"  type: "InnerProduct"  inner_product_param {    num_output: 1000    weight_filler {      type: "xavier"    }    bias_filler {      type: "constant"      value: 0    }  }  param {    lr_mult: 1    decay_mult :1  }  param {    lr_mult: 2    decay_mult: 0  }}layer {  name: "loss"  type: "SoftmaxWithLoss"  bottom: "fc8"  bottom: "label"  top: "loss/loss"}layer {  name: "accuracy/top1"  type: "Accuracy"  bottom: "fc8"  bottom: "label"  top: "accuracy@1"  include: { phase: TEST }  accuracy_param {    top_k: 1  }}layer {  name: "accuracy/top5"  type: "Accuracy"  bottom: "fc8"  bottom: "label"  top: "accuracy@5"  include: { phase: TEST }  accuracy_param {    top_k: 5  }}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435
  • 436
  • 437
  • 438
  • 439
  • 440
  • 441
  • 442
  • 443
  • 444
  • 445
  • 446
  • 447
  • 448
  • 449
  • 450
  • 451
  • 452
  • 453
  • 454
  • 455
  • 456
  • 457
  • 458
  • 459
  • 460
  • 461
  • 462
  • 463
  • 464
  • 465
  • 466
  • 467
  • 468
  • 469
  • 470
  • 471
  • 472
  • 473
  • 474
  • 475
  • 476
  • 477
  • 478
  • 479
  • 480
  • 481
  • 482
  • 483
  • 484
  • 485
  • 486
  • 487
  • 488
  • 489
  • 490
  • 491
  • 492
  • 493
  • 494
  • 495
  • 496
  • 497
  • 498
  • 499
  • 500
  • 501
  • 502
  • 503
  • 504
  • 505
  • 506
  • 507
  • 508
  • 509
  • 510
  • 511
  • 512
  • 513
  • 514
  • 515
  • 516
  • 517
  • 518
  • 519
  • 520
  • 521
  • 522
  • 523
  • 524
  • 525
  • 526
  • 527
  • 528
  • 529
  • 530
  • 531
  • 532
  • 533
  • 534
  • 535
  • 536
  • 537
  • 538
  • 539
  • 540
  • 541
  • 542
  • 543
  • 544
  • 545
  • 546
  • 547
  • 548
  • 549
  • 550
  • 551
  • 552
  • 553
  • 554
  • 555
  • 556
  • 557
  • 558
  • 559
  • 560
  • 561
  • 562
  • 563
  • 564
  • 565
  • 566
  • 567
  • 568
  • 569
  • 570
  • 571
  • 572
  • 573
  • 574
  • 575
  • 576
  • 577
  • 578
  • 579
  • 580
  • 581
  • 582
  • 583
  • 584
  • 585
  • 586
  • 587
  • 588
  • 589
  • 590
  • 591
  • 592
  • 593
  • 594
  • 595
  • 596
  • 597
  • 598
  • 599
  • 600
  • 601
  • 602
  • 603
  • 604
  • 605
  • 606
  • 607
  • 608
  • 609
  • 610
  • 611
  • 612
  • 613
  • 614
  • 615
  • 616
  • 617
  • 618
  • 619
  • 620
  • 621
  • 622
  • 623
  • 624
  • 625
  • 626
  • 627
  • 628
  • 629
  • 630
  • 631
  • 632
  • 633
  • 634
  • 635
  • 636
  • 637
  • 638
  • 639
  • 640
  • 641
  • 642
  • 643
  • 644
  • 645
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435
  • 436
  • 437
  • 438
  • 439
  • 440
  • 441
  • 442
  • 443
  • 444
  • 445
  • 446
  • 447
  • 448
  • 449
  • 450
  • 451
  • 452
  • 453
  • 454
  • 455
  • 456
  • 457
  • 458
  • 459
  • 460
  • 461
  • 462
  • 463
  • 464
  • 465
  • 466
  • 467
  • 468
  • 469
  • 470
  • 471
  • 472
  • 473
  • 474
  • 475
  • 476
  • 477
  • 478
  • 479
  • 480
  • 481
  • 482
  • 483
  • 484
  • 485
  • 486
  • 487
  • 488
  • 489
  • 490
  • 491
  • 492
  • 493
  • 494
  • 495
  • 496
  • 497
  • 498
  • 499
  • 500
  • 501
  • 502
  • 503
  • 504
  • 505
  • 506
  • 507
  • 508
  • 509
  • 510
  • 511
  • 512
  • 513
  • 514
  • 515
  • 516
  • 517
  • 518
  • 519
  • 520
  • 521
  • 522
  • 523
  • 524
  • 525
  • 526
  • 527
  • 528
  • 529
  • 530
  • 531
  • 532
  • 533
  • 534
  • 535
  • 536
  • 537
  • 538
  • 539
  • 540
  • 541
  • 542
  • 543
  • 544
  • 545
  • 546
  • 547
  • 548
  • 549
  • 550
  • 551
  • 552
  • 553
  • 554
  • 555
  • 556
  • 557
  • 558
  • 559
  • 560
  • 561
  • 562
  • 563
  • 564
  • 565
  • 566
  • 567
  • 568
  • 569
  • 570
  • 571
  • 572
  • 573
  • 574
  • 575
  • 576
  • 577
  • 578
  • 579
  • 580
  • 581
  • 582
  • 583
  • 584
  • 585
  • 586
  • 587
  • 588
  • 589
  • 590
  • 591
  • 592
  • 593
  • 594
  • 595
  • 596
  • 597
  • 598
  • 599
  • 600
  • 601
  • 602
  • 603
  • 604
  • 605
  • 606
  • 607
  • 608
  • 609
  • 610
  • 611
  • 612
  • 613
  • 614
  • 615
  • 616
  • 617
  • 618
  • 619
  • 620
  • 621
  • 622
  • 623
  • 624
  • 625
  • 626
  • 627
  • 628
  • 629
  • 630
  • 631
  • 632
  • 633
  • 634
  • 635
  • 636
  • 637
  • 638
  • 639
  • 640
  • 641
  • 642
  • 643
  • 644
  • 645

solver.prototxt

net: "models/vgg/train_val.prototxt"test_iter: 10000test_interval: 40000test_initialization: falsedisplay: 200base_lr: 0.0001lr_policy: "step"stepsize: 320000gamma: 0.96max_iter: 10000000momentum: 0.9weight_decay: 0.0005snapshot: 800000snapshot_prefix: "models/vgg/vgg"solver_mode: GPU
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

finetuning

模型太大,试了下,在GTX980的4G显存下,batchsize只能设置为8或者16这么小。。。 
大模型还是得服务器并行,直接在原有的模型上finetuning

VGG_ILSVRC_16_layers_deploy.prototxt

#!/usr/bin/env shset -eTOOLS=./build/toolsGLOG_logtostderr=0 GLOG_log_dir=models/vgg/Log/ \$TOOLS/caffe train \    --solver=models/vgg/solver.prototxt \    --weights models/vgg/VGG_ILSVRC_16_layers.caffemodel

原创粉丝点击