vendor: OpenCV 5.0.0 snapshot at 755e50675d97db9b7d449d8bd6b09888646f6c6e
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Object Detection using Convolutional Neural Networks
|
||||
|
||||
- These files include model weights, model definition files, model deploy files for two trained networks.
|
||||
|
||||
### Network 1
|
||||
- SqueezeNet model trained on ImageNet 2012 Dataset
|
||||
|
||||
### Network 2
|
||||
- SqueezeDet model trained on PASCAL VOC Dataset
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
# Training and Testing protocol for Object Detection
|
||||
base_lr: 0.000001
|
||||
display: 1
|
||||
max_iter: 100000
|
||||
lr_policy: "step"
|
||||
gamma: 0.5
|
||||
stepsize: 100000
|
||||
momentum: 0.9
|
||||
weight_decay: 0.0002
|
||||
snapshot: 1000
|
||||
snapshot_prefix: "snapshot"
|
||||
solver_mode: GPU
|
||||
net: "SqueezeDet_train_test.prototxt"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,873 @@
|
||||
# SqueezeNet architecture for image classification on ImageNet dataset
|
||||
|
||||
name: "SqueezeNet"
|
||||
|
||||
input: "data"
|
||||
input_dim: 1
|
||||
input_dim: 3
|
||||
input_dim: 416
|
||||
input_dim: 416
|
||||
|
||||
layer {
|
||||
name: "conv1"
|
||||
type: "Convolution"
|
||||
bottom: "data"
|
||||
top: "conv1"
|
||||
convolution_param {
|
||||
num_output: 96
|
||||
kernel_size: 7
|
||||
stride: 2
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_conv1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "conv1"
|
||||
top: "conv1"
|
||||
}
|
||||
layer {
|
||||
name: "pool1"
|
||||
type: "Pooling"
|
||||
bottom: "conv1"
|
||||
top: "pool1"
|
||||
pooling_param {
|
||||
pool: MAX
|
||||
kernel_size: 3
|
||||
stride: 2
|
||||
}
|
||||
}
|
||||
|
||||
layer {
|
||||
name: "fire2_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "pool1"
|
||||
top: "fire2_squeeze"
|
||||
convolution_param {
|
||||
num_output: 16
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire2_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire2_squeeze"
|
||||
top: "fire2_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire2_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire2_squeeze"
|
||||
top: "fire2_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire2_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire2_expand_1x1"
|
||||
top: "fire2_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire2_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire2_squeeze"
|
||||
top: "fire2_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire2_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire2_expand_3x3"
|
||||
top: "fire2_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire2"
|
||||
type: "Concat"
|
||||
bottom: "fire2_expand_1x1"
|
||||
bottom: "fire2_expand_3x3"
|
||||
top: "fire2"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
|
||||
layer {
|
||||
name: "fire3_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "fire2"
|
||||
top: "fire3_squeeze"
|
||||
convolution_param {
|
||||
num_output: 16
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire3_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire3_squeeze"
|
||||
top: "fire3_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire3_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire3_squeeze"
|
||||
top: "fire3_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire3_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire3_expand_1x1"
|
||||
top: "fire3_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire3_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire3_squeeze"
|
||||
top: "fire3_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire3_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire3_expand_3x3"
|
||||
top: "fire3_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire3"
|
||||
type: "Concat"
|
||||
bottom: "fire3_expand_1x1"
|
||||
bottom: "fire3_expand_3x3"
|
||||
top: "fire3"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
|
||||
layer {
|
||||
name: "fire4_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "fire3"
|
||||
top: "fire4_squeeze"
|
||||
convolution_param {
|
||||
num_output: 32
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire4_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire4_squeeze"
|
||||
top: "fire4_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire4_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire4_squeeze"
|
||||
top: "fire4_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 128
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire4_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire4_expand_1x1"
|
||||
top: "fire4_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire4_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire4_squeeze"
|
||||
top: "fire4_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 128
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire4_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire4_expand_3x3"
|
||||
top: "fire4_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire4"
|
||||
type: "Concat"
|
||||
bottom: "fire4_expand_1x1"
|
||||
bottom: "fire4_expand_3x3"
|
||||
top: "fire4"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "pool4"
|
||||
type: "Pooling"
|
||||
bottom: "fire4"
|
||||
top: "pool4"
|
||||
pooling_param {
|
||||
pool: MAX
|
||||
kernel_size: 3
|
||||
stride: 2
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "fire5_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "pool4"
|
||||
top: "fire5_squeeze"
|
||||
convolution_param {
|
||||
num_output: 32
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire5_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire5_squeeze"
|
||||
top: "fire5_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire5_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire5_squeeze"
|
||||
top: "fire5_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 128
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire5_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire5_expand_1x1"
|
||||
top: "fire5_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire5_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire5_squeeze"
|
||||
top: "fire5_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 128
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire5_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire5_expand_3x3"
|
||||
top: "fire5_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire5"
|
||||
type: "Concat"
|
||||
bottom: "fire5_expand_1x1"
|
||||
bottom: "fire5_expand_3x3"
|
||||
top: "fire5"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "fire6_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "fire5"
|
||||
top: "fire6_squeeze"
|
||||
convolution_param {
|
||||
num_output: 48
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire6_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire6_squeeze"
|
||||
top: "fire6_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire6_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire6_squeeze"
|
||||
top: "fire6_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 192
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire6_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire6_expand_1x1"
|
||||
top: "fire6_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire6_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire6_squeeze"
|
||||
top: "fire6_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 192
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire6_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire6_expand_3x3"
|
||||
top: "fire6_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire6"
|
||||
type: "Concat"
|
||||
bottom: "fire6_expand_1x1"
|
||||
bottom: "fire6_expand_3x3"
|
||||
top: "fire6"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "fire7_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "fire6"
|
||||
top: "fire7_squeeze"
|
||||
convolution_param {
|
||||
num_output: 48
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire7_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire7_squeeze"
|
||||
top: "fire7_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire7_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire7_squeeze"
|
||||
top: "fire7_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 192
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire7_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire7_expand_1x1"
|
||||
top: "fire7_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire7_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire7_squeeze"
|
||||
top: "fire7_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 192
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire7_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire7_expand_3x3"
|
||||
top: "fire7_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire7"
|
||||
type: "Concat"
|
||||
bottom: "fire7_expand_1x1"
|
||||
bottom: "fire7_expand_3x3"
|
||||
top: "fire7"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "fire8_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "fire7"
|
||||
top: "fire8_squeeze"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire8_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire8_squeeze"
|
||||
top: "fire8_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire8_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire8_squeeze"
|
||||
top: "fire8_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 256
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire8_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire8_expand_1x1"
|
||||
top: "fire8_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire8_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire8_squeeze"
|
||||
top: "fire8_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 256
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire8_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire8_expand_3x3"
|
||||
top: "fire8_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire8"
|
||||
type: "Concat"
|
||||
bottom: "fire8_expand_1x1"
|
||||
bottom: "fire8_expand_3x3"
|
||||
top: "fire8"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "pool8"
|
||||
type: "Pooling"
|
||||
bottom: "fire8"
|
||||
top: "pool8"
|
||||
pooling_param {
|
||||
pool: MAX
|
||||
kernel_size: 3
|
||||
stride: 2
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "fire9_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "pool8"
|
||||
top: "fire9_squeeze"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire9_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire9_squeeze"
|
||||
top: "fire9_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire9_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire9_squeeze"
|
||||
top: "fire9_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 256
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire9_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire9_expand_1x1"
|
||||
top: "fire9_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire9_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire9_squeeze"
|
||||
top: "fire9_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 256
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire9_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire9_expand_3x3"
|
||||
top: "fire9_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire9"
|
||||
type: "Concat"
|
||||
bottom: "fire9_expand_1x1"
|
||||
bottom: "fire9_expand_3x3"
|
||||
top: "fire9"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "conv10"
|
||||
type: "Convolution"
|
||||
bottom: "fire9"
|
||||
top: "conv10"
|
||||
convolution_param {
|
||||
num_output: 1000
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
weight_filler {
|
||||
type: "gaussian"
|
||||
mean: 0.0
|
||||
std: 0.01
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_conv10"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "conv10"
|
||||
top: "conv10"
|
||||
}
|
||||
layer {
|
||||
name: "pool10"
|
||||
type: "Pooling"
|
||||
bottom: "conv10"
|
||||
top: "pool10"
|
||||
pooling_param {
|
||||
pool: AVE
|
||||
global_pooling: true
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "predictions"
|
||||
type: "Softmax"
|
||||
bottom: "pool10"
|
||||
top: "predictions"
|
||||
softmax_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
# Solver for SqueezeNet Model
|
||||
test_iter: 1000
|
||||
test_interval: 1000
|
||||
base_lr: 0.03
|
||||
display: 1
|
||||
max_iter: 1500000
|
||||
lr_policy: "step"
|
||||
gamma: 0.5
|
||||
stepsize: 100000
|
||||
momentum: 0.9
|
||||
weight_decay: 0.0002
|
||||
snapshot: 1000
|
||||
snapshot_prefix: "snapshot"
|
||||
solver_mode: GPU
|
||||
net: "SqueezeNet_train_test.prototxt"
|
||||
random_seed: 42
|
||||
average_loss: 80
|
||||
@@ -0,0 +1,927 @@
|
||||
# SqueezeNet architecture for image classification on ImageNet dataset
|
||||
name: "SqueezeNet"
|
||||
|
||||
layer {
|
||||
name: "ImageNet"
|
||||
type: "Data"
|
||||
top: "data"
|
||||
top: "label"
|
||||
transform_param {
|
||||
crop_size: 227
|
||||
mean_value: 104
|
||||
mean_value: 117
|
||||
mean_value: 123
|
||||
}
|
||||
data_param {
|
||||
source: "ImageNet_train_lmdb"
|
||||
batch_size: 64
|
||||
backend: LMDB
|
||||
}
|
||||
include {
|
||||
phase: TRAIN
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "ImageNet"
|
||||
type: "Data"
|
||||
top: "data"
|
||||
top: "label"
|
||||
transform_param {
|
||||
crop_size: 227
|
||||
mean_value: 104
|
||||
mean_value: 117
|
||||
mean_value: 123
|
||||
}
|
||||
data_param {
|
||||
source: "ImageNet_val_lmdb"
|
||||
batch_size: 5
|
||||
backend: LMDB
|
||||
}
|
||||
include {
|
||||
phase: TEST
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "conv1"
|
||||
type: "Convolution"
|
||||
bottom: "data"
|
||||
top: "conv1"
|
||||
convolution_param {
|
||||
num_output: 96
|
||||
kernel_size: 7
|
||||
stride: 2
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_conv1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "conv1"
|
||||
top: "conv1"
|
||||
}
|
||||
layer {
|
||||
name: "pool1"
|
||||
type: "Pooling"
|
||||
bottom: "conv1"
|
||||
top: "pool1"
|
||||
pooling_param {
|
||||
pool: MAX
|
||||
kernel_size: 3
|
||||
stride: 2
|
||||
}
|
||||
}
|
||||
|
||||
layer {
|
||||
name: "fire2_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "pool1"
|
||||
top: "fire2_squeeze"
|
||||
convolution_param {
|
||||
num_output: 16
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire2_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire2_squeeze"
|
||||
top: "fire2_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire2_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire2_squeeze"
|
||||
top: "fire2_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire2_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire2_expand_1x1"
|
||||
top: "fire2_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire2_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire2_squeeze"
|
||||
top: "fire2_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire2_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire2_expand_3x3"
|
||||
top: "fire2_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire2"
|
||||
type: "Concat"
|
||||
bottom: "fire2_expand_1x1"
|
||||
bottom: "fire2_expand_3x3"
|
||||
top: "fire2"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
|
||||
layer {
|
||||
name: "fire3_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "fire2"
|
||||
top: "fire3_squeeze"
|
||||
convolution_param {
|
||||
num_output: 16
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire3_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire3_squeeze"
|
||||
top: "fire3_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire3_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire3_squeeze"
|
||||
top: "fire3_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire3_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire3_expand_1x1"
|
||||
top: "fire3_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire3_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire3_squeeze"
|
||||
top: "fire3_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire3_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire3_expand_3x3"
|
||||
top: "fire3_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire3"
|
||||
type: "Concat"
|
||||
bottom: "fire3_expand_1x1"
|
||||
bottom: "fire3_expand_3x3"
|
||||
top: "fire3"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
|
||||
layer {
|
||||
name: "fire4_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "fire3"
|
||||
top: "fire4_squeeze"
|
||||
convolution_param {
|
||||
num_output: 32
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire4_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire4_squeeze"
|
||||
top: "fire4_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire4_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire4_squeeze"
|
||||
top: "fire4_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 128
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire4_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire4_expand_1x1"
|
||||
top: "fire4_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire4_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire4_squeeze"
|
||||
top: "fire4_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 128
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire4_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire4_expand_3x3"
|
||||
top: "fire4_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire4"
|
||||
type: "Concat"
|
||||
bottom: "fire4_expand_1x1"
|
||||
bottom: "fire4_expand_3x3"
|
||||
top: "fire4"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "pool4"
|
||||
type: "Pooling"
|
||||
bottom: "fire4"
|
||||
top: "pool4"
|
||||
pooling_param {
|
||||
pool: MAX
|
||||
kernel_size: 3
|
||||
stride: 2
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "fire5_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "pool4"
|
||||
top: "fire5_squeeze"
|
||||
convolution_param {
|
||||
num_output: 32
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire5_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire5_squeeze"
|
||||
top: "fire5_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire5_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire5_squeeze"
|
||||
top: "fire5_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 128
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire5_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire5_expand_1x1"
|
||||
top: "fire5_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire5_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire5_squeeze"
|
||||
top: "fire5_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 128
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire5_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire5_expand_3x3"
|
||||
top: "fire5_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire5"
|
||||
type: "Concat"
|
||||
bottom: "fire5_expand_1x1"
|
||||
bottom: "fire5_expand_3x3"
|
||||
top: "fire5"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "fire6_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "fire5"
|
||||
top: "fire6_squeeze"
|
||||
convolution_param {
|
||||
num_output: 48
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire6_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire6_squeeze"
|
||||
top: "fire6_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire6_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire6_squeeze"
|
||||
top: "fire6_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 192
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire6_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire6_expand_1x1"
|
||||
top: "fire6_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire6_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire6_squeeze"
|
||||
top: "fire6_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 192
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire6_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire6_expand_3x3"
|
||||
top: "fire6_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire6"
|
||||
type: "Concat"
|
||||
bottom: "fire6_expand_1x1"
|
||||
bottom: "fire6_expand_3x3"
|
||||
top: "fire6"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "fire7_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "fire6"
|
||||
top: "fire7_squeeze"
|
||||
convolution_param {
|
||||
num_output: 48
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire7_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire7_squeeze"
|
||||
top: "fire7_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire7_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire7_squeeze"
|
||||
top: "fire7_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 192
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire7_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire7_expand_1x1"
|
||||
top: "fire7_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire7_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire7_squeeze"
|
||||
top: "fire7_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 192
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire7_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire7_expand_3x3"
|
||||
top: "fire7_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire7"
|
||||
type: "Concat"
|
||||
bottom: "fire7_expand_1x1"
|
||||
bottom: "fire7_expand_3x3"
|
||||
top: "fire7"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "fire8_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "fire7"
|
||||
top: "fire8_squeeze"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire8_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire8_squeeze"
|
||||
top: "fire8_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire8_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire8_squeeze"
|
||||
top: "fire8_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 256
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire8_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire8_expand_1x1"
|
||||
top: "fire8_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire8_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire8_squeeze"
|
||||
top: "fire8_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 256
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire8_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire8_expand_3x3"
|
||||
top: "fire8_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire8"
|
||||
type: "Concat"
|
||||
bottom: "fire8_expand_1x1"
|
||||
bottom: "fire8_expand_3x3"
|
||||
top: "fire8"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "pool8"
|
||||
type: "Pooling"
|
||||
bottom: "fire8"
|
||||
top: "pool8"
|
||||
pooling_param {
|
||||
pool: MAX
|
||||
kernel_size: 3
|
||||
stride: 2
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "fire9_squeeze"
|
||||
type: "Convolution"
|
||||
bottom: "pool8"
|
||||
top: "fire9_squeeze"
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire9_squeeze"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire9_squeeze"
|
||||
top: "fire9_squeeze"
|
||||
}
|
||||
layer {
|
||||
name: "fire9_expand_1x1"
|
||||
type: "Convolution"
|
||||
bottom: "fire9_squeeze"
|
||||
top: "fire9_expand_1x1"
|
||||
convolution_param {
|
||||
num_output: 256
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
pad: 0
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire9_expand_1x1"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire9_expand_1x1"
|
||||
top: "fire9_expand_1x1"
|
||||
}
|
||||
layer {
|
||||
name: "fire9_expand_3x3"
|
||||
type: "Convolution"
|
||||
bottom: "fire9_squeeze"
|
||||
top: "fire9_expand_3x3"
|
||||
convolution_param {
|
||||
num_output: 256
|
||||
kernel_size: 3
|
||||
stride: 1
|
||||
pad: 1
|
||||
weight_filler {
|
||||
type: "xavier"
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_fire9_expand_3x3"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "fire9_expand_3x3"
|
||||
top: "fire9_expand_3x3"
|
||||
}
|
||||
layer {
|
||||
name: "fire9"
|
||||
type: "Concat"
|
||||
bottom: "fire9_expand_1x1"
|
||||
bottom: "fire9_expand_3x3"
|
||||
top: "fire9"
|
||||
concat_param {
|
||||
axis: 1
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "conv10"
|
||||
type: "Convolution"
|
||||
bottom: "fire9"
|
||||
top: "conv10"
|
||||
convolution_param {
|
||||
num_output: 1000
|
||||
kernel_size: 1
|
||||
stride: 1
|
||||
weight_filler {
|
||||
type: "gaussian"
|
||||
mean: 0.0
|
||||
std: 0.01
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
value: 0.01
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "rect_conv10"
|
||||
type: "ReLU"
|
||||
relu_param {
|
||||
negative_slope: 0.01
|
||||
}
|
||||
bottom: "conv10"
|
||||
top: "conv10"
|
||||
}
|
||||
layer {
|
||||
name: "pool10"
|
||||
type: "Pooling"
|
||||
bottom: "conv10"
|
||||
top: "pool10"
|
||||
pooling_param {
|
||||
pool: AVE
|
||||
global_pooling: true
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "loss"
|
||||
type: "SoftmaxWithLoss"
|
||||
bottom: "pool10"
|
||||
bottom: "label"
|
||||
top: "loss"
|
||||
include {
|
||||
phase: TRAIN
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "accuracy"
|
||||
type: "Accuracy"
|
||||
bottom: "pool10"
|
||||
bottom: "label"
|
||||
top: "accuracy"
|
||||
}
|
||||
layer {
|
||||
name: "accuracy_top_5"
|
||||
type: "Accuracy"
|
||||
bottom: "pool10"
|
||||
bottom: "label"
|
||||
top: "accuracy_top_5"
|
||||
include {
|
||||
phase: TEST
|
||||
}
|
||||
accuracy_param {
|
||||
top_k: 5
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <opencv2/dnn.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
if (argc < 4)
|
||||
{
|
||||
std::cerr << "Usage " << argv[0] << ": "
|
||||
<< "<model-definition-file> " << " "
|
||||
<< "<model-weights-file> " << " "
|
||||
<< "<test-image>\n";
|
||||
return -1;
|
||||
|
||||
}
|
||||
cv::String model_prototxt = argv[1];
|
||||
cv::String model_binary = argv[2];
|
||||
cv::String test_image = argv[3];
|
||||
cv::dnn::Net net = cv::dnn::readNet(model_binary, model_prototxt);
|
||||
|
||||
if (net.empty())
|
||||
{
|
||||
std::cerr << "Couldn't load the model !\n";
|
||||
return -2;
|
||||
}
|
||||
cv::Mat img = cv::imread(test_image);
|
||||
if (img.empty())
|
||||
{
|
||||
std::cerr << "Couldn't load image: " << test_image << "\n";
|
||||
return -3;
|
||||
}
|
||||
|
||||
cv::Mat input_blob = cv::dnn::blobFromImage(
|
||||
img, 1.0, cv::Size(416, 416), cv::Scalar(104, 117, 123), false);
|
||||
|
||||
cv::Mat prob;
|
||||
cv::TickMeter t;
|
||||
|
||||
net.setInput(input_blob);
|
||||
t.start();
|
||||
prob = net.forward("predictions");
|
||||
t.stop();
|
||||
|
||||
int prob_size[3] = {1000, 1, 1};
|
||||
cv::Mat prob_data(3, prob_size, CV_32F, prob.ptr<float>(0));
|
||||
|
||||
double max_prob = -1.0;
|
||||
int class_idx = -1;
|
||||
for (int idx = 0; idx < prob.size[1]; ++idx)
|
||||
{
|
||||
double current_prob = prob_data.at<float>(idx, 0, 0);
|
||||
if (current_prob > max_prob)
|
||||
{
|
||||
max_prob = current_prob;
|
||||
class_idx = idx;
|
||||
}
|
||||
}
|
||||
std::cout << "Best class Index: " << class_idx << "\n";
|
||||
std::cout << "Time taken: " << t.getTimeSec() << "\n";
|
||||
std::cout << "Probability: " << max_prob * 100.0<< "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
#include <opencv2/dnn.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <opencv2/core_detect.hpp>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
using namespace cv::dnn;
|
||||
using namespace cv::dnn_objdetect;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc < 4)
|
||||
{
|
||||
std::cerr << "Usage " << argv[0] << ": "
|
||||
<< "<model-definition-file> "
|
||||
<< "<model-weights-file> "
|
||||
<< "<test-image> "
|
||||
<< "<threshold>(optional)\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::string model_prototxt = argv[1];
|
||||
std::string model_binary = argv[2];
|
||||
std::string test_input_image = argv[3];
|
||||
double threshold = 0.7;
|
||||
|
||||
if (argc == 5)
|
||||
{
|
||||
threshold = atof(argv[4]);
|
||||
if (threshold > 1.0 || threshold < 0.0)
|
||||
{
|
||||
std::cerr << "Threshold should belong to [0, 1]\n";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Load the network
|
||||
std::cout << "Loading the network...\n";
|
||||
Net net = dnn::readNet(model_binary, model_prototxt);
|
||||
if (net.empty())
|
||||
{
|
||||
std::cerr << "Couldn't load the model !\n";
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Done loading the network !\n\n";
|
||||
}
|
||||
|
||||
// Load the test image
|
||||
Mat img = cv::imread(test_input_image);
|
||||
Mat original_img(img);
|
||||
if (img.empty())
|
||||
{
|
||||
std::cerr << "Couldn't load image: " << test_input_image << "\n";
|
||||
return -3;
|
||||
}
|
||||
|
||||
cv::namedWindow("Initial Image", WINDOW_AUTOSIZE);
|
||||
cv::imshow("Initial Image", img);
|
||||
|
||||
cv::resize(img, img, cv::Size(416, 416));
|
||||
Mat img_copy(img);
|
||||
img.convertTo(img, CV_32FC3);
|
||||
Mat input_blob = blobFromImage(img, 1.0, Size(), cv::Scalar(104, 117, 123), false);
|
||||
|
||||
// Set the input blob
|
||||
|
||||
// Set the output layers
|
||||
std::cout << "Getting the output of all the three blobs...\n";
|
||||
std::vector<Mat> outblobs(3);
|
||||
std::vector<cv::String> out_layers;
|
||||
out_layers.push_back("slice");
|
||||
out_layers.push_back("softmax");
|
||||
out_layers.push_back("sigmoid");
|
||||
|
||||
// Bbox delta blob
|
||||
std::vector<Mat> temp_blob;
|
||||
net.setInput(input_blob);
|
||||
cv::TickMeter t;
|
||||
|
||||
t.start();
|
||||
net.forward(temp_blob, out_layers[0]);
|
||||
t.stop();
|
||||
outblobs[0] = temp_blob[2];
|
||||
|
||||
// class_scores blob
|
||||
net.setInput(input_blob);
|
||||
t.start();
|
||||
outblobs[1] = net.forward(out_layers[1]);
|
||||
t.stop();
|
||||
|
||||
// conf_scores blob
|
||||
net.setInput(input_blob);
|
||||
t.start();
|
||||
outblobs[2] = net.forward(out_layers[2]);
|
||||
t.stop();
|
||||
|
||||
// Check that the blobs are valid
|
||||
for (size_t i = 0; i < outblobs.size(); ++i)
|
||||
{
|
||||
if (outblobs[i].empty())
|
||||
{
|
||||
std::cerr << "Blob: " << i << " is empty !\n";
|
||||
}
|
||||
}
|
||||
|
||||
int delta_bbox_size[3] = {23, 23, 36};
|
||||
Mat delta_bbox(3, delta_bbox_size, CV_32F, outblobs[0].ptr<float>());
|
||||
|
||||
int class_scores_size[2] = {4761, 20};
|
||||
Mat class_scores(2, class_scores_size, CV_32F, outblobs[1].ptr<float>());
|
||||
|
||||
int conf_scores_size[3] = {23, 23, 9};
|
||||
Mat conf_scores(3, conf_scores_size, CV_32F, outblobs[2].ptr<float>());
|
||||
|
||||
InferBbox inf(delta_bbox, class_scores, conf_scores);
|
||||
inf.filter(threshold);
|
||||
|
||||
|
||||
double average_time = t.getTimeSec() / t.getCounter();
|
||||
std::cout << "\nTotal objects detected: " << inf.detections.size()
|
||||
<< " in " << average_time << " seconds\n";
|
||||
std::cout << "------\n";
|
||||
float x_ratio = (float)original_img.cols / img_copy.cols;
|
||||
float y_ratio = (float)original_img.rows / img_copy.rows;
|
||||
for (size_t i = 0; i < inf.detections.size(); ++i)
|
||||
{
|
||||
|
||||
int xmin = inf.detections[i].xmin;
|
||||
int ymin = inf.detections[i].ymin;
|
||||
int xmax = inf.detections[i].xmax;
|
||||
int ymax = inf.detections[i].ymax;
|
||||
cv::String class_name = inf.detections[i].label_name;
|
||||
std::cout << "Class: " << class_name << "\n"
|
||||
<< "Probability: " << inf.detections[i].class_prob << "\n"
|
||||
<< "Co-ordinates: " << inf.detections[i].xmin << " "
|
||||
<< inf.detections[i].ymin << " "
|
||||
<< inf.detections[i].xmax << " "
|
||||
<< inf.detections[i].ymax << "\n";
|
||||
std::cout << "------\n";
|
||||
// Draw the corresponding bounding box(s)
|
||||
cv::rectangle(original_img, cv::Point((int)(xmin * x_ratio), (int)(ymin * y_ratio)),
|
||||
cv::Point((int)(xmax * x_ratio), (int)(ymax * y_ratio)), cv::Scalar(255, 0, 0), 2);
|
||||
cv::putText(original_img, class_name, cv::Point((int)(xmin * x_ratio), (int)(ymin * y_ratio)),
|
||||
cv::FONT_HERSHEY_SIMPLEX, 0.7, cv::Scalar(255, 0, 0), 1);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
cv::namedWindow("Final Detections", WINDOW_AUTOSIZE);
|
||||
cv::imshow("Final Detections", original_img);
|
||||
cv::imwrite("image.png", original_img);
|
||||
cv::waitKey(0);
|
||||
}
|
||||
catch (const char* msg)
|
||||
{
|
||||
std::cerr << msg << "\n";
|
||||
return -4;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user