deep learning - Error in testing Caffe's Alexnet caffe model -


i trained caffe's alexnet model testing more efficient model. since training pedestrians image size 64 x 80 images. made changes prototxt files match trained image size. according tutorial, better set convolution filter size match input image size. filter sizes have slight changes original alexnet's provided prototxt files (i trained , tested alexnet's original prototxt files , same error @ same line mentioned below).

according calculation, image sizes after passing each layer be

80x64x3 -> conv1 -> 38x30x96
38x30x96 -> pools -> 18x14x96
18x14x96 -> conv2 -> 19x15x256
19x15x256 -> pool2 -> 9x7x256
9x7x256 -> conv3 -> 9x7x384
9x7x384 -> conv4 -> 9x7x384
9x7x384 -> conv5 -> 9x7x256
9x7x256 -> pool5 -> 4x3x256

the error @ fc6 layer , line number 714 of test_predict_imagenet.cpp. use test_predict_imagenet.cpp file test model.

check_eq(target_blobs[j]->width(), source_layer.blobs(j).width()); 

the error

f0816 22:58:28.328047  3432 net.cpp:714] check failed: target_blobs[j]->width() == source_layer.blobs(j).width() (5120 vs. 1024) 

i don't understand why that.

my 2 prototxt files shown below.

train_val.prototxt name: "alexnet" layers {   name: "data"   type: data   top: "data"   top: "label"   data_param {     source: "../../examples/alexnet/alexnet_train_leveldb"     batch_size: 200   }   transform_param {     crop_size: 48     mean_file: "../../examples/alexnet/mean.binaryproto"     mirror: true   }   include: { phase: train } } layers {   name: "data"   type: data   top: "data"   top: "label"   data_param {     source: "../../examples/alexnet/alexnet_test_leveldb"     batch_size: 200   }   transform_param {     crop_size: 48     mean_file: "../../examples/alexnet/mean.binaryproto"     mirror: false   }   include: { phase: test } } layers {   name: "conv1"   type: convolution   bottom: "data"   top: "conv1"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   convolution_param {     num_output: 96     kernel_size: 6     stride: 2     weight_filler {       type: "gaussian"       std: 0.01     }     bias_filler {       type: "constant"       value: 0     }   } } layers {   name: "relu1"   type: relu   bottom: "conv1"   top: "conv1" } layers {   name: "norm1"   type: lrn   bottom: "conv1"   top: "norm1"   lrn_param {     local_size: 5     alpha: 0.0001     beta: 0.75   } } layers {   name: "pool1"   type: pooling   bottom: "norm1"   top: "pool1"   pooling_param {     pool: max     kernel_size: 4     stride: 2   } } layers {   name: "conv2"   type: convolution   bottom: "pool1"   top: "conv2"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   convolution_param {     num_output: 256     pad: 2     kernel_size: 4     group: 2     weight_filler {       type: "gaussian"       std: 0.01     }     bias_filler {       type: "constant"       value: 0.1     }   } } layers {   name: "relu2"   type: relu   bottom: "conv2"   top: "conv2" } layers {   name: "norm2"   type: lrn   bottom: "conv2"   top: "norm2"   lrn_param {     local_size: 5     alpha: 0.0001     beta: 0.75   } } layers {   name: "pool2"   type: pooling   bottom: "norm2"   top: "pool2"   pooling_param {     pool: max     kernel_size: 3     stride: 2   } } layers {   name: "conv3"   type: convolution   bottom: "pool2"   top: "conv3"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   convolution_param {     num_output: 384     pad: 1     kernel_size: 3     weight_filler {       type: "gaussian"       std: 0.01     }     bias_filler {       type: "constant"       value: 0     }   } } layers {   name: "relu3"   type: relu   bottom: "conv3"   top: "conv3" } layers {   name: "conv4"   type: convolution   bottom: "conv3"   top: "conv4"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 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     }   } } layers {   name: "relu4"   type: relu   bottom: "conv4"   top: "conv4" } layers {   name: "conv5"   type: convolution   bottom: "conv4"   top: "conv5"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 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     }   } } layers {   name: "relu5"   type: relu   bottom: "conv5"   top: "conv5" } layers {   name: "pool5"   type: pooling   bottom: "conv5"   top: "pool5"   pooling_param {     pool: max     kernel_size: 3     stride: 2   } } layers {   name: "fc6"   type: inner_product   bottom: "pool5"   top: "fc6"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   inner_product_param {     num_output: 4096     weight_filler {       type: "gaussian"       std: 0.005     }     bias_filler {       type: "constant"       value: 0.1     }   } } layers {   name: "relu6"   type: relu   bottom: "fc6"   top: "fc6" } layers {   name: "drop6"   type: dropout   bottom: "fc6"   top: "fc6"   dropout_param {     dropout_ratio: 0.5   } } layers {   name: "fc7"   type: inner_product   bottom: "fc6"   top: "fc7"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   inner_product_param {     num_output: 4096     weight_filler {       type: "gaussian"       std: 0.005     }     bias_filler {       type: "constant"       value: 0.1     }   } } layers {   name: "relu7"   type: relu   bottom: "fc7"   top: "fc7" } layers {   name: "drop7"   type: dropout   bottom: "fc7"   top: "fc7"   dropout_param {     dropout_ratio: 0.5   } } layers {   name: "fc8"   type: inner_product   bottom: "fc7"   top: "fc8"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   inner_product_param {     num_output: 2     weight_filler {       type: "gaussian"       std: 0.01     }     bias_filler {       type: "constant"       value: 0     }   } } layers {   name: "accuracy"   type: accuracy   bottom: "fc8"   bottom: "label"   top: "accuracy"   include: { phase: test } } layers {   name: "loss"   type: softmax_loss   bottom: "fc8"   bottom: "label"   top: "loss" } 

