Spaces:
Runtime error
Runtime error
faceplugin
commited on
Commit
•
0367344
1
Parent(s):
a86b2f7
Update model
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -0
- README.md +13 -0
- face_recognition/__pycache__/extract.cpython-310.pyc +0 -0
- face_recognition/__pycache__/match.cpython-310.pyc +0 -0
- face_recognition/face_detect/__pycache__/detect_imgs.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/__pycache__/__init__.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/nn/__pycache__/__init__.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/nn/__pycache__/mb_tiny.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/nn/__pycache__/mb_tiny_RFB.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/ssd/__pycache__/__init__.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/ssd/__pycache__/data_preprocessing.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/ssd/__pycache__/mb_tiny_RFB_fd.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/ssd/__pycache__/mb_tiny_fd.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/ssd/__pycache__/predictor.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/ssd/__pycache__/ssd.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/ssd/config/__pycache__/__init__.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/ssd/config/__pycache__/fd_config.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/transforms/__pycache__/__init__.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/transforms/__pycache__/transforms.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/utils/__pycache__/__init__.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/utils/__pycache__/box_utils.cpython-310.pyc +0 -0
- face_recognition/face_detect/vision/utils/__pycache__/misc.cpython-310.pyc +0 -0
- face_recognition/face_feature/__pycache__/GetFeature.cpython-310.pyc +0 -0
- face_recognition/face_feature/__pycache__/irn50_pytorch.cpython-310.pyc +0 -0
- face_recognition/face_landmark/__pycache__/GetLandmark.cpython-310.pyc +0 -0
- face_recognition/face_landmark/__pycache__/MobileFaceNet.cpython-310.pyc +0 -0
- face_recognition/face_manage/__pycache__/manage.cpython-310.pyc +0 -0
- face_recognition/face_util/__pycache__/faceutil.cpython-310.pyc +0 -0
- face_recognition1/face_detect/checkpoints/FaceBoxesProd.pth +3 -0
- face_recognition1/face_detect/checkpoints/Widerface-RetinaFace.caffemodel +3 -0
- face_recognition1/face_detect/checkpoints/deploy.prototxt +2499 -0
- face_recognition1/face_detect/data/config.py +14 -0
- face_recognition1/face_detect/layers/__init__.py +2 -0
- face_recognition1/face_detect/layers/functions/prior_box.py +43 -0
- face_recognition1/face_detect/layers/modules/__init__.py +3 -0
- face_recognition1/face_detect/layers/modules/multibox_loss.py +108 -0
- face_recognition1/face_detect/models/__init__.py +0 -0
- face_recognition1/face_detect/models/faceboxes.py +149 -0
- face_recognition1/face_detect/models/voc-model-labels.txt +2 -0
- face_recognition1/face_detect/test.py +197 -0
- face_recognition1/face_detect/utils/__init__.py +0 -0
- face_recognition1/face_detect/utils/box_utils.py +276 -0
- face_recognition1/face_detect/utils/build.py +138 -0
- face_recognition1/face_detect/utils/build/temp.linux-x86_64-3.6/nms/cpu_nms.o +0 -0
- face_recognition1/face_detect/utils/build/temp.linux-x86_64-3.6/nms/gpu_nms.o +0 -0
- face_recognition1/face_detect/utils/build/temp.linux-x86_64-3.6/nms/nms_kernel.o +0 -0
- face_recognition1/face_detect/utils/nms/cpu_nms.c +0 -0
- face_recognition1/face_detect/utils/nms/cpu_nms.cpython-36m-x86_64-linux-gnu.so +0 -0
- face_recognition1/face_detect/utils/nms/cpu_nms.pyx +156 -0
- face_recognition1/face_detect/utils/nms/gpu_nms.cpp +0 -0
.gitattributes
CHANGED
@@ -4,3 +4,5 @@
|
|
4 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
5 |
*.png filter=lfs diff=lfs merge=lfs -text
|
6 |
*.tar filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
4 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
5 |
*.png filter=lfs diff=lfs merge=lfs -text
|
6 |
*.tar filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.caffemodel filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: FacePlugin-Face-Recognition-SDK
|
3 |
+
emoji: 📈
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: pink
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 4.15.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: mit
|
11 |
+
---
|
12 |
+
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
face_recognition/__pycache__/extract.cpython-310.pyc
DELETED
Binary file (2.03 kB)
|
|
face_recognition/__pycache__/match.cpython-310.pyc
DELETED
Binary file (763 Bytes)
|
|
face_recognition/face_detect/__pycache__/detect_imgs.cpython-310.pyc
DELETED
Binary file (2.05 kB)
|
|
face_recognition/face_detect/vision/__pycache__/__init__.cpython-310.pyc
DELETED
Binary file (173 Bytes)
|
|
face_recognition/face_detect/vision/nn/__pycache__/__init__.cpython-310.pyc
DELETED
Binary file (176 Bytes)
|
|
face_recognition/face_detect/vision/nn/__pycache__/mb_tiny.cpython-310.pyc
DELETED
Binary file (1.8 kB)
|
|
face_recognition/face_detect/vision/nn/__pycache__/mb_tiny_RFB.cpython-310.pyc
DELETED
Binary file (4.01 kB)
|
|
face_recognition/face_detect/vision/ssd/__pycache__/__init__.cpython-310.pyc
DELETED
Binary file (177 Bytes)
|
|
face_recognition/face_detect/vision/ssd/__pycache__/data_preprocessing.cpython-310.pyc
DELETED
Binary file (2.59 kB)
|
|
face_recognition/face_detect/vision/ssd/__pycache__/mb_tiny_RFB_fd.cpython-310.pyc
DELETED
Binary file (2.04 kB)
|
|
face_recognition/face_detect/vision/ssd/__pycache__/mb_tiny_fd.cpython-310.pyc
DELETED
Binary file (2.02 kB)
|
|
face_recognition/face_detect/vision/ssd/__pycache__/predictor.cpython-310.pyc
DELETED
Binary file (2.21 kB)
|
|
face_recognition/face_detect/vision/ssd/__pycache__/ssd.cpython-310.pyc
DELETED
Binary file (5.79 kB)
|
|
face_recognition/face_detect/vision/ssd/config/__pycache__/__init__.cpython-310.pyc
DELETED
Binary file (184 Bytes)
|
|
face_recognition/face_detect/vision/ssd/config/__pycache__/fd_config.cpython-310.pyc
DELETED
Binary file (1.53 kB)
|
|
face_recognition/face_detect/vision/transforms/__pycache__/__init__.cpython-310.pyc
DELETED
Binary file (184 Bytes)
|
|
face_recognition/face_detect/vision/transforms/__pycache__/transforms.cpython-310.pyc
DELETED
Binary file (15.2 kB)
|
|
face_recognition/face_detect/vision/utils/__pycache__/__init__.cpython-310.pyc
DELETED
Binary file (200 Bytes)
|
|
face_recognition/face_detect/vision/utils/__pycache__/box_utils.cpython-310.pyc
DELETED
Binary file (8.14 kB)
|
|
face_recognition/face_detect/vision/utils/__pycache__/misc.cpython-310.pyc
DELETED
Binary file (1.81 kB)
|
|
face_recognition/face_feature/__pycache__/GetFeature.cpython-310.pyc
DELETED
Binary file (1.06 kB)
|
|
face_recognition/face_feature/__pycache__/irn50_pytorch.cpython-310.pyc
DELETED
Binary file (10.6 kB)
|
|
face_recognition/face_landmark/__pycache__/GetLandmark.cpython-310.pyc
DELETED
Binary file (1.6 kB)
|
|
face_recognition/face_landmark/__pycache__/MobileFaceNet.cpython-310.pyc
DELETED
Binary file (5.7 kB)
|
|
face_recognition/face_manage/__pycache__/manage.cpython-310.pyc
DELETED
Binary file (4.27 kB)
|
|
face_recognition/face_util/__pycache__/faceutil.cpython-310.pyc
DELETED
Binary file (987 Bytes)
|
|
face_recognition1/face_detect/checkpoints/FaceBoxesProd.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c0cb2b1e40710c0aa5fc32a8759b1496a0fe0a126c907ca0ffe35b4bd0709d09
|
3 |
+
size 4072492
|
face_recognition1/face_detect/checkpoints/Widerface-RetinaFace.caffemodel
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d08338a2c207df16a9c566f767fea67fb43ba6fff76ce11e938fe3fabefb9402
|
3 |
+
size 1866013
|
face_recognition1/face_detect/checkpoints/deploy.prototxt
ADDED
@@ -0,0 +1,2499 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: "20200403141819_Widerface-RetinaFace_mb_640_negscope-0_epoch_4"
|
2 |
+
input: "data"
|
3 |
+
input_dim: 1
|
4 |
+
input_dim: 3
|
5 |
+
input_dim: 640
|
6 |
+
input_dim: 640
|
7 |
+
layer {
|
8 |
+
name: "conv1"
|
9 |
+
type: "Convolution"
|
10 |
+
bottom: "data"
|
11 |
+
top: "conv_blob1"
|
12 |
+
convolution_param {
|
13 |
+
num_output: 8
|
14 |
+
bias_term: false
|
15 |
+
pad: 1
|
16 |
+
kernel_size: 3
|
17 |
+
group: 1
|
18 |
+
stride: 2
|
19 |
+
weight_filler {
|
20 |
+
type: "xavier"
|
21 |
+
}
|
22 |
+
dilation: 1
|
23 |
+
}
|
24 |
+
}
|
25 |
+
layer {
|
26 |
+
name: "batch_norm1"
|
27 |
+
type: "BatchNorm"
|
28 |
+
bottom: "conv_blob1"
|
29 |
+
top: "batch_norm_blob1"
|
30 |
+
batch_norm_param {
|
31 |
+
use_global_stats: true
|
32 |
+
eps: 9.9999997e-06
|
33 |
+
}
|
34 |
+
}
|
35 |
+
layer {
|
36 |
+
name: "bn_scale1"
|
37 |
+
type: "Scale"
|
38 |
+
bottom: "batch_norm_blob1"
|
39 |
+
top: "batch_norm_blob1"
|
40 |
+
scale_param {
|
41 |
+
bias_term: true
|
42 |
+
}
|
43 |
+
}
|
44 |
+
layer {
|
45 |
+
name: "relu1"
|
46 |
+
type: "ReLU"
|
47 |
+
bottom: "batch_norm_blob1"
|
48 |
+
top: "relu_blob1"
|
49 |
+
}
|
50 |
+
layer {
|
51 |
+
name: "conv2"
|
52 |
+
type: "Convolution"
|
53 |
+
bottom: "relu_blob1"
|
54 |
+
top: "conv_blob2"
|
55 |
+
convolution_param {
|
56 |
+
num_output: 8
|
57 |
+
bias_term: false
|
58 |
+
pad: 1
|
59 |
+
kernel_size: 3
|
60 |
+
group: 8
|
61 |
+
stride: 1
|
62 |
+
weight_filler {
|
63 |
+
type: "xavier"
|
64 |
+
}
|
65 |
+
dilation: 1
|
66 |
+
}
|
67 |
+
}
|
68 |
+
layer {
|
69 |
+
name: "batch_norm2"
|
70 |
+
type: "BatchNorm"
|
71 |
+
bottom: "conv_blob2"
|
72 |
+
top: "batch_norm_blob2"
|
73 |
+
batch_norm_param {
|
74 |
+
use_global_stats: true
|
75 |
+
eps: 9.9999997e-06
|
76 |
+
}
|
77 |
+
}
|
78 |
+
layer {
|
79 |
+
name: "bn_scale2"
|
80 |
+
type: "Scale"
|
81 |
+
bottom: "batch_norm_blob2"
|
82 |
+
top: "batch_norm_blob2"
|
83 |
+
scale_param {
|
84 |
+
bias_term: true
|
85 |
+
}
|
86 |
+
}
|
87 |
+
layer {
|
88 |
+
name: "relu2"
|
89 |
+
type: "ReLU"
|
90 |
+
bottom: "batch_norm_blob2"
|
91 |
+
top: "relu_blob2"
|
92 |
+
}
|
93 |
+
layer {
|
94 |
+
name: "conv3"
|
95 |
+
type: "Convolution"
|
96 |
+
bottom: "relu_blob2"
|
97 |
+
top: "conv_blob3"
|
98 |
+
convolution_param {
|
99 |
+
num_output: 16
|
100 |
+
bias_term: false
|
101 |
+
pad: 0
|
102 |
+
kernel_size: 1
|
103 |
+
group: 1
|
104 |
+
stride: 1
|
105 |
+
weight_filler {
|
106 |
+
type: "xavier"
|
107 |
+
}
|
108 |
+
dilation: 1
|
109 |
+
}
|
110 |
+
}
|
111 |
+
layer {
|
112 |
+
name: "batch_norm3"
|
113 |
+
type: "BatchNorm"
|
114 |
+
bottom: "conv_blob3"
|
115 |
+
top: "batch_norm_blob3"
|
116 |
+
batch_norm_param {
|
117 |
+
use_global_stats: true
|
118 |
+
eps: 9.9999997e-06
|
119 |
+
}
|
120 |
+
}
|
121 |
+
layer {
|
122 |
+
name: "bn_scale3"
|
123 |
+
type: "Scale"
|
124 |
+
bottom: "batch_norm_blob3"
|
125 |
+
top: "batch_norm_blob3"
|
126 |
+
scale_param {
|
127 |
+
bias_term: true
|
128 |
+
}
|
129 |
+
}
|
130 |
+
layer {
|
131 |
+
name: "relu3"
|
132 |
+
type: "ReLU"
|
133 |
+
bottom: "batch_norm_blob3"
|
134 |
+
top: "relu_blob3"
|
135 |
+
}
|
136 |
+
layer {
|
137 |
+
name: "conv4"
|
138 |
+
type: "Convolution"
|
139 |
+
bottom: "relu_blob3"
|
140 |
+
top: "conv_blob4"
|
141 |
+
convolution_param {
|
142 |
+
num_output: 16
|
143 |
+
bias_term: false
|
144 |
+
pad: 1
|
145 |
+
kernel_size: 3
|
146 |
+
group: 16
|
147 |
+
stride: 2
|
148 |
+
weight_filler {
|
149 |
+
type: "xavier"
|
150 |
+
}
|
151 |
+
dilation: 1
|
152 |
+
}
|
153 |
+
}
|
154 |
+
layer {
|
155 |
+
name: "batch_norm4"
|
156 |
+
type: "BatchNorm"
|
157 |
+
bottom: "conv_blob4"
|
158 |
+
top: "batch_norm_blob4"
|
159 |
+
batch_norm_param {
|
160 |
+
use_global_stats: true
|
161 |
+
eps: 9.9999997e-06
|
162 |
+
}
|
163 |
+
}
|
164 |
+
layer {
|
165 |
+
name: "bn_scale4"
|
166 |
+
type: "Scale"
|
167 |
+
bottom: "batch_norm_blob4"
|
168 |
+
top: "batch_norm_blob4"
|
169 |
+
scale_param {
|
170 |
+
bias_term: true
|
171 |
+
}
|
172 |
+
}
|
173 |
+
layer {
|
174 |
+
name: "relu4"
|
175 |
+
type: "ReLU"
|
176 |
+
bottom: "batch_norm_blob4"
|
177 |
+
top: "relu_blob4"
|
178 |
+
}
|
179 |
+
layer {
|
180 |
+
name: "conv5"
|
181 |
+
type: "Convolution"
|
182 |
+
bottom: "relu_blob4"
|
183 |
+
top: "conv_blob5"
|
184 |
+
convolution_param {
|
185 |
+
num_output: 32
|
186 |
+
bias_term: false
|
187 |
+
pad: 0
|
188 |
+
kernel_size: 1
|
189 |
+
group: 1
|
190 |
+
stride: 1
|
191 |
+
weight_filler {
|
192 |
+
type: "xavier"
|
193 |
+
}
|
194 |
+
dilation: 1
|
195 |
+
}
|
196 |
+
}
|
197 |
+
layer {
|
198 |
+
name: "batch_norm5"
|
199 |
+
type: "BatchNorm"
|
200 |
+
bottom: "conv_blob5"
|
201 |
+
top: "batch_norm_blob5"
|
202 |
+
batch_norm_param {
|
203 |
+
use_global_stats: true
|
204 |
+
eps: 9.9999997e-06
|
205 |
+
}
|
206 |
+
}
|
207 |
+
layer {
|
208 |
+
name: "bn_scale5"
|
209 |
+
type: "Scale"
|
210 |
+
bottom: "batch_norm_blob5"
|
211 |
+
top: "batch_norm_blob5"
|
212 |
+
scale_param {
|
213 |
+
bias_term: true
|
214 |
+
}
|
215 |
+
}
|
216 |
+
layer {
|
217 |
+
name: "relu5"
|
218 |
+
type: "ReLU"
|
219 |
+
bottom: "batch_norm_blob5"
|
220 |
+
top: "relu_blob5"
|
221 |
+
}
|
222 |
+
layer {
|
223 |
+
name: "conv6"
|
224 |
+
type: "Convolution"
|
225 |
+
bottom: "relu_blob5"
|
226 |
+
top: "conv_blob6"
|
227 |
+
convolution_param {
|
228 |
+
num_output: 32
|
229 |
+
bias_term: false
|
230 |
+
pad: 1
|
231 |
+
kernel_size: 3
|
232 |
+
group: 32
|
233 |
+
stride: 1
|
234 |
+
weight_filler {
|
235 |
+
type: "xavier"
|
236 |
+
}
|
237 |
+
dilation: 1
|
238 |
+
}
|
239 |
+
}
|
240 |
+
layer {
|
241 |
+
name: "batch_norm6"
|
242 |
+
type: "BatchNorm"
|
243 |
+
bottom: "conv_blob6"
|
244 |
+
top: "batch_norm_blob6"
|
245 |
+
batch_norm_param {
|
246 |
+
use_global_stats: true
|
247 |
+
eps: 9.9999997e-06
|
248 |
+
}
|
249 |
+
}
|
250 |
+
layer {
|
251 |
+
name: "bn_scale6"
|
252 |
+
type: "Scale"
|
253 |
+
bottom: "batch_norm_blob6"
|
254 |
+
top: "batch_norm_blob6"
|
255 |
+
scale_param {
|
256 |
+
bias_term: true
|
257 |
+
}
|
258 |
+
}
|
259 |
+
layer {
|
260 |
+
name: "relu6"
|
261 |
+
type: "ReLU"
|
262 |
+
bottom: "batch_norm_blob6"
|
263 |
+
top: "relu_blob6"
|
264 |
+
}
|
265 |
+
layer {
|
266 |
+
name: "conv7"
|
267 |
+
type: "Convolution"
|
268 |
+
bottom: "relu_blob6"
|
269 |
+
top: "conv_blob7"
|
270 |
+
convolution_param {
|
271 |
+
num_output: 32
|
272 |
+
bias_term: false
|
273 |
+
pad: 0
|
274 |
+
kernel_size: 1
|
275 |
+
group: 1
|
276 |
+
stride: 1
|
277 |
+
weight_filler {
|
278 |
+
type: "xavier"
|
279 |
+
}
|
280 |
+
dilation: 1
|
281 |
+
}
|
282 |
+
}
|
283 |
+
layer {
|
284 |
+
name: "batch_norm7"
|
285 |
+
type: "BatchNorm"
|
286 |
+
bottom: "conv_blob7"
|
287 |
+
top: "batch_norm_blob7"
|
288 |
+
batch_norm_param {
|
289 |
+
use_global_stats: true
|
290 |
+
eps: 9.9999997e-06
|
291 |
+
}
|
292 |
+
}
|
293 |
+
layer {
|
294 |
+
name: "bn_scale7"
|
295 |
+
type: "Scale"
|
296 |
+
bottom: "batch_norm_blob7"
|
297 |
+
top: "batch_norm_blob7"
|
298 |
+
scale_param {
|
299 |
+
bias_term: true
|
300 |
+
}
|
301 |
+
}
|
302 |
+
layer {
|
303 |
+
name: "relu7"
|
304 |
+
type: "ReLU"
|
305 |
+
bottom: "batch_norm_blob7"
|
306 |
+
top: "relu_blob7"
|
307 |
+
}
|
308 |
+
layer {
|
309 |
+
name: "conv8"
|
310 |
+
type: "Convolution"
|
311 |
+
bottom: "relu_blob7"
|
312 |
+
top: "conv_blob8"
|
313 |
+
convolution_param {
|
314 |
+
num_output: 32
|
315 |
+
bias_term: false
|
316 |
+
pad: 1
|
317 |
+
kernel_size: 3
|
318 |
+
group: 32
|
319 |
+
stride: 2
|
320 |
+
weight_filler {
|
321 |
+
type: "xavier"
|
322 |
+
}
|
323 |
+
dilation: 1
|
324 |
+
}
|
325 |
+
}
|
326 |
+
layer {
|
327 |
+
name: "batch_norm8"
|
328 |
+
type: "BatchNorm"
|
329 |
+
bottom: "conv_blob8"
|
330 |
+
top: "batch_norm_blob8"
|
331 |
+
batch_norm_param {
|
332 |
+
use_global_stats: true
|
333 |
+
eps: 9.9999997e-06
|
334 |
+
}
|
335 |
+
}
|
336 |
+
layer {
|
337 |
+
name: "bn_scale8"
|
338 |
+
type: "Scale"
|
339 |
+
bottom: "batch_norm_blob8"
|
340 |
+
top: "batch_norm_blob8"
|
341 |
+
scale_param {
|
342 |
+
bias_term: true
|
343 |
+
}
|
344 |
+
}
|
345 |
+
layer {
|
346 |
+
name: "relu8"
|
347 |
+
type: "ReLU"
|
348 |
+
bottom: "batch_norm_blob8"
|
349 |
+
top: "relu_blob8"
|
350 |
+
}
|
351 |
+
layer {
|
352 |
+
name: "conv9"
|
353 |
+
type: "Convolution"
|
354 |
+
bottom: "relu_blob8"
|
355 |
+
top: "conv_blob9"
|
356 |
+
convolution_param {
|
357 |
+
num_output: 64
|
358 |
+
bias_term: false
|
359 |
+
pad: 0
|
360 |
+
kernel_size: 1
|
361 |
+
group: 1
|
362 |
+
stride: 1
|
363 |
+
weight_filler {
|
364 |
+
type: "xavier"
|
365 |
+
}
|
366 |
+
dilation: 1
|
367 |
+
}
|
368 |
+
}
|
369 |
+
layer {
|
370 |
+
name: "batch_norm9"
|
371 |
+
type: "BatchNorm"
|
372 |
+
bottom: "conv_blob9"
|
373 |
+
top: "batch_norm_blob9"
|
374 |
+
batch_norm_param {
|
375 |
+
use_global_stats: true
|
376 |
+
eps: 9.9999997e-06
|
377 |
+
}
|
378 |
+
}
|
379 |
+
layer {
|
380 |
+
name: "bn_scale9"
|
381 |
+
type: "Scale"
|
382 |
+
bottom: "batch_norm_blob9"
|
383 |
+
top: "batch_norm_blob9"
|
384 |
+
scale_param {
|
385 |
+
bias_term: true
|
386 |
+
}
|
387 |
+
}
|
388 |
+
layer {
|
389 |
+
name: "relu9"
|
390 |
+
type: "ReLU"
|
391 |
+
bottom: "batch_norm_blob9"
|
392 |
+
top: "relu_blob9"
|
393 |
+
}
|
394 |
+
layer {
|
395 |
+
name: "conv10"
|
396 |
+
type: "Convolution"
|
397 |
+
bottom: "relu_blob9"
|
398 |
+
top: "conv_blob10"
|
399 |
+
convolution_param {
|
400 |
+
num_output: 64
|
401 |
+
bias_term: false
|
402 |
+
pad: 1
|
403 |
+
kernel_size: 3
|
404 |
+
group: 64
|
405 |
+
stride: 1
|
406 |
+
weight_filler {
|
407 |
+
type: "xavier"
|
408 |
+
}
|
409 |
+
dilation: 1
|
410 |
+
}
|
411 |
+
}
|
412 |
+
layer {
|
413 |
+
name: "batch_norm10"
|
414 |
+
type: "BatchNorm"
|
415 |
+
bottom: "conv_blob10"
|
416 |
+
top: "batch_norm_blob10"
|
417 |
+
batch_norm_param {
|
418 |
+
use_global_stats: true
|
419 |
+
eps: 9.9999997e-06
|
420 |
+
}
|
421 |
+
}
|
422 |
+
layer {
|
423 |
+
name: "bn_scale10"
|
424 |
+
type: "Scale"
|
425 |
+
bottom: "batch_norm_blob10"
|
426 |
+
top: "batch_norm_blob10"
|
427 |
+
scale_param {
|
428 |
+
bias_term: true
|
429 |
+
}
|
430 |
+
}
|
431 |
+
layer {
|
432 |
+
name: "relu10"
|
433 |
+
type: "ReLU"
|
434 |
+
bottom: "batch_norm_blob10"
|
435 |
+
top: "relu_blob10"
|
436 |
+
}
|
437 |
+
layer {
|
438 |
+
name: "conv11"
|
439 |
+
type: "Convolution"
|
440 |
+
bottom: "relu_blob10"
|
441 |
+
top: "conv_blob11"
|
442 |
+
convolution_param {
|
443 |
+
num_output: 64
|
444 |
+
bias_term: false
|
445 |
+
pad: 0
|
446 |
+
kernel_size: 1
|
447 |
+
group: 1
|
448 |
+
stride: 1
|
449 |
+
weight_filler {
|
450 |
+
type: "xavier"
|
451 |
+
}
|
452 |
+
dilation: 1
|
453 |
+
}
|
454 |
+
}
|
455 |
+
layer {
|
456 |
+
name: "batch_norm11"
|
457 |
+
type: "BatchNorm"
|
458 |
+
bottom: "conv_blob11"
|
459 |
+
top: "batch_norm_blob11"
|
460 |
+
batch_norm_param {
|
461 |
+
use_global_stats: true
|
462 |
+
eps: 9.9999997e-06
|
463 |
+
}
|
464 |
+
}
|
465 |
+
layer {
|
466 |
+
name: "bn_scale11"
|
467 |
+
type: "Scale"
|
468 |
+
bottom: "batch_norm_blob11"
|
469 |
+
top: "batch_norm_blob11"
|
470 |
+
scale_param {
|
471 |
+
bias_term: true
|
472 |
+
}
|
473 |
+
}
|
474 |
+
layer {
|
475 |
+
name: "relu11"
|
476 |
+
type: "ReLU"
|
477 |
+
bottom: "batch_norm_blob11"
|
478 |
+
top: "relu_blob11"
|
479 |
+
}
|
480 |
+
layer {
|
481 |
+
name: "conv12"
|
482 |
+
type: "Convolution"
|
483 |
+
bottom: "relu_blob11"
|
484 |
+
top: "conv_blob12"
|
485 |
+
convolution_param {
|
486 |
+
num_output: 64
|
487 |
+
bias_term: false
|
488 |
+
pad: 1
|
489 |
+
kernel_size: 3
|
490 |
+
group: 64
|
491 |
+
stride: 2
|
492 |
+
weight_filler {
|
493 |
+
type: "xavier"
|
494 |
+
}
|
495 |
+
dilation: 1
|
496 |
+
}
|
497 |
+
}
|
498 |
+
layer {
|
499 |
+
name: "batch_norm12"
|
500 |
+
type: "BatchNorm"
|
501 |
+
bottom: "conv_blob12"
|
502 |
+
top: "batch_norm_blob12"
|
503 |
+
batch_norm_param {
|
504 |
+
use_global_stats: true
|
505 |
+
eps: 9.9999997e-06
|
506 |
+
}
|
507 |
+
}
|
508 |
+
layer {
|
509 |
+
name: "bn_scale12"
|
510 |
+
type: "Scale"
|
511 |
+
bottom: "batch_norm_blob12"
|
512 |
+
top: "batch_norm_blob12"
|
513 |
+
scale_param {
|
514 |
+
bias_term: true
|
515 |
+
}
|
516 |
+
}
|
517 |
+
layer {
|
518 |
+
name: "relu12"
|
519 |
+
type: "ReLU"
|
520 |
+
bottom: "batch_norm_blob12"
|
521 |
+
top: "relu_blob12"
|
522 |
+
}
|
523 |
+
layer {
|
524 |
+
name: "conv13"
|
525 |
+
type: "Convolution"
|
526 |
+
bottom: "relu_blob12"
|
527 |
+
top: "conv_blob13"
|
528 |
+
convolution_param {
|
529 |
+
num_output: 128
|
530 |
+
bias_term: false
|
531 |
+
pad: 0
|
532 |
+
kernel_size: 1
|
533 |
+
group: 1
|
534 |
+
stride: 1
|
535 |
+
weight_filler {
|
536 |
+
type: "xavier"
|
537 |
+
}
|
538 |
+
dilation: 1
|
539 |
+
}
|
540 |
+
}
|
541 |
+
layer {
|
542 |
+
name: "batch_norm13"
|
543 |
+
type: "BatchNorm"
|
544 |
+
bottom: "conv_blob13"
|
545 |
+
top: "batch_norm_blob13"
|
546 |
+
batch_norm_param {
|
547 |
+
use_global_stats: true
|
548 |
+
eps: 9.9999997e-06
|
549 |
+
}
|
550 |
+
}
|
551 |
+
layer {
|
552 |
+
name: "bn_scale13"
|
553 |
+
type: "Scale"
|
554 |
+
bottom: "batch_norm_blob13"
|
555 |
+
top: "batch_norm_blob13"
|
556 |
+
scale_param {
|
557 |
+
bias_term: true
|
558 |
+
}
|
559 |
+
}
|
560 |
+
layer {
|
561 |
+
name: "relu13"
|
562 |
+
type: "ReLU"
|
563 |
+
bottom: "batch_norm_blob13"
|
564 |
+
top: "relu_blob13"
|
565 |
+
}
|
566 |
+
layer {
|
567 |
+
name: "conv14"
|
568 |
+
type: "Convolution"
|
569 |
+
bottom: "relu_blob13"
|
570 |
+
top: "conv_blob14"
|
571 |
+
convolution_param {
|
572 |
+
num_output: 128
|
573 |
+
bias_term: false
|
574 |
+
pad: 1
|
575 |
+
kernel_size: 3
|
576 |
+
group: 128
|
577 |
+
stride: 1
|
578 |
+
weight_filler {
|
579 |
+
type: "xavier"
|
580 |
+
}
|
581 |
+
dilation: 1
|
582 |
+
}
|
583 |
+
}
|
584 |
+
layer {
|
585 |
+
name: "batch_norm14"
|
586 |
+
type: "BatchNorm"
|
587 |
+
bottom: "conv_blob14"
|
588 |
+
top: "batch_norm_blob14"
|
589 |
+
batch_norm_param {
|
590 |
+
use_global_stats: true
|
591 |
+
eps: 9.9999997e-06
|
592 |
+
}
|
593 |
+
}
|
594 |
+
layer {
|
595 |
+
name: "bn_scale14"
|
596 |
+
type: "Scale"
|
597 |
+
bottom: "batch_norm_blob14"
|
598 |
+
top: "batch_norm_blob14"
|
599 |
+
scale_param {
|
600 |
+
bias_term: true
|
601 |
+
}
|
602 |
+
}
|
603 |
+
layer {
|
604 |
+
name: "relu14"
|
605 |
+
type: "ReLU"
|
606 |
+
bottom: "batch_norm_blob14"
|
607 |
+
top: "relu_blob14"
|
608 |
+
}
|
609 |
+
layer {
|
610 |
+
name: "conv15"
|
611 |
+
type: "Convolution"
|
612 |
+
bottom: "relu_blob14"
|
613 |
+
top: "conv_blob15"
|
614 |
+
convolution_param {
|
615 |
+
num_output: 128
|
616 |
+
bias_term: false
|
617 |
+
pad: 0
|
618 |
+
kernel_size: 1
|
619 |
+
group: 1
|
620 |
+
stride: 1
|
621 |
+
weight_filler {
|
622 |
+
type: "xavier"
|
623 |
+
}
|
624 |
+
dilation: 1
|
625 |
+
}
|
626 |
+
}
|
627 |
+
layer {
|
628 |
+
name: "batch_norm15"
|
629 |
+
type: "BatchNorm"
|
630 |
+
bottom: "conv_blob15"
|
631 |
+
top: "batch_norm_blob15"
|
632 |
+
batch_norm_param {
|
633 |
+
use_global_stats: true
|
634 |
+
eps: 9.9999997e-06
|
635 |
+
}
|
636 |
+
}
|
637 |
+
layer {
|
638 |
+
name: "bn_scale15"
|
639 |
+
type: "Scale"
|
640 |
+
bottom: "batch_norm_blob15"
|
641 |
+
top: "batch_norm_blob15"
|
642 |
+
scale_param {
|
643 |
+
bias_term: true
|
644 |
+
}
|
645 |
+
}
|
646 |
+
layer {
|
647 |
+
name: "relu15"
|
648 |
+
type: "ReLU"
|
649 |
+
bottom: "batch_norm_blob15"
|
650 |
+
top: "relu_blob15"
|
651 |
+
}
|
652 |
+
layer {
|
653 |
+
name: "conv16"
|
654 |
+
type: "Convolution"
|
655 |
+
bottom: "relu_blob15"
|
656 |
+
top: "conv_blob16"
|
657 |
+
convolution_param {
|
658 |
+
num_output: 128
|
659 |
+
bias_term: false
|
660 |
+
pad: 1
|
661 |
+
kernel_size: 3
|
662 |
+
group: 128
|
663 |
+
stride: 1
|
664 |
+
weight_filler {
|
665 |
+
type: "xavier"
|
666 |
+
}
|
667 |
+
dilation: 1
|
668 |
+
}
|
669 |
+
}
|
670 |
+
layer {
|
671 |
+
name: "batch_norm16"
|
672 |
+
type: "BatchNorm"
|
673 |
+
bottom: "conv_blob16"
|
674 |
+
top: "batch_norm_blob16"
|
675 |
+
batch_norm_param {
|
676 |
+
use_global_stats: true
|
677 |
+
eps: 9.9999997e-06
|
678 |
+
}
|
679 |
+
}
|
680 |
+
layer {
|
681 |
+
name: "bn_scale16"
|
682 |
+
type: "Scale"
|
683 |
+
bottom: "batch_norm_blob16"
|
684 |
+
top: "batch_norm_blob16"
|
685 |
+
scale_param {
|
686 |
+
bias_term: true
|
687 |
+
}
|
688 |
+
}
|
689 |
+
layer {
|
690 |
+
name: "relu16"
|
691 |
+
type: "ReLU"
|
692 |
+
bottom: "batch_norm_blob16"
|
693 |
+
top: "relu_blob16"
|
694 |
+
}
|
695 |
+
layer {
|
696 |
+
name: "conv17"
|
697 |
+
type: "Convolution"
|
698 |
+
bottom: "relu_blob16"
|
699 |
+
top: "conv_blob17"
|
700 |
+
convolution_param {
|
701 |
+
num_output: 128
|
702 |
+
bias_term: false
|
703 |
+
pad: 0
|
704 |
+
kernel_size: 1
|
705 |
+
group: 1
|
706 |
+
stride: 1
|
707 |
+
weight_filler {
|
708 |
+
type: "xavier"
|
709 |
+
}
|
710 |
+
dilation: 1
|
711 |
+
}
|
712 |
+
}
|
713 |
+
layer {
|
714 |
+
name: "batch_norm17"
|
715 |
+
type: "BatchNorm"
|
716 |
+
bottom: "conv_blob17"
|
717 |
+
top: "batch_norm_blob17"
|
718 |
+
batch_norm_param {
|
719 |
+
use_global_stats: true
|
720 |
+
eps: 9.9999997e-06
|
721 |
+
}
|
722 |
+
}
|
723 |
+
layer {
|
724 |
+
name: "bn_scale17"
|
725 |
+
type: "Scale"
|
726 |
+
bottom: "batch_norm_blob17"
|
727 |
+
top: "batch_norm_blob17"
|
728 |
+
scale_param {
|
729 |
+
bias_term: true
|
730 |
+
}
|
731 |
+
}
|
732 |
+
layer {
|
733 |
+
name: "relu17"
|
734 |
+
type: "ReLU"
|
735 |
+
bottom: "batch_norm_blob17"
|
736 |
+
top: "relu_blob17"
|
737 |
+
}
|
738 |
+
layer {
|
739 |
+
name: "conv18"
|
740 |
+
type: "Convolution"
|
741 |
+
bottom: "relu_blob17"
|
742 |
+
top: "conv_blob18"
|
743 |
+
convolution_param {
|
744 |
+
num_output: 128
|
745 |
+
bias_term: false
|
746 |
+
pad: 1
|
747 |
+
kernel_size: 3
|
748 |
+
group: 128
|
749 |
+
stride: 1
|
750 |
+
weight_filler {
|
751 |
+
type: "xavier"
|
752 |
+
}
|
753 |
+
dilation: 1
|
754 |
+
}
|
755 |
+
}
|
756 |
+
layer {
|
757 |
+
name: "batch_norm18"
|
758 |
+
type: "BatchNorm"
|
759 |
+
bottom: "conv_blob18"
|
760 |
+
top: "batch_norm_blob18"
|
761 |
+
batch_norm_param {
|
762 |
+
use_global_stats: true
|
763 |
+
eps: 9.9999997e-06
|
764 |
+
}
|
765 |
+
}
|
766 |
+
layer {
|
767 |
+
name: "bn_scale18"
|
768 |
+
type: "Scale"
|
769 |
+
bottom: "batch_norm_blob18"
|
770 |
+
top: "batch_norm_blob18"
|
771 |
+
scale_param {
|
772 |
+
bias_term: true
|
773 |
+
}
|
774 |
+
}
|
775 |
+
layer {
|
776 |
+
name: "relu18"
|
777 |
+
type: "ReLU"
|
778 |
+
bottom: "batch_norm_blob18"
|
779 |
+
top: "relu_blob18"
|
780 |
+
}
|
781 |
+
layer {
|
782 |
+
name: "conv19"
|
783 |
+
type: "Convolution"
|
784 |
+
bottom: "relu_blob18"
|
785 |
+
top: "conv_blob19"
|
786 |
+
convolution_param {
|
787 |
+
num_output: 128
|
788 |
+
bias_term: false
|
789 |
+
pad: 0
|
790 |
+
kernel_size: 1
|
791 |
+
group: 1
|
792 |
+
stride: 1
|
793 |
+
weight_filler {
|
794 |
+
type: "xavier"
|
795 |
+
}
|
796 |
+
dilation: 1
|
797 |
+
}
|
798 |
+
}
|
799 |
+
layer {
|
800 |
+
name: "batch_norm19"
|
801 |
+
type: "BatchNorm"
|
802 |
+
bottom: "conv_blob19"
|
803 |
+
top: "batch_norm_blob19"
|
804 |
+
batch_norm_param {
|
805 |
+
use_global_stats: true
|
806 |
+
eps: 9.9999997e-06
|
807 |
+
}
|
808 |
+
}
|
809 |
+
layer {
|
810 |
+
name: "bn_scale19"
|
811 |
+
type: "Scale"
|
812 |
+
bottom: "batch_norm_blob19"
|
813 |
+
top: "batch_norm_blob19"
|
814 |
+
scale_param {
|
815 |
+
bias_term: true
|
816 |
+
}
|
817 |
+
}
|
818 |
+
layer {
|
819 |
+
name: "relu19"
|
820 |
+
type: "ReLU"
|
821 |
+
bottom: "batch_norm_blob19"
|
822 |
+
top: "relu_blob19"
|
823 |
+
}
|
824 |
+
layer {
|
825 |
+
name: "conv20"
|
826 |
+
type: "Convolution"
|
827 |
+
bottom: "relu_blob19"
|
828 |
+
top: "conv_blob20"
|
829 |
+
convolution_param {
|
830 |
+
num_output: 128
|
831 |
+
bias_term: false
|
832 |
+
pad: 1
|
833 |
+
kernel_size: 3
|
834 |
+
group: 128
|
835 |
+
stride: 1
|
836 |
+
weight_filler {
|
837 |
+
type: "xavier"
|
838 |
+
}
|
839 |
+
dilation: 1
|
840 |
+
}
|
841 |
+
}
|
842 |
+
layer {
|
843 |
+
name: "batch_norm20"
|
844 |
+
type: "BatchNorm"
|
845 |
+
bottom: "conv_blob20"
|
846 |
+
top: "batch_norm_blob20"
|
847 |
+
batch_norm_param {
|
848 |
+
use_global_stats: true
|
849 |
+
eps: 9.9999997e-06
|
850 |
+
}
|
851 |
+
}
|
852 |
+
layer {
|
853 |
+
name: "bn_scale20"
|
854 |
+
type: "Scale"
|
855 |
+
bottom: "batch_norm_blob20"
|
856 |
+
top: "batch_norm_blob20"
|
857 |
+
scale_param {
|
858 |
+
bias_term: true
|
859 |
+
}
|
860 |
+
}
|
861 |
+
layer {
|
862 |
+
name: "relu20"
|
863 |
+
type: "ReLU"
|
864 |
+
bottom: "batch_norm_blob20"
|
865 |
+
top: "relu_blob20"
|
866 |
+
}
|
867 |
+
layer {
|
868 |
+
name: "conv21"
|
869 |
+
type: "Convolution"
|
870 |
+
bottom: "relu_blob20"
|
871 |
+
top: "conv_blob21"
|
872 |
+
convolution_param {
|
873 |
+
num_output: 128
|
874 |
+
bias_term: false
|
875 |
+
pad: 0
|
876 |
+
kernel_size: 1
|
877 |
+
group: 1
|
878 |
+
stride: 1
|
879 |
+
weight_filler {
|
880 |
+
type: "xavier"
|
881 |
+
}
|
882 |
+
dilation: 1
|
883 |
+
}
|
884 |
+
}
|
885 |
+
layer {
|
886 |
+
name: "batch_norm21"
|
887 |
+
type: "BatchNorm"
|
888 |
+
bottom: "conv_blob21"
|
889 |
+
top: "batch_norm_blob21"
|
890 |
+
batch_norm_param {
|
891 |
+
use_global_stats: true
|
892 |
+
eps: 9.9999997e-06
|
893 |
+
}
|
894 |
+
}
|
895 |
+
layer {
|
896 |
+
name: "bn_scale21"
|
897 |
+
type: "Scale"
|
898 |
+
bottom: "batch_norm_blob21"
|
899 |
+
top: "batch_norm_blob21"
|
900 |
+
scale_param {
|
901 |
+
bias_term: true
|
902 |
+
}
|
903 |
+
}
|
904 |
+
layer {
|
905 |
+
name: "relu21"
|
906 |
+
type: "ReLU"
|
907 |
+
bottom: "batch_norm_blob21"
|
908 |
+
top: "relu_blob21"
|
909 |
+
}
|
910 |
+
layer {
|
911 |
+
name: "conv22"
|
912 |
+
type: "Convolution"
|
913 |
+
bottom: "relu_blob21"
|
914 |
+
top: "conv_blob22"
|
915 |
+
convolution_param {
|
916 |
+
num_output: 128
|
917 |
+
bias_term: false
|
918 |
+
pad: 1
|
919 |
+
kernel_size: 3
|
920 |
+
group: 128
|
921 |
+
stride: 1
|
922 |
+
weight_filler {
|
923 |
+
type: "xavier"
|
924 |
+
}
|
925 |
+
dilation: 1
|
926 |
+
}
|
927 |
+
}
|
928 |
+
layer {
|
929 |
+
name: "batch_norm22"
|
930 |
+
type: "BatchNorm"
|
931 |
+
bottom: "conv_blob22"
|
932 |
+
top: "batch_norm_blob22"
|
933 |
+
batch_norm_param {
|
934 |
+
use_global_stats: true
|
935 |
+
eps: 9.9999997e-06
|
936 |
+
}
|
937 |
+
}
|
938 |
+
layer {
|
939 |
+
name: "bn_scale22"
|
940 |
+
type: "Scale"
|
941 |
+
bottom: "batch_norm_blob22"
|
942 |
+
top: "batch_norm_blob22"
|
943 |
+
scale_param {
|
944 |
+
bias_term: true
|
945 |
+
}
|
946 |
+
}
|
947 |
+
layer {
|
948 |
+
name: "relu22"
|
949 |
+
type: "ReLU"
|
950 |
+
bottom: "batch_norm_blob22"
|
951 |
+
top: "relu_blob22"
|
952 |
+
}
|
953 |
+
layer {
|
954 |
+
name: "conv23"
|
955 |
+
type: "Convolution"
|
956 |
+
bottom: "relu_blob22"
|
957 |
+
top: "conv_blob23"
|
958 |
+
convolution_param {
|
959 |
+
num_output: 128
|
960 |
+
bias_term: false
|
961 |
+
pad: 0
|
962 |
+
kernel_size: 1
|
963 |
+
group: 1
|
964 |
+
stride: 1
|
965 |
+
weight_filler {
|
966 |
+
type: "xavier"
|
967 |
+
}
|
968 |
+
dilation: 1
|
969 |
+
}
|
970 |
+
}
|
971 |
+
layer {
|
972 |
+
name: "batch_norm23"
|
973 |
+
type: "BatchNorm"
|
974 |
+
bottom: "conv_blob23"
|
975 |
+
top: "batch_norm_blob23"
|
976 |
+
batch_norm_param {
|
977 |
+
use_global_stats: true
|
978 |
+
eps: 9.9999997e-06
|
979 |
+
}
|
980 |
+
}
|
981 |
+
layer {
|
982 |
+
name: "bn_scale23"
|
983 |
+
type: "Scale"
|
984 |
+
bottom: "batch_norm_blob23"
|
985 |
+
top: "batch_norm_blob23"
|
986 |
+
scale_param {
|
987 |
+
bias_term: true
|
988 |
+
}
|
989 |
+
}
|
990 |
+
layer {
|
991 |
+
name: "relu23"
|
992 |
+
type: "ReLU"
|
993 |
+
bottom: "batch_norm_blob23"
|
994 |
+
top: "relu_blob23"
|
995 |
+
}
|
996 |
+
layer {
|
997 |
+
name: "conv24"
|
998 |
+
type: "Convolution"
|
999 |
+
bottom: "relu_blob23"
|
1000 |
+
top: "conv_blob24"
|
1001 |
+
convolution_param {
|
1002 |
+
num_output: 128
|
1003 |
+
bias_term: false
|
1004 |
+
pad: 1
|
1005 |
+
kernel_size: 3
|
1006 |
+
group: 128
|
1007 |
+
stride: 2
|
1008 |
+
weight_filler {
|
1009 |
+
type: "xavier"
|
1010 |
+
}
|
1011 |
+
dilation: 1
|
1012 |
+
}
|
1013 |
+
}
|
1014 |
+
layer {
|
1015 |
+
name: "batch_norm24"
|
1016 |
+
type: "BatchNorm"
|
1017 |
+
bottom: "conv_blob24"
|
1018 |
+
top: "batch_norm_blob24"
|
1019 |
+
batch_norm_param {
|
1020 |
+
use_global_stats: true
|
1021 |
+
eps: 9.9999997e-06
|
1022 |
+
}
|
1023 |
+
}
|
1024 |
+
layer {
|
1025 |
+
name: "bn_scale24"
|
1026 |
+
type: "Scale"
|
1027 |
+
bottom: "batch_norm_blob24"
|
1028 |
+
top: "batch_norm_blob24"
|
1029 |
+
scale_param {
|
1030 |
+
bias_term: true
|
1031 |
+
}
|
1032 |
+
}
|
1033 |
+
layer {
|
1034 |
+
name: "relu24"
|
1035 |
+
type: "ReLU"
|
1036 |
+
bottom: "batch_norm_blob24"
|
1037 |
+
top: "relu_blob24"
|
1038 |
+
}
|
1039 |
+
layer {
|
1040 |
+
name: "conv25"
|
1041 |
+
type: "Convolution"
|
1042 |
+
bottom: "relu_blob24"
|
1043 |
+
top: "conv_blob25"
|
1044 |
+
convolution_param {
|
1045 |
+
num_output: 256
|
1046 |
+
bias_term: false
|
1047 |
+
pad: 0
|
1048 |
+
kernel_size: 1
|
1049 |
+
group: 1
|
1050 |
+
stride: 1
|
1051 |
+
weight_filler {
|
1052 |
+
type: "xavier"
|
1053 |
+
}
|
1054 |
+
dilation: 1
|
1055 |
+
}
|
1056 |
+
}
|
1057 |
+
layer {
|
1058 |
+
name: "batch_norm25"
|
1059 |
+
type: "BatchNorm"
|
1060 |
+
bottom: "conv_blob25"
|
1061 |
+
top: "batch_norm_blob25"
|
1062 |
+
batch_norm_param {
|
1063 |
+
use_global_stats: true
|
1064 |
+
eps: 9.9999997e-06
|
1065 |
+
}
|
1066 |
+
}
|
1067 |
+
layer {
|
1068 |
+
name: "bn_scale25"
|
1069 |
+
type: "Scale"
|
1070 |
+
bottom: "batch_norm_blob25"
|
1071 |
+
top: "batch_norm_blob25"
|
1072 |
+
scale_param {
|
1073 |
+
bias_term: true
|
1074 |
+
}
|
1075 |
+
}
|
1076 |
+
layer {
|
1077 |
+
name: "relu25"
|
1078 |
+
type: "ReLU"
|
1079 |
+
bottom: "batch_norm_blob25"
|
1080 |
+
top: "relu_blob25"
|
1081 |
+
}
|
1082 |
+
layer {
|
1083 |
+
name: "conv26"
|
1084 |
+
type: "Convolution"
|
1085 |
+
bottom: "relu_blob25"
|
1086 |
+
top: "conv_blob26"
|
1087 |
+
convolution_param {
|
1088 |
+
num_output: 256
|
1089 |
+
bias_term: false
|
1090 |
+
pad: 1
|
1091 |
+
kernel_size: 3
|
1092 |
+
group: 256
|
1093 |
+
stride: 1
|
1094 |
+
weight_filler {
|
1095 |
+
type: "xavier"
|
1096 |
+
}
|
1097 |
+
dilation: 1
|
1098 |
+
}
|
1099 |
+
}
|
1100 |
+
layer {
|
1101 |
+
name: "batch_norm26"
|
1102 |
+
type: "BatchNorm"
|
1103 |
+
bottom: "conv_blob26"
|
1104 |
+
top: "batch_norm_blob26"
|
1105 |
+
batch_norm_param {
|
1106 |
+
use_global_stats: true
|
1107 |
+
eps: 9.9999997e-06
|
1108 |
+
}
|
1109 |
+
}
|
1110 |
+
layer {
|
1111 |
+
name: "bn_scale26"
|
1112 |
+
type: "Scale"
|
1113 |
+
bottom: "batch_norm_blob26"
|
1114 |
+
top: "batch_norm_blob26"
|
1115 |
+
scale_param {
|
1116 |
+
bias_term: true
|
1117 |
+
}
|
1118 |
+
}
|
1119 |
+
layer {
|
1120 |
+
name: "relu26"
|
1121 |
+
type: "ReLU"
|
1122 |
+
bottom: "batch_norm_blob26"
|
1123 |
+
top: "relu_blob26"
|
1124 |
+
}
|
1125 |
+
layer {
|
1126 |
+
name: "conv27"
|
1127 |
+
type: "Convolution"
|
1128 |
+
bottom: "relu_blob26"
|
1129 |
+
top: "conv_blob27"
|
1130 |
+
convolution_param {
|
1131 |
+
num_output: 256
|
1132 |
+
bias_term: false
|
1133 |
+
pad: 0
|
1134 |
+
kernel_size: 1
|
1135 |
+
group: 1
|
1136 |
+
stride: 1
|
1137 |
+
weight_filler {
|
1138 |
+
type: "xavier"
|
1139 |
+
}
|
1140 |
+
dilation: 1
|
1141 |
+
}
|
1142 |
+
}
|
1143 |
+
layer {
|
1144 |
+
name: "batch_norm27"
|
1145 |
+
type: "BatchNorm"
|
1146 |
+
bottom: "conv_blob27"
|
1147 |
+
top: "batch_norm_blob27"
|
1148 |
+
batch_norm_param {
|
1149 |
+
use_global_stats: true
|
1150 |
+
eps: 9.9999997e-06
|
1151 |
+
}
|
1152 |
+
}
|
1153 |
+
layer {
|
1154 |
+
name: "bn_scale27"
|
1155 |
+
type: "Scale"
|
1156 |
+
bottom: "batch_norm_blob27"
|
1157 |
+
top: "batch_norm_blob27"
|
1158 |
+
scale_param {
|
1159 |
+
bias_term: true
|
1160 |
+
}
|
1161 |
+
}
|
1162 |
+
layer {
|
1163 |
+
name: "relu27"
|
1164 |
+
type: "ReLU"
|
1165 |
+
bottom: "batch_norm_blob27"
|
1166 |
+
top: "relu_blob27"
|
1167 |
+
}
|
1168 |
+
layer {
|
1169 |
+
name: "conv28"
|
1170 |
+
type: "Convolution"
|
1171 |
+
bottom: "relu_blob11"
|
1172 |
+
top: "conv_blob28"
|
1173 |
+
convolution_param {
|
1174 |
+
num_output: 64
|
1175 |
+
bias_term: false
|
1176 |
+
pad: 0
|
1177 |
+
kernel_size: 1
|
1178 |
+
group: 1
|
1179 |
+
stride: 1
|
1180 |
+
weight_filler {
|
1181 |
+
type: "xavier"
|
1182 |
+
}
|
1183 |
+
dilation: 1
|
1184 |
+
}
|
1185 |
+
}
|
1186 |
+
layer {
|
1187 |
+
name: "batch_norm28"
|
1188 |
+
type: "BatchNorm"
|
1189 |
+
bottom: "conv_blob28"
|
1190 |
+
top: "batch_norm_blob28"
|
1191 |
+
batch_norm_param {
|
1192 |
+
use_global_stats: true
|
1193 |
+
eps: 9.9999997e-06
|
1194 |
+
}
|
1195 |
+
}
|
1196 |
+
layer {
|
1197 |
+
name: "bn_scale28"
|
1198 |
+
type: "Scale"
|
1199 |
+
bottom: "batch_norm_blob28"
|
1200 |
+
top: "batch_norm_blob28"
|
1201 |
+
scale_param {
|
1202 |
+
bias_term: true
|
1203 |
+
}
|
1204 |
+
}
|
1205 |
+
layer {
|
1206 |
+
name: "relu28"
|
1207 |
+
type: "ReLU"
|
1208 |
+
bottom: "batch_norm_blob28"
|
1209 |
+
top: "relu_blob28"
|
1210 |
+
}
|
1211 |
+
layer {
|
1212 |
+
name: "conv29"
|
1213 |
+
type: "Convolution"
|
1214 |
+
bottom: "relu_blob23"
|
1215 |
+
top: "conv_blob29"
|
1216 |
+
convolution_param {
|
1217 |
+
num_output: 64
|
1218 |
+
bias_term: false
|
1219 |
+
pad: 0
|
1220 |
+
kernel_size: 1
|
1221 |
+
group: 1
|
1222 |
+
stride: 1
|
1223 |
+
weight_filler {
|
1224 |
+
type: "xavier"
|
1225 |
+
}
|
1226 |
+
dilation: 1
|
1227 |
+
}
|
1228 |
+
}
|
1229 |
+
layer {
|
1230 |
+
name: "batch_norm29"
|
1231 |
+
type: "BatchNorm"
|
1232 |
+
bottom: "conv_blob29"
|
1233 |
+
top: "batch_norm_blob29"
|
1234 |
+
batch_norm_param {
|
1235 |
+
use_global_stats: true
|
1236 |
+
eps: 9.9999997e-06
|
1237 |
+
}
|
1238 |
+
}
|
1239 |
+
layer {
|
1240 |
+
name: "bn_scale29"
|
1241 |
+
type: "Scale"
|
1242 |
+
bottom: "batch_norm_blob29"
|
1243 |
+
top: "batch_norm_blob29"
|
1244 |
+
scale_param {
|
1245 |
+
bias_term: true
|
1246 |
+
}
|
1247 |
+
}
|
1248 |
+
layer {
|
1249 |
+
name: "relu29"
|
1250 |
+
type: "ReLU"
|
1251 |
+
bottom: "batch_norm_blob29"
|
1252 |
+
top: "relu_blob29"
|
1253 |
+
}
|
1254 |
+
layer {
|
1255 |
+
name: "conv30"
|
1256 |
+
type: "Convolution"
|
1257 |
+
bottom: "relu_blob27"
|
1258 |
+
top: "conv_blob30"
|
1259 |
+
convolution_param {
|
1260 |
+
num_output: 64
|
1261 |
+
bias_term: false
|
1262 |
+
pad: 0
|
1263 |
+
kernel_size: 1
|
1264 |
+
group: 1
|
1265 |
+
stride: 1
|
1266 |
+
weight_filler {
|
1267 |
+
type: "xavier"
|
1268 |
+
}
|
1269 |
+
dilation: 1
|
1270 |
+
}
|
1271 |
+
}
|
1272 |
+
layer {
|
1273 |
+
name: "batch_norm30"
|
1274 |
+
type: "BatchNorm"
|
1275 |
+
bottom: "conv_blob30"
|
1276 |
+
top: "batch_norm_blob30"
|
1277 |
+
batch_norm_param {
|
1278 |
+
use_global_stats: true
|
1279 |
+
eps: 9.9999997e-06
|
1280 |
+
}
|
1281 |
+
}
|
1282 |
+
layer {
|
1283 |
+
name: "bn_scale30"
|
1284 |
+
type: "Scale"
|
1285 |
+
bottom: "batch_norm_blob30"
|
1286 |
+
top: "batch_norm_blob30"
|
1287 |
+
scale_param {
|
1288 |
+
bias_term: true
|
1289 |
+
}
|
1290 |
+
}
|
1291 |
+
layer {
|
1292 |
+
name: "relu30"
|
1293 |
+
type: "ReLU"
|
1294 |
+
bottom: "batch_norm_blob30"
|
1295 |
+
top: "relu_blob30"
|
1296 |
+
}
|
1297 |
+
layer {
|
1298 |
+
name: "conv_transpose1"
|
1299 |
+
type: "Deconvolution"
|
1300 |
+
bottom: "relu_blob30"
|
1301 |
+
top: "conv_transpose_blob1"
|
1302 |
+
convolution_param {
|
1303 |
+
num_output: 64
|
1304 |
+
bias_term: true
|
1305 |
+
pad: 0
|
1306 |
+
kernel_size: 2
|
1307 |
+
group: 1
|
1308 |
+
stride: 2
|
1309 |
+
weight_filler {
|
1310 |
+
type: "xavier"
|
1311 |
+
}
|
1312 |
+
bias_filler {
|
1313 |
+
type: "constant"
|
1314 |
+
}
|
1315 |
+
dilation: 1
|
1316 |
+
}
|
1317 |
+
}
|
1318 |
+
layer {
|
1319 |
+
name: "crop1"
|
1320 |
+
type: "Crop"
|
1321 |
+
bottom: "conv_transpose_blob1"
|
1322 |
+
bottom: "relu_blob29"
|
1323 |
+
top: "crop1"
|
1324 |
+
}
|
1325 |
+
layer {
|
1326 |
+
name: "add1"
|
1327 |
+
type: "Eltwise"
|
1328 |
+
bottom: "relu_blob29"
|
1329 |
+
bottom: "crop1"
|
1330 |
+
top: "add_blob1"
|
1331 |
+
eltwise_param {
|
1332 |
+
operation: SUM
|
1333 |
+
}
|
1334 |
+
}
|
1335 |
+
layer {
|
1336 |
+
name: "conv31"
|
1337 |
+
type: "Convolution"
|
1338 |
+
bottom: "add_blob1"
|
1339 |
+
top: "conv_blob31"
|
1340 |
+
convolution_param {
|
1341 |
+
num_output: 64
|
1342 |
+
bias_term: false
|
1343 |
+
pad: 1
|
1344 |
+
kernel_size: 3
|
1345 |
+
group: 1
|
1346 |
+
stride: 1
|
1347 |
+
weight_filler {
|
1348 |
+
type: "xavier"
|
1349 |
+
}
|
1350 |
+
dilation: 1
|
1351 |
+
}
|
1352 |
+
}
|
1353 |
+
layer {
|
1354 |
+
name: "batch_norm31"
|
1355 |
+
type: "BatchNorm"
|
1356 |
+
bottom: "conv_blob31"
|
1357 |
+
top: "batch_norm_blob31"
|
1358 |
+
batch_norm_param {
|
1359 |
+
use_global_stats: true
|
1360 |
+
eps: 9.9999997e-06
|
1361 |
+
}
|
1362 |
+
}
|
1363 |
+
layer {
|
1364 |
+
name: "bn_scale31"
|
1365 |
+
type: "Scale"
|
1366 |
+
bottom: "batch_norm_blob31"
|
1367 |
+
top: "batch_norm_blob31"
|
1368 |
+
scale_param {
|
1369 |
+
bias_term: true
|
1370 |
+
}
|
1371 |
+
}
|
1372 |
+
layer {
|
1373 |
+
name: "relu31"
|
1374 |
+
type: "ReLU"
|
1375 |
+
bottom: "batch_norm_blob31"
|
1376 |
+
top: "relu_blob31"
|
1377 |
+
}
|
1378 |
+
layer {
|
1379 |
+
name: "conv_transpose2"
|
1380 |
+
type: "Deconvolution"
|
1381 |
+
bottom: "relu_blob31"
|
1382 |
+
top: "conv_transpose_blob2"
|
1383 |
+
convolution_param {
|
1384 |
+
num_output: 64
|
1385 |
+
bias_term: true
|
1386 |
+
pad: 0
|
1387 |
+
kernel_size: 2
|
1388 |
+
group: 1
|
1389 |
+
stride: 2
|
1390 |
+
weight_filler {
|
1391 |
+
type: "xavier"
|
1392 |
+
}
|
1393 |
+
bias_filler {
|
1394 |
+
type: "constant"
|
1395 |
+
}
|
1396 |
+
dilation: 1
|
1397 |
+
}
|
1398 |
+
}
|
1399 |
+
layer {
|
1400 |
+
name: "crop2"
|
1401 |
+
type: "Crop"
|
1402 |
+
bottom: "conv_transpose_blob2"
|
1403 |
+
bottom: "relu_blob28"
|
1404 |
+
top: "crop2"
|
1405 |
+
}
|
1406 |
+
layer {
|
1407 |
+
name: "add2"
|
1408 |
+
type: "Eltwise"
|
1409 |
+
bottom: "relu_blob28"
|
1410 |
+
bottom: "crop2"
|
1411 |
+
top: "add_blob2"
|
1412 |
+
eltwise_param {
|
1413 |
+
operation: SUM
|
1414 |
+
}
|
1415 |
+
}
|
1416 |
+
layer {
|
1417 |
+
name: "conv32"
|
1418 |
+
type: "Convolution"
|
1419 |
+
bottom: "add_blob2"
|
1420 |
+
top: "conv_blob32"
|
1421 |
+
convolution_param {
|
1422 |
+
num_output: 64
|
1423 |
+
bias_term: false
|
1424 |
+
pad: 1
|
1425 |
+
kernel_size: 3
|
1426 |
+
group: 1
|
1427 |
+
stride: 1
|
1428 |
+
weight_filler {
|
1429 |
+
type: "xavier"
|
1430 |
+
}
|
1431 |
+
dilation: 1
|
1432 |
+
}
|
1433 |
+
}
|
1434 |
+
layer {
|
1435 |
+
name: "batch_norm32"
|
1436 |
+
type: "BatchNorm"
|
1437 |
+
bottom: "conv_blob32"
|
1438 |
+
top: "batch_norm_blob32"
|
1439 |
+
batch_norm_param {
|
1440 |
+
use_global_stats: true
|
1441 |
+
eps: 9.9999997e-06
|
1442 |
+
}
|
1443 |
+
}
|
1444 |
+
layer {
|
1445 |
+
name: "bn_scale32"
|
1446 |
+
type: "Scale"
|
1447 |
+
bottom: "batch_norm_blob32"
|
1448 |
+
top: "batch_norm_blob32"
|
1449 |
+
scale_param {
|
1450 |
+
bias_term: true
|
1451 |
+
}
|
1452 |
+
}
|
1453 |
+
layer {
|
1454 |
+
name: "relu32"
|
1455 |
+
type: "ReLU"
|
1456 |
+
bottom: "batch_norm_blob32"
|
1457 |
+
top: "relu_blob32"
|
1458 |
+
}
|
1459 |
+
layer {
|
1460 |
+
name: "conv33"
|
1461 |
+
type: "Convolution"
|
1462 |
+
bottom: "relu_blob32"
|
1463 |
+
top: "conv_blob33"
|
1464 |
+
convolution_param {
|
1465 |
+
num_output: 32
|
1466 |
+
bias_term: false
|
1467 |
+
pad: 1
|
1468 |
+
kernel_size: 3
|
1469 |
+
group: 1
|
1470 |
+
stride: 1
|
1471 |
+
weight_filler {
|
1472 |
+
type: "xavier"
|
1473 |
+
}
|
1474 |
+
dilation: 1
|
1475 |
+
}
|
1476 |
+
}
|
1477 |
+
layer {
|
1478 |
+
name: "batch_norm33"
|
1479 |
+
type: "BatchNorm"
|
1480 |
+
bottom: "conv_blob33"
|
1481 |
+
top: "batch_norm_blob33"
|
1482 |
+
batch_norm_param {
|
1483 |
+
use_global_stats: true
|
1484 |
+
eps: 9.9999997e-06
|
1485 |
+
}
|
1486 |
+
}
|
1487 |
+
layer {
|
1488 |
+
name: "bn_scale33"
|
1489 |
+
type: "Scale"
|
1490 |
+
bottom: "batch_norm_blob33"
|
1491 |
+
top: "batch_norm_blob33"
|
1492 |
+
scale_param {
|
1493 |
+
bias_term: true
|
1494 |
+
}
|
1495 |
+
}
|
1496 |
+
layer {
|
1497 |
+
name: "conv34"
|
1498 |
+
type: "Convolution"
|
1499 |
+
bottom: "relu_blob32"
|
1500 |
+
top: "conv_blob34"
|
1501 |
+
convolution_param {
|
1502 |
+
num_output: 16
|
1503 |
+
bias_term: false
|
1504 |
+
pad: 1
|
1505 |
+
kernel_size: 3
|
1506 |
+
group: 1
|
1507 |
+
stride: 1
|
1508 |
+
weight_filler {
|
1509 |
+
type: "xavier"
|
1510 |
+
}
|
1511 |
+
dilation: 1
|
1512 |
+
}
|
1513 |
+
}
|
1514 |
+
layer {
|
1515 |
+
name: "batch_norm34"
|
1516 |
+
type: "BatchNorm"
|
1517 |
+
bottom: "conv_blob34"
|
1518 |
+
top: "batch_norm_blob34"
|
1519 |
+
batch_norm_param {
|
1520 |
+
use_global_stats: true
|
1521 |
+
eps: 9.9999997e-06
|
1522 |
+
}
|
1523 |
+
}
|
1524 |
+
layer {
|
1525 |
+
name: "bn_scale34"
|
1526 |
+
type: "Scale"
|
1527 |
+
bottom: "batch_norm_blob34"
|
1528 |
+
top: "batch_norm_blob34"
|
1529 |
+
scale_param {
|
1530 |
+
bias_term: true
|
1531 |
+
}
|
1532 |
+
}
|
1533 |
+
layer {
|
1534 |
+
name: "relu33"
|
1535 |
+
type: "ReLU"
|
1536 |
+
bottom: "batch_norm_blob34"
|
1537 |
+
top: "relu_blob33"
|
1538 |
+
}
|
1539 |
+
layer {
|
1540 |
+
name: "conv35"
|
1541 |
+
type: "Convolution"
|
1542 |
+
bottom: "relu_blob33"
|
1543 |
+
top: "conv_blob35"
|
1544 |
+
convolution_param {
|
1545 |
+
num_output: 16
|
1546 |
+
bias_term: false
|
1547 |
+
pad: 1
|
1548 |
+
kernel_size: 3
|
1549 |
+
group: 1
|
1550 |
+
stride: 1
|
1551 |
+
weight_filler {
|
1552 |
+
type: "xavier"
|
1553 |
+
}
|
1554 |
+
dilation: 1
|
1555 |
+
}
|
1556 |
+
}
|
1557 |
+
layer {
|
1558 |
+
name: "batch_norm35"
|
1559 |
+
type: "BatchNorm"
|
1560 |
+
bottom: "conv_blob35"
|
1561 |
+
top: "batch_norm_blob35"
|
1562 |
+
batch_norm_param {
|
1563 |
+
use_global_stats: true
|
1564 |
+
eps: 9.9999997e-06
|
1565 |
+
}
|
1566 |
+
}
|
1567 |
+
layer {
|
1568 |
+
name: "bn_scale35"
|
1569 |
+
type: "Scale"
|
1570 |
+
bottom: "batch_norm_blob35"
|
1571 |
+
top: "batch_norm_blob35"
|
1572 |
+
scale_param {
|
1573 |
+
bias_term: true
|
1574 |
+
}
|
1575 |
+
}
|
1576 |
+
layer {
|
1577 |
+
name: "conv36"
|
1578 |
+
type: "Convolution"
|
1579 |
+
bottom: "relu_blob33"
|
1580 |
+
top: "conv_blob36"
|
1581 |
+
convolution_param {
|
1582 |
+
num_output: 16
|
1583 |
+
bias_term: false
|
1584 |
+
pad: 1
|
1585 |
+
kernel_size: 3
|
1586 |
+
group: 1
|
1587 |
+
stride: 1
|
1588 |
+
weight_filler {
|
1589 |
+
type: "xavier"
|
1590 |
+
}
|
1591 |
+
dilation: 1
|
1592 |
+
}
|
1593 |
+
}
|
1594 |
+
layer {
|
1595 |
+
name: "batch_norm36"
|
1596 |
+
type: "BatchNorm"
|
1597 |
+
bottom: "conv_blob36"
|
1598 |
+
top: "batch_norm_blob36"
|
1599 |
+
batch_norm_param {
|
1600 |
+
use_global_stats: true
|
1601 |
+
eps: 9.9999997e-06
|
1602 |
+
}
|
1603 |
+
}
|
1604 |
+
layer {
|
1605 |
+
name: "bn_scale36"
|
1606 |
+
type: "Scale"
|
1607 |
+
bottom: "batch_norm_blob36"
|
1608 |
+
top: "batch_norm_blob36"
|
1609 |
+
scale_param {
|
1610 |
+
bias_term: true
|
1611 |
+
}
|
1612 |
+
}
|
1613 |
+
layer {
|
1614 |
+
name: "relu34"
|
1615 |
+
type: "ReLU"
|
1616 |
+
bottom: "batch_norm_blob36"
|
1617 |
+
top: "relu_blob34"
|
1618 |
+
}
|
1619 |
+
layer {
|
1620 |
+
name: "conv37"
|
1621 |
+
type: "Convolution"
|
1622 |
+
bottom: "relu_blob34"
|
1623 |
+
top: "conv_blob37"
|
1624 |
+
convolution_param {
|
1625 |
+
num_output: 16
|
1626 |
+
bias_term: false
|
1627 |
+
pad: 1
|
1628 |
+
kernel_size: 3
|
1629 |
+
group: 1
|
1630 |
+
stride: 1
|
1631 |
+
weight_filler {
|
1632 |
+
type: "xavier"
|
1633 |
+
}
|
1634 |
+
dilation: 1
|
1635 |
+
}
|
1636 |
+
}
|
1637 |
+
layer {
|
1638 |
+
name: "batch_norm37"
|
1639 |
+
type: "BatchNorm"
|
1640 |
+
bottom: "conv_blob37"
|
1641 |
+
top: "batch_norm_blob37"
|
1642 |
+
batch_norm_param {
|
1643 |
+
use_global_stats: true
|
1644 |
+
eps: 9.9999997e-06
|
1645 |
+
}
|
1646 |
+
}
|
1647 |
+
layer {
|
1648 |
+
name: "bn_scale37"
|
1649 |
+
type: "Scale"
|
1650 |
+
bottom: "batch_norm_blob37"
|
1651 |
+
top: "batch_norm_blob37"
|
1652 |
+
scale_param {
|
1653 |
+
bias_term: true
|
1654 |
+
}
|
1655 |
+
}
|
1656 |
+
layer {
|
1657 |
+
name: "cat1"
|
1658 |
+
type: "Concat"
|
1659 |
+
bottom: "batch_norm_blob33"
|
1660 |
+
bottom: "batch_norm_blob35"
|
1661 |
+
bottom: "batch_norm_blob37"
|
1662 |
+
top: "cat_blob1"
|
1663 |
+
concat_param {
|
1664 |
+
axis: 1
|
1665 |
+
}
|
1666 |
+
}
|
1667 |
+
layer {
|
1668 |
+
name: "relu35"
|
1669 |
+
type: "ReLU"
|
1670 |
+
bottom: "cat_blob1"
|
1671 |
+
top: "relu_blob35"
|
1672 |
+
}
|
1673 |
+
layer {
|
1674 |
+
name: "conv38"
|
1675 |
+
type: "Convolution"
|
1676 |
+
bottom: "relu_blob31"
|
1677 |
+
top: "conv_blob38"
|
1678 |
+
convolution_param {
|
1679 |
+
num_output: 32
|
1680 |
+
bias_term: false
|
1681 |
+
pad: 1
|
1682 |
+
kernel_size: 3
|
1683 |
+
group: 1
|
1684 |
+
stride: 1
|
1685 |
+
weight_filler {
|
1686 |
+
type: "xavier"
|
1687 |
+
}
|
1688 |
+
dilation: 1
|
1689 |
+
}
|
1690 |
+
}
|
1691 |
+
layer {
|
1692 |
+
name: "batch_norm38"
|
1693 |
+
type: "BatchNorm"
|
1694 |
+
bottom: "conv_blob38"
|
1695 |
+
top: "batch_norm_blob38"
|
1696 |
+
batch_norm_param {
|
1697 |
+
use_global_stats: true
|
1698 |
+
eps: 9.9999997e-06
|
1699 |
+
}
|
1700 |
+
}
|
1701 |
+
layer {
|
1702 |
+
name: "bn_scale38"
|
1703 |
+
type: "Scale"
|
1704 |
+
bottom: "batch_norm_blob38"
|
1705 |
+
top: "batch_norm_blob38"
|
1706 |
+
scale_param {
|
1707 |
+
bias_term: true
|
1708 |
+
}
|
1709 |
+
}
|
1710 |
+
layer {
|
1711 |
+
name: "conv39"
|
1712 |
+
type: "Convolution"
|
1713 |
+
bottom: "relu_blob31"
|
1714 |
+
top: "conv_blob39"
|
1715 |
+
convolution_param {
|
1716 |
+
num_output: 16
|
1717 |
+
bias_term: false
|
1718 |
+
pad: 1
|
1719 |
+
kernel_size: 3
|
1720 |
+
group: 1
|
1721 |
+
stride: 1
|
1722 |
+
weight_filler {
|
1723 |
+
type: "xavier"
|
1724 |
+
}
|
1725 |
+
dilation: 1
|
1726 |
+
}
|
1727 |
+
}
|
1728 |
+
layer {
|
1729 |
+
name: "batch_norm39"
|
1730 |
+
type: "BatchNorm"
|
1731 |
+
bottom: "conv_blob39"
|
1732 |
+
top: "batch_norm_blob39"
|
1733 |
+
batch_norm_param {
|
1734 |
+
use_global_stats: true
|
1735 |
+
eps: 9.9999997e-06
|
1736 |
+
}
|
1737 |
+
}
|
1738 |
+
layer {
|
1739 |
+
name: "bn_scale39"
|
1740 |
+
type: "Scale"
|
1741 |
+
bottom: "batch_norm_blob39"
|
1742 |
+
top: "batch_norm_blob39"
|
1743 |
+
scale_param {
|
1744 |
+
bias_term: true
|
1745 |
+
}
|
1746 |
+
}
|
1747 |
+
layer {
|
1748 |
+
name: "relu36"
|
1749 |
+
type: "ReLU"
|
1750 |
+
bottom: "batch_norm_blob39"
|
1751 |
+
top: "relu_blob36"
|
1752 |
+
}
|
1753 |
+
layer {
|
1754 |
+
name: "conv40"
|
1755 |
+
type: "Convolution"
|
1756 |
+
bottom: "relu_blob36"
|
1757 |
+
top: "conv_blob40"
|
1758 |
+
convolution_param {
|
1759 |
+
num_output: 16
|
1760 |
+
bias_term: false
|
1761 |
+
pad: 1
|
1762 |
+
kernel_size: 3
|
1763 |
+
group: 1
|
1764 |
+
stride: 1
|
1765 |
+
weight_filler {
|
1766 |
+
type: "xavier"
|
1767 |
+
}
|
1768 |
+
dilation: 1
|
1769 |
+
}
|
1770 |
+
}
|
1771 |
+
layer {
|
1772 |
+
name: "batch_norm40"
|
1773 |
+
type: "BatchNorm"
|
1774 |
+
bottom: "conv_blob40"
|
1775 |
+
top: "batch_norm_blob40"
|
1776 |
+
batch_norm_param {
|
1777 |
+
use_global_stats: true
|
1778 |
+
eps: 9.9999997e-06
|
1779 |
+
}
|
1780 |
+
}
|
1781 |
+
layer {
|
1782 |
+
name: "bn_scale40"
|
1783 |
+
type: "Scale"
|
1784 |
+
bottom: "batch_norm_blob40"
|
1785 |
+
top: "batch_norm_blob40"
|
1786 |
+
scale_param {
|
1787 |
+
bias_term: true
|
1788 |
+
}
|
1789 |
+
}
|
1790 |
+
layer {
|
1791 |
+
name: "conv41"
|
1792 |
+
type: "Convolution"
|
1793 |
+
bottom: "relu_blob36"
|
1794 |
+
top: "conv_blob41"
|
1795 |
+
convolution_param {
|
1796 |
+
num_output: 16
|
1797 |
+
bias_term: false
|
1798 |
+
pad: 1
|
1799 |
+
kernel_size: 3
|
1800 |
+
group: 1
|
1801 |
+
stride: 1
|
1802 |
+
weight_filler {
|
1803 |
+
type: "xavier"
|
1804 |
+
}
|
1805 |
+
dilation: 1
|
1806 |
+
}
|
1807 |
+
}
|
1808 |
+
layer {
|
1809 |
+
name: "batch_norm41"
|
1810 |
+
type: "BatchNorm"
|
1811 |
+
bottom: "conv_blob41"
|
1812 |
+
top: "batch_norm_blob41"
|
1813 |
+
batch_norm_param {
|
1814 |
+
use_global_stats: true
|
1815 |
+
eps: 9.9999997e-06
|
1816 |
+
}
|
1817 |
+
}
|
1818 |
+
layer {
|
1819 |
+
name: "bn_scale41"
|
1820 |
+
type: "Scale"
|
1821 |
+
bottom: "batch_norm_blob41"
|
1822 |
+
top: "batch_norm_blob41"
|
1823 |
+
scale_param {
|
1824 |
+
bias_term: true
|
1825 |
+
}
|
1826 |
+
}
|
1827 |
+
layer {
|
1828 |
+
name: "relu37"
|
1829 |
+
type: "ReLU"
|
1830 |
+
bottom: "batch_norm_blob41"
|
1831 |
+
top: "relu_blob37"
|
1832 |
+
}
|
1833 |
+
layer {
|
1834 |
+
name: "conv42"
|
1835 |
+
type: "Convolution"
|
1836 |
+
bottom: "relu_blob37"
|
1837 |
+
top: "conv_blob42"
|
1838 |
+
convolution_param {
|
1839 |
+
num_output: 16
|
1840 |
+
bias_term: false
|
1841 |
+
pad: 1
|
1842 |
+
kernel_size: 3
|
1843 |
+
group: 1
|
1844 |
+
stride: 1
|
1845 |
+
weight_filler {
|
1846 |
+
type: "xavier"
|
1847 |
+
}
|
1848 |
+
dilation: 1
|
1849 |
+
}
|
1850 |
+
}
|
1851 |
+
layer {
|
1852 |
+
name: "batch_norm42"
|
1853 |
+
type: "BatchNorm"
|
1854 |
+
bottom: "conv_blob42"
|
1855 |
+
top: "batch_norm_blob42"
|
1856 |
+
batch_norm_param {
|
1857 |
+
use_global_stats: true
|
1858 |
+
eps: 9.9999997e-06
|
1859 |
+
}
|
1860 |
+
}
|
1861 |
+
layer {
|
1862 |
+
name: "bn_scale42"
|
1863 |
+
type: "Scale"
|
1864 |
+
bottom: "batch_norm_blob42"
|
1865 |
+
top: "batch_norm_blob42"
|
1866 |
+
scale_param {
|
1867 |
+
bias_term: true
|
1868 |
+
}
|
1869 |
+
}
|
1870 |
+
layer {
|
1871 |
+
name: "cat2"
|
1872 |
+
type: "Concat"
|
1873 |
+
bottom: "batch_norm_blob38"
|
1874 |
+
bottom: "batch_norm_blob40"
|
1875 |
+
bottom: "batch_norm_blob42"
|
1876 |
+
top: "cat_blob2"
|
1877 |
+
concat_param {
|
1878 |
+
axis: 1
|
1879 |
+
}
|
1880 |
+
}
|
1881 |
+
layer {
|
1882 |
+
name: "relu38"
|
1883 |
+
type: "ReLU"
|
1884 |
+
bottom: "cat_blob2"
|
1885 |
+
top: "relu_blob38"
|
1886 |
+
}
|
1887 |
+
layer {
|
1888 |
+
name: "conv43"
|
1889 |
+
type: "Convolution"
|
1890 |
+
bottom: "relu_blob30"
|
1891 |
+
top: "conv_blob43"
|
1892 |
+
convolution_param {
|
1893 |
+
num_output: 32
|
1894 |
+
bias_term: false
|
1895 |
+
pad: 1
|
1896 |
+
kernel_size: 3
|
1897 |
+
group: 1
|
1898 |
+
stride: 1
|
1899 |
+
weight_filler {
|
1900 |
+
type: "xavier"
|
1901 |
+
}
|
1902 |
+
dilation: 1
|
1903 |
+
}
|
1904 |
+
}
|
1905 |
+
layer {
|
1906 |
+
name: "batch_norm43"
|
1907 |
+
type: "BatchNorm"
|
1908 |
+
bottom: "conv_blob43"
|
1909 |
+
top: "batch_norm_blob43"
|
1910 |
+
batch_norm_param {
|
1911 |
+
use_global_stats: true
|
1912 |
+
eps: 9.9999997e-06
|
1913 |
+
}
|
1914 |
+
}
|
1915 |
+
layer {
|
1916 |
+
name: "bn_scale43"
|
1917 |
+
type: "Scale"
|
1918 |
+
bottom: "batch_norm_blob43"
|
1919 |
+
top: "batch_norm_blob43"
|
1920 |
+
scale_param {
|
1921 |
+
bias_term: true
|
1922 |
+
}
|
1923 |
+
}
|
1924 |
+
layer {
|
1925 |
+
name: "conv44"
|
1926 |
+
type: "Convolution"
|
1927 |
+
bottom: "relu_blob30"
|
1928 |
+
top: "conv_blob44"
|
1929 |
+
convolution_param {
|
1930 |
+
num_output: 16
|
1931 |
+
bias_term: false
|
1932 |
+
pad: 1
|
1933 |
+
kernel_size: 3
|
1934 |
+
group: 1
|
1935 |
+
stride: 1
|
1936 |
+
weight_filler {
|
1937 |
+
type: "xavier"
|
1938 |
+
}
|
1939 |
+
dilation: 1
|
1940 |
+
}
|
1941 |
+
}
|
1942 |
+
layer {
|
1943 |
+
name: "batch_norm44"
|
1944 |
+
type: "BatchNorm"
|
1945 |
+
bottom: "conv_blob44"
|
1946 |
+
top: "batch_norm_blob44"
|
1947 |
+
batch_norm_param {
|
1948 |
+
use_global_stats: true
|
1949 |
+
eps: 9.9999997e-06
|
1950 |
+
}
|
1951 |
+
}
|
1952 |
+
layer {
|
1953 |
+
name: "bn_scale44"
|
1954 |
+
type: "Scale"
|
1955 |
+
bottom: "batch_norm_blob44"
|
1956 |
+
top: "batch_norm_blob44"
|
1957 |
+
scale_param {
|
1958 |
+
bias_term: true
|
1959 |
+
}
|
1960 |
+
}
|
1961 |
+
layer {
|
1962 |
+
name: "relu39"
|
1963 |
+
type: "ReLU"
|
1964 |
+
bottom: "batch_norm_blob44"
|
1965 |
+
top: "relu_blob39"
|
1966 |
+
}
|
1967 |
+
layer {
|
1968 |
+
name: "conv45"
|
1969 |
+
type: "Convolution"
|
1970 |
+
bottom: "relu_blob39"
|
1971 |
+
top: "conv_blob45"
|
1972 |
+
convolution_param {
|
1973 |
+
num_output: 16
|
1974 |
+
bias_term: false
|
1975 |
+
pad: 1
|
1976 |
+
kernel_size: 3
|
1977 |
+
group: 1
|
1978 |
+
stride: 1
|
1979 |
+
weight_filler {
|
1980 |
+
type: "xavier"
|
1981 |
+
}
|
1982 |
+
dilation: 1
|
1983 |
+
}
|
1984 |
+
}
|
1985 |
+
layer {
|
1986 |
+
name: "batch_norm45"
|
1987 |
+
type: "BatchNorm"
|
1988 |
+
bottom: "conv_blob45"
|
1989 |
+
top: "batch_norm_blob45"
|
1990 |
+
batch_norm_param {
|
1991 |
+
use_global_stats: true
|
1992 |
+
eps: 9.9999997e-06
|
1993 |
+
}
|
1994 |
+
}
|
1995 |
+
layer {
|
1996 |
+
name: "bn_scale45"
|
1997 |
+
type: "Scale"
|
1998 |
+
bottom: "batch_norm_blob45"
|
1999 |
+
top: "batch_norm_blob45"
|
2000 |
+
scale_param {
|
2001 |
+
bias_term: true
|
2002 |
+
}
|
2003 |
+
}
|
2004 |
+
layer {
|
2005 |
+
name: "conv46"
|
2006 |
+
type: "Convolution"
|
2007 |
+
bottom: "relu_blob39"
|
2008 |
+
top: "conv_blob46"
|
2009 |
+
convolution_param {
|
2010 |
+
num_output: 16
|
2011 |
+
bias_term: false
|
2012 |
+
pad: 1
|
2013 |
+
kernel_size: 3
|
2014 |
+
group: 1
|
2015 |
+
stride: 1
|
2016 |
+
weight_filler {
|
2017 |
+
type: "xavier"
|
2018 |
+
}
|
2019 |
+
dilation: 1
|
2020 |
+
}
|
2021 |
+
}
|
2022 |
+
layer {
|
2023 |
+
name: "batch_norm46"
|
2024 |
+
type: "BatchNorm"
|
2025 |
+
bottom: "conv_blob46"
|
2026 |
+
top: "batch_norm_blob46"
|
2027 |
+
batch_norm_param {
|
2028 |
+
use_global_stats: true
|
2029 |
+
eps: 9.9999997e-06
|
2030 |
+
}
|
2031 |
+
}
|
2032 |
+
layer {
|
2033 |
+
name: "bn_scale46"
|
2034 |
+
type: "Scale"
|
2035 |
+
bottom: "batch_norm_blob46"
|
2036 |
+
top: "batch_norm_blob46"
|
2037 |
+
scale_param {
|
2038 |
+
bias_term: true
|
2039 |
+
}
|
2040 |
+
}
|
2041 |
+
layer {
|
2042 |
+
name: "relu40"
|
2043 |
+
type: "ReLU"
|
2044 |
+
bottom: "batch_norm_blob46"
|
2045 |
+
top: "relu_blob40"
|
2046 |
+
}
|
2047 |
+
layer {
|
2048 |
+
name: "conv47"
|
2049 |
+
type: "Convolution"
|
2050 |
+
bottom: "relu_blob40"
|
2051 |
+
top: "conv_blob47"
|
2052 |
+
convolution_param {
|
2053 |
+
num_output: 16
|
2054 |
+
bias_term: false
|
2055 |
+
pad: 1
|
2056 |
+
kernel_size: 3
|
2057 |
+
group: 1
|
2058 |
+
stride: 1
|
2059 |
+
weight_filler {
|
2060 |
+
type: "xavier"
|
2061 |
+
}
|
2062 |
+
dilation: 1
|
2063 |
+
}
|
2064 |
+
}
|
2065 |
+
layer {
|
2066 |
+
name: "batch_norm47"
|
2067 |
+
type: "BatchNorm"
|
2068 |
+
bottom: "conv_blob47"
|
2069 |
+
top: "batch_norm_blob47"
|
2070 |
+
batch_norm_param {
|
2071 |
+
use_global_stats: true
|
2072 |
+
eps: 9.9999997e-06
|
2073 |
+
}
|
2074 |
+
}
|
2075 |
+
layer {
|
2076 |
+
name: "bn_scale47"
|
2077 |
+
type: "Scale"
|
2078 |
+
bottom: "batch_norm_blob47"
|
2079 |
+
top: "batch_norm_blob47"
|
2080 |
+
scale_param {
|
2081 |
+
bias_term: true
|
2082 |
+
}
|
2083 |
+
}
|
2084 |
+
layer {
|
2085 |
+
name: "cat3"
|
2086 |
+
type: "Concat"
|
2087 |
+
bottom: "batch_norm_blob43"
|
2088 |
+
bottom: "batch_norm_blob45"
|
2089 |
+
bottom: "batch_norm_blob47"
|
2090 |
+
top: "cat_blob3"
|
2091 |
+
concat_param {
|
2092 |
+
axis: 1
|
2093 |
+
}
|
2094 |
+
}
|
2095 |
+
layer {
|
2096 |
+
name: "relu41"
|
2097 |
+
type: "ReLU"
|
2098 |
+
bottom: "cat_blob3"
|
2099 |
+
top: "relu_blob41"
|
2100 |
+
}
|
2101 |
+
layer {
|
2102 |
+
name: "conv48"
|
2103 |
+
type: "Convolution"
|
2104 |
+
bottom: "relu_blob35"
|
2105 |
+
top: "conv_blob48"
|
2106 |
+
convolution_param {
|
2107 |
+
num_output: 8
|
2108 |
+
bias_term: true
|
2109 |
+
pad: 0
|
2110 |
+
kernel_size: 1
|
2111 |
+
group: 1
|
2112 |
+
stride: 1
|
2113 |
+
weight_filler {
|
2114 |
+
type: "xavier"
|
2115 |
+
}
|
2116 |
+
bias_filler {
|
2117 |
+
type: "constant"
|
2118 |
+
}
|
2119 |
+
dilation: 1
|
2120 |
+
}
|
2121 |
+
}
|
2122 |
+
layer {
|
2123 |
+
name: "conv49"
|
2124 |
+
type: "Convolution"
|
2125 |
+
bottom: "relu_blob35"
|
2126 |
+
top: "conv_blob49"
|
2127 |
+
convolution_param {
|
2128 |
+
num_output: 4
|
2129 |
+
bias_term: true
|
2130 |
+
pad: 0
|
2131 |
+
kernel_size: 1
|
2132 |
+
group: 1
|
2133 |
+
stride: 1
|
2134 |
+
weight_filler {
|
2135 |
+
type: "xavier"
|
2136 |
+
}
|
2137 |
+
bias_filler {
|
2138 |
+
type: "constant"
|
2139 |
+
}
|
2140 |
+
dilation: 1
|
2141 |
+
}
|
2142 |
+
}
|
2143 |
+
layer {
|
2144 |
+
name: "conv50"
|
2145 |
+
type: "Convolution"
|
2146 |
+
bottom: "relu_blob38"
|
2147 |
+
top: "conv_blob50"
|
2148 |
+
convolution_param {
|
2149 |
+
num_output: 8
|
2150 |
+
bias_term: true
|
2151 |
+
pad: 0
|
2152 |
+
kernel_size: 1
|
2153 |
+
group: 1
|
2154 |
+
stride: 1
|
2155 |
+
weight_filler {
|
2156 |
+
type: "xavier"
|
2157 |
+
}
|
2158 |
+
bias_filler {
|
2159 |
+
type: "constant"
|
2160 |
+
}
|
2161 |
+
dilation: 1
|
2162 |
+
}
|
2163 |
+
}
|
2164 |
+
layer {
|
2165 |
+
name: "conv51"
|
2166 |
+
type: "Convolution"
|
2167 |
+
bottom: "relu_blob38"
|
2168 |
+
top: "conv_blob51"
|
2169 |
+
convolution_param {
|
2170 |
+
num_output: 4
|
2171 |
+
bias_term: true
|
2172 |
+
pad: 0
|
2173 |
+
kernel_size: 1
|
2174 |
+
group: 1
|
2175 |
+
stride: 1
|
2176 |
+
weight_filler {
|
2177 |
+
type: "xavier"
|
2178 |
+
}
|
2179 |
+
bias_filler {
|
2180 |
+
type: "constant"
|
2181 |
+
}
|
2182 |
+
dilation: 1
|
2183 |
+
}
|
2184 |
+
}
|
2185 |
+
layer {
|
2186 |
+
name: "conv52"
|
2187 |
+
type: "Convolution"
|
2188 |
+
bottom: "relu_blob41"
|
2189 |
+
top: "conv_blob52"
|
2190 |
+
convolution_param {
|
2191 |
+
num_output: 8
|
2192 |
+
bias_term: true
|
2193 |
+
pad: 0
|
2194 |
+
kernel_size: 1
|
2195 |
+
group: 1
|
2196 |
+
stride: 1
|
2197 |
+
weight_filler {
|
2198 |
+
type: "xavier"
|
2199 |
+
}
|
2200 |
+
bias_filler {
|
2201 |
+
type: "constant"
|
2202 |
+
}
|
2203 |
+
dilation: 1
|
2204 |
+
}
|
2205 |
+
}
|
2206 |
+
layer {
|
2207 |
+
name: "conv53"
|
2208 |
+
type: "Convolution"
|
2209 |
+
bottom: "relu_blob41"
|
2210 |
+
top: "conv_blob53"
|
2211 |
+
convolution_param {
|
2212 |
+
num_output: 4
|
2213 |
+
bias_term: true
|
2214 |
+
pad: 0
|
2215 |
+
kernel_size: 1
|
2216 |
+
group: 1
|
2217 |
+
stride: 1
|
2218 |
+
weight_filler {
|
2219 |
+
type: "xavier"
|
2220 |
+
}
|
2221 |
+
bias_filler {
|
2222 |
+
type: "constant"
|
2223 |
+
}
|
2224 |
+
dilation: 1
|
2225 |
+
}
|
2226 |
+
}
|
2227 |
+
############ prior box ###########
|
2228 |
+
|
2229 |
+
layer {
|
2230 |
+
name: "conv4_3_norm_mbox_loc_perm"
|
2231 |
+
type: "Permute"
|
2232 |
+
bottom: "conv_blob48"
|
2233 |
+
top: "conv4_3_norm_mbox_loc_perm"
|
2234 |
+
permute_param {
|
2235 |
+
order: 0
|
2236 |
+
order: 2
|
2237 |
+
order: 3
|
2238 |
+
order: 1
|
2239 |
+
}
|
2240 |
+
}
|
2241 |
+
layer {
|
2242 |
+
name: "conv4_3_norm_mbox_loc_flat"
|
2243 |
+
type: "Flatten"
|
2244 |
+
bottom: "conv4_3_norm_mbox_loc_perm"
|
2245 |
+
top: "conv4_3_norm_mbox_loc_flat"
|
2246 |
+
flatten_param {
|
2247 |
+
axis: 1
|
2248 |
+
}
|
2249 |
+
}
|
2250 |
+
layer {
|
2251 |
+
name: "conv4_3_norm_mbox_conf_perm"
|
2252 |
+
type: "Permute"
|
2253 |
+
bottom: "conv_blob49"
|
2254 |
+
top: "conv4_3_norm_mbox_conf_perm"
|
2255 |
+
permute_param {
|
2256 |
+
order: 0
|
2257 |
+
order: 2
|
2258 |
+
order: 3
|
2259 |
+
order: 1
|
2260 |
+
}
|
2261 |
+
}
|
2262 |
+
layer {
|
2263 |
+
name: "conv4_3_norm_mbox_conf_flat"
|
2264 |
+
type: "Flatten"
|
2265 |
+
bottom: "conv4_3_norm_mbox_conf_perm"
|
2266 |
+
top: "conv4_3_norm_mbox_conf_flat"
|
2267 |
+
flatten_param {
|
2268 |
+
axis: 1
|
2269 |
+
}
|
2270 |
+
}
|
2271 |
+
layer {
|
2272 |
+
name: "conv4_3_norm_mbox_priorbox"
|
2273 |
+
type: "PriorBox"
|
2274 |
+
bottom: "relu_blob35"
|
2275 |
+
bottom: "data"
|
2276 |
+
top: "conv4_3_norm_mbox_priorbox"
|
2277 |
+
prior_box_param {
|
2278 |
+
min_size: 16.0
|
2279 |
+
min_size: 32.0
|
2280 |
+
clip: false
|
2281 |
+
variance: 0.1
|
2282 |
+
variance: 0.1
|
2283 |
+
variance: 0.2
|
2284 |
+
variance: 0.2
|
2285 |
+
step: 8.0
|
2286 |
+
offset: 0.5
|
2287 |
+
}
|
2288 |
+
}
|
2289 |
+
|
2290 |
+
layer {
|
2291 |
+
name: "conv5_3_norm_mbox_loc_perm"
|
2292 |
+
type: "Permute"
|
2293 |
+
bottom: "conv_blob50"
|
2294 |
+
top: "conv5_3_norm_mbox_loc_perm"
|
2295 |
+
permute_param {
|
2296 |
+
order: 0
|
2297 |
+
order: 2
|
2298 |
+
order: 3
|
2299 |
+
order: 1
|
2300 |
+
}
|
2301 |
+
}
|
2302 |
+
layer {
|
2303 |
+
name: "conv5_3_norm_mbox_loc_flat"
|
2304 |
+
type: "Flatten"
|
2305 |
+
bottom: "conv5_3_norm_mbox_loc_perm"
|
2306 |
+
top: "conv5_3_norm_mbox_loc_flat"
|
2307 |
+
flatten_param {
|
2308 |
+
axis: 1
|
2309 |
+
}
|
2310 |
+
}
|
2311 |
+
layer {
|
2312 |
+
name: "conv5_3_norm_mbox_conf_perm"
|
2313 |
+
type: "Permute"
|
2314 |
+
bottom: "conv_blob51"
|
2315 |
+
top: "conv5_3_norm_mbox_conf_perm"
|
2316 |
+
permute_param {
|
2317 |
+
order: 0
|
2318 |
+
order: 2
|
2319 |
+
order: 3
|
2320 |
+
order: 1
|
2321 |
+
}
|
2322 |
+
}
|
2323 |
+
layer {
|
2324 |
+
name: "conv5_3_norm_mbox_conf_flat"
|
2325 |
+
type: "Flatten"
|
2326 |
+
bottom: "conv5_3_norm_mbox_conf_perm"
|
2327 |
+
top: "conv5_3_norm_mbox_conf_flat"
|
2328 |
+
flatten_param {
|
2329 |
+
axis: 1
|
2330 |
+
}
|
2331 |
+
}
|
2332 |
+
layer {
|
2333 |
+
name: "conv5_3_norm_mbox_priorbox"
|
2334 |
+
type: "PriorBox"
|
2335 |
+
bottom: "relu_blob38"
|
2336 |
+
bottom: "data"
|
2337 |
+
top: "conv5_3_norm_mbox_priorbox"
|
2338 |
+
prior_box_param {
|
2339 |
+
min_size: 64.0
|
2340 |
+
min_size: 128.0
|
2341 |
+
clip: false
|
2342 |
+
variance: 0.1
|
2343 |
+
variance: 0.1
|
2344 |
+
variance: 0.2
|
2345 |
+
variance: 0.2
|
2346 |
+
step: 16.0
|
2347 |
+
offset: 0.5
|
2348 |
+
}
|
2349 |
+
}
|
2350 |
+
|
2351 |
+
layer {
|
2352 |
+
name: "conv6_3_norm_mbox_loc_perm"
|
2353 |
+
type: "Permute"
|
2354 |
+
bottom: "conv_blob52"
|
2355 |
+
top: "conv6_3_norm_mbox_loc_perm"
|
2356 |
+
permute_param {
|
2357 |
+
order: 0
|
2358 |
+
order: 2
|
2359 |
+
order: 3
|
2360 |
+
order: 1
|
2361 |
+
}
|
2362 |
+
}
|
2363 |
+
layer {
|
2364 |
+
name: "conv6_3_norm_mbox_loc_flat"
|
2365 |
+
type: "Flatten"
|
2366 |
+
bottom: "conv6_3_norm_mbox_loc_perm"
|
2367 |
+
top: "conv6_3_norm_mbox_loc_flat"
|
2368 |
+
flatten_param {
|
2369 |
+
axis: 1
|
2370 |
+
}
|
2371 |
+
}
|
2372 |
+
layer {
|
2373 |
+
name: "conv6_3_norm_mbox_conf_perm"
|
2374 |
+
type: "Permute"
|
2375 |
+
bottom: "conv_blob53"
|
2376 |
+
top: "conv6_3_norm_mbox_conf_perm"
|
2377 |
+
permute_param {
|
2378 |
+
order: 0
|
2379 |
+
order: 2
|
2380 |
+
order: 3
|
2381 |
+
order: 1
|
2382 |
+
}
|
2383 |
+
}
|
2384 |
+
layer {
|
2385 |
+
name: "conv6_3_norm_mbox_conf_flat"
|
2386 |
+
type: "Flatten"
|
2387 |
+
bottom: "conv6_3_norm_mbox_conf_perm"
|
2388 |
+
top: "conv6_3_norm_mbox_conf_flat"
|
2389 |
+
flatten_param {
|
2390 |
+
axis: 1
|
2391 |
+
}
|
2392 |
+
}
|
2393 |
+
layer {
|
2394 |
+
name: "conv6_3_norm_mbox_priorbox"
|
2395 |
+
type: "PriorBox"
|
2396 |
+
bottom: "relu_blob41"
|
2397 |
+
bottom: "data"
|
2398 |
+
top: "conv6_3_norm_mbox_priorbox"
|
2399 |
+
prior_box_param {
|
2400 |
+
min_size: 256.0
|
2401 |
+
min_size: 512.0
|
2402 |
+
clip: false
|
2403 |
+
variance: 0.1
|
2404 |
+
variance: 0.1
|
2405 |
+
variance: 0.2
|
2406 |
+
variance: 0.2
|
2407 |
+
step: 32.0
|
2408 |
+
offset: 0.5
|
2409 |
+
}
|
2410 |
+
}
|
2411 |
+
|
2412 |
+
########################################################
|
2413 |
+
layer {
|
2414 |
+
name: "mbox_loc"
|
2415 |
+
type: "Concat"
|
2416 |
+
bottom: "conv4_3_norm_mbox_loc_flat"
|
2417 |
+
bottom: "conv5_3_norm_mbox_loc_flat"
|
2418 |
+
bottom: "conv6_3_norm_mbox_loc_flat"
|
2419 |
+
top: "mbox_loc"
|
2420 |
+
concat_param {
|
2421 |
+
axis: 1
|
2422 |
+
}
|
2423 |
+
}
|
2424 |
+
layer {
|
2425 |
+
name: "mbox_conf"
|
2426 |
+
type: "Concat"
|
2427 |
+
bottom: "conv4_3_norm_mbox_conf_flat"
|
2428 |
+
bottom: "conv5_3_norm_mbox_conf_flat"
|
2429 |
+
bottom: "conv6_3_norm_mbox_conf_flat"
|
2430 |
+
top: "mbox_conf"
|
2431 |
+
concat_param {
|
2432 |
+
axis: 1
|
2433 |
+
}
|
2434 |
+
}
|
2435 |
+
layer {
|
2436 |
+
name: "mbox_priorbox"
|
2437 |
+
type: "Concat"
|
2438 |
+
bottom: "conv4_3_norm_mbox_priorbox"
|
2439 |
+
bottom: "conv5_3_norm_mbox_priorbox"
|
2440 |
+
bottom: "conv6_3_norm_mbox_priorbox"
|
2441 |
+
top: "mbox_priorbox"
|
2442 |
+
concat_param {
|
2443 |
+
axis: 2
|
2444 |
+
}
|
2445 |
+
}
|
2446 |
+
layer {
|
2447 |
+
name: "mbox_conf_reshape"
|
2448 |
+
type: "Reshape"
|
2449 |
+
bottom: "mbox_conf"
|
2450 |
+
top: "mbox_conf_reshape"
|
2451 |
+
reshape_param {
|
2452 |
+
shape {
|
2453 |
+
dim: 0
|
2454 |
+
dim: -1
|
2455 |
+
dim: 2
|
2456 |
+
}
|
2457 |
+
}
|
2458 |
+
}
|
2459 |
+
layer {
|
2460 |
+
name: "mbox_conf_softmax"
|
2461 |
+
type: "Softmax"
|
2462 |
+
bottom: "mbox_conf_reshape"
|
2463 |
+
top: "mbox_conf_softmax"
|
2464 |
+
softmax_param {
|
2465 |
+
axis: 2
|
2466 |
+
}
|
2467 |
+
}
|
2468 |
+
layer {
|
2469 |
+
name: "mbox_conf_flatten"
|
2470 |
+
type: "Flatten"
|
2471 |
+
bottom: "mbox_conf_softmax"
|
2472 |
+
top: "mbox_conf_flatten"
|
2473 |
+
flatten_param {
|
2474 |
+
axis: 1
|
2475 |
+
}
|
2476 |
+
}
|
2477 |
+
layer {
|
2478 |
+
name: "detection_out"
|
2479 |
+
type: "DetectionOutput"
|
2480 |
+
bottom: "mbox_loc"
|
2481 |
+
bottom: "mbox_conf_flatten"
|
2482 |
+
bottom: "mbox_priorbox"
|
2483 |
+
top: "detection_out"
|
2484 |
+
include {
|
2485 |
+
phase: TEST
|
2486 |
+
}
|
2487 |
+
detection_output_param {
|
2488 |
+
num_classes: 2
|
2489 |
+
share_location: true
|
2490 |
+
background_label_id: 0
|
2491 |
+
nms_param {
|
2492 |
+
nms_threshold: 0.3
|
2493 |
+
top_k: 400
|
2494 |
+
}
|
2495 |
+
code_type: CENTER_SIZE
|
2496 |
+
keep_top_k: 200
|
2497 |
+
confidence_threshold: 0.1
|
2498 |
+
}
|
2499 |
+
}
|
face_recognition1/face_detect/data/config.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# config.py
|
2 |
+
|
3 |
+
cfg = {
|
4 |
+
'name': 'FaceBoxes',
|
5 |
+
#'min_dim': 1024,
|
6 |
+
#'feature_maps': [[32, 32], [16, 16], [8, 8]],
|
7 |
+
# 'aspect_ratios': [[1], [1], [1]],
|
8 |
+
'min_sizes': [[32, 64, 128], [256], [512]],
|
9 |
+
'steps': [32, 64, 128],
|
10 |
+
'variance': [0.1, 0.2],
|
11 |
+
'clip': False,
|
12 |
+
'loc_weight': 2.0,
|
13 |
+
'gpu_train': True
|
14 |
+
}
|
face_recognition1/face_detect/layers/__init__.py
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
from .functions import *
|
2 |
+
from .modules import *
|
face_recognition1/face_detect/layers/functions/prior_box.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from itertools import product as product
|
3 |
+
import numpy as np
|
4 |
+
from math import ceil
|
5 |
+
|
6 |
+
|
7 |
+
class PriorBox(object):
|
8 |
+
def __init__(self, cfg, image_size=None, phase='train'):
|
9 |
+
super(PriorBox, self).__init__()
|
10 |
+
#self.aspect_ratios = cfg['aspect_ratios']
|
11 |
+
self.min_sizes = cfg['min_sizes']
|
12 |
+
self.steps = cfg['steps']
|
13 |
+
self.clip = cfg['clip']
|
14 |
+
self.image_size = image_size
|
15 |
+
self.feature_maps = [[ceil(self.image_size[0]/step), ceil(self.image_size[1]/step)] for step in self.steps]
|
16 |
+
|
17 |
+
def forward(self):
|
18 |
+
anchors = []
|
19 |
+
for k, f in enumerate(self.feature_maps):
|
20 |
+
min_sizes = self.min_sizes[k]
|
21 |
+
for i, j in product(range(f[0]), range(f[1])):
|
22 |
+
for min_size in min_sizes:
|
23 |
+
s_kx = min_size / self.image_size[1]
|
24 |
+
s_ky = min_size / self.image_size[0]
|
25 |
+
if min_size == 32:
|
26 |
+
dense_cx = [x*self.steps[k]/self.image_size[1] for x in [j+0, j+0.25, j+0.5, j+0.75]]
|
27 |
+
dense_cy = [y*self.steps[k]/self.image_size[0] for y in [i+0, i+0.25, i+0.5, i+0.75]]
|
28 |
+
for cy, cx in product(dense_cy, dense_cx):
|
29 |
+
anchors += [cx, cy, s_kx, s_ky]
|
30 |
+
elif min_size == 64:
|
31 |
+
dense_cx = [x*self.steps[k]/self.image_size[1] for x in [j+0, j+0.5]]
|
32 |
+
dense_cy = [y*self.steps[k]/self.image_size[0] for y in [i+0, i+0.5]]
|
33 |
+
for cy, cx in product(dense_cy, dense_cx):
|
34 |
+
anchors += [cx, cy, s_kx, s_ky]
|
35 |
+
else:
|
36 |
+
cx = (j + 0.5) * self.steps[k] / self.image_size[1]
|
37 |
+
cy = (i + 0.5) * self.steps[k] / self.image_size[0]
|
38 |
+
anchors += [cx, cy, s_kx, s_ky]
|
39 |
+
# back to torch land
|
40 |
+
output = torch.Tensor(anchors).view(-1, 4)
|
41 |
+
if self.clip:
|
42 |
+
output.clamp_(max=1, min=0)
|
43 |
+
return output
|
face_recognition1/face_detect/layers/modules/__init__.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from .multibox_loss import MultiBoxLoss
|
2 |
+
|
3 |
+
__all__ = ['MultiBoxLoss']
|
face_recognition1/face_detect/layers/modules/multibox_loss.py
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torch.nn as nn
|
3 |
+
import torch.nn.functional as F
|
4 |
+
from torch.autograd import Variable
|
5 |
+
from utils.box_utils import match, log_sum_exp
|
6 |
+
from data.config import cfg
|
7 |
+
GPU = cfg['gpu_train']
|
8 |
+
|
9 |
+
class MultiBoxLoss(nn.Module):
|
10 |
+
"""SSD Weighted Loss Function
|
11 |
+
Compute Targets:
|
12 |
+
1) Produce Confidence Target Indices by matching ground truth boxes
|
13 |
+
with (default) 'priorboxes' that have jaccard index > threshold parameter
|
14 |
+
(default threshold: 0.5).
|
15 |
+
2) Produce localization target by 'encoding' variance into offsets of ground
|
16 |
+
truth boxes and their matched 'priorboxes'.
|
17 |
+
3) Hard negative mining to filter the excessive number of negative examples
|
18 |
+
that comes with using a large number of default bounding boxes.
|
19 |
+
(default negative:positive ratio 3:1)
|
20 |
+
Objective Loss:
|
21 |
+
L(x,c,l,g) = (Lconf(x, c) + αLloc(x,l,g)) / N
|
22 |
+
Where, Lconf is the CrossEntropy Loss and Lloc is the SmoothL1 Loss
|
23 |
+
weighted by α which is set to 1 by cross val.
|
24 |
+
Args:
|
25 |
+
c: class confidences,
|
26 |
+
l: predicted boxes,
|
27 |
+
g: ground truth boxes
|
28 |
+
N: number of matched default boxes
|
29 |
+
See: https://arxiv.org/pdf/1512.02325.pdf for more details.
|
30 |
+
"""
|
31 |
+
|
32 |
+
def __init__(self, num_classes, overlap_thresh, prior_for_matching, bkg_label, neg_mining, neg_pos, neg_overlap, encode_target):
|
33 |
+
super(MultiBoxLoss, self).__init__()
|
34 |
+
self.num_classes = num_classes
|
35 |
+
self.threshold = overlap_thresh
|
36 |
+
self.background_label = bkg_label
|
37 |
+
self.encode_target = encode_target
|
38 |
+
self.use_prior_for_matching = prior_for_matching
|
39 |
+
self.do_neg_mining = neg_mining
|
40 |
+
self.negpos_ratio = neg_pos
|
41 |
+
self.neg_overlap = neg_overlap
|
42 |
+
self.variance = [0.1, 0.2]
|
43 |
+
|
44 |
+
def forward(self, predictions, priors, targets):
|
45 |
+
"""Multibox Loss
|
46 |
+
Args:
|
47 |
+
predictions (tuple): A tuple containing loc preds, conf preds,
|
48 |
+
and prior boxes from SSD net.
|
49 |
+
conf shape: torch.size(batch_size,num_priors,num_classes)
|
50 |
+
loc shape: torch.size(batch_size,num_priors,4)
|
51 |
+
priors shape: torch.size(num_priors,4)
|
52 |
+
|
53 |
+
ground_truth (tensor): Ground truth boxes and labels for a batch,
|
54 |
+
shape: [batch_size,num_objs,5] (last idx is the label).
|
55 |
+
"""
|
56 |
+
|
57 |
+
loc_data, conf_data = predictions
|
58 |
+
priors = priors
|
59 |
+
num = loc_data.size(0)
|
60 |
+
num_priors = (priors.size(0))
|
61 |
+
|
62 |
+
# match priors (default boxes) and ground truth boxes
|
63 |
+
loc_t = torch.Tensor(num, num_priors, 4)
|
64 |
+
conf_t = torch.LongTensor(num, num_priors)
|
65 |
+
for idx in range(num):
|
66 |
+
truths = targets[idx][:, :-1].data
|
67 |
+
labels = targets[idx][:, -1].data
|
68 |
+
defaults = priors.data
|
69 |
+
match(self.threshold, truths, defaults, self.variance, labels, loc_t, conf_t, idx)
|
70 |
+
if GPU:
|
71 |
+
loc_t = loc_t.cuda()
|
72 |
+
conf_t = conf_t.cuda()
|
73 |
+
|
74 |
+
pos = conf_t > 0
|
75 |
+
|
76 |
+
# Localization Loss (Smooth L1)
|
77 |
+
# Shape: [batch,num_priors,4]
|
78 |
+
pos_idx = pos.unsqueeze(pos.dim()).expand_as(loc_data)
|
79 |
+
loc_p = loc_data[pos_idx].view(-1, 4)
|
80 |
+
loc_t = loc_t[pos_idx].view(-1, 4)
|
81 |
+
loss_l = F.smooth_l1_loss(loc_p, loc_t, reduction='sum')
|
82 |
+
|
83 |
+
# Compute max conf across batch for hard negative mining
|
84 |
+
batch_conf = conf_data.view(-1, self.num_classes)
|
85 |
+
loss_c = log_sum_exp(batch_conf) - batch_conf.gather(1, conf_t.view(-1, 1))
|
86 |
+
|
87 |
+
# Hard Negative Mining
|
88 |
+
loss_c[pos.view(-1, 1)] = 0 # filter out pos boxes for now
|
89 |
+
loss_c = loss_c.view(num, -1)
|
90 |
+
_, loss_idx = loss_c.sort(1, descending=True)
|
91 |
+
_, idx_rank = loss_idx.sort(1)
|
92 |
+
num_pos = pos.long().sum(1, keepdim=True)
|
93 |
+
num_neg = torch.clamp(self.negpos_ratio*num_pos, max=pos.size(1)-1)
|
94 |
+
neg = idx_rank < num_neg.expand_as(idx_rank)
|
95 |
+
|
96 |
+
# Confidence Loss Including Positive and Negative Examples
|
97 |
+
pos_idx = pos.unsqueeze(2).expand_as(conf_data)
|
98 |
+
neg_idx = neg.unsqueeze(2).expand_as(conf_data)
|
99 |
+
conf_p = conf_data[(pos_idx+neg_idx).gt(0)].view(-1,self.num_classes)
|
100 |
+
targets_weighted = conf_t[(pos+neg).gt(0)]
|
101 |
+
loss_c = F.cross_entropy(conf_p, targets_weighted, reduction='sum')
|
102 |
+
|
103 |
+
# Sum of losses: L(x,c,l,g) = (Lconf(x, c) + αLloc(x,l,g)) / N
|
104 |
+
N = max(num_pos.data.sum().float(), 1)
|
105 |
+
loss_l /= N
|
106 |
+
loss_c /= N
|
107 |
+
|
108 |
+
return loss_l, loss_c
|
face_recognition1/face_detect/models/__init__.py
ADDED
File without changes
|
face_recognition1/face_detect/models/faceboxes.py
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import torch.nn as nn
|
3 |
+
import torch.nn.functional as F
|
4 |
+
|
5 |
+
|
6 |
+
class BasicConv2d(nn.Module):
|
7 |
+
|
8 |
+
def __init__(self, in_channels, out_channels, **kwargs):
|
9 |
+
super(BasicConv2d, self).__init__()
|
10 |
+
self.conv = nn.Conv2d(in_channels, out_channels, bias=False, **kwargs)
|
11 |
+
self.bn = nn.BatchNorm2d(out_channels, eps=1e-5)
|
12 |
+
|
13 |
+
def forward(self, x):
|
14 |
+
x = self.conv(x)
|
15 |
+
x = self.bn(x)
|
16 |
+
return F.relu(x, inplace=True)
|
17 |
+
|
18 |
+
|
19 |
+
class Inception(nn.Module):
|
20 |
+
|
21 |
+
def __init__(self):
|
22 |
+
super(Inception, self).__init__()
|
23 |
+
self.branch1x1 = BasicConv2d(128, 32, kernel_size=1, padding=0)
|
24 |
+
self.branch1x1_2 = BasicConv2d(128, 32, kernel_size=1, padding=0)
|
25 |
+
self.branch3x3_reduce = BasicConv2d(128, 24, kernel_size=1, padding=0)
|
26 |
+
self.branch3x3 = BasicConv2d(24, 32, kernel_size=3, padding=1)
|
27 |
+
self.branch3x3_reduce_2 = BasicConv2d(128, 24, kernel_size=1, padding=0)
|
28 |
+
self.branch3x3_2 = BasicConv2d(24, 32, kernel_size=3, padding=1)
|
29 |
+
self.branch3x3_3 = BasicConv2d(32, 32, kernel_size=3, padding=1)
|
30 |
+
|
31 |
+
def forward(self, x):
|
32 |
+
branch1x1 = self.branch1x1(x)
|
33 |
+
|
34 |
+
branch1x1_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1)
|
35 |
+
branch1x1_2 = self.branch1x1_2(branch1x1_pool)
|
36 |
+
|
37 |
+
branch3x3_reduce = self.branch3x3_reduce(x)
|
38 |
+
branch3x3 = self.branch3x3(branch3x3_reduce)
|
39 |
+
|
40 |
+
branch3x3_reduce_2 = self.branch3x3_reduce_2(x)
|
41 |
+
branch3x3_2 = self.branch3x3_2(branch3x3_reduce_2)
|
42 |
+
branch3x3_3 = self.branch3x3_3(branch3x3_2)
|
43 |
+
|
44 |
+
outputs = [branch1x1, branch1x1_2, branch3x3, branch3x3_3]
|
45 |
+
return torch.cat(outputs, 1)
|
46 |
+
|
47 |
+
|
48 |
+
class CRelu(nn.Module):
|
49 |
+
|
50 |
+
def __init__(self, in_channels, out_channels, **kwargs):
|
51 |
+
super(CRelu, self).__init__()
|
52 |
+
self.conv = nn.Conv2d(in_channels, out_channels, bias=False, **kwargs)
|
53 |
+
self.bn = nn.BatchNorm2d(out_channels, eps=1e-5)
|
54 |
+
|
55 |
+
def forward(self, x):
|
56 |
+
x = self.conv(x)
|
57 |
+
x = self.bn(x)
|
58 |
+
x = torch.cat([x, -x], 1)
|
59 |
+
x = F.relu(x, inplace=True)
|
60 |
+
return x
|
61 |
+
|
62 |
+
|
63 |
+
class FaceBoxes(nn.Module):
|
64 |
+
|
65 |
+
def __init__(self, phase, size, num_classes):
|
66 |
+
super(FaceBoxes, self).__init__()
|
67 |
+
self.phase = phase
|
68 |
+
self.num_classes = num_classes
|
69 |
+
self.size = size
|
70 |
+
|
71 |
+
self.conv1 = CRelu(3, 24, kernel_size=7, stride=4, padding=3)
|
72 |
+
self.conv2 = CRelu(48, 64, kernel_size=5, stride=2, padding=2)
|
73 |
+
|
74 |
+
self.inception1 = Inception()
|
75 |
+
self.inception2 = Inception()
|
76 |
+
self.inception3 = Inception()
|
77 |
+
|
78 |
+
self.conv3_1 = BasicConv2d(128, 128, kernel_size=1, stride=1, padding=0)
|
79 |
+
self.conv3_2 = BasicConv2d(128, 256, kernel_size=3, stride=2, padding=1)
|
80 |
+
|
81 |
+
self.conv4_1 = BasicConv2d(256, 128, kernel_size=1, stride=1, padding=0)
|
82 |
+
self.conv4_2 = BasicConv2d(128, 256, kernel_size=3, stride=2, padding=1)
|
83 |
+
|
84 |
+
self.loc, self.conf = self.multibox(self.num_classes)
|
85 |
+
|
86 |
+
if self.phase == 'test':
|
87 |
+
self.softmax = nn.Softmax(dim=-1)
|
88 |
+
|
89 |
+
if self.phase == 'train':
|
90 |
+
for m in self.modules():
|
91 |
+
if isinstance(m, nn.Conv2d):
|
92 |
+
if m.bias is not None:
|
93 |
+
nn.init.xavier_normal_(m.weight.data)
|
94 |
+
m.bias.data.fill_(0.02)
|
95 |
+
else:
|
96 |
+
m.weight.data.normal_(0, 0.01)
|
97 |
+
elif isinstance(m, nn.BatchNorm2d):
|
98 |
+
m.weight.data.fill_(1)
|
99 |
+
m.bias.data.zero_()
|
100 |
+
|
101 |
+
def multibox(self, num_classes):
|
102 |
+
loc_layers = []
|
103 |
+
conf_layers = []
|
104 |
+
loc_layers += [nn.Conv2d(128, 21 * 4, kernel_size=3, padding=1)]
|
105 |
+
conf_layers += [nn.Conv2d(128, 21 * num_classes, kernel_size=3, padding=1)]
|
106 |
+
loc_layers += [nn.Conv2d(256, 1 * 4, kernel_size=3, padding=1)]
|
107 |
+
conf_layers += [nn.Conv2d(256, 1 * num_classes, kernel_size=3, padding=1)]
|
108 |
+
loc_layers += [nn.Conv2d(256, 1 * 4, kernel_size=3, padding=1)]
|
109 |
+
conf_layers += [nn.Conv2d(256, 1 * num_classes, kernel_size=3, padding=1)]
|
110 |
+
return nn.Sequential(*loc_layers), nn.Sequential(*conf_layers)
|
111 |
+
|
112 |
+
def forward(self, x):
|
113 |
+
|
114 |
+
detection_sources = list()
|
115 |
+
loc = list()
|
116 |
+
conf = list()
|
117 |
+
|
118 |
+
x = self.conv1(x)
|
119 |
+
x = F.max_pool2d(x, kernel_size=3, stride=2, padding=1)
|
120 |
+
x = self.conv2(x)
|
121 |
+
x = F.max_pool2d(x, kernel_size=3, stride=2, padding=1)
|
122 |
+
x = self.inception1(x)
|
123 |
+
x = self.inception2(x)
|
124 |
+
x = self.inception3(x)
|
125 |
+
detection_sources.append(x)
|
126 |
+
|
127 |
+
x = self.conv3_1(x)
|
128 |
+
x = self.conv3_2(x)
|
129 |
+
detection_sources.append(x)
|
130 |
+
|
131 |
+
x = self.conv4_1(x)
|
132 |
+
x = self.conv4_2(x)
|
133 |
+
detection_sources.append(x)
|
134 |
+
|
135 |
+
for (x, l, c) in zip(detection_sources, self.loc, self.conf):
|
136 |
+
loc.append(l(x).permute(0, 2, 3, 1).contiguous())
|
137 |
+
conf.append(c(x).permute(0, 2, 3, 1).contiguous())
|
138 |
+
|
139 |
+
loc = torch.cat([o.view(o.size(0), -1) for o in loc], 1)
|
140 |
+
conf = torch.cat([o.view(o.size(0), -1) for o in conf], 1)
|
141 |
+
|
142 |
+
if self.phase == "test":
|
143 |
+
output = (loc.view(loc.size(0), -1, 4),
|
144 |
+
self.softmax(conf.view(conf.size(0), -1, self.num_classes)))
|
145 |
+
else:
|
146 |
+
output = (loc.view(loc.size(0), -1, 4),
|
147 |
+
conf.view(conf.size(0), -1, self.num_classes))
|
148 |
+
|
149 |
+
return output
|
face_recognition1/face_detect/models/voc-model-labels.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
BACKGROUND
|
2 |
+
face
|
face_recognition1/face_detect/test.py
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
sys.path.append(os.path.dirname(__file__))
|
4 |
+
|
5 |
+
import cv2
|
6 |
+
import math
|
7 |
+
import torch
|
8 |
+
import torch.backends.cudnn as cudnn
|
9 |
+
import numpy as np
|
10 |
+
from data.config import cfg
|
11 |
+
from layers.functions.prior_box import PriorBox
|
12 |
+
from utils.nms_wrapper import nms
|
13 |
+
from models.faceboxes import FaceBoxes
|
14 |
+
from utils.box_utils import decode
|
15 |
+
from utils.timer import Timer
|
16 |
+
|
17 |
+
trained_model = os.path.join(os.path.dirname(__file__), './checkpoints/FaceBoxesProd.pth')
|
18 |
+
save_folder = 'eval'
|
19 |
+
dataset = 'Custom'
|
20 |
+
confidence_threshold = 0.2
|
21 |
+
top_k = 5000
|
22 |
+
nms_threshold = 0.3
|
23 |
+
keep_top_k = 750
|
24 |
+
show_image = True
|
25 |
+
vis_thres = 0.5
|
26 |
+
|
27 |
+
|
28 |
+
def check_keys(model, pretrained_state_dict):
|
29 |
+
ckpt_keys = set(pretrained_state_dict.keys())
|
30 |
+
model_keys = set(model.state_dict().keys())
|
31 |
+
used_pretrained_keys = model_keys & ckpt_keys
|
32 |
+
unused_pretrained_keys = ckpt_keys - model_keys
|
33 |
+
missing_keys = model_keys - ckpt_keys
|
34 |
+
print('Missing keys:{}'.format(len(missing_keys)))
|
35 |
+
print('Unused checkpoint keys:{}'.format(len(unused_pretrained_keys)))
|
36 |
+
print('Used keys:{}'.format(len(used_pretrained_keys)))
|
37 |
+
assert len(used_pretrained_keys) > 0, 'load NONE from pretrained checkpoint'
|
38 |
+
return True
|
39 |
+
|
40 |
+
|
41 |
+
def remove_prefix(state_dict, prefix):
|
42 |
+
""" Old style model is stored with all names of parameters sharing common prefix 'module.' """
|
43 |
+
print('remove prefix \'{}\''.format(prefix))
|
44 |
+
f = lambda x: x.split(prefix, 1)[-1] if x.startswith(prefix) else x
|
45 |
+
return {f(key): value for key, value in state_dict.items()}
|
46 |
+
|
47 |
+
|
48 |
+
def load_model(model, pretrained_path, device):
|
49 |
+
print('Loading pretrained model from {}'.format(pretrained_path))
|
50 |
+
pretrained_dict = torch.load(pretrained_path, map_location=device)
|
51 |
+
|
52 |
+
if "state_dict" in pretrained_dict.keys():
|
53 |
+
pretrained_dict = remove_prefix(pretrained_dict['state_dict'], 'module.')
|
54 |
+
else:
|
55 |
+
pretrained_dict = remove_prefix(pretrained_dict, 'module.')
|
56 |
+
check_keys(model, pretrained_dict)
|
57 |
+
model.load_state_dict(pretrained_dict, strict=False)
|
58 |
+
return model
|
59 |
+
|
60 |
+
|
61 |
+
torch.set_grad_enabled(False)
|
62 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
63 |
+
net = FaceBoxes(phase='test', size=None, num_classes=2)
|
64 |
+
net = load_model(net, trained_model, device)
|
65 |
+
net.eval()
|
66 |
+
cudnn.benchmark = True
|
67 |
+
net = net.to(device)
|
68 |
+
|
69 |
+
|
70 |
+
def get_bbox(orig_image):
|
71 |
+
# testing scale
|
72 |
+
resize = 0.5
|
73 |
+
|
74 |
+
_t = {'forward_pass': Timer(), 'misc': Timer()}
|
75 |
+
|
76 |
+
img_raw = orig_image
|
77 |
+
img = np.float32(img_raw)
|
78 |
+
if resize != 1:
|
79 |
+
img = cv2.resize(img, None, None, fx=resize, fy=resize, interpolation=cv2.INTER_LINEAR)
|
80 |
+
im_height, im_width, _ = img.shape
|
81 |
+
scale = torch.Tensor([img.shape[1], img.shape[0], img.shape[1], img.shape[0]])
|
82 |
+
img -= (104, 117, 123)
|
83 |
+
img = img.transpose(2, 0, 1)
|
84 |
+
img = torch.from_numpy(img).unsqueeze(0)
|
85 |
+
img = img.to(device)
|
86 |
+
scale = scale.to(device)
|
87 |
+
|
88 |
+
_t['forward_pass'].tic()
|
89 |
+
loc, conf = net(img) # forward pass
|
90 |
+
_t['forward_pass'].toc()
|
91 |
+
_t['misc'].tic()
|
92 |
+
priorbox = PriorBox(cfg, image_size=(im_height, im_width))
|
93 |
+
priors = priorbox.forward()
|
94 |
+
priors = priors.to(device)
|
95 |
+
prior_data = priors.data
|
96 |
+
boxes = decode(loc.data.squeeze(0), prior_data, cfg['variance'])
|
97 |
+
boxes = boxes * scale / resize
|
98 |
+
boxes = boxes.cpu().numpy()
|
99 |
+
scores = conf.squeeze(0).data.cpu().numpy()[:, 1]
|
100 |
+
|
101 |
+
# ignore low scores
|
102 |
+
inds = np.where(scores > confidence_threshold)[0]
|
103 |
+
boxes = boxes[inds]
|
104 |
+
scores = scores[inds]
|
105 |
+
|
106 |
+
# keep top-K before NMS
|
107 |
+
order = scores.argsort()[::-1][:top_k]
|
108 |
+
boxes = boxes[order]
|
109 |
+
scores = scores[order]
|
110 |
+
|
111 |
+
# do NMS
|
112 |
+
dets = np.hstack((boxes, scores[:, np.newaxis])).astype(np.float32, copy=False)
|
113 |
+
#keep = py_cpu_nms(dets, nms_threshold)
|
114 |
+
keep = nms(dets, nms_threshold, force_cpu=True)
|
115 |
+
dets = dets[keep, :]
|
116 |
+
|
117 |
+
# keep top-K faster NMS
|
118 |
+
dets = dets[:keep_top_k, :]
|
119 |
+
_t['misc'].toc()
|
120 |
+
|
121 |
+
boxes, scores = [], []
|
122 |
+
for k in range(dets.shape[0]):
|
123 |
+
xmin = dets[k, 0]
|
124 |
+
ymin = dets[k, 1]
|
125 |
+
xmax = dets[k, 2]
|
126 |
+
ymax = dets[k, 3]
|
127 |
+
ymin += 0.2 * (ymax - ymin + 1)
|
128 |
+
score = dets[k, 4]
|
129 |
+
boxes.append([int(xmin), int(ymin), int(xmax - xmin), int(ymax - ymin)])
|
130 |
+
scores.append(score)
|
131 |
+
|
132 |
+
max_score = 0.0
|
133 |
+
final_box = None
|
134 |
+
for i, score in enumerate(scores):
|
135 |
+
if max_score < score:
|
136 |
+
max_score = score
|
137 |
+
final_box = boxes[i]
|
138 |
+
|
139 |
+
return final_box
|
140 |
+
|
141 |
+
|
142 |
+
class Detection:
|
143 |
+
def __init__(self):
|
144 |
+
src_dir = os.path.dirname(__file__)
|
145 |
+
if not os.path.exists(os.path.join(src_dir, "checkpoints")):
|
146 |
+
os.makedirs(os.path.join(src_dir, "checkpoints"))
|
147 |
+
|
148 |
+
caffemodel = os.path.join(src_dir, "checkpoints/Widerface-RetinaFace.caffemodel")
|
149 |
+
deploy = os.path.join(src_dir, "checkpoints/deploy.prototxt")
|
150 |
+
|
151 |
+
self.detector = cv2.dnn.readNetFromCaffe(deploy, caffemodel)
|
152 |
+
self.detector_confidence = 0.6
|
153 |
+
|
154 |
+
def get_bbox(self, img):
|
155 |
+
height, width = img.shape[0], img.shape[1]
|
156 |
+
aspect_ratio = width / height
|
157 |
+
if img.shape[1] * img.shape[0] >= 192 * 192:
|
158 |
+
img = cv2.resize(img,
|
159 |
+
(int(192 * math.sqrt(aspect_ratio)),
|
160 |
+
int(192 / math.sqrt(aspect_ratio))), interpolation=cv2.INTER_LINEAR)
|
161 |
+
|
162 |
+
blob = cv2.dnn.blobFromImage(img, 1, mean=(104, 117, 123))
|
163 |
+
self.detector.setInput(blob, 'data')
|
164 |
+
out = self.detector.forward('detection_out').squeeze()
|
165 |
+
max_conf_index = np.argmax(out[:, 2])
|
166 |
+
left, top, right, bottom = out[max_conf_index, 3]*width, out[max_conf_index, 4]*height, \
|
167 |
+
out[max_conf_index, 5]*width, out[max_conf_index, 6]*height
|
168 |
+
|
169 |
+
if right == left or bottom == top:
|
170 |
+
return None
|
171 |
+
|
172 |
+
bbox = [int(left), int(top), int(right-left+1), int(bottom-top+1)]
|
173 |
+
return bbox
|
174 |
+
|
175 |
+
def check_face(self):
|
176 |
+
pass
|
177 |
+
|
178 |
+
|
179 |
+
if __name__ == '__main__':
|
180 |
+
|
181 |
+
# image = cv2.imread('arun_2.jpg')
|
182 |
+
|
183 |
+
# box = get_bbox(image)
|
184 |
+
# cv2.rectangle(image, (box[0], box[1]), (box[2], box[3]), (0, 0, 255), 2)
|
185 |
+
#
|
186 |
+
src_dir = 'D:/19.Database/office_angled_db'
|
187 |
+
dst_dir = 'D:/19.Database/office_angled_db_result'
|
188 |
+
detector = Detection()
|
189 |
+
|
190 |
+
for file in os.listdir(src_dir):
|
191 |
+
image1 = cv2.imread(os.path.join(src_dir, file))
|
192 |
+
box = detector.get_bbox(image1)
|
193 |
+
if box:
|
194 |
+
cv2.rectangle(image1, (box[0], box[1]), (box[0] + box[2], box[1] + box[3]), (0, 0, 255), 5)
|
195 |
+
|
196 |
+
cv2.imwrite(os.path.join(dst_dir, file), image1)
|
197 |
+
# cv2.waitKey(0)
|
face_recognition1/face_detect/utils/__init__.py
ADDED
File without changes
|
face_recognition1/face_detect/utils/box_utils.py
ADDED
@@ -0,0 +1,276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
import numpy as np
|
3 |
+
|
4 |
+
|
5 |
+
def point_form(boxes):
|
6 |
+
""" Convert prior_boxes to (xmin, ymin, xmax, ymax)
|
7 |
+
representation for comparison to point form ground truth data.
|
8 |
+
Args:
|
9 |
+
boxes: (tensor) center-size default boxes from priorbox layers.
|
10 |
+
Return:
|
11 |
+
boxes: (tensor) Converted xmin, ymin, xmax, ymax form of boxes.
|
12 |
+
"""
|
13 |
+
return torch.cat((boxes[:, :2] - boxes[:, 2:]/2, # xmin, ymin
|
14 |
+
boxes[:, :2] + boxes[:, 2:]/2), 1) # xmax, ymax
|
15 |
+
|
16 |
+
|
17 |
+
def center_size(boxes):
|
18 |
+
""" Convert prior_boxes to (cx, cy, w, h)
|
19 |
+
representation for comparison to center-size form ground truth data.
|
20 |
+
Args:
|
21 |
+
boxes: (tensor) point_form boxes
|
22 |
+
Return:
|
23 |
+
boxes: (tensor) Converted xmin, ymin, xmax, ymax form of boxes.
|
24 |
+
"""
|
25 |
+
return torch.cat((boxes[:, 2:] + boxes[:, :2])/2, # cx, cy
|
26 |
+
boxes[:, 2:] - boxes[:, :2], 1) # w, h
|
27 |
+
|
28 |
+
|
29 |
+
def intersect(box_a, box_b):
|
30 |
+
""" We resize both tensors to [A,B,2] without new malloc:
|
31 |
+
[A,2] -> [A,1,2] -> [A,B,2]
|
32 |
+
[B,2] -> [1,B,2] -> [A,B,2]
|
33 |
+
Then we compute the area of intersect between box_a and box_b.
|
34 |
+
Args:
|
35 |
+
box_a: (tensor) bounding boxes, Shape: [A,4].
|
36 |
+
box_b: (tensor) bounding boxes, Shape: [B,4].
|
37 |
+
Return:
|
38 |
+
(tensor) intersection area, Shape: [A,B].
|
39 |
+
"""
|
40 |
+
A = box_a.size(0)
|
41 |
+
B = box_b.size(0)
|
42 |
+
max_xy = torch.min(box_a[:, 2:].unsqueeze(1).expand(A, B, 2),
|
43 |
+
box_b[:, 2:].unsqueeze(0).expand(A, B, 2))
|
44 |
+
min_xy = torch.max(box_a[:, :2].unsqueeze(1).expand(A, B, 2),
|
45 |
+
box_b[:, :2].unsqueeze(0).expand(A, B, 2))
|
46 |
+
inter = torch.clamp((max_xy - min_xy), min=0)
|
47 |
+
return inter[:, :, 0] * inter[:, :, 1]
|
48 |
+
|
49 |
+
|
50 |
+
def jaccard(box_a, box_b):
|
51 |
+
"""Compute the jaccard overlap of two sets of boxes. The jaccard overlap
|
52 |
+
is simply the intersection over union of two boxes. Here we operate on
|
53 |
+
ground truth boxes and default boxes.
|
54 |
+
E.g.:
|
55 |
+
A ∩ B / A ∪ B = A ∩ B / (area(A) + area(B) - A ∩ B)
|
56 |
+
Args:
|
57 |
+
box_a: (tensor) Ground truth bounding boxes, Shape: [num_objects,4]
|
58 |
+
box_b: (tensor) Prior boxes from priorbox layers, Shape: [num_priors,4]
|
59 |
+
Return:
|
60 |
+
jaccard overlap: (tensor) Shape: [box_a.size(0), box_b.size(0)]
|
61 |
+
"""
|
62 |
+
inter = intersect(box_a, box_b)
|
63 |
+
area_a = ((box_a[:, 2]-box_a[:, 0]) *
|
64 |
+
(box_a[:, 3]-box_a[:, 1])).unsqueeze(1).expand_as(inter) # [A,B]
|
65 |
+
area_b = ((box_b[:, 2]-box_b[:, 0]) *
|
66 |
+
(box_b[:, 3]-box_b[:, 1])).unsqueeze(0).expand_as(inter) # [A,B]
|
67 |
+
union = area_a + area_b - inter
|
68 |
+
return inter / union # [A,B]
|
69 |
+
|
70 |
+
|
71 |
+
def matrix_iou(a, b):
|
72 |
+
"""
|
73 |
+
return iou of a and b, numpy version for data augenmentation
|
74 |
+
"""
|
75 |
+
lt = np.maximum(a[:, np.newaxis, :2], b[:, :2])
|
76 |
+
rb = np.minimum(a[:, np.newaxis, 2:], b[:, 2:])
|
77 |
+
|
78 |
+
area_i = np.prod(rb - lt, axis=2) * (lt < rb).all(axis=2)
|
79 |
+
area_a = np.prod(a[:, 2:] - a[:, :2], axis=1)
|
80 |
+
area_b = np.prod(b[:, 2:] - b[:, :2], axis=1)
|
81 |
+
return area_i / (area_a[:, np.newaxis] + area_b - area_i)
|
82 |
+
|
83 |
+
|
84 |
+
def matrix_iof(a, b):
|
85 |
+
"""
|
86 |
+
return iof of a and b, numpy version for data augenmentation
|
87 |
+
"""
|
88 |
+
lt = np.maximum(a[:, np.newaxis, :2], b[:, :2])
|
89 |
+
rb = np.minimum(a[:, np.newaxis, 2:], b[:, 2:])
|
90 |
+
|
91 |
+
area_i = np.prod(rb - lt, axis=2) * (lt < rb).all(axis=2)
|
92 |
+
area_a = np.prod(a[:, 2:] - a[:, :2], axis=1)
|
93 |
+
return area_i / np.maximum(area_a[:, np.newaxis], 1)
|
94 |
+
|
95 |
+
|
96 |
+
def match(threshold, truths, priors, variances, labels, loc_t, conf_t, idx):
|
97 |
+
"""Match each prior box with the ground truth box of the highest jaccard
|
98 |
+
overlap, encode the bounding boxes, then return the matched indices
|
99 |
+
corresponding to both confidence and location preds.
|
100 |
+
Args:
|
101 |
+
threshold: (float) The overlap threshold used when mathing boxes.
|
102 |
+
truths: (tensor) Ground truth boxes, Shape: [num_obj, num_priors].
|
103 |
+
priors: (tensor) Prior boxes from priorbox layers, Shape: [n_priors,4].
|
104 |
+
variances: (tensor) Variances corresponding to each prior coord,
|
105 |
+
Shape: [num_priors, 4].
|
106 |
+
labels: (tensor) All the class labels for the image, Shape: [num_obj].
|
107 |
+
loc_t: (tensor) Tensor to be filled w/ endcoded location targets.
|
108 |
+
conf_t: (tensor) Tensor to be filled w/ matched indices for conf preds.
|
109 |
+
idx: (int) current batch index
|
110 |
+
Return:
|
111 |
+
The matched indices corresponding to 1)location and 2)confidence preds.
|
112 |
+
"""
|
113 |
+
# jaccard index
|
114 |
+
overlaps = jaccard(
|
115 |
+
truths,
|
116 |
+
point_form(priors)
|
117 |
+
)
|
118 |
+
# (Bipartite Matching)
|
119 |
+
# [1,num_objects] best prior for each ground truth
|
120 |
+
best_prior_overlap, best_prior_idx = overlaps.max(1, keepdim=True)
|
121 |
+
|
122 |
+
# ignore hard gt
|
123 |
+
valid_gt_idx = best_prior_overlap[:, 0] >= 0.2
|
124 |
+
best_prior_idx_filter = best_prior_idx[valid_gt_idx, :]
|
125 |
+
if best_prior_idx_filter.shape[0] <= 0:
|
126 |
+
loc_t[idx] = 0
|
127 |
+
conf_t[idx] = 0
|
128 |
+
return
|
129 |
+
|
130 |
+
# [1,num_priors] best ground truth for each prior
|
131 |
+
best_truth_overlap, best_truth_idx = overlaps.max(0, keepdim=True)
|
132 |
+
best_truth_idx.squeeze_(0)
|
133 |
+
best_truth_overlap.squeeze_(0)
|
134 |
+
best_prior_idx.squeeze_(1)
|
135 |
+
best_prior_idx_filter.squeeze_(1)
|
136 |
+
best_prior_overlap.squeeze_(1)
|
137 |
+
best_truth_overlap.index_fill_(0, best_prior_idx_filter, 2) # ensure best prior
|
138 |
+
# TODO refactor: index best_prior_idx with long tensor
|
139 |
+
# ensure every gt matches with its prior of max overlap
|
140 |
+
for j in range(best_prior_idx.size(0)):
|
141 |
+
best_truth_idx[best_prior_idx[j]] = j
|
142 |
+
matches = truths[best_truth_idx] # Shape: [num_priors,4]
|
143 |
+
conf = labels[best_truth_idx] # Shape: [num_priors]
|
144 |
+
conf[best_truth_overlap < threshold] = 0 # label as background
|
145 |
+
loc = encode(matches, priors, variances)
|
146 |
+
loc_t[idx] = loc # [num_priors,4] encoded offsets to learn
|
147 |
+
conf_t[idx] = conf # [num_priors] top class label for each prior
|
148 |
+
|
149 |
+
|
150 |
+
def encode(matched, priors, variances):
|
151 |
+
"""Encode the variances from the priorbox layers into the ground truth boxes
|
152 |
+
we have matched (based on jaccard overlap) with the prior boxes.
|
153 |
+
Args:
|
154 |
+
matched: (tensor) Coords of ground truth for each prior in point-form
|
155 |
+
Shape: [num_priors, 4].
|
156 |
+
priors: (tensor) Prior boxes in center-offset form
|
157 |
+
Shape: [num_priors,4].
|
158 |
+
variances: (list[float]) Variances of priorboxes
|
159 |
+
Return:
|
160 |
+
encoded boxes (tensor), Shape: [num_priors, 4]
|
161 |
+
"""
|
162 |
+
|
163 |
+
# dist b/t match center and prior's center
|
164 |
+
g_cxcy = (matched[:, :2] + matched[:, 2:])/2 - priors[:, :2]
|
165 |
+
# encode variance
|
166 |
+
g_cxcy /= (variances[0] * priors[:, 2:])
|
167 |
+
# match wh / prior wh
|
168 |
+
g_wh = (matched[:, 2:] - matched[:, :2]) / priors[:, 2:]
|
169 |
+
g_wh = torch.log(g_wh) / variances[1]
|
170 |
+
# return target for smooth_l1_loss
|
171 |
+
return torch.cat([g_cxcy, g_wh], 1) # [num_priors,4]
|
172 |
+
|
173 |
+
|
174 |
+
# Adapted from https://github.com/Hakuyume/chainer-ssd
|
175 |
+
def decode(loc, priors, variances):
|
176 |
+
"""Decode locations from predictions using priors to undo
|
177 |
+
the encoding we did for offset regression at train time.
|
178 |
+
Args:
|
179 |
+
loc (tensor): location predictions for loc layers,
|
180 |
+
Shape: [num_priors,4]
|
181 |
+
priors (tensor): Prior boxes in center-offset form.
|
182 |
+
Shape: [num_priors,4].
|
183 |
+
variances: (list[float]) Variances of priorboxes
|
184 |
+
Return:
|
185 |
+
decoded bounding box predictions
|
186 |
+
"""
|
187 |
+
|
188 |
+
boxes = torch.cat((
|
189 |
+
priors[:, :2] + loc[:, :2] * variances[0] * priors[:, 2:],
|
190 |
+
priors[:, 2:] * torch.exp(loc[:, 2:] * variances[1])), 1)
|
191 |
+
boxes[:, :2] -= boxes[:, 2:] / 2
|
192 |
+
boxes[:, 2:] += boxes[:, :2]
|
193 |
+
return boxes
|
194 |
+
|
195 |
+
|
196 |
+
def log_sum_exp(x):
|
197 |
+
"""Utility function for computing log_sum_exp while determining
|
198 |
+
This will be used to determine unaveraged confidence loss across
|
199 |
+
all examples in a batch.
|
200 |
+
Args:
|
201 |
+
x (Variable(tensor)): conf_preds from conf layers
|
202 |
+
"""
|
203 |
+
x_max = x.data.max()
|
204 |
+
return torch.log(torch.sum(torch.exp(x-x_max), 1, keepdim=True)) + x_max
|
205 |
+
|
206 |
+
|
207 |
+
# Original author: Francisco Massa:
|
208 |
+
# https://github.com/fmassa/object-detection.torch
|
209 |
+
# Ported to PyTorch by Max deGroot (02/01/2017)
|
210 |
+
def nms(boxes, scores, overlap=0.5, top_k=200):
|
211 |
+
"""Apply non-maximum suppression at test time to avoid detecting too many
|
212 |
+
overlapping bounding boxes for a given object.
|
213 |
+
Args:
|
214 |
+
boxes: (tensor) The location preds for the img, Shape: [num_priors,4].
|
215 |
+
scores: (tensor) The class predscores for the img, Shape:[num_priors].
|
216 |
+
overlap: (float) The overlap thresh for suppressing unnecessary boxes.
|
217 |
+
top_k: (int) The Maximum number of box preds to consider.
|
218 |
+
Return:
|
219 |
+
The indices of the kept boxes with respect to num_priors.
|
220 |
+
"""
|
221 |
+
|
222 |
+
keep = torch.Tensor(scores.size(0)).fill_(0).long()
|
223 |
+
if boxes.numel() == 0:
|
224 |
+
return keep
|
225 |
+
x1 = boxes[:, 0]
|
226 |
+
y1 = boxes[:, 1]
|
227 |
+
x2 = boxes[:, 2]
|
228 |
+
y2 = boxes[:, 3]
|
229 |
+
area = torch.mul(x2 - x1, y2 - y1)
|
230 |
+
v, idx = scores.sort(0) # sort in ascending order
|
231 |
+
# I = I[v >= 0.01]
|
232 |
+
idx = idx[-top_k:] # indices of the top-k largest vals
|
233 |
+
xx1 = boxes.new()
|
234 |
+
yy1 = boxes.new()
|
235 |
+
xx2 = boxes.new()
|
236 |
+
yy2 = boxes.new()
|
237 |
+
w = boxes.new()
|
238 |
+
h = boxes.new()
|
239 |
+
|
240 |
+
# keep = torch.Tensor()
|
241 |
+
count = 0
|
242 |
+
while idx.numel() > 0:
|
243 |
+
i = idx[-1] # index of current largest val
|
244 |
+
# keep.append(i)
|
245 |
+
keep[count] = i
|
246 |
+
count += 1
|
247 |
+
if idx.size(0) == 1:
|
248 |
+
break
|
249 |
+
idx = idx[:-1] # remove kept element from view
|
250 |
+
# load bboxes of next highest vals
|
251 |
+
torch.index_select(x1, 0, idx, out=xx1)
|
252 |
+
torch.index_select(y1, 0, idx, out=yy1)
|
253 |
+
torch.index_select(x2, 0, idx, out=xx2)
|
254 |
+
torch.index_select(y2, 0, idx, out=yy2)
|
255 |
+
# store element-wise max with next highest score
|
256 |
+
xx1 = torch.clamp(xx1, min=x1[i])
|
257 |
+
yy1 = torch.clamp(yy1, min=y1[i])
|
258 |
+
xx2 = torch.clamp(xx2, max=x2[i])
|
259 |
+
yy2 = torch.clamp(yy2, max=y2[i])
|
260 |
+
w.resize_as_(xx2)
|
261 |
+
h.resize_as_(yy2)
|
262 |
+
w = xx2 - xx1
|
263 |
+
h = yy2 - yy1
|
264 |
+
# check sizes of xx1 and xx2.. after each iteration
|
265 |
+
w = torch.clamp(w, min=0.0)
|
266 |
+
h = torch.clamp(h, min=0.0)
|
267 |
+
inter = w*h
|
268 |
+
# IoU = i / (area(a) + area(b) - i)
|
269 |
+
rem_areas = torch.index_select(area, 0, idx) # load remaining areas)
|
270 |
+
union = (rem_areas - inter) + area[i]
|
271 |
+
IoU = inter/union # store result in iou
|
272 |
+
# keep only elements with an IoU <= overlap
|
273 |
+
idx = idx[IoU.le(overlap)]
|
274 |
+
return keep, count
|
275 |
+
|
276 |
+
|
face_recognition1/face_detect/utils/build.py
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from os.path import join as pjoin
|
3 |
+
import numpy as np
|
4 |
+
from distutils.core import setup
|
5 |
+
from distutils.extension import Extension
|
6 |
+
from Cython.Distutils import build_ext
|
7 |
+
|
8 |
+
|
9 |
+
def find_in_path(name, path):
|
10 |
+
"Find a file in a search path"
|
11 |
+
# adapted fom http://code.activestate.com/recipes/52224-find-a-file-given-a-search-path/
|
12 |
+
for dir in path.split(os.pathsep):
|
13 |
+
binpath = pjoin(dir, name)
|
14 |
+
if os.path.exists(binpath):
|
15 |
+
return os.path.abspath(binpath)
|
16 |
+
return None
|
17 |
+
|
18 |
+
|
19 |
+
def locate_cuda():
|
20 |
+
"""Locate the CUDA environment on the system
|
21 |
+
|
22 |
+
Returns a dict with keys 'home', 'nvcc', 'include', and 'lib64'
|
23 |
+
and values giving the absolute path to each directory.
|
24 |
+
|
25 |
+
Starts by looking for the CUDAHOME env variable. If not found, everything
|
26 |
+
is based on finding 'nvcc' in the PATH.
|
27 |
+
"""
|
28 |
+
|
29 |
+
# first check if the CUDAHOME env variable is in use
|
30 |
+
if 'CUDAHOME' in os.environ:
|
31 |
+
home = os.environ['CUDAHOME']
|
32 |
+
nvcc = pjoin(home, 'bin', 'nvcc')
|
33 |
+
else:
|
34 |
+
# otherwise, search the PATH for NVCC
|
35 |
+
default_path = pjoin(os.sep, 'usr', 'local', 'cuda', 'bin')
|
36 |
+
nvcc = find_in_path('nvcc', os.environ['PATH'] + os.pathsep + default_path)
|
37 |
+
if nvcc is None:
|
38 |
+
raise EnvironmentError('The nvcc binary could not be '
|
39 |
+
'located in your $PATH. Either add it to your path, or set $CUDAHOME')
|
40 |
+
home = os.path.dirname(os.path.dirname(nvcc))
|
41 |
+
|
42 |
+
cudaconfig = {'home': home, 'nvcc': nvcc,
|
43 |
+
'include': pjoin(home, 'include'),
|
44 |
+
'lib64': pjoin(home, 'lib64')}
|
45 |
+
for k, v in cudaconfig.items():
|
46 |
+
if not os.path.exists(v):
|
47 |
+
raise EnvironmentError('The CUDA %s path could not be located in %s' % (k, v))
|
48 |
+
|
49 |
+
return cudaconfig
|
50 |
+
|
51 |
+
|
52 |
+
CUDA = locate_cuda()
|
53 |
+
|
54 |
+
# Obtain the numpy include directory. This logic works across numpy versions.
|
55 |
+
try:
|
56 |
+
numpy_include = np.get_include()
|
57 |
+
except AttributeError:
|
58 |
+
numpy_include = np.get_numpy_include()
|
59 |
+
|
60 |
+
|
61 |
+
def customize_compiler_for_nvcc(self):
|
62 |
+
"""inject deep into distutils to customize how the dispatch
|
63 |
+
to gcc/nvcc works.
|
64 |
+
|
65 |
+
If you subclass UnixCCompiler, it's not trivial to get your subclass
|
66 |
+
injected in, and still have the right customizations (i.e.
|
67 |
+
distutils.sysconfig.customize_compiler) run on it. So instead of going
|
68 |
+
the OO route, I have this. Note, it's kindof like a wierd functional
|
69 |
+
subclassing going on."""
|
70 |
+
|
71 |
+
# tell the compiler it can processes .cu
|
72 |
+
self.src_extensions.append('.cu')
|
73 |
+
|
74 |
+
# save references to the default compiler_so and _comple methods
|
75 |
+
default_compiler_so = self.compiler_so
|
76 |
+
super = self._compile
|
77 |
+
|
78 |
+
# now redefine the _compile method. This gets executed for each
|
79 |
+
# object but distutils doesn't have the ability to change compilers
|
80 |
+
# based on source extension: we add it.
|
81 |
+
def _compile(obj, src, ext, cc_args, extra_postargs, pp_opts):
|
82 |
+
print(extra_postargs)
|
83 |
+
if os.path.splitext(src)[1] == '.cu':
|
84 |
+
# use the cuda for .cu files
|
85 |
+
self.set_executable('compiler_so', CUDA['nvcc'])
|
86 |
+
# use only a subset of the extra_postargs, which are 1-1 translated
|
87 |
+
# from the extra_compile_args in the Extension class
|
88 |
+
postargs = extra_postargs['nvcc']
|
89 |
+
else:
|
90 |
+
postargs = extra_postargs['gcc']
|
91 |
+
|
92 |
+
super(obj, src, ext, cc_args, postargs, pp_opts)
|
93 |
+
# reset the default compiler_so, which we might have changed for cuda
|
94 |
+
self.compiler_so = default_compiler_so
|
95 |
+
|
96 |
+
# inject our redefined _compile method into the class
|
97 |
+
self._compile = _compile
|
98 |
+
|
99 |
+
|
100 |
+
# run the customize_compiler
|
101 |
+
class custom_build_ext(build_ext):
|
102 |
+
def build_extensions(self):
|
103 |
+
customize_compiler_for_nvcc(self.compiler)
|
104 |
+
build_ext.build_extensions(self)
|
105 |
+
|
106 |
+
|
107 |
+
ext_modules = [
|
108 |
+
Extension(
|
109 |
+
"nms.cpu_nms",
|
110 |
+
["nms/cpu_nms.pyx"],
|
111 |
+
extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]},
|
112 |
+
include_dirs=[numpy_include]
|
113 |
+
),
|
114 |
+
Extension('nms.gpu_nms',
|
115 |
+
['nms/nms_kernel.cu', 'nms/gpu_nms.pyx'],
|
116 |
+
library_dirs=[CUDA['lib64']],
|
117 |
+
libraries=['cudart'],
|
118 |
+
language='c++',
|
119 |
+
runtime_library_dirs=[CUDA['lib64']],
|
120 |
+
# this syntax is specific to this build system
|
121 |
+
# we're only going to use certain compiler args with nvcc and not with gcc
|
122 |
+
# the implementation of this trick is in customize_compiler() below
|
123 |
+
extra_compile_args={'gcc': ["-Wno-unused-function"],
|
124 |
+
'nvcc': ['-arch=sm_52',
|
125 |
+
'--ptxas-options=-v',
|
126 |
+
'-c',
|
127 |
+
'--compiler-options',
|
128 |
+
"'-fPIC'"]},
|
129 |
+
include_dirs=[numpy_include, CUDA['include']]
|
130 |
+
),
|
131 |
+
]
|
132 |
+
|
133 |
+
setup(
|
134 |
+
name='mot_utils',
|
135 |
+
ext_modules=ext_modules,
|
136 |
+
# inject our custom trigger
|
137 |
+
cmdclass={'build_ext': custom_build_ext},
|
138 |
+
)
|
face_recognition1/face_detect/utils/build/temp.linux-x86_64-3.6/nms/cpu_nms.o
ADDED
Binary file (961 kB). View file
|
|
face_recognition1/face_detect/utils/build/temp.linux-x86_64-3.6/nms/gpu_nms.o
ADDED
Binary file (478 kB). View file
|
|
face_recognition1/face_detect/utils/build/temp.linux-x86_64-3.6/nms/nms_kernel.o
ADDED
Binary file (41.2 kB). View file
|
|
face_recognition1/face_detect/utils/nms/cpu_nms.c
ADDED
The diff for this file is too large to render.
See raw diff
|
|
face_recognition1/face_detect/utils/nms/cpu_nms.cpython-36m-x86_64-linux-gnu.so
ADDED
Binary file (399 kB). View file
|
|
face_recognition1/face_detect/utils/nms/cpu_nms.pyx
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
cimport numpy as np
|
3 |
+
|
4 |
+
cdef inline np.float32_t max(np.float32_t a, np.float32_t b):
|
5 |
+
return a if a >= b else b
|
6 |
+
|
7 |
+
cdef inline np.float32_t min(np.float32_t a, np.float32_t b):
|
8 |
+
return a if a <= b else b
|
9 |
+
|
10 |
+
def cpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh):
|
11 |
+
cdef np.ndarray[np.float32_t, ndim=1] x1 = dets[:, 0]
|
12 |
+
cdef np.ndarray[np.float32_t, ndim=1] y1 = dets[:, 1]
|
13 |
+
cdef np.ndarray[np.float32_t, ndim=1] x2 = dets[:, 2]
|
14 |
+
cdef np.ndarray[np.float32_t, ndim=1] y2 = dets[:, 3]
|
15 |
+
cdef np.ndarray[np.float32_t, ndim=1] scores = dets[:, 4]
|
16 |
+
|
17 |
+
cdef np.ndarray[np.float32_t, ndim=1] areas = (x2 - x1 + 1) * (y2 - y1 + 1)
|
18 |
+
cdef np.ndarray[np.int_t, ndim=1] order = scores.argsort()[::-1]
|
19 |
+
|
20 |
+
cdef int ndets = dets.shape[0]
|
21 |
+
cdef np.ndarray[np.int_t, ndim=1] suppressed = \
|
22 |
+
np.zeros((ndets), dtype=np.int)
|
23 |
+
|
24 |
+
# nominal indices
|
25 |
+
cdef int _i, _j
|
26 |
+
# sorted indices
|
27 |
+
cdef int i, j
|
28 |
+
# temp variables for box i's (the box currently under consideration)
|
29 |
+
cdef np.float32_t ix1, iy1, ix2, iy2, iarea
|
30 |
+
# variables for computing overlap with box j (lower scoring box)
|
31 |
+
cdef np.float32_t xx1, yy1, xx2, yy2
|
32 |
+
cdef np.float32_t w, h
|
33 |
+
cdef np.float32_t inter, ovr
|
34 |
+
|
35 |
+
keep = []
|
36 |
+
for _i in range(ndets):
|
37 |
+
i = order[_i]
|
38 |
+
if suppressed[i] == 1:
|
39 |
+
continue
|
40 |
+
keep.append(i)
|
41 |
+
ix1 = x1[i]
|
42 |
+
iy1 = y1[i]
|
43 |
+
ix2 = x2[i]
|
44 |
+
iy2 = y2[i]
|
45 |
+
iarea = areas[i]
|
46 |
+
for _j in range(_i + 1, ndets):
|
47 |
+
j = order[_j]
|
48 |
+
if suppressed[j] == 1:
|
49 |
+
continue
|
50 |
+
xx1 = max(ix1, x1[j])
|
51 |
+
yy1 = max(iy1, y1[j])
|
52 |
+
xx2 = min(ix2, x2[j])
|
53 |
+
yy2 = min(iy2, y2[j])
|
54 |
+
w = max(0.0, xx2 - xx1 + 1)
|
55 |
+
h = max(0.0, yy2 - yy1 + 1)
|
56 |
+
inter = w * h
|
57 |
+
ovr = inter / (iarea + areas[j] - inter)
|
58 |
+
if ovr >= thresh:
|
59 |
+
suppressed[j] = 1
|
60 |
+
|
61 |
+
return keep
|
62 |
+
|
63 |
+
def cpu_soft_nms(np.ndarray[float, ndim=2] boxes, float sigma=0.5, float Nt=0.3, float threshold=0.001, unsigned int method=0):
|
64 |
+
cdef unsigned int N = boxes.shape[0]
|
65 |
+
cdef float iw, ih, box_area
|
66 |
+
cdef float ua
|
67 |
+
cdef int pos = 0
|
68 |
+
cdef float maxscore = 0
|
69 |
+
cdef int maxpos = 0
|
70 |
+
cdef float x1,x2,y1,y2,tx1,tx2,ty1,ty2,ts,area,weight,ov
|
71 |
+
|
72 |
+
for i in range(N):
|
73 |
+
maxscore = boxes[i, 4]
|
74 |
+
maxpos = i
|
75 |
+
|
76 |
+
tx1 = boxes[i,0]
|
77 |
+
ty1 = boxes[i,1]
|
78 |
+
tx2 = boxes[i,2]
|
79 |
+
ty2 = boxes[i,3]
|
80 |
+
ts = boxes[i,4]
|
81 |
+
|
82 |
+
pos = i + 1
|
83 |
+
# get max box
|
84 |
+
while pos < N:
|
85 |
+
if maxscore < boxes[pos, 4]:
|
86 |
+
maxscore = boxes[pos, 4]
|
87 |
+
maxpos = pos
|
88 |
+
pos = pos + 1
|
89 |
+
|
90 |
+
# add max box as a detection
|
91 |
+
boxes[i,0] = boxes[maxpos,0]
|
92 |
+
boxes[i,1] = boxes[maxpos,1]
|
93 |
+
boxes[i,2] = boxes[maxpos,2]
|
94 |
+
boxes[i,3] = boxes[maxpos,3]
|
95 |
+
boxes[i,4] = boxes[maxpos,4]
|
96 |
+
|
97 |
+
# swap ith box with position of max box
|
98 |
+
boxes[maxpos,0] = tx1
|
99 |
+
boxes[maxpos,1] = ty1
|
100 |
+
boxes[maxpos,2] = tx2
|
101 |
+
boxes[maxpos,3] = ty2
|
102 |
+
boxes[maxpos,4] = ts
|
103 |
+
|
104 |
+
tx1 = boxes[i,0]
|
105 |
+
ty1 = boxes[i,1]
|
106 |
+
tx2 = boxes[i,2]
|
107 |
+
ty2 = boxes[i,3]
|
108 |
+
ts = boxes[i,4]
|
109 |
+
|
110 |
+
pos = i + 1
|
111 |
+
# NMS iterations, note that N changes if detection boxes fall below threshold
|
112 |
+
while pos < N:
|
113 |
+
x1 = boxes[pos, 0]
|
114 |
+
y1 = boxes[pos, 1]
|
115 |
+
x2 = boxes[pos, 2]
|
116 |
+
y2 = boxes[pos, 3]
|
117 |
+
s = boxes[pos, 4]
|
118 |
+
|
119 |
+
area = (x2 - x1 + 1) * (y2 - y1 + 1)
|
120 |
+
iw = (min(tx2, x2) - max(tx1, x1) + 1)
|
121 |
+
if iw > 0:
|
122 |
+
ih = (min(ty2, y2) - max(ty1, y1) + 1)
|
123 |
+
if ih > 0:
|
124 |
+
ua = float((tx2 - tx1 + 1) * (ty2 - ty1 + 1) + area - iw * ih)
|
125 |
+
ov = iw * ih / ua #iou between max box and detection box
|
126 |
+
|
127 |
+
if method == 1: # linear
|
128 |
+
if ov > Nt:
|
129 |
+
weight = 1 - ov
|
130 |
+
else:
|
131 |
+
weight = 1
|
132 |
+
elif method == 2: # gaussian
|
133 |
+
weight = np.exp(-(ov * ov)/sigma)
|
134 |
+
else: # original NMS
|
135 |
+
if ov > Nt:
|
136 |
+
weight = 0
|
137 |
+
else:
|
138 |
+
weight = 1
|
139 |
+
|
140 |
+
boxes[pos, 4] = weight*boxes[pos, 4]
|
141 |
+
|
142 |
+
# if box score falls below threshold, discard the box by swapping with last box
|
143 |
+
# update N
|
144 |
+
if boxes[pos, 4] < threshold:
|
145 |
+
boxes[pos,0] = boxes[N-1, 0]
|
146 |
+
boxes[pos,1] = boxes[N-1, 1]
|
147 |
+
boxes[pos,2] = boxes[N-1, 2]
|
148 |
+
boxes[pos,3] = boxes[N-1, 3]
|
149 |
+
boxes[pos,4] = boxes[N-1, 4]
|
150 |
+
N = N - 1
|
151 |
+
pos = pos - 1
|
152 |
+
|
153 |
+
pos = pos + 1
|
154 |
+
|
155 |
+
keep = [i for i in range(N)]
|
156 |
+
return keep
|
face_recognition1/face_detect/utils/nms/gpu_nms.cpp
ADDED
The diff for this file is too large to render.
See raw diff
|
|