Skip to content

Commit

Permalink
Lnet (#3)
Browse files Browse the repository at this point in the history
* new structure for LNet

* update mini-caffe

* update mini-caffe

* update mini-caffe

* update
  • Loading branch information
luoyetx authored Oct 20, 2017
1 parent f7faf2a commit 73d4f61
Show file tree
Hide file tree
Showing 12 changed files with 28,370 additions and 392 deletions.
28,238 changes: 28,238 additions & 0 deletions 1130.log

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cpp/mini-caffe
Submodule mini-caffe updated 65 files
+2 −0 .gitignore
+1 −0 CMakeLists.txt
+8 −2 appveyor.yml
+3 −1 example/.gitignore
+3 −0 example/CMakeLists.txt
+4 −0 example/README.md
+1 −0 example/deeplandmark/landmark.cpp
+3,790 −0 example/models/r-fcn/test_agnostic.prototxt
+ example/r-fcn/000456.jpg
+ example/r-fcn/000542.jpg
+ example/r-fcn/001150.jpg
+ example/r-fcn/001763.jpg
+ example/r-fcn/004545.jpg
+188 −0 example/r-fcn/main.cpp
+3 −2 example/wgan/main.cpp
+1 −1 generatepb.bat
+1 −1 generatepb.sh
+13 −8 include/caffe/base.hpp
+4 −3 include/caffe/blob.hpp
+10 −0 include/caffe/c_api.h
+11 −0 include/caffe/logging.hpp
+4 −0 include/caffe/net.hpp
+12 −0 java/src/main/java/com/luoyetx/minicaffe/Net.java
+1 −0 java/src/test/java/MiniCaffeTest.java
+11 −0 python/minicaffe/net.py
+1 −0 python/tests/test.py
+12 −12 src/blob.cpp
+13 −48 src/c_api.cpp
+3 −2 src/common.cpp
+13 −3 src/common.hpp
+11 −0 src/jni/jni.c
+4 −0 src/layer.hpp
+3 −0 src/layers/base_conv_layer.hpp
+5 −0 src/layers/batch_norm_layer.hpp
+4 −3 src/layers/bn_layer.cpp
+4 −0 src/layers/bn_layer.hpp
+10 −8 src/layers/conv_layer.cpp
+11 −34 src/layers/cudnn/cudnn_conv_layer.cpp
+5 −1 src/layers/cudnn/cudnn_conv_layer.hpp
+12 −11 src/layers/lrn_layer.cpp
+5 −0 src/layers/mvn_layer.hpp
+4 −3 src/layers/pooling_layer.cpp
+315 −0 src/layers/proposal_layer.cpp
+278 −0 src/layers/proposal_layer.cu
+47 −0 src/layers/proposal_layer.hpp
+114 −0 src/layers/psroi_pooling_layer.cpp
+89 −0 src/layers/psroi_pooling_layer.cu
+55 −0 src/layers/psroi_pooling_layer.hpp
+4 −3 src/layers/relu_layer.cpp
+2 −4 src/layers/roi_pooling_layer.cpp
+4 −6 src/layers/roi_pooling_layer.cu
+4 −3 src/layers/sigmoid_layer.cpp
+4 −3 src/layers/softmax_layer.cpp
+4 −3 src/layers/tanh_layer.cpp
+31 −4 src/net.cpp
+54 −35 src/proto/caffe.proto
+256 −61 src/syncedmem.cpp
+71 −44 src/syncedmem.hpp
+54 −0 src/thread_local.hpp
+32 −0 tests/run_net.cpp
+34 −0 tools/benchmark.cpp
+199 −0 tools/fuse_bn.py
+132 −0 tools/parse_mem.py
+3 −0 tools/tools.cmake
+2 −0 travis.sh
4 changes: 4 additions & 0 deletions cpp/profile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ detect img/test3.jpg costs 0.3730s
image size = (778 x 1024), s1: 0.1960s, s2: 0.1270s, s3: 0.0400s, s4: 0.0050
bboxes, s1: 401, s2: 21, s3: 5, s4: 5
```

### Update

LNet 利用卷积替换掉全连接,在保证精度不变的情况下,提高了速度。GTX 1070 上从 17.59ms 降到了 13.907ms。
Binary file modified img/lnet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/test1_stage4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/test2_stage4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/test3_stage4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified model/l.caffemodel
Binary file not shown.
173 changes: 39 additions & 134 deletions proto/l.prototxt
Original file line number Diff line number Diff line change
Expand Up @@ -91,157 +91,62 @@ layer {
top: "conv3"
}
layer {
name: "fc4"
type: "InnerProduct"
name: "conv4"
type: "Convolution"
bottom: "conv3"
top: "fc4"
inner_product_param {
num_output: 256
top: "conv4"
convolution_param {
num_output: 100
group: 5
kernel_size: 3
stride: 3
}
}
layer {
name: "prelu4"
type: "PReLU"
bottom: "fc4"
top: "fc4"
}
######## net-1 output ########
layer {
name: "fc5_1"
type: "InnerProduct"
bottom: "fc4"
top: "fc5_1"
inner_product_param {
num_output: 64
}
}
layer {
name: "prelu5_1"
type: "PReLU"
bottom: "fc5_1"
top: "fc5_1"
}
layer {
name: "fc6_1"
type: "InnerProduct"
bottom: "fc5_1"
top: "fc6_1"
inner_product_param {
num_output: 2
}
}
######## net-2 output ########
layer {
name: "fc5_2"
type: "InnerProduct"
bottom: "fc4"
top: "fc5_2"
inner_product_param {
num_output: 64
}
}
layer {
name: "prelu5_2"
type: "PReLU"
bottom: "fc5_2"
top: "fc5_2"
}
layer {
name: "fc6_2"
type: "InnerProduct"
bottom: "fc5_2"
top: "fc6_2"
inner_product_param {
num_output: 2
}
}
######## net-3 output ########
layer {
name: "fc5_3"
type: "InnerProduct"
bottom: "fc4"
top: "fc5_3"
inner_product_param {
num_output: 64
}
}
layer {
name: "prelu5_3"
type: "PReLU"
bottom: "fc5_3"
top: "fc5_3"
}
layer {
name: "fc6_3"
type: "InnerProduct"
bottom: "fc5_3"
top: "fc6_3"
inner_product_param {
num_output: 2
}
}
######## net-4 output ########
layer {
name: "fc5_4"
type: "InnerProduct"
bottom: "fc4"
top: "fc5_4"
inner_product_param {
num_output: 64
}
}
layer {
name: "prelu5_4"
type: "PReLU"
bottom: "fc5_4"
top: "fc5_4"
}
layer {
name: "fc6_4"
type: "InnerProduct"
bottom: "fc5_4"
top: "fc6_4"
inner_product_param {
num_output: 2
}
bottom: "conv4"
top: "conv4"
}
######## net-5 output ########
layer {
name: "fc5_5"
type: "InnerProduct"
bottom: "fc4"
top: "fc5_5"
inner_product_param {
num_output: 64
name: "conv5"
type: "Convolution"
bottom: "conv4"
top: "conv5"
convolution_param {
num_output: 50
group: 5
kernel_size: 1
stride: 1
}
}
layer {
name: "prelu5_5"
name: "prelu5"
type: "PReLU"
bottom: "fc5_5"
top: "fc5_5"
bottom: "conv5"
top: "conv5"
}
layer {
name: "fc6_5"
type: "InnerProduct"
bottom: "fc5_5"
top: "fc6_5"
inner_product_param {
num_output: 2
name: "conv6"
type: "Convolution"
bottom: "conv5"
top: "conv6"
convolution_param {
num_output: 10
group: 5
kernel_size: 1
stride: 1
}
}

######## final output ########
layer {
name: "landmark_offset"
type: "Concat"
bottom: "fc6_1"
bottom: "fc6_2"
bottom: "fc6_3"
bottom: "fc6_4"
bottom: "fc6_5"
name: "landmark"
type: "Reshape"
bottom: "conv6"
top: "landmark_offset"
concat_param {
axis: 1
reshape_param {
shape {
dim: 0
dim: 10
}
}
}
Loading

0 comments on commit 73d4f61

Please sign in to comment.