咖啡因验证损失增加

时间:2018-03-09 16:43:41

标签: machine-learning neural-network deep-learning caffe conv-neural-network

我正在使用caffe训练AlexNet

name: "AlexNet"
layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TRAIN
  }
  transform_param {
    mean_file: "data/cropCenter/cropCenter_mean.binaryproto"
  }
  data_param {
    source: "examples/cropCenter/cropCenter_train_lmdb"
    batch_size: 256
    backend: LMDB
  }
}
layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TEST
  }
  transform_param {
    mean_file: "data/cropCenter/cropCenter_mean.binaryproto"
  }
  data_param {
    source: "examples/cropCenter/cropCenter_val_lmdb"
    batch_size: 128
    backend: LMDB
  }
}
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 96
    kernel_size: 11
    stride: 4
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layer {
  name: "relu1"
  type: "ReLU"
  bottom: "conv1"
  top: "conv1"
}
layer {
  name: "norm1"
  type: "LRN"
  bottom: "conv1"
  top: "norm1"
  lrn_param {
    local_size: 5
    alpha: 0.0001
    beta: 0.75
  }
}
layer {
  name: "pool1"
  type: "Pooling"
  bottom: "norm1"
  top: "pool1"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}
layer {
  name: "conv2"
  type: "Convolution"
  bottom: "pool1"
  top: "conv2"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 256
    pad: 2
    kernel_size: 5
    group: 2
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}
layer {
  name: "relu2"
  type: "ReLU"
  bottom: "conv2"
  top: "conv2"
}
layer {
  name: "norm2"
  type: "LRN"
  bottom: "conv2"
  top: "norm2"
  lrn_param {
    local_size: 5
    alpha: 0.0001
    beta: 0.75
  }
}
layer {
  name: "pool2"
  type: "Pooling"
  bottom: "norm2"
  top: "pool2"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}
layer {
  name: "conv3"
  type: "Convolution"
  bottom: "pool2"
  top: "conv3"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 384
    pad: 1
    kernel_size: 3
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layer {
  name: "relu3"
  type: "ReLU"
  bottom: "conv3"
  top: "conv3"
}
layer {
  name: "conv4"
  type: "Convolution"
  bottom: "conv3"
  top: "conv4"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 384
    pad: 1
    kernel_size: 3
    group: 2
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}
layer {
  name: "relu4"
  type: "ReLU"
  bottom: "conv4"
  top: "conv4"
}
layer {
  name: "conv5"
  type: "Convolution"
  bottom: "conv4"
  top: "conv5"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  convolution_param {
    num_output: 256
    pad: 1
    kernel_size: 3
    group: 2
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}
layer {
  name: "relu5"
  type: "ReLU"
  bottom: "conv5"
  top: "conv5"
}
layer {
  name: "pool5"
  type: "Pooling"
  bottom: "conv5"
  top: "pool5"
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}
layer {
  name: "fc6"
  type: "InnerProduct"
  bottom: "pool5"
  top: "fc6"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}
layer {
  name: "relu6"
  type: "ReLU"
  bottom: "fc6"
  top: "fc6"
}
layer {
  name: "drop6"
  type: "Dropout"
  bottom: "fc6"
  top: "fc6"
  dropout_param {
    dropout_ratio: 0.5
  }
}
layer {
  name: "fc7"
  type: "InnerProduct"
  bottom: "fc6"
  top: "fc7"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}
layer {
  name: "relu7"
  type: "ReLU"
  bottom: "fc7"
  top: "fc7"
}
layer {
  name: "drop7"
  type: "Dropout"
  bottom: "fc7"
  top: "fc7"
  dropout_param {
    dropout_ratio: 0.5
  }
}
layer {
  name: "fc8"
  type: "InnerProduct"
  bottom: "fc7"
  top: "fc8"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 3
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layer {
  name: "accuracy"
  type: "Accuracy"
  bottom: "fc8"
  bottom: "label"
  top: "accuracy"
  include {
    phase: TEST
  }
}
layer {
  name: "loss"
  type: "SoftmaxWithLoss"
  bottom: "fc8"
  bottom: "label"
  top: "loss"
}

我的数据在 3k培训样本和 0.7k验证设置下很小但是它的像素大小很大 3000x4000 我裁剪每个图像的中心以关注我的数据并对其进行增强(旋转,裁剪,缩放,翻转,模糊等等很多功能)并且我达到了 300k训练样本和70k验证样本< /强>

我的问题是训练损失正在减少,但验证损失正在增加,我不知道为什么

这是我的解算器文件

net: "models/cropCenter/train_val.prototxt"
test_iter: 602
test_interval: 2000
base_lr: 0.01
lr_policy: "step"
gamma: 0.1
stepsize: 25000
display: 20
max_iter: 111771
momentum: 0.9
weight_decay: 0.0005
snapshot: 10000
snapshot_prefix: "models/cropCenter/caffe_alexnet_cropCenter_train"
solver_mode: GPU

这是来自日志文件的快照

I0309 18:31:48.157299 11157 sgd_solver.cpp:105] Iteration 7880, lr = 0.01
I0309 18:31:59.188576 11157 solver.cpp:218] Iteration 7900 (1.81303 iter/s, 11.0313s/20 iters), loss = 0.095763
I0309 18:31:59.188653 11157 solver.cpp:237]     Train net output #0: loss = 0.0957631 (* 1 = 0.0957631 loss)
I0309 18:31:59.188664 11157 sgd_solver.cpp:105] Iteration 7900, lr = 0.01
I0309 18:32:10.279839 11157 solver.cpp:218] Iteration 7920 (1.80324 iter/s, 11.0911s/20 iters), loss = 0.0490094
I0309 18:32:10.279883 11157 solver.cpp:237]     Train net output #0: loss = 0.0490094 (* 1 = 0.0490094 loss)
I0309 18:32:10.279912 11157 sgd_solver.cpp:105] Iteration 7920, lr = 0.01
I0309 18:32:21.498523 11157 solver.cpp:218] Iteration 7940 (1.78275 iter/s, 11.2186s/20 iters), loss = 0.0937675
I0309 18:32:21.498741 11157 solver.cpp:237]     Train net output #0: loss = 0.0937675 (* 1 = 0.0937675 loss)
I0309 18:32:21.498785 11157 sgd_solver.cpp:105] Iteration 7940, lr = 0.01
I0309 18:32:32.785640 11157 solver.cpp:218] Iteration 7960 (1.77197 iter/s, 11.2869s/20 iters), loss = 0.0631587
I0309 18:32:32.785701 11157 solver.cpp:237]     Train net output #0: loss = 0.0631588 (* 1 = 0.0631588 loss)
I0309 18:32:32.785713 11157 sgd_solver.cpp:105] Iteration 7960, lr = 0.01
I0309 18:32:41.650172 11157 solver.cpp:218] Iteration 7980 (2.25621 iter/s, 8.86444s/20 iters), loss = 0.0407214
I0309 18:32:41.650233 11157 solver.cpp:237]     Train net output #0: loss = 0.0407215 (* 1 = 0.0407215 loss)
I0309 18:32:41.650245 11157 sgd_solver.cpp:105] Iteration 7980, lr = 0.01
I0309 18:32:49.210865 11157 solver.cpp:330] Iteration 8000, Testing net (#0)
I0309 18:34:55.362457 11157 solver.cpp:397]     Test net output #0: accuracy = 0.524748
I0309 18:34:55.362599 11157 solver.cpp:397]     Test net output #1: loss = 2.43989 (* 1 = 2.43989 loss)
I0309 18:34:55.511060 11166 data_layer.cpp:73] Restarting data prefetching from start.
I0309 18:34:55.662698 11157 solver.cpp:218] Iteration 8000 (0.14924 iter/s, 134.012s/20 iters), loss = 0.0704969
I0309 18:34:55.662761 11157 solver.cpp:237]     Train net output #0: loss = 0.070497 (* 1 = 0.070497 loss)
I0309 18:34:55.662773 11157 sgd_solver.cpp:105] Iteration 8000, lr = 0.01
I0309 18:35:06.450870 11157 solver.cpp:218] Iteration 8020 (1.8539 iter/s, 10.7881s/20 iters), loss = 0.100138
I0309 18:35:06.450949 11157 solver.cpp:237]     Train net output #0: loss = 0.100138 (* 1 = 0.100138 loss)
I0309 18:35:06.450960 11157 sgd_solver.cpp:105] Iteration 8020, lr = 0.01
I0309 18:35:07.103420 11157 blocking_queue.cpp:49] Waiting for data
I0309 18:35:15.513669 11157 solver.cpp:218] Iteration 8040 (2.20685 iter/s, 9.06268s/20 iters), loss = 0.0950916

对3个类进行分类

非常感谢任何帮助 谢谢

0 个答案:

没有答案