# This is basically the same as the default linear test trainer # but here we have removed python layers so we can run in a # multi-gpu system. This one also works with CaffeNet variant # of AlexNet. The python layers are only for display, so we # really don't miss them. You will need to adjust the batch # size for how many GPU's you are using. name: "CaffeNet" # ************************ # ***** DATA LAYER ******* # ************************ # force_backward: True # train data layer { top: "data" top: "label" name: "data" type: "ImageData" image_data_param { source: "/tmp/train_list.txt" # 1 GPU : Iter Size 4 (effective 256 batch size) #batch_size: 64 # 2 GPU : Iter Size 1 #batch_size: 128 # 4 GPU : Iter Size 1 batch_size: 64 shuffle: true } transform_param { mirror: true crop_size: 227 mean_value: 104 mean_value: 117 mean_value: 123 } include { phase: TRAIN } } # test data layer { top: "data" top: "label" name: "data" type: "ImageData" image_data_param { source: "/tmp/test_list.txt" # Suggested 25 batch_size: 25 } transform_param { mirror: false crop_size: 227 mean_value: 104 mean_value: 117 mean_value: 123 } include { phase: TEST } } # ================================================================================================ # ================================================================================================ # ======== NETWORK 1 # ================================================================================================ # ================================================================================================ layer { name: "conv1" type: "Convolution" bottom: "data" top: "conv1" param { lr_mult: 0 decay_mult: 0 name: "conv1_w" } param { lr_mult: 0 decay_mult: 0 name: "conv1_b" } 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: "pool1" type: "Pooling" bottom: "conv1" top: "pool1" pooling_param { pool: MAX kernel_size: 3 stride: 2 } } layer { name: "norm1" type: "LRN" bottom: "pool1" top: "norm1" lrn_param { local_size: 5 alpha: 0.0001 beta: 0.75 } } layer { name: "conv2" type: "Convolution" bottom: "norm1" top: "conv2" param { lr_mult: 0 decay_mult: 0 name: "conv2_w" } param { lr_mult: 0 decay_mult: 0 name: "conv2_b" } convolution_param { num_output: 256 pad: 2 kernel_size: 5 group: 2 weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 1 } } } layer { name: "relu2" type: "ReLU" bottom: "conv2" top: "conv2" } layer { name: "pool2" type: "Pooling" bottom: "conv2" top: "pool2" pooling_param { pool: MAX kernel_size: 3 stride: 2 } } layer { name: "norm2" type: "LRN" bottom: "pool2" top: "norm2" lrn_param { local_size: 5 alpha: 0.0001 beta: 0.75 } } layer { name: "conv3" type: "Convolution" bottom: "norm2" top: "conv3" param { lr_mult: 0 decay_mult: 0 name: "conv3_w" } param { lr_mult: 0 decay_mult: 0 name: "conv3_b" } 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: 0 decay_mult: 0 name: "conv4_w" } param { lr_mult: 0 decay_mult: 0 name: "conv4_b" } convolution_param { num_output: 384 pad: 1 kernel_size: 3 group: 2 weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 1 } } } layer { name: "relu4" type: "ReLU" bottom: "conv4" top: "conv4" } layer { name: "conv5" type: "Convolution" bottom: "conv4" top: "conv5" param { lr_mult: 0 decay_mult: 0 name: "conv5_w" } param { lr_mult: 0 decay_mult: 0 name: "conv5_b" } convolution_param { num_output: 256 pad: 1 kernel_size: 3 group: 2 weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 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 } } # ************************** # ***** POOLING LAYERS ***** # ************************** layer { name: "conv1_pool" type: "Resize" bottom: "conv1" top: "conv1_pool" resize_param { height: 10 width: 10 } } layer { name: "pool1_pool" type: "Resize" bottom: "pool1" top: "pool1_pool" resize_param { height: 10 width: 10 } } layer { name: "conv2_pool" type: "Resize" bottom: "conv2" top: "conv2_pool" resize_param { height: 6 width: 6 } } layer { name: "pool2_pool" type: "Resize" bottom: "pool2" top: "pool2_pool" resize_param { height: 6 width: 6 } } layer { name: "conv3_pool" type: "Resize" bottom: "conv3" top: "conv3_pool" resize_param { height: 5 width: 5 } } layer { name: "conv4_pool" type: "Resize" bottom: "conv4" top: "conv4_pool" resize_param { height: 5 width: 5 } } layer { name: "conv5_pool" type: "Resize" bottom: "conv5" top: "conv5_pool" resize_param { height: 6 width: 6 } } # ******************************** # ***** NORMALIZATION LAYERS ***** # ******************************** layer { name: "conv1_norm" type: "BatchNorm" bottom: "conv1_pool" top: "conv1_norm" batch_norm_param{ } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } } layer { name: "pool1_norm" type: "BatchNorm" bottom: "pool1_pool" top: "pool1_norm" batch_norm_param{ } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } } layer { name: "conv2_norm" type: "BatchNorm" bottom: "conv2_pool" top: "conv2_norm" batch_norm_param{ } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } } layer { name: "pool2_norm" type: "BatchNorm" bottom: "pool2_pool" top: "pool2_norm" batch_norm_param{ } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } } layer { name: "conv3_norm" type: "BatchNorm" bottom: "conv3_pool" top: "conv3_norm" batch_norm_param{ } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } } layer { name: "conv4_norm" type: "BatchNorm" bottom: "conv4_pool" top: "conv4_norm" batch_norm_param{ } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } } layer { name: "conv5_norm" type: "BatchNorm" bottom: "conv5_pool" top: "conv5_norm" batch_norm_param{ } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } } layer { name: "pool5_norm" type: "BatchNorm" bottom: "pool5" top: "pool5_norm" batch_norm_param{ } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } param { lr_mult: 0 decay_mult: 0 } } # ********************************* # ***** CLASSIFICATION LAYERS ***** # ********************************* layer { name: "conv1_cl" type: "InnerProduct" bottom: "conv1_norm" top: "conv1_cl" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } inner_product_param { num_output: 1000 } } layer { name: "pool1_cl" type: "InnerProduct" bottom: "pool1_norm" top: "pool1_cl" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } inner_product_param { num_output: 1000 } } layer { name: "conv2_cl" type: "InnerProduct" bottom: "conv2_norm" top: "conv2_cl" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } inner_product_param { num_output: 1000 } } layer { name: "pool2_cl" type: "InnerProduct" bottom: "pool2_norm" top: "pool2_cl" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } inner_product_param { num_output: 1000 } } layer { name: "conv3_cl" type: "InnerProduct" bottom: "conv3_norm" top: "conv3_cl" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } inner_product_param { num_output: 1000 } } layer { name: "conv4_cl" type: "InnerProduct" bottom: "conv4_norm" top: "conv4_cl" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } inner_product_param { num_output: 1000 } } layer { name: "conv5_cl" type: "InnerProduct" bottom: "conv5_norm" top: "conv5_cl" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } inner_product_param { num_output: 1000 } } layer { name: "pool5_cl" type: "InnerProduct" bottom: "pool5_norm" top: "pool5_cl" param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } inner_product_param { num_output: 1000 } } # *********************** # ***** LOSS LAYERS ***** # *********************** layer { name: "loss1_c" type: "SoftmaxWithLoss" bottom: "conv1_cl" bottom: "label" top: "loss1_c" loss_weight: 1 } layer { name: "loss1_p" type: "SoftmaxWithLoss" bottom: "pool1_cl" bottom: "label" top: "loss1_p" loss_weight: 1 } layer { name: "loss2_c" type: "SoftmaxWithLoss" bottom: "conv2_cl" bottom: "label" top: "loss2_c" loss_weight: 1 } layer { name: "loss2_p" type: "SoftmaxWithLoss" bottom: "pool2_cl" bottom: "label" top: "loss2_p" loss_weight: 1 } layer { name: "loss3_c" type: "SoftmaxWithLoss" bottom: "conv3_cl" bottom: "label" top: "loss3_c" loss_weight: 1 } layer { name: "loss4_c" type: "SoftmaxWithLoss" bottom: "conv4_cl" bottom: "label" top: "loss4_c" loss_weight: 1 } layer { name: "loss5_c" type: "SoftmaxWithLoss" bottom: "conv5_cl" bottom: "label" top: "loss5_c" loss_weight: 1 } layer { name: "loss5_p" type: "SoftmaxWithLoss" bottom: "pool5_cl" bottom: "label" top: "loss5_p" loss_weight: 1 } # *************************** # ***** ACCURACY LAYERS ***** # *************************** layer { name: "k1_accuracy" type: "Accuracy" bottom: "conv1_cl" bottom: "label" top: "k1_accuracy1_c" include { phase: TEST } } layer { name: "k1_accuracy" type: "Accuracy" bottom: "pool1_cl" bottom: "label" top: "k1_accuracy1_p" include { phase: TEST } } layer { name: "k1_accuracy" type: "Accuracy" bottom: "conv2_cl" bottom: "label" top: "k1_accuracy2_c" include { phase: TEST } } layer { name: "k1_accuracy" type: "Accuracy" bottom: "pool2_cl" bottom: "label" top: "k1_accuracy2_p" include { phase: TEST } } layer { name: "k1_accuracy" type: "Accuracy" bottom: "conv3_cl" bottom: "label" top: "k1_accuracy3_c" include { phase: TEST } } layer { name: "k1_accuracy" type: "Accuracy" bottom: "conv4_cl" bottom: "label" top: "k1_accuracy4_c" include { phase: TEST } } layer { name: "k1_accuracy" type: "Accuracy" bottom: "conv5_cl" bottom: "label" top: "k1_accuracy5_c" include { phase: TEST } } layer { name: "k1_accuracy" type: "Accuracy" bottom: "pool5_cl" bottom: "label" top: "k1_accuracy5_p" include { phase: TEST } }