this testing file model.

deploy.txt name: "alexnet" layers  {   name: "data"   type: memory_data   top: "data"   top: "label"   memory_data_param    {     batch_size: 1     channels: 3     height: 80     width: 64   }   transform_param    {     crop_size: 64     mirror: false     mean_file: "../../examples/alexnet/mean.binaryproto"   } }  layers {   name: "conv1"   type: convolution   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   convolution_param {     num_output: 96     kernel_size: 6     stride: 2   }   bottom: "data"   top: "conv1" } layers {   name: "relu1"   type: relu   bottom: "conv1"   top: "conv1" } layers {   name: "norm1"   type: lrn   lrn_param {     local_size: 5     alpha: 0.0001     beta: 0.75   }   bottom: "conv1"   top: "norm1" } layers {   name: "pool1"   type: pooling   pooling_param {     pool: max     kernel_size: 3     stride: 2   }   bottom: "norm1"   top: "pool1" } layers {   name: "conv2"   type: convolution   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   convolution_param {     num_output: 256     pad: 2     kernel_size: 4     group: 2   }   bottom: "pool1"   top: "conv2" } layers {   name: "relu2"   type: relu   bottom: "conv2"   top: "conv2" } layers {   name: "norm2"   type: lrn   lrn_param {     local_size: 5     alpha: 0.0001     beta: 0.75   }   bottom: "conv2"   top: "norm2" } layers {   name: "pool2"   type: pooling   pooling_param {     pool: max     kernel_size: 3     stride: 2   }   bottom: "norm2"   top: "pool2" } layers {   name: "conv3"   type: convolution   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   convolution_param {     num_output: 384     pad: 1     kernel_size: 3   }   bottom: "pool2"   top: "conv3" } layers {   name: "relu3"   type: relu   bottom: "conv3"   top: "conv3" } layers {   name: "conv4"   type: convolution   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   convolution_param {     num_output: 384     pad: 1     kernel_size: 3     group: 2   }   bottom: "conv3"   top: "conv4" } layers {   name: "relu4"   type: relu   bottom: "conv4"   top: "conv4" } layers {   name: "conv5"   type: convolution   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   convolution_param {     num_output: 256     pad: 1     kernel_size: 3     group: 2   }   bottom: "conv4"   top: "conv5" } layers {   name: "relu5"   type: relu   bottom: "conv5"   top: "conv5" } layers {   name: "pool5"   type: pooling   pooling_param {     pool: max     kernel_size: 3     stride: 2   }   bottom: "conv5"   top: "pool5" } layers {   name: "fc6"   type: inner_product   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   inner_product_param {     num_output: 4096   }   bottom: "pool5"   top: "fc6" } layers {   name: "relu6"   type: relu   bottom: "fc6"   top: "fc6" } layers {   name: "drop6"   type: dropout   dropout_param {     dropout_ratio: 0.5   }   bottom: "fc6"   top: "fc6" } layers {   name: "fc7"   type: inner_product   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   inner_product_param {     num_output: 4096   }   bottom: "fc6"   top: "fc7" } layers {   name: "relu7"   type: relu   bottom: "fc7"   top: "fc7" } layers {   name: "drop7"   type: dropout   dropout_param {     dropout_ratio: 0.5   }   bottom: "fc7"   top: "fc7" } layers {   name: "fc8"   type: inner_product   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   inner_product_param {     num_output: 2   }   bottom: "fc7"   top: "fc8" } layers {   name: "prob"   type: softmax   bottom: "fc8"   top: "prob" } 

what wrong error?

those have same problem faced, please @ prototxt files shown below. there modifications made compared original prototxt files provided in downloaded folders. used 80x64 image sizes input in training , testing.

train_val.prototxt name: "alexnet" layers {   name: "data"   type: data   top: "data"   top: "label"   data_param {     source: "../../examples/alexnet_2/alexnet_train_leveldb"     batch_size: 100   }   transform_param {     mean_file: "../../examples/alexnet_2/mean.binaryproto"    }   include: { phase: train } } layers {   name: "data"   type: data   top: "data"   top: "label"   data_param {     source: "../../examples/alexnet_2/alexnet_test_leveldb"     batch_size: 100   }   transform_param {         mean_file: "../../examples/alexnet_2/mean.binaryproto"       }   include: { phase: test } } layers {   name: "conv1"   type: convolution   bottom: "data"   top: "conv1"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   convolution_param {     num_output: 96     kernel_size: 11     stride: 2     weight_filler {       type: "gaussian"       std: 0.01     }     bias_filler {       type: "constant"       value: 0     }   } } layers {   name: "relu1"   type: relu   bottom: "conv1"   top: "conv1" } layers {   name: "pool1"   type: pooling   bottom: "conv1"   top: "pool1"   pooling_param {     pool: max     kernel_size: 3     stride: 2   } } layers {   name: "norm1"   type: lrn   bottom: "pool1"   top: "norm1"   lrn_param {     local_size: 5     alpha: 0.0001     beta: 0.75   } } layers {   name: "conv2"   type: convolution   bottom: "norm1"   top: "conv2"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 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: 1     }   } } layers {   name: "relu2"   type: relu   bottom: "conv2"   top: "conv2" } layers {   name: "pool2"   type: pooling   bottom: "conv2"   top: "pool2"   pooling_param {     pool: max     kernel_size: 3     stride: 2   } } layers {   name: "norm2"   type: lrn   bottom: "pool2"   top: "norm2"   lrn_param {     local_size: 5     alpha: 0.0001     beta: 0.75   } } layers {   name: "conv3"   type: convolution   bottom: "norm2"   top: "conv3"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   convolution_param {     num_output: 384     pad: 1     kernel_size: 3     weight_filler {       type: "gaussian"       std: 0.01     }     bias_filler {       type: "constant"       value: 0     }   } } layers {   name: "relu3"   type: relu   bottom: "conv3"   top: "conv3" } layers {   name: "conv4"   type: convolution   bottom: "conv3"   top: "conv4"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 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: 1     }   } } layers {   name: "relu4"   type: relu   bottom: "conv4"   top: "conv4" } layers {   name: "conv5"   type: convolution   bottom: "conv4"   top: "conv5"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 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: 1     }   } } layers {   name: "relu5"   type: relu   bottom: "conv5"   top: "conv5" } layers {   name: "pool5"   type: pooling   bottom: "conv5"   top: "pool5"   pooling_param {     pool: max     kernel_size: 3     stride: 2   } } layers {   name: "fc6"   type: inner_product   bottom: "pool5"   top: "fc6"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   inner_product_param {     num_output: 4096     weight_filler {       type: "gaussian"       std: 0.005     }     bias_filler {       type: "constant"       value: 1     }   } } layers {   name: "relu6"   type: relu   bottom: "fc6"   top: "fc6" } layers {   name: "drop6"   type: dropout   bottom: "fc6"   top: "fc6"   dropout_param {     dropout_ratio: 0.5   } } layers {   name: "fc7"   type: inner_product   bottom: "fc6"   top: "fc7"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   inner_product_param {     num_output: 4096     weight_filler {       type: "gaussian"       std: 0.005     }     bias_filler {       type: "constant"       value: 1     }   } } layers {   name: "relu7"   type: relu   bottom: "fc7"   top: "fc7" } layers {   name: "drop7"   type: dropout   bottom: "fc7"   top: "fc7"   dropout_param {     dropout_ratio: 0.5   } } layers {   name: "fc8"   type: inner_product   bottom: "fc7"   top: "fc8"   blobs_lr: 1   blobs_lr: 2   weight_decay: 1   weight_decay: 0   inner_product_param {     num_output: 2     weight_filler {       type: "gaussian"       std: 0.01     }     bias_filler {       type: "constant"       value: 0     }   } } layers {   name: "accuracy"   type: accuracy   bottom: "fc8"   bottom: "label"   top: "accuracy"   include: { phase: test } } layers {   name: "loss"   type: softmax_loss   bottom: "fc8"   bottom: "label"   top: "loss" }  test.prototxt name: "caffenet" layers  {   name: "data"   type: memory_data   top: "data"   top: "label"   memory_data_param    {     batch_size: 1     channels: 3     height: 80     width: 64   }   transform_param    {     crop_size: 64     mirror: false     mean_file: "../../examples/alexnet_2/mean.binaryproto"   } } layers {   name: "conv1"   type: convolution   bottom: "data"   top: "conv1"   convolution_param {     num_output: 96     kernel_size: 11     stride: 2   } } layers {   name: "relu1"   type: relu   bottom: "conv1"   top: "conv1" } layers {   name: "pool1"   type: pooling   bottom: "conv1"   top: "pool1"   pooling_param {     pool: max     kernel_size: 3     stride: 2   } } layers {   name: "norm1"   type: lrn   bottom: "pool1"   top: "norm1"   lrn_param {     local_size: 5     alpha: 0.0001     beta: 0.75   } } layers {   name: "conv2"   type: convolution   bottom: "norm1"   top: "conv2"   convolution_param {     num_output: 256     pad: 2     kernel_size: 5     group: 2   } } layers {   name: "relu2"   type: relu   bottom: "conv2"   top: "conv2" } layers {   name: "pool2"   type: pooling   bottom: "conv2"   top: "pool2"   pooling_param {     pool: max     kernel_size: 3     stride: 2   } } layers {   name: "norm2"   type: lrn   bottom: "pool2"   top: "norm2"   lrn_param {     local_size: 5     alpha: 0.0001     beta: 0.75   } } layers {   name: "conv3"   type: convolution   bottom: "norm2"   top: "conv3"   convolution_param {     num_output: 384     pad: 1     kernel_size: 3   } } layers {   name: "relu3"   type: relu   bottom: "conv3"   top: "conv3" } layers {   name: "conv4"   type: convolution   bottom: "conv3"   top: "conv4"   convolution_param {     num_output: 384     pad: 1     kernel_size: 3     group: 2   } } layers {   name: "relu4"   type: relu   bottom: "conv4"   top: "conv4" } layers {   name: "conv5"   type: convolution   bottom: "conv4"   top: "conv5"   convolution_param {     num_output: 256     pad: 1     kernel_size: 3     group: 2   } } layers {   name: "relu5"   type: relu   bottom: "conv5"   top: "conv5" } layers {   name: "pool5"   type: pooling   bottom: "conv5"   top: "pool5"   pooling_param {     pool: max     kernel_size: 3     stride: 2   } } layers {   name: "fc6"   type: inner_product   bottom: "pool5"   top: "fc6"   inner_product_param {     num_output: 4096   } } layers {   name: "relu6"   type: relu   bottom: "fc6"   top: "fc6" } layers {   name: "drop6"   type: dropout   bottom: "fc6"   top: "fc6"   dropout_param {     dropout_ratio: 0.5   } } layers {   name: "fc7"   type: inner_product   bottom: "fc6"   top: "fc7"   inner_product_param {     num_output: 4096   } } layers {   name: "relu7"   type: relu   bottom: "fc7"   top: "fc7" } layers {   name: "drop7"   type: dropout   bottom: "fc7"   top: "fc7"   dropout_param {     dropout_ratio: 0.5   } } layers {   name: "fc8"   type: inner_product   bottom: "fc7"   top: "fc8"   inner_product_param {     num_output: 2   } } layers {   name: "prob"   type: softmax   bottom: "fc8"   top: "prob" } layers {   name: "output"   type: argmax   bottom: "prob"   top: "output" } 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -