Ibtehaj10 commited on
Commit
26187fd
1 Parent(s): 844b810

Upload 49 files

Browse files
Files changed (49) hide show
  1. .gitattributes +6 -0
  2. LoginStatus.csv +7 -0
  3. MobileNetSSD_deploy.caffemodel +3 -0
  4. MobileNetSSD_deploy.prototxt +1912 -0
  5. README.md +45 -12
  6. __pycache__/centroidtracker.cpython-310.pyc +0 -0
  7. app.py +24 -2
  8. cat_dog_detection.py +43 -0
  9. centroidtracker.py +172 -0
  10. data.db +0 -0
  11. deploy.prototxt +1789 -0
  12. draw_tracking_line.py +152 -0
  13. dwell_time_calculation.py +147 -0
  14. eg.py +691 -0
  15. face_detections.py +60 -0
  16. face_mask_detector.py +73 -0
  17. fps_example.py +37 -0
  18. generate_keys.py +17 -0
  19. img/cat.jpg +0 -0
  20. img/dog.jpg +0 -0
  21. img/input_image.jpg +0 -0
  22. img/people.jpg +0 -0
  23. logo.jpeg +0 -0
  24. mask.mp4 +3 -0
  25. mask_detector.model +3 -0
  26. model files/face detection model/deploy.prototxt +1789 -0
  27. model files/face detection model/readme.txt +1 -0
  28. model files/face detection model/res10_300x300_ssd_iter_140000.caffemodel +3 -0
  29. model files/face mask detection model/mask_detector.model +3 -0
  30. model files/generic object detection model/MobileNetSSD_deploy.caffemodel +3 -0
  31. model files/generic object detection model/MobileNetSSD_deploy.prototxt +1912 -0
  32. model files/generic object detection model/readme.txt +8 -0
  33. opencv-example.py +22 -0
  34. pages/Login.py +679 -0
  35. pages/LoginStatus.csv +3 -0
  36. pages/hashed_pw.pkl +3 -0
  37. pages/signup.py +81 -0
  38. person_counter.py +143 -0
  39. person_detection_image.py +43 -0
  40. person_detection_video.py +71 -0
  41. person_tracking.py +542 -0
  42. res10_300x300_ssd_iter_140000.caffemodel +3 -0
  43. social_distancing.py +152 -0
  44. test4.csv +4 -0
  45. test_video.mp4 +3 -0
  46. video/mask.mp4 +3 -0
  47. video/test_video.mp4 +3 -0
  48. video/testvideo2.mp4 +3 -0
  49. yolov5s.pt +3 -0
.gitattributes CHANGED
@@ -41,3 +41,9 @@ AIComputerVision-master/test_video.mp4 filter=lfs diff=lfs merge=lfs -text
41
  AIComputerVision-master/video/mask.mp4 filter=lfs diff=lfs merge=lfs -text
42
  AIComputerVision-master/video/test_video.mp4 filter=lfs diff=lfs merge=lfs -text
43
  AIComputerVision-master/video/testvideo2.mp4 filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
41
  AIComputerVision-master/video/mask.mp4 filter=lfs diff=lfs merge=lfs -text
42
  AIComputerVision-master/video/test_video.mp4 filter=lfs diff=lfs merge=lfs -text
43
  AIComputerVision-master/video/testvideo2.mp4 filter=lfs diff=lfs merge=lfs -text
44
+ mask.mp4 filter=lfs diff=lfs merge=lfs -text
45
+ MobileNetSSD_deploy.caffemodel filter=lfs diff=lfs merge=lfs -text
46
+ model[[:space:]]files/face[[:space:]]detection[[:space:]]model/res10_300x300_ssd_iter_140000.caffemodel filter=lfs diff=lfs merge=lfs -text
47
+ res10_300x300_ssd_iter_140000.caffemodel filter=lfs diff=lfs merge=lfs -text
48
+ test_video.mp4 filter=lfs diff=lfs merge=lfs -text
49
+ video/testvideo2.mp4 filter=lfs diff=lfs merge=lfs -text
LoginStatus.csv ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ Id,Password
2
+
3
+ ffg,ffg
4
+ anas,12345
5
+ test,12345
6
+ test,12345
7
+ imran,12345
MobileNetSSD_deploy.caffemodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:761c86fbae3d8361dd454f7c740a964f62975ed32f4324b8b85994edec30f6af
3
+ size 23147564
MobileNetSSD_deploy.prototxt ADDED
@@ -0,0 +1,1912 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "MobileNet-SSD"
2
+ input: "data"
3
+ input_shape {
4
+ dim: 1
5
+ dim: 3
6
+ dim: 300
7
+ dim: 300
8
+ }
9
+ layer {
10
+ name: "conv0"
11
+ type: "Convolution"
12
+ bottom: "data"
13
+ top: "conv0"
14
+ param {
15
+ lr_mult: 1.0
16
+ decay_mult: 1.0
17
+ }
18
+ param {
19
+ lr_mult: 2.0
20
+ decay_mult: 0.0
21
+ }
22
+ convolution_param {
23
+ num_output: 32
24
+ pad: 1
25
+ kernel_size: 3
26
+ stride: 2
27
+ weight_filler {
28
+ type: "msra"
29
+ }
30
+ bias_filler {
31
+ type: "constant"
32
+ value: 0.0
33
+ }
34
+ }
35
+ }
36
+ layer {
37
+ name: "conv0/relu"
38
+ type: "ReLU"
39
+ bottom: "conv0"
40
+ top: "conv0"
41
+ }
42
+ layer {
43
+ name: "conv1/dw"
44
+ type: "Convolution"
45
+ bottom: "conv0"
46
+ top: "conv1/dw"
47
+ param {
48
+ lr_mult: 1.0
49
+ decay_mult: 1.0
50
+ }
51
+ param {
52
+ lr_mult: 2.0
53
+ decay_mult: 0.0
54
+ }
55
+ convolution_param {
56
+ num_output: 32
57
+ pad: 1
58
+ kernel_size: 3
59
+ group: 32
60
+ engine: CAFFE
61
+ weight_filler {
62
+ type: "msra"
63
+ }
64
+ bias_filler {
65
+ type: "constant"
66
+ value: 0.0
67
+ }
68
+ }
69
+ }
70
+ layer {
71
+ name: "conv1/dw/relu"
72
+ type: "ReLU"
73
+ bottom: "conv1/dw"
74
+ top: "conv1/dw"
75
+ }
76
+ layer {
77
+ name: "conv1"
78
+ type: "Convolution"
79
+ bottom: "conv1/dw"
80
+ top: "conv1"
81
+ param {
82
+ lr_mult: 1.0
83
+ decay_mult: 1.0
84
+ }
85
+ param {
86
+ lr_mult: 2.0
87
+ decay_mult: 0.0
88
+ }
89
+ convolution_param {
90
+ num_output: 64
91
+ kernel_size: 1
92
+ weight_filler {
93
+ type: "msra"
94
+ }
95
+ bias_filler {
96
+ type: "constant"
97
+ value: 0.0
98
+ }
99
+ }
100
+ }
101
+ layer {
102
+ name: "conv1/relu"
103
+ type: "ReLU"
104
+ bottom: "conv1"
105
+ top: "conv1"
106
+ }
107
+ layer {
108
+ name: "conv2/dw"
109
+ type: "Convolution"
110
+ bottom: "conv1"
111
+ top: "conv2/dw"
112
+ param {
113
+ lr_mult: 1.0
114
+ decay_mult: 1.0
115
+ }
116
+ param {
117
+ lr_mult: 2.0
118
+ decay_mult: 0.0
119
+ }
120
+ convolution_param {
121
+ num_output: 64
122
+ pad: 1
123
+ kernel_size: 3
124
+ stride: 2
125
+ group: 64
126
+ engine: CAFFE
127
+ weight_filler {
128
+ type: "msra"
129
+ }
130
+ bias_filler {
131
+ type: "constant"
132
+ value: 0.0
133
+ }
134
+ }
135
+ }
136
+ layer {
137
+ name: "conv2/dw/relu"
138
+ type: "ReLU"
139
+ bottom: "conv2/dw"
140
+ top: "conv2/dw"
141
+ }
142
+ layer {
143
+ name: "conv2"
144
+ type: "Convolution"
145
+ bottom: "conv2/dw"
146
+ top: "conv2"
147
+ param {
148
+ lr_mult: 1.0
149
+ decay_mult: 1.0
150
+ }
151
+ param {
152
+ lr_mult: 2.0
153
+ decay_mult: 0.0
154
+ }
155
+ convolution_param {
156
+ num_output: 128
157
+ kernel_size: 1
158
+ weight_filler {
159
+ type: "msra"
160
+ }
161
+ bias_filler {
162
+ type: "constant"
163
+ value: 0.0
164
+ }
165
+ }
166
+ }
167
+ layer {
168
+ name: "conv2/relu"
169
+ type: "ReLU"
170
+ bottom: "conv2"
171
+ top: "conv2"
172
+ }
173
+ layer {
174
+ name: "conv3/dw"
175
+ type: "Convolution"
176
+ bottom: "conv2"
177
+ top: "conv3/dw"
178
+ param {
179
+ lr_mult: 1.0
180
+ decay_mult: 1.0
181
+ }
182
+ param {
183
+ lr_mult: 2.0
184
+ decay_mult: 0.0
185
+ }
186
+ convolution_param {
187
+ num_output: 128
188
+ pad: 1
189
+ kernel_size: 3
190
+ group: 128
191
+ engine: CAFFE
192
+ weight_filler {
193
+ type: "msra"
194
+ }
195
+ bias_filler {
196
+ type: "constant"
197
+ value: 0.0
198
+ }
199
+ }
200
+ }
201
+ layer {
202
+ name: "conv3/dw/relu"
203
+ type: "ReLU"
204
+ bottom: "conv3/dw"
205
+ top: "conv3/dw"
206
+ }
207
+ layer {
208
+ name: "conv3"
209
+ type: "Convolution"
210
+ bottom: "conv3/dw"
211
+ top: "conv3"
212
+ param {
213
+ lr_mult: 1.0
214
+ decay_mult: 1.0
215
+ }
216
+ param {
217
+ lr_mult: 2.0
218
+ decay_mult: 0.0
219
+ }
220
+ convolution_param {
221
+ num_output: 128
222
+ kernel_size: 1
223
+ weight_filler {
224
+ type: "msra"
225
+ }
226
+ bias_filler {
227
+ type: "constant"
228
+ value: 0.0
229
+ }
230
+ }
231
+ }
232
+ layer {
233
+ name: "conv3/relu"
234
+ type: "ReLU"
235
+ bottom: "conv3"
236
+ top: "conv3"
237
+ }
238
+ layer {
239
+ name: "conv4/dw"
240
+ type: "Convolution"
241
+ bottom: "conv3"
242
+ top: "conv4/dw"
243
+ param {
244
+ lr_mult: 1.0
245
+ decay_mult: 1.0
246
+ }
247
+ param {
248
+ lr_mult: 2.0
249
+ decay_mult: 0.0
250
+ }
251
+ convolution_param {
252
+ num_output: 128
253
+ pad: 1
254
+ kernel_size: 3
255
+ stride: 2
256
+ group: 128
257
+ engine: CAFFE
258
+ weight_filler {
259
+ type: "msra"
260
+ }
261
+ bias_filler {
262
+ type: "constant"
263
+ value: 0.0
264
+ }
265
+ }
266
+ }
267
+ layer {
268
+ name: "conv4/dw/relu"
269
+ type: "ReLU"
270
+ bottom: "conv4/dw"
271
+ top: "conv4/dw"
272
+ }
273
+ layer {
274
+ name: "conv4"
275
+ type: "Convolution"
276
+ bottom: "conv4/dw"
277
+ top: "conv4"
278
+ param {
279
+ lr_mult: 1.0
280
+ decay_mult: 1.0
281
+ }
282
+ param {
283
+ lr_mult: 2.0
284
+ decay_mult: 0.0
285
+ }
286
+ convolution_param {
287
+ num_output: 256
288
+ kernel_size: 1
289
+ weight_filler {
290
+ type: "msra"
291
+ }
292
+ bias_filler {
293
+ type: "constant"
294
+ value: 0.0
295
+ }
296
+ }
297
+ }
298
+ layer {
299
+ name: "conv4/relu"
300
+ type: "ReLU"
301
+ bottom: "conv4"
302
+ top: "conv4"
303
+ }
304
+ layer {
305
+ name: "conv5/dw"
306
+ type: "Convolution"
307
+ bottom: "conv4"
308
+ top: "conv5/dw"
309
+ param {
310
+ lr_mult: 1.0
311
+ decay_mult: 1.0
312
+ }
313
+ param {
314
+ lr_mult: 2.0
315
+ decay_mult: 0.0
316
+ }
317
+ convolution_param {
318
+ num_output: 256
319
+ pad: 1
320
+ kernel_size: 3
321
+ group: 256
322
+ engine: CAFFE
323
+ weight_filler {
324
+ type: "msra"
325
+ }
326
+ bias_filler {
327
+ type: "constant"
328
+ value: 0.0
329
+ }
330
+ }
331
+ }
332
+ layer {
333
+ name: "conv5/dw/relu"
334
+ type: "ReLU"
335
+ bottom: "conv5/dw"
336
+ top: "conv5/dw"
337
+ }
338
+ layer {
339
+ name: "conv5"
340
+ type: "Convolution"
341
+ bottom: "conv5/dw"
342
+ top: "conv5"
343
+ param {
344
+ lr_mult: 1.0
345
+ decay_mult: 1.0
346
+ }
347
+ param {
348
+ lr_mult: 2.0
349
+ decay_mult: 0.0
350
+ }
351
+ convolution_param {
352
+ num_output: 256
353
+ kernel_size: 1
354
+ weight_filler {
355
+ type: "msra"
356
+ }
357
+ bias_filler {
358
+ type: "constant"
359
+ value: 0.0
360
+ }
361
+ }
362
+ }
363
+ layer {
364
+ name: "conv5/relu"
365
+ type: "ReLU"
366
+ bottom: "conv5"
367
+ top: "conv5"
368
+ }
369
+ layer {
370
+ name: "conv6/dw"
371
+ type: "Convolution"
372
+ bottom: "conv5"
373
+ top: "conv6/dw"
374
+ param {
375
+ lr_mult: 1.0
376
+ decay_mult: 1.0
377
+ }
378
+ param {
379
+ lr_mult: 2.0
380
+ decay_mult: 0.0
381
+ }
382
+ convolution_param {
383
+ num_output: 256
384
+ pad: 1
385
+ kernel_size: 3
386
+ stride: 2
387
+ group: 256
388
+ engine: CAFFE
389
+ weight_filler {
390
+ type: "msra"
391
+ }
392
+ bias_filler {
393
+ type: "constant"
394
+ value: 0.0
395
+ }
396
+ }
397
+ }
398
+ layer {
399
+ name: "conv6/dw/relu"
400
+ type: "ReLU"
401
+ bottom: "conv6/dw"
402
+ top: "conv6/dw"
403
+ }
404
+ layer {
405
+ name: "conv6"
406
+ type: "Convolution"
407
+ bottom: "conv6/dw"
408
+ top: "conv6"
409
+ param {
410
+ lr_mult: 1.0
411
+ decay_mult: 1.0
412
+ }
413
+ param {
414
+ lr_mult: 2.0
415
+ decay_mult: 0.0
416
+ }
417
+ convolution_param {
418
+ num_output: 512
419
+ kernel_size: 1
420
+ weight_filler {
421
+ type: "msra"
422
+ }
423
+ bias_filler {
424
+ type: "constant"
425
+ value: 0.0
426
+ }
427
+ }
428
+ }
429
+ layer {
430
+ name: "conv6/relu"
431
+ type: "ReLU"
432
+ bottom: "conv6"
433
+ top: "conv6"
434
+ }
435
+ layer {
436
+ name: "conv7/dw"
437
+ type: "Convolution"
438
+ bottom: "conv6"
439
+ top: "conv7/dw"
440
+ param {
441
+ lr_mult: 1.0
442
+ decay_mult: 1.0
443
+ }
444
+ param {
445
+ lr_mult: 2.0
446
+ decay_mult: 0.0
447
+ }
448
+ convolution_param {
449
+ num_output: 512
450
+ pad: 1
451
+ kernel_size: 3
452
+ group: 512
453
+ engine: CAFFE
454
+ weight_filler {
455
+ type: "msra"
456
+ }
457
+ bias_filler {
458
+ type: "constant"
459
+ value: 0.0
460
+ }
461
+ }
462
+ }
463
+ layer {
464
+ name: "conv7/dw/relu"
465
+ type: "ReLU"
466
+ bottom: "conv7/dw"
467
+ top: "conv7/dw"
468
+ }
469
+ layer {
470
+ name: "conv7"
471
+ type: "Convolution"
472
+ bottom: "conv7/dw"
473
+ top: "conv7"
474
+ param {
475
+ lr_mult: 1.0
476
+ decay_mult: 1.0
477
+ }
478
+ param {
479
+ lr_mult: 2.0
480
+ decay_mult: 0.0
481
+ }
482
+ convolution_param {
483
+ num_output: 512
484
+ kernel_size: 1
485
+ weight_filler {
486
+ type: "msra"
487
+ }
488
+ bias_filler {
489
+ type: "constant"
490
+ value: 0.0
491
+ }
492
+ }
493
+ }
494
+ layer {
495
+ name: "conv7/relu"
496
+ type: "ReLU"
497
+ bottom: "conv7"
498
+ top: "conv7"
499
+ }
500
+ layer {
501
+ name: "conv8/dw"
502
+ type: "Convolution"
503
+ bottom: "conv7"
504
+ top: "conv8/dw"
505
+ param {
506
+ lr_mult: 1.0
507
+ decay_mult: 1.0
508
+ }
509
+ param {
510
+ lr_mult: 2.0
511
+ decay_mult: 0.0
512
+ }
513
+ convolution_param {
514
+ num_output: 512
515
+ pad: 1
516
+ kernel_size: 3
517
+ group: 512
518
+ engine: CAFFE
519
+ weight_filler {
520
+ type: "msra"
521
+ }
522
+ bias_filler {
523
+ type: "constant"
524
+ value: 0.0
525
+ }
526
+ }
527
+ }
528
+ layer {
529
+ name: "conv8/dw/relu"
530
+ type: "ReLU"
531
+ bottom: "conv8/dw"
532
+ top: "conv8/dw"
533
+ }
534
+ layer {
535
+ name: "conv8"
536
+ type: "Convolution"
537
+ bottom: "conv8/dw"
538
+ top: "conv8"
539
+ param {
540
+ lr_mult: 1.0
541
+ decay_mult: 1.0
542
+ }
543
+ param {
544
+ lr_mult: 2.0
545
+ decay_mult: 0.0
546
+ }
547
+ convolution_param {
548
+ num_output: 512
549
+ kernel_size: 1
550
+ weight_filler {
551
+ type: "msra"
552
+ }
553
+ bias_filler {
554
+ type: "constant"
555
+ value: 0.0
556
+ }
557
+ }
558
+ }
559
+ layer {
560
+ name: "conv8/relu"
561
+ type: "ReLU"
562
+ bottom: "conv8"
563
+ top: "conv8"
564
+ }
565
+ layer {
566
+ name: "conv9/dw"
567
+ type: "Convolution"
568
+ bottom: "conv8"
569
+ top: "conv9/dw"
570
+ param {
571
+ lr_mult: 1.0
572
+ decay_mult: 1.0
573
+ }
574
+ param {
575
+ lr_mult: 2.0
576
+ decay_mult: 0.0
577
+ }
578
+ convolution_param {
579
+ num_output: 512
580
+ pad: 1
581
+ kernel_size: 3
582
+ group: 512
583
+ engine: CAFFE
584
+ weight_filler {
585
+ type: "msra"
586
+ }
587
+ bias_filler {
588
+ type: "constant"
589
+ value: 0.0
590
+ }
591
+ }
592
+ }
593
+ layer {
594
+ name: "conv9/dw/relu"
595
+ type: "ReLU"
596
+ bottom: "conv9/dw"
597
+ top: "conv9/dw"
598
+ }
599
+ layer {
600
+ name: "conv9"
601
+ type: "Convolution"
602
+ bottom: "conv9/dw"
603
+ top: "conv9"
604
+ param {
605
+ lr_mult: 1.0
606
+ decay_mult: 1.0
607
+ }
608
+ param {
609
+ lr_mult: 2.0
610
+ decay_mult: 0.0
611
+ }
612
+ convolution_param {
613
+ num_output: 512
614
+ kernel_size: 1
615
+ weight_filler {
616
+ type: "msra"
617
+ }
618
+ bias_filler {
619
+ type: "constant"
620
+ value: 0.0
621
+ }
622
+ }
623
+ }
624
+ layer {
625
+ name: "conv9/relu"
626
+ type: "ReLU"
627
+ bottom: "conv9"
628
+ top: "conv9"
629
+ }
630
+ layer {
631
+ name: "conv10/dw"
632
+ type: "Convolution"
633
+ bottom: "conv9"
634
+ top: "conv10/dw"
635
+ param {
636
+ lr_mult: 1.0
637
+ decay_mult: 1.0
638
+ }
639
+ param {
640
+ lr_mult: 2.0
641
+ decay_mult: 0.0
642
+ }
643
+ convolution_param {
644
+ num_output: 512
645
+ pad: 1
646
+ kernel_size: 3
647
+ group: 512
648
+ engine: CAFFE
649
+ weight_filler {
650
+ type: "msra"
651
+ }
652
+ bias_filler {
653
+ type: "constant"
654
+ value: 0.0
655
+ }
656
+ }
657
+ }
658
+ layer {
659
+ name: "conv10/dw/relu"
660
+ type: "ReLU"
661
+ bottom: "conv10/dw"
662
+ top: "conv10/dw"
663
+ }
664
+ layer {
665
+ name: "conv10"
666
+ type: "Convolution"
667
+ bottom: "conv10/dw"
668
+ top: "conv10"
669
+ param {
670
+ lr_mult: 1.0
671
+ decay_mult: 1.0
672
+ }
673
+ param {
674
+ lr_mult: 2.0
675
+ decay_mult: 0.0
676
+ }
677
+ convolution_param {
678
+ num_output: 512
679
+ kernel_size: 1
680
+ weight_filler {
681
+ type: "msra"
682
+ }
683
+ bias_filler {
684
+ type: "constant"
685
+ value: 0.0
686
+ }
687
+ }
688
+ }
689
+ layer {
690
+ name: "conv10/relu"
691
+ type: "ReLU"
692
+ bottom: "conv10"
693
+ top: "conv10"
694
+ }
695
+ layer {
696
+ name: "conv11/dw"
697
+ type: "Convolution"
698
+ bottom: "conv10"
699
+ top: "conv11/dw"
700
+ param {
701
+ lr_mult: 1.0
702
+ decay_mult: 1.0
703
+ }
704
+ param {
705
+ lr_mult: 2.0
706
+ decay_mult: 0.0
707
+ }
708
+ convolution_param {
709
+ num_output: 512
710
+ pad: 1
711
+ kernel_size: 3
712
+ group: 512
713
+ engine: CAFFE
714
+ weight_filler {
715
+ type: "msra"
716
+ }
717
+ bias_filler {
718
+ type: "constant"
719
+ value: 0.0
720
+ }
721
+ }
722
+ }
723
+ layer {
724
+ name: "conv11/dw/relu"
725
+ type: "ReLU"
726
+ bottom: "conv11/dw"
727
+ top: "conv11/dw"
728
+ }
729
+ layer {
730
+ name: "conv11"
731
+ type: "Convolution"
732
+ bottom: "conv11/dw"
733
+ top: "conv11"
734
+ param {
735
+ lr_mult: 1.0
736
+ decay_mult: 1.0
737
+ }
738
+ param {
739
+ lr_mult: 2.0
740
+ decay_mult: 0.0
741
+ }
742
+ convolution_param {
743
+ num_output: 512
744
+ kernel_size: 1
745
+ weight_filler {
746
+ type: "msra"
747
+ }
748
+ bias_filler {
749
+ type: "constant"
750
+ value: 0.0
751
+ }
752
+ }
753
+ }
754
+ layer {
755
+ name: "conv11/relu"
756
+ type: "ReLU"
757
+ bottom: "conv11"
758
+ top: "conv11"
759
+ }
760
+ layer {
761
+ name: "conv12/dw"
762
+ type: "Convolution"
763
+ bottom: "conv11"
764
+ top: "conv12/dw"
765
+ param {
766
+ lr_mult: 1.0
767
+ decay_mult: 1.0
768
+ }
769
+ param {
770
+ lr_mult: 2.0
771
+ decay_mult: 0.0
772
+ }
773
+ convolution_param {
774
+ num_output: 512
775
+ pad: 1
776
+ kernel_size: 3
777
+ stride: 2
778
+ group: 512
779
+ engine: CAFFE
780
+ weight_filler {
781
+ type: "msra"
782
+ }
783
+ bias_filler {
784
+ type: "constant"
785
+ value: 0.0
786
+ }
787
+ }
788
+ }
789
+ layer {
790
+ name: "conv12/dw/relu"
791
+ type: "ReLU"
792
+ bottom: "conv12/dw"
793
+ top: "conv12/dw"
794
+ }
795
+ layer {
796
+ name: "conv12"
797
+ type: "Convolution"
798
+ bottom: "conv12/dw"
799
+ top: "conv12"
800
+ param {
801
+ lr_mult: 1.0
802
+ decay_mult: 1.0
803
+ }
804
+ param {
805
+ lr_mult: 2.0
806
+ decay_mult: 0.0
807
+ }
808
+ convolution_param {
809
+ num_output: 1024
810
+ kernel_size: 1
811
+ weight_filler {
812
+ type: "msra"
813
+ }
814
+ bias_filler {
815
+ type: "constant"
816
+ value: 0.0
817
+ }
818
+ }
819
+ }
820
+ layer {
821
+ name: "conv12/relu"
822
+ type: "ReLU"
823
+ bottom: "conv12"
824
+ top: "conv12"
825
+ }
826
+ layer {
827
+ name: "conv13/dw"
828
+ type: "Convolution"
829
+ bottom: "conv12"
830
+ top: "conv13/dw"
831
+ param {
832
+ lr_mult: 1.0
833
+ decay_mult: 1.0
834
+ }
835
+ param {
836
+ lr_mult: 2.0
837
+ decay_mult: 0.0
838
+ }
839
+ convolution_param {
840
+ num_output: 1024
841
+ pad: 1
842
+ kernel_size: 3
843
+ group: 1024
844
+ engine: CAFFE
845
+ weight_filler {
846
+ type: "msra"
847
+ }
848
+ bias_filler {
849
+ type: "constant"
850
+ value: 0.0
851
+ }
852
+ }
853
+ }
854
+ layer {
855
+ name: "conv13/dw/relu"
856
+ type: "ReLU"
857
+ bottom: "conv13/dw"
858
+ top: "conv13/dw"
859
+ }
860
+ layer {
861
+ name: "conv13"
862
+ type: "Convolution"
863
+ bottom: "conv13/dw"
864
+ top: "conv13"
865
+ param {
866
+ lr_mult: 1.0
867
+ decay_mult: 1.0
868
+ }
869
+ param {
870
+ lr_mult: 2.0
871
+ decay_mult: 0.0
872
+ }
873
+ convolution_param {
874
+ num_output: 1024
875
+ kernel_size: 1
876
+ weight_filler {
877
+ type: "msra"
878
+ }
879
+ bias_filler {
880
+ type: "constant"
881
+ value: 0.0
882
+ }
883
+ }
884
+ }
885
+ layer {
886
+ name: "conv13/relu"
887
+ type: "ReLU"
888
+ bottom: "conv13"
889
+ top: "conv13"
890
+ }
891
+ layer {
892
+ name: "conv14_1"
893
+ type: "Convolution"
894
+ bottom: "conv13"
895
+ top: "conv14_1"
896
+ param {
897
+ lr_mult: 1.0
898
+ decay_mult: 1.0
899
+ }
900
+ param {
901
+ lr_mult: 2.0
902
+ decay_mult: 0.0
903
+ }
904
+ convolution_param {
905
+ num_output: 256
906
+ kernel_size: 1
907
+ weight_filler {
908
+ type: "msra"
909
+ }
910
+ bias_filler {
911
+ type: "constant"
912
+ value: 0.0
913
+ }
914
+ }
915
+ }
916
+ layer {
917
+ name: "conv14_1/relu"
918
+ type: "ReLU"
919
+ bottom: "conv14_1"
920
+ top: "conv14_1"
921
+ }
922
+ layer {
923
+ name: "conv14_2"
924
+ type: "Convolution"
925
+ bottom: "conv14_1"
926
+ top: "conv14_2"
927
+ param {
928
+ lr_mult: 1.0
929
+ decay_mult: 1.0
930
+ }
931
+ param {
932
+ lr_mult: 2.0
933
+ decay_mult: 0.0
934
+ }
935
+ convolution_param {
936
+ num_output: 512
937
+ pad: 1
938
+ kernel_size: 3
939
+ stride: 2
940
+ weight_filler {
941
+ type: "msra"
942
+ }
943
+ bias_filler {
944
+ type: "constant"
945
+ value: 0.0
946
+ }
947
+ }
948
+ }
949
+ layer {
950
+ name: "conv14_2/relu"
951
+ type: "ReLU"
952
+ bottom: "conv14_2"
953
+ top: "conv14_2"
954
+ }
955
+ layer {
956
+ name: "conv15_1"
957
+ type: "Convolution"
958
+ bottom: "conv14_2"
959
+ top: "conv15_1"
960
+ param {
961
+ lr_mult: 1.0
962
+ decay_mult: 1.0
963
+ }
964
+ param {
965
+ lr_mult: 2.0
966
+ decay_mult: 0.0
967
+ }
968
+ convolution_param {
969
+ num_output: 128
970
+ kernel_size: 1
971
+ weight_filler {
972
+ type: "msra"
973
+ }
974
+ bias_filler {
975
+ type: "constant"
976
+ value: 0.0
977
+ }
978
+ }
979
+ }
980
+ layer {
981
+ name: "conv15_1/relu"
982
+ type: "ReLU"
983
+ bottom: "conv15_1"
984
+ top: "conv15_1"
985
+ }
986
+ layer {
987
+ name: "conv15_2"
988
+ type: "Convolution"
989
+ bottom: "conv15_1"
990
+ top: "conv15_2"
991
+ param {
992
+ lr_mult: 1.0
993
+ decay_mult: 1.0
994
+ }
995
+ param {
996
+ lr_mult: 2.0
997
+ decay_mult: 0.0
998
+ }
999
+ convolution_param {
1000
+ num_output: 256
1001
+ pad: 1
1002
+ kernel_size: 3
1003
+ stride: 2
1004
+ weight_filler {
1005
+ type: "msra"
1006
+ }
1007
+ bias_filler {
1008
+ type: "constant"
1009
+ value: 0.0
1010
+ }
1011
+ }
1012
+ }
1013
+ layer {
1014
+ name: "conv15_2/relu"
1015
+ type: "ReLU"
1016
+ bottom: "conv15_2"
1017
+ top: "conv15_2"
1018
+ }
1019
+ layer {
1020
+ name: "conv16_1"
1021
+ type: "Convolution"
1022
+ bottom: "conv15_2"
1023
+ top: "conv16_1"
1024
+ param {
1025
+ lr_mult: 1.0
1026
+ decay_mult: 1.0
1027
+ }
1028
+ param {
1029
+ lr_mult: 2.0
1030
+ decay_mult: 0.0
1031
+ }
1032
+ convolution_param {
1033
+ num_output: 128
1034
+ kernel_size: 1
1035
+ weight_filler {
1036
+ type: "msra"
1037
+ }
1038
+ bias_filler {
1039
+ type: "constant"
1040
+ value: 0.0
1041
+ }
1042
+ }
1043
+ }
1044
+ layer {
1045
+ name: "conv16_1/relu"
1046
+ type: "ReLU"
1047
+ bottom: "conv16_1"
1048
+ top: "conv16_1"
1049
+ }
1050
+ layer {
1051
+ name: "conv16_2"
1052
+ type: "Convolution"
1053
+ bottom: "conv16_1"
1054
+ top: "conv16_2"
1055
+ param {
1056
+ lr_mult: 1.0
1057
+ decay_mult: 1.0
1058
+ }
1059
+ param {
1060
+ lr_mult: 2.0
1061
+ decay_mult: 0.0
1062
+ }
1063
+ convolution_param {
1064
+ num_output: 256
1065
+ pad: 1
1066
+ kernel_size: 3
1067
+ stride: 2
1068
+ weight_filler {
1069
+ type: "msra"
1070
+ }
1071
+ bias_filler {
1072
+ type: "constant"
1073
+ value: 0.0
1074
+ }
1075
+ }
1076
+ }
1077
+ layer {
1078
+ name: "conv16_2/relu"
1079
+ type: "ReLU"
1080
+ bottom: "conv16_2"
1081
+ top: "conv16_2"
1082
+ }
1083
+ layer {
1084
+ name: "conv17_1"
1085
+ type: "Convolution"
1086
+ bottom: "conv16_2"
1087
+ top: "conv17_1"
1088
+ param {
1089
+ lr_mult: 1.0
1090
+ decay_mult: 1.0
1091
+ }
1092
+ param {
1093
+ lr_mult: 2.0
1094
+ decay_mult: 0.0
1095
+ }
1096
+ convolution_param {
1097
+ num_output: 64
1098
+ kernel_size: 1
1099
+ weight_filler {
1100
+ type: "msra"
1101
+ }
1102
+ bias_filler {
1103
+ type: "constant"
1104
+ value: 0.0
1105
+ }
1106
+ }
1107
+ }
1108
+ layer {
1109
+ name: "conv17_1/relu"
1110
+ type: "ReLU"
1111
+ bottom: "conv17_1"
1112
+ top: "conv17_1"
1113
+ }
1114
+ layer {
1115
+ name: "conv17_2"
1116
+ type: "Convolution"
1117
+ bottom: "conv17_1"
1118
+ top: "conv17_2"
1119
+ param {
1120
+ lr_mult: 1.0
1121
+ decay_mult: 1.0
1122
+ }
1123
+ param {
1124
+ lr_mult: 2.0
1125
+ decay_mult: 0.0
1126
+ }
1127
+ convolution_param {
1128
+ num_output: 128
1129
+ pad: 1
1130
+ kernel_size: 3
1131
+ stride: 2
1132
+ weight_filler {
1133
+ type: "msra"
1134
+ }
1135
+ bias_filler {
1136
+ type: "constant"
1137
+ value: 0.0
1138
+ }
1139
+ }
1140
+ }
1141
+ layer {
1142
+ name: "conv17_2/relu"
1143
+ type: "ReLU"
1144
+ bottom: "conv17_2"
1145
+ top: "conv17_2"
1146
+ }
1147
+ layer {
1148
+ name: "conv11_mbox_loc"
1149
+ type: "Convolution"
1150
+ bottom: "conv11"
1151
+ top: "conv11_mbox_loc"
1152
+ param {
1153
+ lr_mult: 1.0
1154
+ decay_mult: 1.0
1155
+ }
1156
+ param {
1157
+ lr_mult: 2.0
1158
+ decay_mult: 0.0
1159
+ }
1160
+ convolution_param {
1161
+ num_output: 12
1162
+ kernel_size: 1
1163
+ weight_filler {
1164
+ type: "msra"
1165
+ }
1166
+ bias_filler {
1167
+ type: "constant"
1168
+ value: 0.0
1169
+ }
1170
+ }
1171
+ }
1172
+ layer {
1173
+ name: "conv11_mbox_loc_perm"
1174
+ type: "Permute"
1175
+ bottom: "conv11_mbox_loc"
1176
+ top: "conv11_mbox_loc_perm"
1177
+ permute_param {
1178
+ order: 0
1179
+ order: 2
1180
+ order: 3
1181
+ order: 1
1182
+ }
1183
+ }
1184
+ layer {
1185
+ name: "conv11_mbox_loc_flat"
1186
+ type: "Flatten"
1187
+ bottom: "conv11_mbox_loc_perm"
1188
+ top: "conv11_mbox_loc_flat"
1189
+ flatten_param {
1190
+ axis: 1
1191
+ }
1192
+ }
1193
+ layer {
1194
+ name: "conv11_mbox_conf"
1195
+ type: "Convolution"
1196
+ bottom: "conv11"
1197
+ top: "conv11_mbox_conf"
1198
+ param {
1199
+ lr_mult: 1.0
1200
+ decay_mult: 1.0
1201
+ }
1202
+ param {
1203
+ lr_mult: 2.0
1204
+ decay_mult: 0.0
1205
+ }
1206
+ convolution_param {
1207
+ num_output: 63
1208
+ kernel_size: 1
1209
+ weight_filler {
1210
+ type: "msra"
1211
+ }
1212
+ bias_filler {
1213
+ type: "constant"
1214
+ value: 0.0
1215
+ }
1216
+ }
1217
+ }
1218
+ layer {
1219
+ name: "conv11_mbox_conf_perm"
1220
+ type: "Permute"
1221
+ bottom: "conv11_mbox_conf"
1222
+ top: "conv11_mbox_conf_perm"
1223
+ permute_param {
1224
+ order: 0
1225
+ order: 2
1226
+ order: 3
1227
+ order: 1
1228
+ }
1229
+ }
1230
+ layer {
1231
+ name: "conv11_mbox_conf_flat"
1232
+ type: "Flatten"
1233
+ bottom: "conv11_mbox_conf_perm"
1234
+ top: "conv11_mbox_conf_flat"
1235
+ flatten_param {
1236
+ axis: 1
1237
+ }
1238
+ }
1239
+ layer {
1240
+ name: "conv11_mbox_priorbox"
1241
+ type: "PriorBox"
1242
+ bottom: "conv11"
1243
+ bottom: "data"
1244
+ top: "conv11_mbox_priorbox"
1245
+ prior_box_param {
1246
+ min_size: 60.0
1247
+ aspect_ratio: 2.0
1248
+ flip: true
1249
+ clip: false
1250
+ variance: 0.1
1251
+ variance: 0.1
1252
+ variance: 0.2
1253
+ variance: 0.2
1254
+ offset: 0.5
1255
+ }
1256
+ }
1257
+ layer {
1258
+ name: "conv13_mbox_loc"
1259
+ type: "Convolution"
1260
+ bottom: "conv13"
1261
+ top: "conv13_mbox_loc"
1262
+ param {
1263
+ lr_mult: 1.0
1264
+ decay_mult: 1.0
1265
+ }
1266
+ param {
1267
+ lr_mult: 2.0
1268
+ decay_mult: 0.0
1269
+ }
1270
+ convolution_param {
1271
+ num_output: 24
1272
+ kernel_size: 1
1273
+ weight_filler {
1274
+ type: "msra"
1275
+ }
1276
+ bias_filler {
1277
+ type: "constant"
1278
+ value: 0.0
1279
+ }
1280
+ }
1281
+ }
1282
+ layer {
1283
+ name: "conv13_mbox_loc_perm"
1284
+ type: "Permute"
1285
+ bottom: "conv13_mbox_loc"
1286
+ top: "conv13_mbox_loc_perm"
1287
+ permute_param {
1288
+ order: 0
1289
+ order: 2
1290
+ order: 3
1291
+ order: 1
1292
+ }
1293
+ }
1294
+ layer {
1295
+ name: "conv13_mbox_loc_flat"
1296
+ type: "Flatten"
1297
+ bottom: "conv13_mbox_loc_perm"
1298
+ top: "conv13_mbox_loc_flat"
1299
+ flatten_param {
1300
+ axis: 1
1301
+ }
1302
+ }
1303
+ layer {
1304
+ name: "conv13_mbox_conf"
1305
+ type: "Convolution"
1306
+ bottom: "conv13"
1307
+ top: "conv13_mbox_conf"
1308
+ param {
1309
+ lr_mult: 1.0
1310
+ decay_mult: 1.0
1311
+ }
1312
+ param {
1313
+ lr_mult: 2.0
1314
+ decay_mult: 0.0
1315
+ }
1316
+ convolution_param {
1317
+ num_output: 126
1318
+ kernel_size: 1
1319
+ weight_filler {
1320
+ type: "msra"
1321
+ }
1322
+ bias_filler {
1323
+ type: "constant"
1324
+ value: 0.0
1325
+ }
1326
+ }
1327
+ }
1328
+ layer {
1329
+ name: "conv13_mbox_conf_perm"
1330
+ type: "Permute"
1331
+ bottom: "conv13_mbox_conf"
1332
+ top: "conv13_mbox_conf_perm"
1333
+ permute_param {
1334
+ order: 0
1335
+ order: 2
1336
+ order: 3
1337
+ order: 1
1338
+ }
1339
+ }
1340
+ layer {
1341
+ name: "conv13_mbox_conf_flat"
1342
+ type: "Flatten"
1343
+ bottom: "conv13_mbox_conf_perm"
1344
+ top: "conv13_mbox_conf_flat"
1345
+ flatten_param {
1346
+ axis: 1
1347
+ }
1348
+ }
1349
+ layer {
1350
+ name: "conv13_mbox_priorbox"
1351
+ type: "PriorBox"
1352
+ bottom: "conv13"
1353
+ bottom: "data"
1354
+ top: "conv13_mbox_priorbox"
1355
+ prior_box_param {
1356
+ min_size: 105.0
1357
+ max_size: 150.0
1358
+ aspect_ratio: 2.0
1359
+ aspect_ratio: 3.0
1360
+ flip: true
1361
+ clip: false
1362
+ variance: 0.1
1363
+ variance: 0.1
1364
+ variance: 0.2
1365
+ variance: 0.2
1366
+ offset: 0.5
1367
+ }
1368
+ }
1369
+ layer {
1370
+ name: "conv14_2_mbox_loc"
1371
+ type: "Convolution"
1372
+ bottom: "conv14_2"
1373
+ top: "conv14_2_mbox_loc"
1374
+ param {
1375
+ lr_mult: 1.0
1376
+ decay_mult: 1.0
1377
+ }
1378
+ param {
1379
+ lr_mult: 2.0
1380
+ decay_mult: 0.0
1381
+ }
1382
+ convolution_param {
1383
+ num_output: 24
1384
+ kernel_size: 1
1385
+ weight_filler {
1386
+ type: "msra"
1387
+ }
1388
+ bias_filler {
1389
+ type: "constant"
1390
+ value: 0.0
1391
+ }
1392
+ }
1393
+ }
1394
+ layer {
1395
+ name: "conv14_2_mbox_loc_perm"
1396
+ type: "Permute"
1397
+ bottom: "conv14_2_mbox_loc"
1398
+ top: "conv14_2_mbox_loc_perm"
1399
+ permute_param {
1400
+ order: 0
1401
+ order: 2
1402
+ order: 3
1403
+ order: 1
1404
+ }
1405
+ }
1406
+ layer {
1407
+ name: "conv14_2_mbox_loc_flat"
1408
+ type: "Flatten"
1409
+ bottom: "conv14_2_mbox_loc_perm"
1410
+ top: "conv14_2_mbox_loc_flat"
1411
+ flatten_param {
1412
+ axis: 1
1413
+ }
1414
+ }
1415
+ layer {
1416
+ name: "conv14_2_mbox_conf"
1417
+ type: "Convolution"
1418
+ bottom: "conv14_2"
1419
+ top: "conv14_2_mbox_conf"
1420
+ param {
1421
+ lr_mult: 1.0
1422
+ decay_mult: 1.0
1423
+ }
1424
+ param {
1425
+ lr_mult: 2.0
1426
+ decay_mult: 0.0
1427
+ }
1428
+ convolution_param {
1429
+ num_output: 126
1430
+ kernel_size: 1
1431
+ weight_filler {
1432
+ type: "msra"
1433
+ }
1434
+ bias_filler {
1435
+ type: "constant"
1436
+ value: 0.0
1437
+ }
1438
+ }
1439
+ }
1440
+ layer {
1441
+ name: "conv14_2_mbox_conf_perm"
1442
+ type: "Permute"
1443
+ bottom: "conv14_2_mbox_conf"
1444
+ top: "conv14_2_mbox_conf_perm"
1445
+ permute_param {
1446
+ order: 0
1447
+ order: 2
1448
+ order: 3
1449
+ order: 1
1450
+ }
1451
+ }
1452
+ layer {
1453
+ name: "conv14_2_mbox_conf_flat"
1454
+ type: "Flatten"
1455
+ bottom: "conv14_2_mbox_conf_perm"
1456
+ top: "conv14_2_mbox_conf_flat"
1457
+ flatten_param {
1458
+ axis: 1
1459
+ }
1460
+ }
1461
+ layer {
1462
+ name: "conv14_2_mbox_priorbox"
1463
+ type: "PriorBox"
1464
+ bottom: "conv14_2"
1465
+ bottom: "data"
1466
+ top: "conv14_2_mbox_priorbox"
1467
+ prior_box_param {
1468
+ min_size: 150.0
1469
+ max_size: 195.0
1470
+ aspect_ratio: 2.0
1471
+ aspect_ratio: 3.0
1472
+ flip: true
1473
+ clip: false
1474
+ variance: 0.1
1475
+ variance: 0.1
1476
+ variance: 0.2
1477
+ variance: 0.2
1478
+ offset: 0.5
1479
+ }
1480
+ }
1481
+ layer {
1482
+ name: "conv15_2_mbox_loc"
1483
+ type: "Convolution"
1484
+ bottom: "conv15_2"
1485
+ top: "conv15_2_mbox_loc"
1486
+ param {
1487
+ lr_mult: 1.0
1488
+ decay_mult: 1.0
1489
+ }
1490
+ param {
1491
+ lr_mult: 2.0
1492
+ decay_mult: 0.0
1493
+ }
1494
+ convolution_param {
1495
+ num_output: 24
1496
+ kernel_size: 1
1497
+ weight_filler {
1498
+ type: "msra"
1499
+ }
1500
+ bias_filler {
1501
+ type: "constant"
1502
+ value: 0.0
1503
+ }
1504
+ }
1505
+ }
1506
+ layer {
1507
+ name: "conv15_2_mbox_loc_perm"
1508
+ type: "Permute"
1509
+ bottom: "conv15_2_mbox_loc"
1510
+ top: "conv15_2_mbox_loc_perm"
1511
+ permute_param {
1512
+ order: 0
1513
+ order: 2
1514
+ order: 3
1515
+ order: 1
1516
+ }
1517
+ }
1518
+ layer {
1519
+ name: "conv15_2_mbox_loc_flat"
1520
+ type: "Flatten"
1521
+ bottom: "conv15_2_mbox_loc_perm"
1522
+ top: "conv15_2_mbox_loc_flat"
1523
+ flatten_param {
1524
+ axis: 1
1525
+ }
1526
+ }
1527
+ layer {
1528
+ name: "conv15_2_mbox_conf"
1529
+ type: "Convolution"
1530
+ bottom: "conv15_2"
1531
+ top: "conv15_2_mbox_conf"
1532
+ param {
1533
+ lr_mult: 1.0
1534
+ decay_mult: 1.0
1535
+ }
1536
+ param {
1537
+ lr_mult: 2.0
1538
+ decay_mult: 0.0
1539
+ }
1540
+ convolution_param {
1541
+ num_output: 126
1542
+ kernel_size: 1
1543
+ weight_filler {
1544
+ type: "msra"
1545
+ }
1546
+ bias_filler {
1547
+ type: "constant"
1548
+ value: 0.0
1549
+ }
1550
+ }
1551
+ }
1552
+ layer {
1553
+ name: "conv15_2_mbox_conf_perm"
1554
+ type: "Permute"
1555
+ bottom: "conv15_2_mbox_conf"
1556
+ top: "conv15_2_mbox_conf_perm"
1557
+ permute_param {
1558
+ order: 0
1559
+ order: 2
1560
+ order: 3
1561
+ order: 1
1562
+ }
1563
+ }
1564
+ layer {
1565
+ name: "conv15_2_mbox_conf_flat"
1566
+ type: "Flatten"
1567
+ bottom: "conv15_2_mbox_conf_perm"
1568
+ top: "conv15_2_mbox_conf_flat"
1569
+ flatten_param {
1570
+ axis: 1
1571
+ }
1572
+ }
1573
+ layer {
1574
+ name: "conv15_2_mbox_priorbox"
1575
+ type: "PriorBox"
1576
+ bottom: "conv15_2"
1577
+ bottom: "data"
1578
+ top: "conv15_2_mbox_priorbox"
1579
+ prior_box_param {
1580
+ min_size: 195.0
1581
+ max_size: 240.0
1582
+ aspect_ratio: 2.0
1583
+ aspect_ratio: 3.0
1584
+ flip: true
1585
+ clip: false
1586
+ variance: 0.1
1587
+ variance: 0.1
1588
+ variance: 0.2
1589
+ variance: 0.2
1590
+ offset: 0.5
1591
+ }
1592
+ }
1593
+ layer {
1594
+ name: "conv16_2_mbox_loc"
1595
+ type: "Convolution"
1596
+ bottom: "conv16_2"
1597
+ top: "conv16_2_mbox_loc"
1598
+ param {
1599
+ lr_mult: 1.0
1600
+ decay_mult: 1.0
1601
+ }
1602
+ param {
1603
+ lr_mult: 2.0
1604
+ decay_mult: 0.0
1605
+ }
1606
+ convolution_param {
1607
+ num_output: 24
1608
+ kernel_size: 1
1609
+ weight_filler {
1610
+ type: "msra"
1611
+ }
1612
+ bias_filler {
1613
+ type: "constant"
1614
+ value: 0.0
1615
+ }
1616
+ }
1617
+ }
1618
+ layer {
1619
+ name: "conv16_2_mbox_loc_perm"
1620
+ type: "Permute"
1621
+ bottom: "conv16_2_mbox_loc"
1622
+ top: "conv16_2_mbox_loc_perm"
1623
+ permute_param {
1624
+ order: 0
1625
+ order: 2
1626
+ order: 3
1627
+ order: 1
1628
+ }
1629
+ }
1630
+ layer {
1631
+ name: "conv16_2_mbox_loc_flat"
1632
+ type: "Flatten"
1633
+ bottom: "conv16_2_mbox_loc_perm"
1634
+ top: "conv16_2_mbox_loc_flat"
1635
+ flatten_param {
1636
+ axis: 1
1637
+ }
1638
+ }
1639
+ layer {
1640
+ name: "conv16_2_mbox_conf"
1641
+ type: "Convolution"
1642
+ bottom: "conv16_2"
1643
+ top: "conv16_2_mbox_conf"
1644
+ param {
1645
+ lr_mult: 1.0
1646
+ decay_mult: 1.0
1647
+ }
1648
+ param {
1649
+ lr_mult: 2.0
1650
+ decay_mult: 0.0
1651
+ }
1652
+ convolution_param {
1653
+ num_output: 126
1654
+ kernel_size: 1
1655
+ weight_filler {
1656
+ type: "msra"
1657
+ }
1658
+ bias_filler {
1659
+ type: "constant"
1660
+ value: 0.0
1661
+ }
1662
+ }
1663
+ }
1664
+ layer {
1665
+ name: "conv16_2_mbox_conf_perm"
1666
+ type: "Permute"
1667
+ bottom: "conv16_2_mbox_conf"
1668
+ top: "conv16_2_mbox_conf_perm"
1669
+ permute_param {
1670
+ order: 0
1671
+ order: 2
1672
+ order: 3
1673
+ order: 1
1674
+ }
1675
+ }
1676
+ layer {
1677
+ name: "conv16_2_mbox_conf_flat"
1678
+ type: "Flatten"
1679
+ bottom: "conv16_2_mbox_conf_perm"
1680
+ top: "conv16_2_mbox_conf_flat"
1681
+ flatten_param {
1682
+ axis: 1
1683
+ }
1684
+ }
1685
+ layer {
1686
+ name: "conv16_2_mbox_priorbox"
1687
+ type: "PriorBox"
1688
+ bottom: "conv16_2"
1689
+ bottom: "data"
1690
+ top: "conv16_2_mbox_priorbox"
1691
+ prior_box_param {
1692
+ min_size: 240.0
1693
+ max_size: 285.0
1694
+ aspect_ratio: 2.0
1695
+ aspect_ratio: 3.0
1696
+ flip: true
1697
+ clip: false
1698
+ variance: 0.1
1699
+ variance: 0.1
1700
+ variance: 0.2
1701
+ variance: 0.2
1702
+ offset: 0.5
1703
+ }
1704
+ }
1705
+ layer {
1706
+ name: "conv17_2_mbox_loc"
1707
+ type: "Convolution"
1708
+ bottom: "conv17_2"
1709
+ top: "conv17_2_mbox_loc"
1710
+ param {
1711
+ lr_mult: 1.0
1712
+ decay_mult: 1.0
1713
+ }
1714
+ param {
1715
+ lr_mult: 2.0
1716
+ decay_mult: 0.0
1717
+ }
1718
+ convolution_param {
1719
+ num_output: 24
1720
+ kernel_size: 1
1721
+ weight_filler {
1722
+ type: "msra"
1723
+ }
1724
+ bias_filler {
1725
+ type: "constant"
1726
+ value: 0.0
1727
+ }
1728
+ }
1729
+ }
1730
+ layer {
1731
+ name: "conv17_2_mbox_loc_perm"
1732
+ type: "Permute"
1733
+ bottom: "conv17_2_mbox_loc"
1734
+ top: "conv17_2_mbox_loc_perm"
1735
+ permute_param {
1736
+ order: 0
1737
+ order: 2
1738
+ order: 3
1739
+ order: 1
1740
+ }
1741
+ }
1742
+ layer {
1743
+ name: "conv17_2_mbox_loc_flat"
1744
+ type: "Flatten"
1745
+ bottom: "conv17_2_mbox_loc_perm"
1746
+ top: "conv17_2_mbox_loc_flat"
1747
+ flatten_param {
1748
+ axis: 1
1749
+ }
1750
+ }
1751
+ layer {
1752
+ name: "conv17_2_mbox_conf"
1753
+ type: "Convolution"
1754
+ bottom: "conv17_2"
1755
+ top: "conv17_2_mbox_conf"
1756
+ param {
1757
+ lr_mult: 1.0
1758
+ decay_mult: 1.0
1759
+ }
1760
+ param {
1761
+ lr_mult: 2.0
1762
+ decay_mult: 0.0
1763
+ }
1764
+ convolution_param {
1765
+ num_output: 126
1766
+ kernel_size: 1
1767
+ weight_filler {
1768
+ type: "msra"
1769
+ }
1770
+ bias_filler {
1771
+ type: "constant"
1772
+ value: 0.0
1773
+ }
1774
+ }
1775
+ }
1776
+ layer {
1777
+ name: "conv17_2_mbox_conf_perm"
1778
+ type: "Permute"
1779
+ bottom: "conv17_2_mbox_conf"
1780
+ top: "conv17_2_mbox_conf_perm"
1781
+ permute_param {
1782
+ order: 0
1783
+ order: 2
1784
+ order: 3
1785
+ order: 1
1786
+ }
1787
+ }
1788
+ layer {
1789
+ name: "conv17_2_mbox_conf_flat"
1790
+ type: "Flatten"
1791
+ bottom: "conv17_2_mbox_conf_perm"
1792
+ top: "conv17_2_mbox_conf_flat"
1793
+ flatten_param {
1794
+ axis: 1
1795
+ }
1796
+ }
1797
+ layer {
1798
+ name: "conv17_2_mbox_priorbox"
1799
+ type: "PriorBox"
1800
+ bottom: "conv17_2"
1801
+ bottom: "data"
1802
+ top: "conv17_2_mbox_priorbox"
1803
+ prior_box_param {
1804
+ min_size: 285.0
1805
+ max_size: 300.0
1806
+ aspect_ratio: 2.0
1807
+ aspect_ratio: 3.0
1808
+ flip: true
1809
+ clip: false
1810
+ variance: 0.1
1811
+ variance: 0.1
1812
+ variance: 0.2
1813
+ variance: 0.2
1814
+ offset: 0.5
1815
+ }
1816
+ }
1817
+ layer {
1818
+ name: "mbox_loc"
1819
+ type: "Concat"
1820
+ bottom: "conv11_mbox_loc_flat"
1821
+ bottom: "conv13_mbox_loc_flat"
1822
+ bottom: "conv14_2_mbox_loc_flat"
1823
+ bottom: "conv15_2_mbox_loc_flat"
1824
+ bottom: "conv16_2_mbox_loc_flat"
1825
+ bottom: "conv17_2_mbox_loc_flat"
1826
+ top: "mbox_loc"
1827
+ concat_param {
1828
+ axis: 1
1829
+ }
1830
+ }
1831
+ layer {
1832
+ name: "mbox_conf"
1833
+ type: "Concat"
1834
+ bottom: "conv11_mbox_conf_flat"
1835
+ bottom: "conv13_mbox_conf_flat"
1836
+ bottom: "conv14_2_mbox_conf_flat"
1837
+ bottom: "conv15_2_mbox_conf_flat"
1838
+ bottom: "conv16_2_mbox_conf_flat"
1839
+ bottom: "conv17_2_mbox_conf_flat"
1840
+ top: "mbox_conf"
1841
+ concat_param {
1842
+ axis: 1
1843
+ }
1844
+ }
1845
+ layer {
1846
+ name: "mbox_priorbox"
1847
+ type: "Concat"
1848
+ bottom: "conv11_mbox_priorbox"
1849
+ bottom: "conv13_mbox_priorbox"
1850
+ bottom: "conv14_2_mbox_priorbox"
1851
+ bottom: "conv15_2_mbox_priorbox"
1852
+ bottom: "conv16_2_mbox_priorbox"
1853
+ bottom: "conv17_2_mbox_priorbox"
1854
+ top: "mbox_priorbox"
1855
+ concat_param {
1856
+ axis: 2
1857
+ }
1858
+ }
1859
+ layer {
1860
+ name: "mbox_conf_reshape"
1861
+ type: "Reshape"
1862
+ bottom: "mbox_conf"
1863
+ top: "mbox_conf_reshape"
1864
+ reshape_param {
1865
+ shape {
1866
+ dim: 0
1867
+ dim: -1
1868
+ dim: 21
1869
+ }
1870
+ }
1871
+ }
1872
+ layer {
1873
+ name: "mbox_conf_softmax"
1874
+ type: "Softmax"
1875
+ bottom: "mbox_conf_reshape"
1876
+ top: "mbox_conf_softmax"
1877
+ softmax_param {
1878
+ axis: 2
1879
+ }
1880
+ }
1881
+ layer {
1882
+ name: "mbox_conf_flatten"
1883
+ type: "Flatten"
1884
+ bottom: "mbox_conf_softmax"
1885
+ top: "mbox_conf_flatten"
1886
+ flatten_param {
1887
+ axis: 1
1888
+ }
1889
+ }
1890
+ layer {
1891
+ name: "detection_out"
1892
+ type: "DetectionOutput"
1893
+ bottom: "mbox_loc"
1894
+ bottom: "mbox_conf_flatten"
1895
+ bottom: "mbox_priorbox"
1896
+ top: "detection_out"
1897
+ include {
1898
+ phase: TEST
1899
+ }
1900
+ detection_output_param {
1901
+ num_classes: 21
1902
+ share_location: true
1903
+ background_label_id: 0
1904
+ nms_param {
1905
+ nms_threshold: 0.45
1906
+ top_k: 100
1907
+ }
1908
+ code_type: CENTER_SIZE
1909
+ keep_top_k: 100
1910
+ confidence_threshold: 0.25
1911
+ }
1912
+ }
README.md CHANGED
@@ -1,12 +1,45 @@
1
- ---
2
- title: Cheating Detection
3
- emoji: 😻
4
- colorFrom: red
5
- colorTo: gray
6
- sdk: streamlit
7
- sdk_version: 1.15.2
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AIComputerVision
2
+ This project contains various computer vision and AI related python scripts
3
+
4
+ Link to full playlist: https://www.youtube.com/watch?v=UM9oDhhAg88&list=PLWw98q-Xe7iH8UHARl8RGk8MRj1raY4Eh
5
+
6
+ Below is brief description for each script:
7
+
8
+ 1. Cat Dog detection:
9
+ This script can detect cats and dogs in a frame. You can replace cat or dog with any other object you want to detect.
10
+
11
+ 2. Centroidtracker:
12
+ This script helps in tracking any object in a frame. We have used this in person_tracking.py script in order to track persons in the frame.
13
+
14
+ 3. Dwell Time Calculation:
15
+ This script calculates the time a person has spent in a frame. It is a good example of calculating total time a person was present in frame.
16
+
17
+ 4. Face Detection:
18
+ This script detects face in person image or in a frame
19
+
20
+ 5. FPS Example:
21
+ While inferencing on a video file or frame from live usb webcam, its always a good idea to keep a check on how much fps we are getting. This script shows approx fps on frame.
22
+
23
+ 6. OpenCV Example:
24
+ This script shows basic usage of opencv
25
+
26
+ 7. Person Detection in Image File:
27
+ This script detects person in image file
28
+
29
+ 8. Person Detection in Video File:
30
+ This script detects person in video file. Test video file is present in video dir.
31
+
32
+ 9. Person Tracking:
33
+ This script detects person and keeps tracking them in the frame. It assigns a unique ID to each detected person.
34
+
35
+ 10. Monitor Social Distance
36
+ This script monitors social distance between the persons. If it is less than a threshold value, we display bounding box in red otherwise green.
37
+
38
+ 11. Drawing tracking line:
39
+ This script draws a line denoting where the person has entered in the frame and where he has moved in the frame.
40
+
41
+ 12. Face Mask Detection:
42
+ This script checks if a person is wearing face mask or not
43
+
44
+ 13. Person Counter:
45
+ This script counts the number of person present in the frame.
__pycache__/centroidtracker.cpython-310.pyc ADDED
Binary file (2.41 kB). View file
 
app.py CHANGED
@@ -1,2 +1,24 @@
1
- import streamlit as st
2
- st.write('Hello world')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from PIL import Image
3
+ st.set_page_config(
4
+ page_title = "Cheating Detection Application")
5
+
6
+ st.title("Cheating Application Final Year Project")
7
+
8
+ st.sidebar.success("Select a page above")
9
+
10
+
11
+ st.image("logo.jpeg")
12
+
13
+ st.write("""
14
+ Imran Ahmed (GL)
15
+ SE-093-2019
16
+
17
+ Mir Taimoor Iqbal
18
+ SE-075-2019
19
+
20
+ Muhammad Ali Akbar
21
+ SE-019-2018
22
+
23
+ FABEHA QADIR
24
+ SE-076-2019""")
cat_dog_detection.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import numpy as np
3
+ import imutils
4
+
5
+ protopath = "MobileNetSSD_deploy.prototxt"
6
+ modelpath = "MobileNetSSD_deploy.caffemodel"
7
+ detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
8
+
9
+ CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
10
+ "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
11
+ "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
12
+ "sofa", "train", "tvmonitor"]
13
+
14
+
15
+ def main():
16
+ image = cv2.imread('dog.jpg')
17
+ image = imutils.resize(image, width=600)
18
+
19
+ (H, W) = image.shape[:2]
20
+
21
+ blob = cv2.dnn.blobFromImage(image, 0.007843, (W, H), 127.5)
22
+
23
+ detector.setInput(blob)
24
+ person_detections = detector.forward()
25
+
26
+ for i in np.arange(0, person_detections.shape[2]):
27
+ confidence = person_detections[0, 0, i, 2]
28
+ if confidence > 0.5:
29
+ idx = int(person_detections[0, 0, i, 1])
30
+
31
+ if CLASSES[idx] != "dog":
32
+ continue
33
+
34
+ person_box = person_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
35
+ (startX, startY, endX, endY) = person_box.astype("int")
36
+
37
+ cv2.rectangle(image, (startX, startY), (endX, endY), (0, 0, 255), 2)
38
+
39
+ cv2.imshow("Results", image)
40
+ cv2.waitKey(0)
41
+ cv2.destroyAllWindows()
42
+
43
+ main()
centroidtracker.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # import the necessary packages
2
+ from scipy.spatial import distance as dist
3
+ from collections import OrderedDict
4
+ import numpy as np
5
+
6
+
7
+ class CentroidTracker:
8
+ def __init__(self, maxDisappeared=50, maxDistance=50):
9
+ # initialize the next unique object ID along with two ordered
10
+ # dictionaries used to keep track of mapping a given object
11
+ # ID to its centroid and number of consecutive frames it has
12
+ # been marked as "disappeared", respectively
13
+ self.nextObjectID = 0
14
+ self.objects = OrderedDict()
15
+ self.disappeared = OrderedDict()
16
+ self.bbox = OrderedDict() # CHANGE
17
+
18
+ # store the number of maximum consecutive frames a given
19
+ # object is allowed to be marked as "disappeared" until we
20
+ # need to deregister the object from tracking
21
+ self.maxDisappeared = maxDisappeared
22
+
23
+ # store the maximum distance between centroids to associate
24
+ # an object -- if the distance is larger than this maximum
25
+ # distance we'll start to mark the object as "disappeared"
26
+ self.maxDistance = maxDistance
27
+
28
+ def register(self, centroid, inputRect):
29
+ # when registering an object we use the next available object
30
+ # ID to store the centroid
31
+ self.objects[self.nextObjectID] = centroid
32
+ self.bbox[self.nextObjectID] = inputRect # CHANGE
33
+ self.disappeared[self.nextObjectID] = 0
34
+ self.nextObjectID += 1
35
+
36
+ def deregister(self, objectID):
37
+ # to deregister an object ID we delete the object ID from
38
+ # both of our respective dictionaries
39
+ del self.objects[objectID]
40
+ del self.disappeared[objectID]
41
+ del self.bbox[objectID] # CHANGE
42
+
43
+ def update(self, rects):
44
+ # check to see if the list of input bounding box rectangles
45
+ # is empty
46
+ if len(rects) == 0:
47
+ # loop over any existing tracked objects and mark them
48
+ # as disappeared
49
+ for objectID in list(self.disappeared.keys()):
50
+ self.disappeared[objectID] += 1
51
+
52
+ # if we have reached a maximum number of consecutive
53
+ # frames where a given object has been marked as
54
+ # missing, deregister it
55
+ if self.disappeared[objectID] > self.maxDisappeared:
56
+ self.deregister(objectID)
57
+
58
+ # return early as there are no centroids or tracking info
59
+ # to update
60
+ # return self.objects
61
+ return self.bbox
62
+
63
+ # initialize an array of input centroids for the current frame
64
+ inputCentroids = np.zeros((len(rects), 2), dtype="int")
65
+ inputRects = []
66
+ # loop over the bounding box rectangles
67
+ for (i, (startX, startY, endX, endY)) in enumerate(rects):
68
+ # use the bounding box coordinates to derive the centroid
69
+ cX = int((startX + endX) / 2.0)
70
+ cY = int((startY + endY) / 2.0)
71
+ inputCentroids[i] = (cX, cY)
72
+ inputRects.append(rects[i]) # CHANGE
73
+
74
+ # if we are currently not tracking any objects take the input
75
+ # centroids and register each of them
76
+ if len(self.objects) == 0:
77
+ for i in range(0, len(inputCentroids)):
78
+ self.register(inputCentroids[i], inputRects[i]) # CHANGE
79
+
80
+ # otherwise, are are currently tracking objects so we need to
81
+ # try to match the input centroids to existing object
82
+ # centroids
83
+ else:
84
+ # grab the set of object IDs and corresponding centroids
85
+ objectIDs = list(self.objects.keys())
86
+ objectCentroids = list(self.objects.values())
87
+
88
+ # compute the distance between each pair of object
89
+ # centroids and input centroids, respectively -- our
90
+ # goal will be to match an input centroid to an existing
91
+ # object centroid
92
+ D = dist.cdist(np.array(objectCentroids), inputCentroids)
93
+
94
+ # in order to perform this matching we must (1) find the
95
+ # smallest value in each row and then (2) sort the row
96
+ # indexes based on their minimum values so that the row
97
+ # with the smallest value as at the *front* of the index
98
+ # list
99
+ rows = D.min(axis=1).argsort()
100
+
101
+ # next, we perform a similar process on the columns by
102
+ # finding the smallest value in each column and then
103
+ # sorting using the previously computed row index list
104
+ cols = D.argmin(axis=1)[rows]
105
+
106
+ # in order to determine if we need to update, register,
107
+ # or deregister an object we need to keep track of which
108
+ # of the rows and column indexes we have already examined
109
+ usedRows = set()
110
+ usedCols = set()
111
+
112
+ # loop over the combination of the (row, column) index
113
+ # tuples
114
+ for (row, col) in zip(rows, cols):
115
+ # if we have already examined either the row or
116
+ # column value before, ignore it
117
+ if row in usedRows or col in usedCols:
118
+ continue
119
+
120
+ # if the distance between centroids is greater than
121
+ # the maximum distance, do not associate the two
122
+ # centroids to the same object
123
+ if D[row, col] > self.maxDistance:
124
+ continue
125
+
126
+ # otherwise, grab the object ID for the current row,
127
+ # set its new centroid, and reset the disappeared
128
+ # counter
129
+ objectID = objectIDs[row]
130
+ self.objects[objectID] = inputCentroids[col]
131
+ self.bbox[objectID] = inputRects[col] # CHANGE
132
+ self.disappeared[objectID] = 0
133
+
134
+ # indicate that we have examined each of the row and
135
+ # column indexes, respectively
136
+ usedRows.add(row)
137
+ usedCols.add(col)
138
+
139
+ # compute both the row and column index we have NOT yet
140
+ # examined
141
+ unusedRows = set(range(0, D.shape[0])).difference(usedRows)
142
+ unusedCols = set(range(0, D.shape[1])).difference(usedCols)
143
+
144
+ # in the event that the number of object centroids is
145
+ # equal or greater than the number of input centroids
146
+ # we need to check and see if some of these objects have
147
+ # potentially disappeared
148
+ if D.shape[0] >= D.shape[1]:
149
+ # loop over the unused row indexes
150
+ for row in unusedRows:
151
+ # grab the object ID for the corresponding row
152
+ # index and increment the disappeared counter
153
+ objectID = objectIDs[row]
154
+ self.disappeared[objectID] += 1
155
+
156
+ # check to see if the number of consecutive
157
+ # frames the object has been marked "disappeared"
158
+ # for warrants deregistering the object
159
+ if self.disappeared[objectID] > self.maxDisappeared:
160
+ self.deregister(objectID)
161
+
162
+ # otherwise, if the number of input centroids is greater
163
+ # than the number of existing object centroids we need to
164
+ # register each new input centroid as a trackable object
165
+ else:
166
+ for col in unusedCols:
167
+ self.register(inputCentroids[col], inputRects[col])
168
+
169
+ # return the set of trackable objects
170
+ # return self.objects
171
+ return self.bbox
172
+
data.db ADDED
Binary file (8.19 kB). View file
 
deploy.prototxt ADDED
@@ -0,0 +1,1789 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ input: "data"
2
+ input_shape {
3
+ dim: 1
4
+ dim: 3
5
+ dim: 300
6
+ dim: 300
7
+ }
8
+
9
+ layer {
10
+ name: "data_bn"
11
+ type: "BatchNorm"
12
+ bottom: "data"
13
+ top: "data_bn"
14
+ param {
15
+ lr_mult: 0.0
16
+ }
17
+ param {
18
+ lr_mult: 0.0
19
+ }
20
+ param {
21
+ lr_mult: 0.0
22
+ }
23
+ }
24
+ layer {
25
+ name: "data_scale"
26
+ type: "Scale"
27
+ bottom: "data_bn"
28
+ top: "data_bn"
29
+ param {
30
+ lr_mult: 1.0
31
+ decay_mult: 1.0
32
+ }
33
+ param {
34
+ lr_mult: 2.0
35
+ decay_mult: 1.0
36
+ }
37
+ scale_param {
38
+ bias_term: true
39
+ }
40
+ }
41
+ layer {
42
+ name: "conv1_h"
43
+ type: "Convolution"
44
+ bottom: "data_bn"
45
+ top: "conv1_h"
46
+ param {
47
+ lr_mult: 1.0
48
+ decay_mult: 1.0
49
+ }
50
+ param {
51
+ lr_mult: 2.0
52
+ decay_mult: 1.0
53
+ }
54
+ convolution_param {
55
+ num_output: 32
56
+ pad: 3
57
+ kernel_size: 7
58
+ stride: 2
59
+ weight_filler {
60
+ type: "msra"
61
+ variance_norm: FAN_OUT
62
+ }
63
+ bias_filler {
64
+ type: "constant"
65
+ value: 0.0
66
+ }
67
+ }
68
+ }
69
+ layer {
70
+ name: "conv1_bn_h"
71
+ type: "BatchNorm"
72
+ bottom: "conv1_h"
73
+ top: "conv1_h"
74
+ param {
75
+ lr_mult: 0.0
76
+ }
77
+ param {
78
+ lr_mult: 0.0
79
+ }
80
+ param {
81
+ lr_mult: 0.0
82
+ }
83
+ }
84
+ layer {
85
+ name: "conv1_scale_h"
86
+ type: "Scale"
87
+ bottom: "conv1_h"
88
+ top: "conv1_h"
89
+ param {
90
+ lr_mult: 1.0
91
+ decay_mult: 1.0
92
+ }
93
+ param {
94
+ lr_mult: 2.0
95
+ decay_mult: 1.0
96
+ }
97
+ scale_param {
98
+ bias_term: true
99
+ }
100
+ }
101
+ layer {
102
+ name: "conv1_relu"
103
+ type: "ReLU"
104
+ bottom: "conv1_h"
105
+ top: "conv1_h"
106
+ }
107
+ layer {
108
+ name: "conv1_pool"
109
+ type: "Pooling"
110
+ bottom: "conv1_h"
111
+ top: "conv1_pool"
112
+ pooling_param {
113
+ kernel_size: 3
114
+ stride: 2
115
+ }
116
+ }
117
+ layer {
118
+ name: "layer_64_1_conv1_h"
119
+ type: "Convolution"
120
+ bottom: "conv1_pool"
121
+ top: "layer_64_1_conv1_h"
122
+ param {
123
+ lr_mult: 1.0
124
+ decay_mult: 1.0
125
+ }
126
+ convolution_param {
127
+ num_output: 32
128
+ bias_term: false
129
+ pad: 1
130
+ kernel_size: 3
131
+ stride: 1
132
+ weight_filler {
133
+ type: "msra"
134
+ }
135
+ bias_filler {
136
+ type: "constant"
137
+ value: 0.0
138
+ }
139
+ }
140
+ }
141
+ layer {
142
+ name: "layer_64_1_bn2_h"
143
+ type: "BatchNorm"
144
+ bottom: "layer_64_1_conv1_h"
145
+ top: "layer_64_1_conv1_h"
146
+ param {
147
+ lr_mult: 0.0
148
+ }
149
+ param {
150
+ lr_mult: 0.0
151
+ }
152
+ param {
153
+ lr_mult: 0.0
154
+ }
155
+ }
156
+ layer {
157
+ name: "layer_64_1_scale2_h"
158
+ type: "Scale"
159
+ bottom: "layer_64_1_conv1_h"
160
+ top: "layer_64_1_conv1_h"
161
+ param {
162
+ lr_mult: 1.0
163
+ decay_mult: 1.0
164
+ }
165
+ param {
166
+ lr_mult: 2.0
167
+ decay_mult: 1.0
168
+ }
169
+ scale_param {
170
+ bias_term: true
171
+ }
172
+ }
173
+ layer {
174
+ name: "layer_64_1_relu2"
175
+ type: "ReLU"
176
+ bottom: "layer_64_1_conv1_h"
177
+ top: "layer_64_1_conv1_h"
178
+ }
179
+ layer {
180
+ name: "layer_64_1_conv2_h"
181
+ type: "Convolution"
182
+ bottom: "layer_64_1_conv1_h"
183
+ top: "layer_64_1_conv2_h"
184
+ param {
185
+ lr_mult: 1.0
186
+ decay_mult: 1.0
187
+ }
188
+ convolution_param {
189
+ num_output: 32
190
+ bias_term: false
191
+ pad: 1
192
+ kernel_size: 3
193
+ stride: 1
194
+ weight_filler {
195
+ type: "msra"
196
+ }
197
+ bias_filler {
198
+ type: "constant"
199
+ value: 0.0
200
+ }
201
+ }
202
+ }
203
+ layer {
204
+ name: "layer_64_1_sum"
205
+ type: "Eltwise"
206
+ bottom: "layer_64_1_conv2_h"
207
+ bottom: "conv1_pool"
208
+ top: "layer_64_1_sum"
209
+ }
210
+ layer {
211
+ name: "layer_128_1_bn1_h"
212
+ type: "BatchNorm"
213
+ bottom: "layer_64_1_sum"
214
+ top: "layer_128_1_bn1_h"
215
+ param {
216
+ lr_mult: 0.0
217
+ }
218
+ param {
219
+ lr_mult: 0.0
220
+ }
221
+ param {
222
+ lr_mult: 0.0
223
+ }
224
+ }
225
+ layer {
226
+ name: "layer_128_1_scale1_h"
227
+ type: "Scale"
228
+ bottom: "layer_128_1_bn1_h"
229
+ top: "layer_128_1_bn1_h"
230
+ param {
231
+ lr_mult: 1.0
232
+ decay_mult: 1.0
233
+ }
234
+ param {
235
+ lr_mult: 2.0
236
+ decay_mult: 1.0
237
+ }
238
+ scale_param {
239
+ bias_term: true
240
+ }
241
+ }
242
+ layer {
243
+ name: "layer_128_1_relu1"
244
+ type: "ReLU"
245
+ bottom: "layer_128_1_bn1_h"
246
+ top: "layer_128_1_bn1_h"
247
+ }
248
+ layer {
249
+ name: "layer_128_1_conv1_h"
250
+ type: "Convolution"
251
+ bottom: "layer_128_1_bn1_h"
252
+ top: "layer_128_1_conv1_h"
253
+ param {
254
+ lr_mult: 1.0
255
+ decay_mult: 1.0
256
+ }
257
+ convolution_param {
258
+ num_output: 128
259
+ bias_term: false
260
+ pad: 1
261
+ kernel_size: 3
262
+ stride: 2
263
+ weight_filler {
264
+ type: "msra"
265
+ }
266
+ bias_filler {
267
+ type: "constant"
268
+ value: 0.0
269
+ }
270
+ }
271
+ }
272
+ layer {
273
+ name: "layer_128_1_bn2"
274
+ type: "BatchNorm"
275
+ bottom: "layer_128_1_conv1_h"
276
+ top: "layer_128_1_conv1_h"
277
+ param {
278
+ lr_mult: 0.0
279
+ }
280
+ param {
281
+ lr_mult: 0.0
282
+ }
283
+ param {
284
+ lr_mult: 0.0
285
+ }
286
+ }
287
+ layer {
288
+ name: "layer_128_1_scale2"
289
+ type: "Scale"
290
+ bottom: "layer_128_1_conv1_h"
291
+ top: "layer_128_1_conv1_h"
292
+ param {
293
+ lr_mult: 1.0
294
+ decay_mult: 1.0
295
+ }
296
+ param {
297
+ lr_mult: 2.0
298
+ decay_mult: 1.0
299
+ }
300
+ scale_param {
301
+ bias_term: true
302
+ }
303
+ }
304
+ layer {
305
+ name: "layer_128_1_relu2"
306
+ type: "ReLU"
307
+ bottom: "layer_128_1_conv1_h"
308
+ top: "layer_128_1_conv1_h"
309
+ }
310
+ layer {
311
+ name: "layer_128_1_conv2"
312
+ type: "Convolution"
313
+ bottom: "layer_128_1_conv1_h"
314
+ top: "layer_128_1_conv2"
315
+ param {
316
+ lr_mult: 1.0
317
+ decay_mult: 1.0
318
+ }
319
+ convolution_param {
320
+ num_output: 128
321
+ bias_term: false
322
+ pad: 1
323
+ kernel_size: 3
324
+ stride: 1
325
+ weight_filler {
326
+ type: "msra"
327
+ }
328
+ bias_filler {
329
+ type: "constant"
330
+ value: 0.0
331
+ }
332
+ }
333
+ }
334
+ layer {
335
+ name: "layer_128_1_conv_expand_h"
336
+ type: "Convolution"
337
+ bottom: "layer_128_1_bn1_h"
338
+ top: "layer_128_1_conv_expand_h"
339
+ param {
340
+ lr_mult: 1.0
341
+ decay_mult: 1.0
342
+ }
343
+ convolution_param {
344
+ num_output: 128
345
+ bias_term: false
346
+ pad: 0
347
+ kernel_size: 1
348
+ stride: 2
349
+ weight_filler {
350
+ type: "msra"
351
+ }
352
+ bias_filler {
353
+ type: "constant"
354
+ value: 0.0
355
+ }
356
+ }
357
+ }
358
+ layer {
359
+ name: "layer_128_1_sum"
360
+ type: "Eltwise"
361
+ bottom: "layer_128_1_conv2"
362
+ bottom: "layer_128_1_conv_expand_h"
363
+ top: "layer_128_1_sum"
364
+ }
365
+ layer {
366
+ name: "layer_256_1_bn1"
367
+ type: "BatchNorm"
368
+ bottom: "layer_128_1_sum"
369
+ top: "layer_256_1_bn1"
370
+ param {
371
+ lr_mult: 0.0
372
+ }
373
+ param {
374
+ lr_mult: 0.0
375
+ }
376
+ param {
377
+ lr_mult: 0.0
378
+ }
379
+ }
380
+ layer {
381
+ name: "layer_256_1_scale1"
382
+ type: "Scale"
383
+ bottom: "layer_256_1_bn1"
384
+ top: "layer_256_1_bn1"
385
+ param {
386
+ lr_mult: 1.0
387
+ decay_mult: 1.0
388
+ }
389
+ param {
390
+ lr_mult: 2.0
391
+ decay_mult: 1.0
392
+ }
393
+ scale_param {
394
+ bias_term: true
395
+ }
396
+ }
397
+ layer {
398
+ name: "layer_256_1_relu1"
399
+ type: "ReLU"
400
+ bottom: "layer_256_1_bn1"
401
+ top: "layer_256_1_bn1"
402
+ }
403
+ layer {
404
+ name: "layer_256_1_conv1"
405
+ type: "Convolution"
406
+ bottom: "layer_256_1_bn1"
407
+ top: "layer_256_1_conv1"
408
+ param {
409
+ lr_mult: 1.0
410
+ decay_mult: 1.0
411
+ }
412
+ convolution_param {
413
+ num_output: 256
414
+ bias_term: false
415
+ pad: 1
416
+ kernel_size: 3
417
+ stride: 2
418
+ weight_filler {
419
+ type: "msra"
420
+ }
421
+ bias_filler {
422
+ type: "constant"
423
+ value: 0.0
424
+ }
425
+ }
426
+ }
427
+ layer {
428
+ name: "layer_256_1_bn2"
429
+ type: "BatchNorm"
430
+ bottom: "layer_256_1_conv1"
431
+ top: "layer_256_1_conv1"
432
+ param {
433
+ lr_mult: 0.0
434
+ }
435
+ param {
436
+ lr_mult: 0.0
437
+ }
438
+ param {
439
+ lr_mult: 0.0
440
+ }
441
+ }
442
+ layer {
443
+ name: "layer_256_1_scale2"
444
+ type: "Scale"
445
+ bottom: "layer_256_1_conv1"
446
+ top: "layer_256_1_conv1"
447
+ param {
448
+ lr_mult: 1.0
449
+ decay_mult: 1.0
450
+ }
451
+ param {
452
+ lr_mult: 2.0
453
+ decay_mult: 1.0
454
+ }
455
+ scale_param {
456
+ bias_term: true
457
+ }
458
+ }
459
+ layer {
460
+ name: "layer_256_1_relu2"
461
+ type: "ReLU"
462
+ bottom: "layer_256_1_conv1"
463
+ top: "layer_256_1_conv1"
464
+ }
465
+ layer {
466
+ name: "layer_256_1_conv2"
467
+ type: "Convolution"
468
+ bottom: "layer_256_1_conv1"
469
+ top: "layer_256_1_conv2"
470
+ param {
471
+ lr_mult: 1.0
472
+ decay_mult: 1.0
473
+ }
474
+ convolution_param {
475
+ num_output: 256
476
+ bias_term: false
477
+ pad: 1
478
+ kernel_size: 3
479
+ stride: 1
480
+ weight_filler {
481
+ type: "msra"
482
+ }
483
+ bias_filler {
484
+ type: "constant"
485
+ value: 0.0
486
+ }
487
+ }
488
+ }
489
+ layer {
490
+ name: "layer_256_1_conv_expand"
491
+ type: "Convolution"
492
+ bottom: "layer_256_1_bn1"
493
+ top: "layer_256_1_conv_expand"
494
+ param {
495
+ lr_mult: 1.0
496
+ decay_mult: 1.0
497
+ }
498
+ convolution_param {
499
+ num_output: 256
500
+ bias_term: false
501
+ pad: 0
502
+ kernel_size: 1
503
+ stride: 2
504
+ weight_filler {
505
+ type: "msra"
506
+ }
507
+ bias_filler {
508
+ type: "constant"
509
+ value: 0.0
510
+ }
511
+ }
512
+ }
513
+ layer {
514
+ name: "layer_256_1_sum"
515
+ type: "Eltwise"
516
+ bottom: "layer_256_1_conv2"
517
+ bottom: "layer_256_1_conv_expand"
518
+ top: "layer_256_1_sum"
519
+ }
520
+ layer {
521
+ name: "layer_512_1_bn1"
522
+ type: "BatchNorm"
523
+ bottom: "layer_256_1_sum"
524
+ top: "layer_512_1_bn1"
525
+ param {
526
+ lr_mult: 0.0
527
+ }
528
+ param {
529
+ lr_mult: 0.0
530
+ }
531
+ param {
532
+ lr_mult: 0.0
533
+ }
534
+ }
535
+ layer {
536
+ name: "layer_512_1_scale1"
537
+ type: "Scale"
538
+ bottom: "layer_512_1_bn1"
539
+ top: "layer_512_1_bn1"
540
+ param {
541
+ lr_mult: 1.0
542
+ decay_mult: 1.0
543
+ }
544
+ param {
545
+ lr_mult: 2.0
546
+ decay_mult: 1.0
547
+ }
548
+ scale_param {
549
+ bias_term: true
550
+ }
551
+ }
552
+ layer {
553
+ name: "layer_512_1_relu1"
554
+ type: "ReLU"
555
+ bottom: "layer_512_1_bn1"
556
+ top: "layer_512_1_bn1"
557
+ }
558
+ layer {
559
+ name: "layer_512_1_conv1_h"
560
+ type: "Convolution"
561
+ bottom: "layer_512_1_bn1"
562
+ top: "layer_512_1_conv1_h"
563
+ param {
564
+ lr_mult: 1.0
565
+ decay_mult: 1.0
566
+ }
567
+ convolution_param {
568
+ num_output: 128
569
+ bias_term: false
570
+ pad: 1
571
+ kernel_size: 3
572
+ stride: 1 # 2
573
+ weight_filler {
574
+ type: "msra"
575
+ }
576
+ bias_filler {
577
+ type: "constant"
578
+ value: 0.0
579
+ }
580
+ }
581
+ }
582
+ layer {
583
+ name: "layer_512_1_bn2_h"
584
+ type: "BatchNorm"
585
+ bottom: "layer_512_1_conv1_h"
586
+ top: "layer_512_1_conv1_h"
587
+ param {
588
+ lr_mult: 0.0
589
+ }
590
+ param {
591
+ lr_mult: 0.0
592
+ }
593
+ param {
594
+ lr_mult: 0.0
595
+ }
596
+ }
597
+ layer {
598
+ name: "layer_512_1_scale2_h"
599
+ type: "Scale"
600
+ bottom: "layer_512_1_conv1_h"
601
+ top: "layer_512_1_conv1_h"
602
+ param {
603
+ lr_mult: 1.0
604
+ decay_mult: 1.0
605
+ }
606
+ param {
607
+ lr_mult: 2.0
608
+ decay_mult: 1.0
609
+ }
610
+ scale_param {
611
+ bias_term: true
612
+ }
613
+ }
614
+ layer {
615
+ name: "layer_512_1_relu2"
616
+ type: "ReLU"
617
+ bottom: "layer_512_1_conv1_h"
618
+ top: "layer_512_1_conv1_h"
619
+ }
620
+ layer {
621
+ name: "layer_512_1_conv2_h"
622
+ type: "Convolution"
623
+ bottom: "layer_512_1_conv1_h"
624
+ top: "layer_512_1_conv2_h"
625
+ param {
626
+ lr_mult: 1.0
627
+ decay_mult: 1.0
628
+ }
629
+ convolution_param {
630
+ num_output: 256
631
+ bias_term: false
632
+ pad: 2 # 1
633
+ kernel_size: 3
634
+ stride: 1
635
+ dilation: 2
636
+ weight_filler {
637
+ type: "msra"
638
+ }
639
+ bias_filler {
640
+ type: "constant"
641
+ value: 0.0
642
+ }
643
+ }
644
+ }
645
+ layer {
646
+ name: "layer_512_1_conv_expand_h"
647
+ type: "Convolution"
648
+ bottom: "layer_512_1_bn1"
649
+ top: "layer_512_1_conv_expand_h"
650
+ param {
651
+ lr_mult: 1.0
652
+ decay_mult: 1.0
653
+ }
654
+ convolution_param {
655
+ num_output: 256
656
+ bias_term: false
657
+ pad: 0
658
+ kernel_size: 1
659
+ stride: 1 # 2
660
+ weight_filler {
661
+ type: "msra"
662
+ }
663
+ bias_filler {
664
+ type: "constant"
665
+ value: 0.0
666
+ }
667
+ }
668
+ }
669
+ layer {
670
+ name: "layer_512_1_sum"
671
+ type: "Eltwise"
672
+ bottom: "layer_512_1_conv2_h"
673
+ bottom: "layer_512_1_conv_expand_h"
674
+ top: "layer_512_1_sum"
675
+ }
676
+ layer {
677
+ name: "last_bn_h"
678
+ type: "BatchNorm"
679
+ bottom: "layer_512_1_sum"
680
+ top: "layer_512_1_sum"
681
+ param {
682
+ lr_mult: 0.0
683
+ }
684
+ param {
685
+ lr_mult: 0.0
686
+ }
687
+ param {
688
+ lr_mult: 0.0
689
+ }
690
+ }
691
+ layer {
692
+ name: "last_scale_h"
693
+ type: "Scale"
694
+ bottom: "layer_512_1_sum"
695
+ top: "layer_512_1_sum"
696
+ param {
697
+ lr_mult: 1.0
698
+ decay_mult: 1.0
699
+ }
700
+ param {
701
+ lr_mult: 2.0
702
+ decay_mult: 1.0
703
+ }
704
+ scale_param {
705
+ bias_term: true
706
+ }
707
+ }
708
+ layer {
709
+ name: "last_relu"
710
+ type: "ReLU"
711
+ bottom: "layer_512_1_sum"
712
+ top: "fc7"
713
+ }
714
+
715
+ layer {
716
+ name: "conv6_1_h"
717
+ type: "Convolution"
718
+ bottom: "fc7"
719
+ top: "conv6_1_h"
720
+ param {
721
+ lr_mult: 1
722
+ decay_mult: 1
723
+ }
724
+ param {
725
+ lr_mult: 2
726
+ decay_mult: 0
727
+ }
728
+ convolution_param {
729
+ num_output: 128
730
+ pad: 0
731
+ kernel_size: 1
732
+ stride: 1
733
+ weight_filler {
734
+ type: "xavier"
735
+ }
736
+ bias_filler {
737
+ type: "constant"
738
+ value: 0
739
+ }
740
+ }
741
+ }
742
+ layer {
743
+ name: "conv6_1_relu"
744
+ type: "ReLU"
745
+ bottom: "conv6_1_h"
746
+ top: "conv6_1_h"
747
+ }
748
+ layer {
749
+ name: "conv6_2_h"
750
+ type: "Convolution"
751
+ bottom: "conv6_1_h"
752
+ top: "conv6_2_h"
753
+ param {
754
+ lr_mult: 1
755
+ decay_mult: 1
756
+ }
757
+ param {
758
+ lr_mult: 2
759
+ decay_mult: 0
760
+ }
761
+ convolution_param {
762
+ num_output: 256
763
+ pad: 1
764
+ kernel_size: 3
765
+ stride: 2
766
+ weight_filler {
767
+ type: "xavier"
768
+ }
769
+ bias_filler {
770
+ type: "constant"
771
+ value: 0
772
+ }
773
+ }
774
+ }
775
+ layer {
776
+ name: "conv6_2_relu"
777
+ type: "ReLU"
778
+ bottom: "conv6_2_h"
779
+ top: "conv6_2_h"
780
+ }
781
+ layer {
782
+ name: "conv7_1_h"
783
+ type: "Convolution"
784
+ bottom: "conv6_2_h"
785
+ top: "conv7_1_h"
786
+ param {
787
+ lr_mult: 1
788
+ decay_mult: 1
789
+ }
790
+ param {
791
+ lr_mult: 2
792
+ decay_mult: 0
793
+ }
794
+ convolution_param {
795
+ num_output: 64
796
+ pad: 0
797
+ kernel_size: 1
798
+ stride: 1
799
+ weight_filler {
800
+ type: "xavier"
801
+ }
802
+ bias_filler {
803
+ type: "constant"
804
+ value: 0
805
+ }
806
+ }
807
+ }
808
+ layer {
809
+ name: "conv7_1_relu"
810
+ type: "ReLU"
811
+ bottom: "conv7_1_h"
812
+ top: "conv7_1_h"
813
+ }
814
+ layer {
815
+ name: "conv7_2_h"
816
+ type: "Convolution"
817
+ bottom: "conv7_1_h"
818
+ top: "conv7_2_h"
819
+ param {
820
+ lr_mult: 1
821
+ decay_mult: 1
822
+ }
823
+ param {
824
+ lr_mult: 2
825
+ decay_mult: 0
826
+ }
827
+ convolution_param {
828
+ num_output: 128
829
+ pad: 1
830
+ kernel_size: 3
831
+ stride: 2
832
+ weight_filler {
833
+ type: "xavier"
834
+ }
835
+ bias_filler {
836
+ type: "constant"
837
+ value: 0
838
+ }
839
+ }
840
+ }
841
+ layer {
842
+ name: "conv7_2_relu"
843
+ type: "ReLU"
844
+ bottom: "conv7_2_h"
845
+ top: "conv7_2_h"
846
+ }
847
+ layer {
848
+ name: "conv8_1_h"
849
+ type: "Convolution"
850
+ bottom: "conv7_2_h"
851
+ top: "conv8_1_h"
852
+ param {
853
+ lr_mult: 1
854
+ decay_mult: 1
855
+ }
856
+ param {
857
+ lr_mult: 2
858
+ decay_mult: 0
859
+ }
860
+ convolution_param {
861
+ num_output: 64
862
+ pad: 0
863
+ kernel_size: 1
864
+ stride: 1
865
+ weight_filler {
866
+ type: "xavier"
867
+ }
868
+ bias_filler {
869
+ type: "constant"
870
+ value: 0
871
+ }
872
+ }
873
+ }
874
+ layer {
875
+ name: "conv8_1_relu"
876
+ type: "ReLU"
877
+ bottom: "conv8_1_h"
878
+ top: "conv8_1_h"
879
+ }
880
+ layer {
881
+ name: "conv8_2_h"
882
+ type: "Convolution"
883
+ bottom: "conv8_1_h"
884
+ top: "conv8_2_h"
885
+ param {
886
+ lr_mult: 1
887
+ decay_mult: 1
888
+ }
889
+ param {
890
+ lr_mult: 2
891
+ decay_mult: 0
892
+ }
893
+ convolution_param {
894
+ num_output: 128
895
+ pad: 1
896
+ kernel_size: 3
897
+ stride: 1
898
+ weight_filler {
899
+ type: "xavier"
900
+ }
901
+ bias_filler {
902
+ type: "constant"
903
+ value: 0
904
+ }
905
+ }
906
+ }
907
+ layer {
908
+ name: "conv8_2_relu"
909
+ type: "ReLU"
910
+ bottom: "conv8_2_h"
911
+ top: "conv8_2_h"
912
+ }
913
+ layer {
914
+ name: "conv9_1_h"
915
+ type: "Convolution"
916
+ bottom: "conv8_2_h"
917
+ top: "conv9_1_h"
918
+ param {
919
+ lr_mult: 1
920
+ decay_mult: 1
921
+ }
922
+ param {
923
+ lr_mult: 2
924
+ decay_mult: 0
925
+ }
926
+ convolution_param {
927
+ num_output: 64
928
+ pad: 0
929
+ kernel_size: 1
930
+ stride: 1
931
+ weight_filler {
932
+ type: "xavier"
933
+ }
934
+ bias_filler {
935
+ type: "constant"
936
+ value: 0
937
+ }
938
+ }
939
+ }
940
+ layer {
941
+ name: "conv9_1_relu"
942
+ type: "ReLU"
943
+ bottom: "conv9_1_h"
944
+ top: "conv9_1_h"
945
+ }
946
+ layer {
947
+ name: "conv9_2_h"
948
+ type: "Convolution"
949
+ bottom: "conv9_1_h"
950
+ top: "conv9_2_h"
951
+ param {
952
+ lr_mult: 1
953
+ decay_mult: 1
954
+ }
955
+ param {
956
+ lr_mult: 2
957
+ decay_mult: 0
958
+ }
959
+ convolution_param {
960
+ num_output: 128
961
+ pad: 1
962
+ kernel_size: 3
963
+ stride: 1
964
+ weight_filler {
965
+ type: "xavier"
966
+ }
967
+ bias_filler {
968
+ type: "constant"
969
+ value: 0
970
+ }
971
+ }
972
+ }
973
+ layer {
974
+ name: "conv9_2_relu"
975
+ type: "ReLU"
976
+ bottom: "conv9_2_h"
977
+ top: "conv9_2_h"
978
+ }
979
+ layer {
980
+ name: "conv4_3_norm"
981
+ type: "Normalize"
982
+ bottom: "layer_256_1_bn1"
983
+ top: "conv4_3_norm"
984
+ norm_param {
985
+ across_spatial: false
986
+ scale_filler {
987
+ type: "constant"
988
+ value: 20
989
+ }
990
+ channel_shared: false
991
+ }
992
+ }
993
+ layer {
994
+ name: "conv4_3_norm_mbox_loc"
995
+ type: "Convolution"
996
+ bottom: "conv4_3_norm"
997
+ top: "conv4_3_norm_mbox_loc"
998
+ param {
999
+ lr_mult: 1
1000
+ decay_mult: 1
1001
+ }
1002
+ param {
1003
+ lr_mult: 2
1004
+ decay_mult: 0
1005
+ }
1006
+ convolution_param {
1007
+ num_output: 16
1008
+ pad: 1
1009
+ kernel_size: 3
1010
+ stride: 1
1011
+ weight_filler {
1012
+ type: "xavier"
1013
+ }
1014
+ bias_filler {
1015
+ type: "constant"
1016
+ value: 0
1017
+ }
1018
+ }
1019
+ }
1020
+ layer {
1021
+ name: "conv4_3_norm_mbox_loc_perm"
1022
+ type: "Permute"
1023
+ bottom: "conv4_3_norm_mbox_loc"
1024
+ top: "conv4_3_norm_mbox_loc_perm"
1025
+ permute_param {
1026
+ order: 0
1027
+ order: 2
1028
+ order: 3
1029
+ order: 1
1030
+ }
1031
+ }
1032
+ layer {
1033
+ name: "conv4_3_norm_mbox_loc_flat"
1034
+ type: "Flatten"
1035
+ bottom: "conv4_3_norm_mbox_loc_perm"
1036
+ top: "conv4_3_norm_mbox_loc_flat"
1037
+ flatten_param {
1038
+ axis: 1
1039
+ }
1040
+ }
1041
+ layer {
1042
+ name: "conv4_3_norm_mbox_conf"
1043
+ type: "Convolution"
1044
+ bottom: "conv4_3_norm"
1045
+ top: "conv4_3_norm_mbox_conf"
1046
+ param {
1047
+ lr_mult: 1
1048
+ decay_mult: 1
1049
+ }
1050
+ param {
1051
+ lr_mult: 2
1052
+ decay_mult: 0
1053
+ }
1054
+ convolution_param {
1055
+ num_output: 8 # 84
1056
+ pad: 1
1057
+ kernel_size: 3
1058
+ stride: 1
1059
+ weight_filler {
1060
+ type: "xavier"
1061
+ }
1062
+ bias_filler {
1063
+ type: "constant"
1064
+ value: 0
1065
+ }
1066
+ }
1067
+ }
1068
+ layer {
1069
+ name: "conv4_3_norm_mbox_conf_perm"
1070
+ type: "Permute"
1071
+ bottom: "conv4_3_norm_mbox_conf"
1072
+ top: "conv4_3_norm_mbox_conf_perm"
1073
+ permute_param {
1074
+ order: 0
1075
+ order: 2
1076
+ order: 3
1077
+ order: 1
1078
+ }
1079
+ }
1080
+ layer {
1081
+ name: "conv4_3_norm_mbox_conf_flat"
1082
+ type: "Flatten"
1083
+ bottom: "conv4_3_norm_mbox_conf_perm"
1084
+ top: "conv4_3_norm_mbox_conf_flat"
1085
+ flatten_param {
1086
+ axis: 1
1087
+ }
1088
+ }
1089
+ layer {
1090
+ name: "conv4_3_norm_mbox_priorbox"
1091
+ type: "PriorBox"
1092
+ bottom: "conv4_3_norm"
1093
+ bottom: "data"
1094
+ top: "conv4_3_norm_mbox_priorbox"
1095
+ prior_box_param {
1096
+ min_size: 30.0
1097
+ max_size: 60.0
1098
+ aspect_ratio: 2
1099
+ flip: true
1100
+ clip: false
1101
+ variance: 0.1
1102
+ variance: 0.1
1103
+ variance: 0.2
1104
+ variance: 0.2
1105
+ step: 8
1106
+ offset: 0.5
1107
+ }
1108
+ }
1109
+ layer {
1110
+ name: "fc7_mbox_loc"
1111
+ type: "Convolution"
1112
+ bottom: "fc7"
1113
+ top: "fc7_mbox_loc"
1114
+ param {
1115
+ lr_mult: 1
1116
+ decay_mult: 1
1117
+ }
1118
+ param {
1119
+ lr_mult: 2
1120
+ decay_mult: 0
1121
+ }
1122
+ convolution_param {
1123
+ num_output: 24
1124
+ pad: 1
1125
+ kernel_size: 3
1126
+ stride: 1
1127
+ weight_filler {
1128
+ type: "xavier"
1129
+ }
1130
+ bias_filler {
1131
+ type: "constant"
1132
+ value: 0
1133
+ }
1134
+ }
1135
+ }
1136
+ layer {
1137
+ name: "fc7_mbox_loc_perm"
1138
+ type: "Permute"
1139
+ bottom: "fc7_mbox_loc"
1140
+ top: "fc7_mbox_loc_perm"
1141
+ permute_param {
1142
+ order: 0
1143
+ order: 2
1144
+ order: 3
1145
+ order: 1
1146
+ }
1147
+ }
1148
+ layer {
1149
+ name: "fc7_mbox_loc_flat"
1150
+ type: "Flatten"
1151
+ bottom: "fc7_mbox_loc_perm"
1152
+ top: "fc7_mbox_loc_flat"
1153
+ flatten_param {
1154
+ axis: 1
1155
+ }
1156
+ }
1157
+ layer {
1158
+ name: "fc7_mbox_conf"
1159
+ type: "Convolution"
1160
+ bottom: "fc7"
1161
+ top: "fc7_mbox_conf"
1162
+ param {
1163
+ lr_mult: 1
1164
+ decay_mult: 1
1165
+ }
1166
+ param {
1167
+ lr_mult: 2
1168
+ decay_mult: 0
1169
+ }
1170
+ convolution_param {
1171
+ num_output: 12 # 126
1172
+ pad: 1
1173
+ kernel_size: 3
1174
+ stride: 1
1175
+ weight_filler {
1176
+ type: "xavier"
1177
+ }
1178
+ bias_filler {
1179
+ type: "constant"
1180
+ value: 0
1181
+ }
1182
+ }
1183
+ }
1184
+ layer {
1185
+ name: "fc7_mbox_conf_perm"
1186
+ type: "Permute"
1187
+ bottom: "fc7_mbox_conf"
1188
+ top: "fc7_mbox_conf_perm"
1189
+ permute_param {
1190
+ order: 0
1191
+ order: 2
1192
+ order: 3
1193
+ order: 1
1194
+ }
1195
+ }
1196
+ layer {
1197
+ name: "fc7_mbox_conf_flat"
1198
+ type: "Flatten"
1199
+ bottom: "fc7_mbox_conf_perm"
1200
+ top: "fc7_mbox_conf_flat"
1201
+ flatten_param {
1202
+ axis: 1
1203
+ }
1204
+ }
1205
+ layer {
1206
+ name: "fc7_mbox_priorbox"
1207
+ type: "PriorBox"
1208
+ bottom: "fc7"
1209
+ bottom: "data"
1210
+ top: "fc7_mbox_priorbox"
1211
+ prior_box_param {
1212
+ min_size: 60.0
1213
+ max_size: 111.0
1214
+ aspect_ratio: 2
1215
+ aspect_ratio: 3
1216
+ flip: true
1217
+ clip: false
1218
+ variance: 0.1
1219
+ variance: 0.1
1220
+ variance: 0.2
1221
+ variance: 0.2
1222
+ step: 16
1223
+ offset: 0.5
1224
+ }
1225
+ }
1226
+ layer {
1227
+ name: "conv6_2_mbox_loc"
1228
+ type: "Convolution"
1229
+ bottom: "conv6_2_h"
1230
+ top: "conv6_2_mbox_loc"
1231
+ param {
1232
+ lr_mult: 1
1233
+ decay_mult: 1
1234
+ }
1235
+ param {
1236
+ lr_mult: 2
1237
+ decay_mult: 0
1238
+ }
1239
+ convolution_param {
1240
+ num_output: 24
1241
+ pad: 1
1242
+ kernel_size: 3
1243
+ stride: 1
1244
+ weight_filler {
1245
+ type: "xavier"
1246
+ }
1247
+ bias_filler {
1248
+ type: "constant"
1249
+ value: 0
1250
+ }
1251
+ }
1252
+ }
1253
+ layer {
1254
+ name: "conv6_2_mbox_loc_perm"
1255
+ type: "Permute"
1256
+ bottom: "conv6_2_mbox_loc"
1257
+ top: "conv6_2_mbox_loc_perm"
1258
+ permute_param {
1259
+ order: 0
1260
+ order: 2
1261
+ order: 3
1262
+ order: 1
1263
+ }
1264
+ }
1265
+ layer {
1266
+ name: "conv6_2_mbox_loc_flat"
1267
+ type: "Flatten"
1268
+ bottom: "conv6_2_mbox_loc_perm"
1269
+ top: "conv6_2_mbox_loc_flat"
1270
+ flatten_param {
1271
+ axis: 1
1272
+ }
1273
+ }
1274
+ layer {
1275
+ name: "conv6_2_mbox_conf"
1276
+ type: "Convolution"
1277
+ bottom: "conv6_2_h"
1278
+ top: "conv6_2_mbox_conf"
1279
+ param {
1280
+ lr_mult: 1
1281
+ decay_mult: 1
1282
+ }
1283
+ param {
1284
+ lr_mult: 2
1285
+ decay_mult: 0
1286
+ }
1287
+ convolution_param {
1288
+ num_output: 12 # 126
1289
+ pad: 1
1290
+ kernel_size: 3
1291
+ stride: 1
1292
+ weight_filler {
1293
+ type: "xavier"
1294
+ }
1295
+ bias_filler {
1296
+ type: "constant"
1297
+ value: 0
1298
+ }
1299
+ }
1300
+ }
1301
+ layer {
1302
+ name: "conv6_2_mbox_conf_perm"
1303
+ type: "Permute"
1304
+ bottom: "conv6_2_mbox_conf"
1305
+ top: "conv6_2_mbox_conf_perm"
1306
+ permute_param {
1307
+ order: 0
1308
+ order: 2
1309
+ order: 3
1310
+ order: 1
1311
+ }
1312
+ }
1313
+ layer {
1314
+ name: "conv6_2_mbox_conf_flat"
1315
+ type: "Flatten"
1316
+ bottom: "conv6_2_mbox_conf_perm"
1317
+ top: "conv6_2_mbox_conf_flat"
1318
+ flatten_param {
1319
+ axis: 1
1320
+ }
1321
+ }
1322
+ layer {
1323
+ name: "conv6_2_mbox_priorbox"
1324
+ type: "PriorBox"
1325
+ bottom: "conv6_2_h"
1326
+ bottom: "data"
1327
+ top: "conv6_2_mbox_priorbox"
1328
+ prior_box_param {
1329
+ min_size: 111.0
1330
+ max_size: 162.0
1331
+ aspect_ratio: 2
1332
+ aspect_ratio: 3
1333
+ flip: true
1334
+ clip: false
1335
+ variance: 0.1
1336
+ variance: 0.1
1337
+ variance: 0.2
1338
+ variance: 0.2
1339
+ step: 32
1340
+ offset: 0.5
1341
+ }
1342
+ }
1343
+ layer {
1344
+ name: "conv7_2_mbox_loc"
1345
+ type: "Convolution"
1346
+ bottom: "conv7_2_h"
1347
+ top: "conv7_2_mbox_loc"
1348
+ param {
1349
+ lr_mult: 1
1350
+ decay_mult: 1
1351
+ }
1352
+ param {
1353
+ lr_mult: 2
1354
+ decay_mult: 0
1355
+ }
1356
+ convolution_param {
1357
+ num_output: 24
1358
+ pad: 1
1359
+ kernel_size: 3
1360
+ stride: 1
1361
+ weight_filler {
1362
+ type: "xavier"
1363
+ }
1364
+ bias_filler {
1365
+ type: "constant"
1366
+ value: 0
1367
+ }
1368
+ }
1369
+ }
1370
+ layer {
1371
+ name: "conv7_2_mbox_loc_perm"
1372
+ type: "Permute"
1373
+ bottom: "conv7_2_mbox_loc"
1374
+ top: "conv7_2_mbox_loc_perm"
1375
+ permute_param {
1376
+ order: 0
1377
+ order: 2
1378
+ order: 3
1379
+ order: 1
1380
+ }
1381
+ }
1382
+ layer {
1383
+ name: "conv7_2_mbox_loc_flat"
1384
+ type: "Flatten"
1385
+ bottom: "conv7_2_mbox_loc_perm"
1386
+ top: "conv7_2_mbox_loc_flat"
1387
+ flatten_param {
1388
+ axis: 1
1389
+ }
1390
+ }
1391
+ layer {
1392
+ name: "conv7_2_mbox_conf"
1393
+ type: "Convolution"
1394
+ bottom: "conv7_2_h"
1395
+ top: "conv7_2_mbox_conf"
1396
+ param {
1397
+ lr_mult: 1
1398
+ decay_mult: 1
1399
+ }
1400
+ param {
1401
+ lr_mult: 2
1402
+ decay_mult: 0
1403
+ }
1404
+ convolution_param {
1405
+ num_output: 12 # 126
1406
+ pad: 1
1407
+ kernel_size: 3
1408
+ stride: 1
1409
+ weight_filler {
1410
+ type: "xavier"
1411
+ }
1412
+ bias_filler {
1413
+ type: "constant"
1414
+ value: 0
1415
+ }
1416
+ }
1417
+ }
1418
+ layer {
1419
+ name: "conv7_2_mbox_conf_perm"
1420
+ type: "Permute"
1421
+ bottom: "conv7_2_mbox_conf"
1422
+ top: "conv7_2_mbox_conf_perm"
1423
+ permute_param {
1424
+ order: 0
1425
+ order: 2
1426
+ order: 3
1427
+ order: 1
1428
+ }
1429
+ }
1430
+ layer {
1431
+ name: "conv7_2_mbox_conf_flat"
1432
+ type: "Flatten"
1433
+ bottom: "conv7_2_mbox_conf_perm"
1434
+ top: "conv7_2_mbox_conf_flat"
1435
+ flatten_param {
1436
+ axis: 1
1437
+ }
1438
+ }
1439
+ layer {
1440
+ name: "conv7_2_mbox_priorbox"
1441
+ type: "PriorBox"
1442
+ bottom: "conv7_2_h"
1443
+ bottom: "data"
1444
+ top: "conv7_2_mbox_priorbox"
1445
+ prior_box_param {
1446
+ min_size: 162.0
1447
+ max_size: 213.0
1448
+ aspect_ratio: 2
1449
+ aspect_ratio: 3
1450
+ flip: true
1451
+ clip: false
1452
+ variance: 0.1
1453
+ variance: 0.1
1454
+ variance: 0.2
1455
+ variance: 0.2
1456
+ step: 64
1457
+ offset: 0.5
1458
+ }
1459
+ }
1460
+ layer {
1461
+ name: "conv8_2_mbox_loc"
1462
+ type: "Convolution"
1463
+ bottom: "conv8_2_h"
1464
+ top: "conv8_2_mbox_loc"
1465
+ param {
1466
+ lr_mult: 1
1467
+ decay_mult: 1
1468
+ }
1469
+ param {
1470
+ lr_mult: 2
1471
+ decay_mult: 0
1472
+ }
1473
+ convolution_param {
1474
+ num_output: 16
1475
+ pad: 1
1476
+ kernel_size: 3
1477
+ stride: 1
1478
+ weight_filler {
1479
+ type: "xavier"
1480
+ }
1481
+ bias_filler {
1482
+ type: "constant"
1483
+ value: 0
1484
+ }
1485
+ }
1486
+ }
1487
+ layer {
1488
+ name: "conv8_2_mbox_loc_perm"
1489
+ type: "Permute"
1490
+ bottom: "conv8_2_mbox_loc"
1491
+ top: "conv8_2_mbox_loc_perm"
1492
+ permute_param {
1493
+ order: 0
1494
+ order: 2
1495
+ order: 3
1496
+ order: 1
1497
+ }
1498
+ }
1499
+ layer {
1500
+ name: "conv8_2_mbox_loc_flat"
1501
+ type: "Flatten"
1502
+ bottom: "conv8_2_mbox_loc_perm"
1503
+ top: "conv8_2_mbox_loc_flat"
1504
+ flatten_param {
1505
+ axis: 1
1506
+ }
1507
+ }
1508
+ layer {
1509
+ name: "conv8_2_mbox_conf"
1510
+ type: "Convolution"
1511
+ bottom: "conv8_2_h"
1512
+ top: "conv8_2_mbox_conf"
1513
+ param {
1514
+ lr_mult: 1
1515
+ decay_mult: 1
1516
+ }
1517
+ param {
1518
+ lr_mult: 2
1519
+ decay_mult: 0
1520
+ }
1521
+ convolution_param {
1522
+ num_output: 8 # 84
1523
+ pad: 1
1524
+ kernel_size: 3
1525
+ stride: 1
1526
+ weight_filler {
1527
+ type: "xavier"
1528
+ }
1529
+ bias_filler {
1530
+ type: "constant"
1531
+ value: 0
1532
+ }
1533
+ }
1534
+ }
1535
+ layer {
1536
+ name: "conv8_2_mbox_conf_perm"
1537
+ type: "Permute"
1538
+ bottom: "conv8_2_mbox_conf"
1539
+ top: "conv8_2_mbox_conf_perm"
1540
+ permute_param {
1541
+ order: 0
1542
+ order: 2
1543
+ order: 3
1544
+ order: 1
1545
+ }
1546
+ }
1547
+ layer {
1548
+ name: "conv8_2_mbox_conf_flat"
1549
+ type: "Flatten"
1550
+ bottom: "conv8_2_mbox_conf_perm"
1551
+ top: "conv8_2_mbox_conf_flat"
1552
+ flatten_param {
1553
+ axis: 1
1554
+ }
1555
+ }
1556
+ layer {
1557
+ name: "conv8_2_mbox_priorbox"
1558
+ type: "PriorBox"
1559
+ bottom: "conv8_2_h"
1560
+ bottom: "data"
1561
+ top: "conv8_2_mbox_priorbox"
1562
+ prior_box_param {
1563
+ min_size: 213.0
1564
+ max_size: 264.0
1565
+ aspect_ratio: 2
1566
+ flip: true
1567
+ clip: false
1568
+ variance: 0.1
1569
+ variance: 0.1
1570
+ variance: 0.2
1571
+ variance: 0.2
1572
+ step: 100
1573
+ offset: 0.5
1574
+ }
1575
+ }
1576
+ layer {
1577
+ name: "conv9_2_mbox_loc"
1578
+ type: "Convolution"
1579
+ bottom: "conv9_2_h"
1580
+ top: "conv9_2_mbox_loc"
1581
+ param {
1582
+ lr_mult: 1
1583
+ decay_mult: 1
1584
+ }
1585
+ param {
1586
+ lr_mult: 2
1587
+ decay_mult: 0
1588
+ }
1589
+ convolution_param {
1590
+ num_output: 16
1591
+ pad: 1
1592
+ kernel_size: 3
1593
+ stride: 1
1594
+ weight_filler {
1595
+ type: "xavier"
1596
+ }
1597
+ bias_filler {
1598
+ type: "constant"
1599
+ value: 0
1600
+ }
1601
+ }
1602
+ }
1603
+ layer {
1604
+ name: "conv9_2_mbox_loc_perm"
1605
+ type: "Permute"
1606
+ bottom: "conv9_2_mbox_loc"
1607
+ top: "conv9_2_mbox_loc_perm"
1608
+ permute_param {
1609
+ order: 0
1610
+ order: 2
1611
+ order: 3
1612
+ order: 1
1613
+ }
1614
+ }
1615
+ layer {
1616
+ name: "conv9_2_mbox_loc_flat"
1617
+ type: "Flatten"
1618
+ bottom: "conv9_2_mbox_loc_perm"
1619
+ top: "conv9_2_mbox_loc_flat"
1620
+ flatten_param {
1621
+ axis: 1
1622
+ }
1623
+ }
1624
+ layer {
1625
+ name: "conv9_2_mbox_conf"
1626
+ type: "Convolution"
1627
+ bottom: "conv9_2_h"
1628
+ top: "conv9_2_mbox_conf"
1629
+ param {
1630
+ lr_mult: 1
1631
+ decay_mult: 1
1632
+ }
1633
+ param {
1634
+ lr_mult: 2
1635
+ decay_mult: 0
1636
+ }
1637
+ convolution_param {
1638
+ num_output: 8 # 84
1639
+ pad: 1
1640
+ kernel_size: 3
1641
+ stride: 1
1642
+ weight_filler {
1643
+ type: "xavier"
1644
+ }
1645
+ bias_filler {
1646
+ type: "constant"
1647
+ value: 0
1648
+ }
1649
+ }
1650
+ }
1651
+ layer {
1652
+ name: "conv9_2_mbox_conf_perm"
1653
+ type: "Permute"
1654
+ bottom: "conv9_2_mbox_conf"
1655
+ top: "conv9_2_mbox_conf_perm"
1656
+ permute_param {
1657
+ order: 0
1658
+ order: 2
1659
+ order: 3
1660
+ order: 1
1661
+ }
1662
+ }
1663
+ layer {
1664
+ name: "conv9_2_mbox_conf_flat"
1665
+ type: "Flatten"
1666
+ bottom: "conv9_2_mbox_conf_perm"
1667
+ top: "conv9_2_mbox_conf_flat"
1668
+ flatten_param {
1669
+ axis: 1
1670
+ }
1671
+ }
1672
+ layer {
1673
+ name: "conv9_2_mbox_priorbox"
1674
+ type: "PriorBox"
1675
+ bottom: "conv9_2_h"
1676
+ bottom: "data"
1677
+ top: "conv9_2_mbox_priorbox"
1678
+ prior_box_param {
1679
+ min_size: 264.0
1680
+ max_size: 315.0
1681
+ aspect_ratio: 2
1682
+ flip: true
1683
+ clip: false
1684
+ variance: 0.1
1685
+ variance: 0.1
1686
+ variance: 0.2
1687
+ variance: 0.2
1688
+ step: 300
1689
+ offset: 0.5
1690
+ }
1691
+ }
1692
+ layer {
1693
+ name: "mbox_loc"
1694
+ type: "Concat"
1695
+ bottom: "conv4_3_norm_mbox_loc_flat"
1696
+ bottom: "fc7_mbox_loc_flat"
1697
+ bottom: "conv6_2_mbox_loc_flat"
1698
+ bottom: "conv7_2_mbox_loc_flat"
1699
+ bottom: "conv8_2_mbox_loc_flat"
1700
+ bottom: "conv9_2_mbox_loc_flat"
1701
+ top: "mbox_loc"
1702
+ concat_param {
1703
+ axis: 1
1704
+ }
1705
+ }
1706
+ layer {
1707
+ name: "mbox_conf"
1708
+ type: "Concat"
1709
+ bottom: "conv4_3_norm_mbox_conf_flat"
1710
+ bottom: "fc7_mbox_conf_flat"
1711
+ bottom: "conv6_2_mbox_conf_flat"
1712
+ bottom: "conv7_2_mbox_conf_flat"
1713
+ bottom: "conv8_2_mbox_conf_flat"
1714
+ bottom: "conv9_2_mbox_conf_flat"
1715
+ top: "mbox_conf"
1716
+ concat_param {
1717
+ axis: 1
1718
+ }
1719
+ }
1720
+ layer {
1721
+ name: "mbox_priorbox"
1722
+ type: "Concat"
1723
+ bottom: "conv4_3_norm_mbox_priorbox"
1724
+ bottom: "fc7_mbox_priorbox"
1725
+ bottom: "conv6_2_mbox_priorbox"
1726
+ bottom: "conv7_2_mbox_priorbox"
1727
+ bottom: "conv8_2_mbox_priorbox"
1728
+ bottom: "conv9_2_mbox_priorbox"
1729
+ top: "mbox_priorbox"
1730
+ concat_param {
1731
+ axis: 2
1732
+ }
1733
+ }
1734
+
1735
+ layer {
1736
+ name: "mbox_conf_reshape"
1737
+ type: "Reshape"
1738
+ bottom: "mbox_conf"
1739
+ top: "mbox_conf_reshape"
1740
+ reshape_param {
1741
+ shape {
1742
+ dim: 0
1743
+ dim: -1
1744
+ dim: 2
1745
+ }
1746
+ }
1747
+ }
1748
+ layer {
1749
+ name: "mbox_conf_softmax"
1750
+ type: "Softmax"
1751
+ bottom: "mbox_conf_reshape"
1752
+ top: "mbox_conf_softmax"
1753
+ softmax_param {
1754
+ axis: 2
1755
+ }
1756
+ }
1757
+ layer {
1758
+ name: "mbox_conf_flatten"
1759
+ type: "Flatten"
1760
+ bottom: "mbox_conf_softmax"
1761
+ top: "mbox_conf_flatten"
1762
+ flatten_param {
1763
+ axis: 1
1764
+ }
1765
+ }
1766
+
1767
+ layer {
1768
+ name: "detection_out"
1769
+ type: "DetectionOutput"
1770
+ bottom: "mbox_loc"
1771
+ bottom: "mbox_conf_flatten"
1772
+ bottom: "mbox_priorbox"
1773
+ top: "detection_out"
1774
+ include {
1775
+ phase: TEST
1776
+ }
1777
+ detection_output_param {
1778
+ num_classes: 2
1779
+ share_location: true
1780
+ background_label_id: 0
1781
+ nms_param {
1782
+ nms_threshold: 0.45
1783
+ top_k: 400
1784
+ }
1785
+ code_type: CENTER_SIZE
1786
+ keep_top_k: 200
1787
+ confidence_threshold: 0.01
1788
+ }
1789
+ }
draw_tracking_line.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import datetime
3
+ import imutils
4
+ import numpy as np
5
+ from centroidtracker import CentroidTracker
6
+ from collections import defaultdict
7
+
8
+ protopath = "MobileNetSSD_deploy.prototxt"
9
+ modelpath = "MobileNetSSD_deploy.caffemodel"
10
+ detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
11
+
12
+ # Only enable it if you are using OpenVino environment
13
+ # detector.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
14
+ # detector.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
15
+
16
+
17
+ CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
18
+ "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
19
+ "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
20
+ "sofa", "train", "tvmonitor"]
21
+
22
+ tracker = CentroidTracker(maxDisappeared=80, maxDistance=90)
23
+
24
+
25
+ def non_max_suppression_fast(boxes, overlapThresh):
26
+ try:
27
+ if len(boxes) == 0:
28
+ return []
29
+
30
+ if boxes.dtype.kind == "i":
31
+ boxes = boxes.astype("float")
32
+
33
+ pick = []
34
+
35
+ x1 = boxes[:, 0]
36
+ y1 = boxes[:, 1]
37
+ x2 = boxes[:, 2]
38
+ y2 = boxes[:, 3]
39
+
40
+ area = (x2 - x1 + 1) * (y2 - y1 + 1)
41
+ idxs = np.argsort(y2)
42
+
43
+ while len(idxs) > 0:
44
+ last = len(idxs) - 1
45
+ i = idxs[last]
46
+ pick.append(i)
47
+
48
+ xx1 = np.maximum(x1[i], x1[idxs[:last]])
49
+ yy1 = np.maximum(y1[i], y1[idxs[:last]])
50
+ xx2 = np.minimum(x2[i], x2[idxs[:last]])
51
+ yy2 = np.minimum(y2[i], y2[idxs[:last]])
52
+
53
+ w = np.maximum(0, xx2 - xx1 + 1)
54
+ h = np.maximum(0, yy2 - yy1 + 1)
55
+
56
+ overlap = (w * h) / area[idxs[:last]]
57
+
58
+ idxs = np.delete(idxs, np.concatenate(([last],
59
+ np.where(overlap > overlapThresh)[0])))
60
+
61
+ return boxes[pick].astype("int")
62
+ except Exception as e:
63
+ print("Exception occurred in non_max_suppression : {}".format(e))
64
+
65
+
66
+ def main():
67
+ cap = cv2.VideoCapture('test_video.mp4')
68
+
69
+ fps_start_time = datetime.datetime.now()
70
+ fps = 0
71
+ total_frames = 0
72
+ centroid_dict = defaultdict(list)
73
+ object_id_list = []
74
+
75
+ while True:
76
+ ret, frame = cap.read()
77
+ frame = imutils.resize(frame, width=600)
78
+ total_frames = total_frames + 1
79
+
80
+ (H, W) = frame.shape[:2]
81
+
82
+ blob = cv2.dnn.blobFromImage(frame, 0.007843, (W, H), 127.5)
83
+
84
+ detector.setInput(blob)
85
+ person_detections = detector.forward()
86
+ rects = []
87
+ for i in np.arange(0, person_detections.shape[2]):
88
+ confidence = person_detections[0, 0, i, 2]
89
+ if confidence > 0.5:
90
+ idx = int(person_detections[0, 0, i, 1])
91
+
92
+ if CLASSES[idx] != "person":
93
+ continue
94
+
95
+ person_box = person_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
96
+ (startX, startY, endX, endY) = person_box.astype("int")
97
+ rects.append(person_box)
98
+
99
+ boundingboxes = np.array(rects)
100
+ boundingboxes = boundingboxes.astype(int)
101
+ rects = non_max_suppression_fast(boundingboxes, 0.3)
102
+
103
+ objects = tracker.update(rects)
104
+ for (objectId, bbox) in objects.items():
105
+ x1, y1, x2, y2 = bbox
106
+ x1 = int(x1)
107
+ y1 = int(y1)
108
+ x2 = int(x2)
109
+ y2 = int(y2)
110
+
111
+ cX = int((x1 + x2) / 2.0)
112
+ cY = int((y1 + y2) / 2.0)
113
+ cv2.circle(frame, (cX, cY), 4, (0, 255, 0), -1)
114
+
115
+ centroid_dict[objectId].append((cX, cY))
116
+ if objectId not in object_id_list:
117
+ object_id_list.append(objectId)
118
+ start_pt = (cX, cY)
119
+ end_pt = (cX, cY)
120
+ cv2.line(frame, start_pt, end_pt, (0, 255, 0), 2)
121
+ else:
122
+ l = len(centroid_dict[objectId])
123
+ for pt in range(len(centroid_dict[objectId])):
124
+ if not pt + 1 == l:
125
+ start_pt = (centroid_dict[objectId][pt][0], centroid_dict[objectId][pt][1])
126
+ end_pt = (centroid_dict[objectId][pt + 1][0], centroid_dict[objectId][pt + 1][1])
127
+ cv2.line(frame, start_pt, end_pt, (0, 255, 0), 2)
128
+
129
+ cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 255), 2)
130
+ text = "ID: {}".format(objectId)
131
+ cv2.putText(frame, text, (x1, y1-5), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
132
+
133
+ fps_end_time = datetime.datetime.now()
134
+ time_diff = fps_end_time - fps_start_time
135
+ if time_diff.seconds == 0:
136
+ fps = 0.0
137
+ else:
138
+ fps = (total_frames / time_diff.seconds)
139
+
140
+ fps_text = "FPS: {:.2f}".format(fps)
141
+
142
+ cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
143
+
144
+ cv2.imshow("Application", frame)
145
+ key = cv2.waitKey(1)
146
+ if key == ord('q'):
147
+ break
148
+
149
+ cv2.destroyAllWindows()
150
+
151
+
152
+ main()
dwell_time_calculation.py ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import datetime
3
+ import imutils
4
+ import numpy as np
5
+ from centroidtracker import CentroidTracker
6
+
7
+ protopath = "MobileNetSSD_deploy.prototxt"
8
+ modelpath = "MobileNetSSD_deploy.caffemodel"
9
+ detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
10
+ # Only enable it if you are using OpenVino environment
11
+ # detector.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
12
+ # detector.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
13
+
14
+
15
+ CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
16
+ "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
17
+ "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
18
+ "sofa", "train", "tvmonitor"]
19
+
20
+ tracker = CentroidTracker(maxDisappeared=80, maxDistance=90)
21
+
22
+
23
+ def non_max_suppression_fast(boxes, overlapThresh):
24
+ try:
25
+ if len(boxes) == 0:
26
+ return []
27
+
28
+ if boxes.dtype.kind == "i":
29
+ boxes = boxes.astype("float")
30
+
31
+ pick = []
32
+
33
+ x1 = boxes[:, 0]
34
+ y1 = boxes[:, 1]
35
+ x2 = boxes[:, 2]
36
+ y2 = boxes[:, 3]
37
+
38
+ area = (x2 - x1 + 1) * (y2 - y1 + 1)
39
+ idxs = np.argsort(y2)
40
+
41
+ while len(idxs) > 0:
42
+ last = len(idxs) - 1
43
+ i = idxs[last]
44
+ pick.append(i)
45
+
46
+ xx1 = np.maximum(x1[i], x1[idxs[:last]])
47
+ yy1 = np.maximum(y1[i], y1[idxs[:last]])
48
+ xx2 = np.minimum(x2[i], x2[idxs[:last]])
49
+ yy2 = np.minimum(y2[i], y2[idxs[:last]])
50
+
51
+ w = np.maximum(0, xx2 - xx1 + 1)
52
+ h = np.maximum(0, yy2 - yy1 + 1)
53
+
54
+ overlap = (w * h) / area[idxs[:last]]
55
+
56
+ idxs = np.delete(idxs, np.concatenate(([last],
57
+ np.where(overlap > overlapThresh)[0])))
58
+
59
+ return boxes[pick].astype("int")
60
+ except Exception as e:
61
+ print("Exception occurred in non_max_suppression : {}".format(e))
62
+
63
+
64
+ def main():
65
+ cap = cv2.VideoCapture('test_video.mp4')
66
+
67
+ fps_start_time = datetime.datetime.now()
68
+ fps = 0
69
+ total_frames = 0
70
+
71
+ object_id_list = []
72
+ dtime = dict()
73
+ dwell_time = dict()
74
+
75
+ while True:
76
+ ret, frame = cap.read()
77
+ frame = imutils.resize(frame, width=600)
78
+ total_frames = total_frames + 1
79
+
80
+ (H, W) = frame.shape[:2]
81
+
82
+ blob = cv2.dnn.blobFromImage(frame, 0.007843, (W, H), 127.5)
83
+
84
+ detector.setInput(blob)
85
+ person_detections = detector.forward()
86
+ rects = []
87
+ for i in np.arange(0, person_detections.shape[2]):
88
+ confidence = person_detections[0, 0, i, 2]
89
+ if confidence > 0.5:
90
+ idx = int(person_detections[0, 0, i, 1])
91
+
92
+ if CLASSES[idx] != "person":
93
+ continue
94
+
95
+ person_box = person_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
96
+ (startX, startY, endX, endY) = person_box.astype("int")
97
+ rects.append(person_box)
98
+
99
+ boundingboxes = np.array(rects)
100
+ boundingboxes = boundingboxes.astype(int)
101
+ rects = non_max_suppression_fast(boundingboxes, 0.3)
102
+
103
+ objects = tracker.update(rects)
104
+ for (objectId, bbox) in objects.items():
105
+ x1, y1, x2, y2 = bbox
106
+ x1 = int(x1)
107
+ y1 = int(y1)
108
+ x2 = int(x2)
109
+ y2 = int(y2)
110
+
111
+ if objectId not in object_id_list:
112
+ object_id_list.append(objectId)
113
+ dtime[objectId] = datetime.datetime.now()
114
+ dwell_time[objectId] = 0
115
+ else:
116
+ curr_time = datetime.datetime.now()
117
+ old_time = dtime[objectId]
118
+ time_diff = curr_time - old_time
119
+ dtime[objectId] = datetime.datetime.now()
120
+ sec = time_diff.total_seconds()
121
+ dwell_time[objectId] += sec
122
+
123
+
124
+ cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 255), 2)
125
+ text = "{}|{}".format(objectId, int(dwell_time[objectId]))
126
+ cv2.putText(frame, text, (x1, y1-5), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
127
+
128
+ fps_end_time = datetime.datetime.now()
129
+ time_diff = fps_end_time - fps_start_time
130
+ if time_diff.seconds == 0:
131
+ fps = 0.0
132
+ else:
133
+ fps = (total_frames / time_diff.seconds)
134
+
135
+ fps_text = "FPS: {:.2f}".format(fps)
136
+
137
+ cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
138
+
139
+ cv2.imshow("Application", frame)
140
+ key = cv2.waitKey(1)
141
+ if key == ord('q'):
142
+ break
143
+
144
+ cv2.destroyAllWindows()
145
+
146
+
147
+ main()
eg.py ADDED
@@ -0,0 +1,691 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # import streamlit as st
2
+ # import pandas as pd
3
+
4
+
5
+ # # Security
6
+ # #passlib,hashlib,bcrypt,scrypt
7
+ # import hashlib
8
+ # def make_hashes(password):
9
+ # return hashlib.sha256(str.encode(password)).hexdigest()
10
+
11
+ # def check_hashes(password,hashed_text):
12
+ # if make_hashes(password) == hashed_text:
13
+ # return hashed_text
14
+ # return False
15
+ # # DB Management
16
+ # import sqlite3
17
+ # conn = sqlite3.connect('data.db')
18
+ # c = conn.cursor()
19
+ # # DB Functions
20
+ # def create_usertable():
21
+ # c.execute('CREATE TABLE IF NOT EXISTS userstable(username TEXT,password TEXT)')
22
+
23
+
24
+ # def add_userdata(username,password):
25
+ # c.execute('INSERT INTO userstable(username,password) VALUES (?,?)',(username,password))
26
+ # conn.commit()
27
+
28
+ # def login_user(username,password):
29
+ # c.execute('SELECT * FROM userstable WHERE username =? AND password = ?',(username,password))
30
+ # data = c.fetchall()
31
+ # return data
32
+
33
+
34
+ # def view_all_users():
35
+ # c.execute('SELECT * FROM userstable')
36
+ # data = c.fetchall()
37
+ # return data
38
+
39
+
40
+
41
+ # def main():
42
+ # """Simple Login App"""
43
+
44
+ # st.title("Simple Login App")
45
+
46
+ # menu = ["Home","Login","SignUp"]
47
+ # choice = st.sidebar.selectbox("Menu",menu)
48
+
49
+ # if choice == "Home":
50
+ # st.subheader("Home")
51
+
52
+ # elif choice == "Login":
53
+ # st.subheader("Login Section")
54
+
55
+ # username = st.sidebar.text_input("User Name")
56
+ # password = st.sidebar.text_input("Password",type='password')
57
+ # if st.sidebar.checkbox("Login"):
58
+ # # if password == '12345':
59
+ # create_usertable()
60
+ # hashed_pswd = make_hashes(password)
61
+
62
+ # result = login_user(username,check_hashes(password,hashed_pswd))
63
+ # if result:
64
+
65
+ # st.success("Logged In as {}".format(username))
66
+
67
+ # task = st.selectbox("Task",["Add Post","Analytics","Profiles"])
68
+ # if task == "Add Post":
69
+ # st.subheader("Add Your Post")
70
+
71
+ # elif task == "Analytics":
72
+ # st.subheader("Analytics")
73
+ # elif task == "Profiles":
74
+ # st.subheader("User Profiles")
75
+ # user_result = view_all_users()
76
+ # clean_db = pd.DataFrame(user_result,columns=["Username","Password"])
77
+ # st.dataframe(clean_db)
78
+ # else:
79
+ # st.warning("Incorrect Username/Password")
80
+
81
+
82
+
83
+
84
+
85
+ # elif choice == "SignUp":
86
+ # st.subheader("Create New Account")
87
+ # new_user = st.text_input("Username")
88
+ # new_password = st.text_input("Password",type='password')
89
+
90
+ # if st.button("Signup"):
91
+ # create_usertable()
92
+ # add_userdata(new_user,make_hashes(new_password))
93
+ # st.success("You have successfully created a valid Account")
94
+ # st.info("Go to Login Menu to login")
95
+
96
+
97
+
98
+ # if __name__ == '__main__':
99
+ # main()
100
+
101
+
102
+ import cv2
103
+ import datetime
104
+ import imutils
105
+ import numpy as np
106
+ from centroidtracker import CentroidTracker
107
+ import pandas as pd
108
+ import torch
109
+ import streamlit as st
110
+ import mediapipe as mp
111
+ import cv2 as cv
112
+ import numpy as np
113
+ import tempfile
114
+ import time
115
+ from PIL import Image
116
+ import pandas as pd
117
+ import torch
118
+ import base64
119
+ import streamlit.components.v1 as components
120
+ import csv
121
+ import pickle
122
+ from pathlib import Path
123
+ import streamlit_authenticator as stauth
124
+ import os
125
+ import csv
126
+ # x-x-x-x-x-x-x-x-x-x-x-x-x-x LOGIN FORM x-x-x-x-x-x-x-x-x
127
+
128
+
129
+ data = ["student Count",'Date','Id','Mobile','Watch']
130
+ with open('final.csv', 'w') as file:
131
+ writer = csv.writer(file)
132
+ writer.writerow(data)
133
+ import streamlit as st
134
+ import pandas as pd
135
+ import hashlib
136
+ import sqlite3
137
+ # if st.button("Open CRM !!"):
138
+
139
+ # # Security
140
+ # #passlib,hashlib,bcrypt,scrypt
141
+ # def make_hashes(password):
142
+ # return hashlib.sha256(str.encode(password)).hexdigest()
143
+
144
+ # def check_hashes(password,hashed_text):
145
+ # if make_hashes(password) == hashed_text:
146
+ # return hashed_text
147
+ # return False
148
+ # # DB Management
149
+
150
+ # conn = sqlite3.connect('data.db')
151
+ # c = conn.cursor()
152
+ # # DB Functions
153
+ # def create_usertable():
154
+ # c.execute('CREATE TABLE IF NOT EXISTS userstable(username TEXT,password TEXT)')
155
+
156
+
157
+ # def add_userdata(username,password):
158
+ # c.execute('INSERT INTO userstable(username,password) VALUES (?,?)',(username,password))
159
+ # conn.commit()
160
+
161
+ # def login_user(username,password):
162
+ # c.execute('SELECT * FROM userstable WHERE username =? AND password = ?',(username,password))
163
+ # data = c.fetchall()
164
+ # return data
165
+
166
+
167
+ # def view_all_users():
168
+ # c.execute('SELECT * FROM userstable')
169
+ # data = c.fetchall()
170
+ # return data
171
+
172
+
173
+
174
+ # def main():
175
+ # """Simple Login App"""
176
+
177
+ # st.title("Simple Login App")
178
+
179
+ # menu = ["Home","Login","SignUp"]
180
+ # choice = st.sidebar.selectbox("Menu",menu)
181
+
182
+ # if choice == "Home":
183
+ # st.subheader("Home")
184
+
185
+ # elif choice == "Login":
186
+ # st.subheader("Login Section")
187
+
188
+ # username = st.sidebar.text_input("User Name")
189
+ # password = st.sidebar.text_input("Password",type='password')
190
+ # if st.sidebar.checkbox("Login"):
191
+ # # if password == '12345':
192
+ # create_usertable()
193
+ # hashed_pswd = make_hashes(password)
194
+
195
+ # result = login_user(username,check_hashes(password,hashed_pswd))
196
+ # if result:
197
+
198
+ # st.success("Logged In as {}".format(username))
199
+
200
+ # # task = st.selectbox("Task",["Add Post","Analytics","Profiles"])
201
+ # # if task == "Add Post":
202
+ # # st.subheader("Add Your Post")
203
+
204
+ # # elif task == "Analytics":
205
+ # # st.subheader("Analytics")
206
+ # # elif task == "Profiles":
207
+ # # st.subheader("User Profiles")
208
+ # # user_result = view_all_users()
209
+ # # clean_db = pd.DataFrame(user_result,columns=["Username","Password"])
210
+ # # st.dataframe(clean_db)
211
+ # else:
212
+ # st.warning("Incorrect Username/Password")
213
+
214
+
215
+
216
+
217
+
218
+ # elif choice == "SignUp":
219
+ # st.subheader("Create New Account")
220
+ # new_user = st.text_input("Username")
221
+ # new_password = st.text_input("Password",type='password')
222
+
223
+ # if st.button("Signup"):
224
+ # create_usertable()
225
+ # add_userdata(new_user,make_hashes(new_password))
226
+ # st.success("You have successfully created a valid Account")
227
+ # st.info("Go to Login Menu to login")
228
+
229
+
230
+
231
+ # if __name__ == '__main__':
232
+ # main()
233
+
234
+
235
+
236
+ date_time = time.strftime("%b %d %Y %-I:%M %p")
237
+ date = date_time.split()
238
+ dates = date[0:3]
239
+ times = date[3:5]
240
+ # x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-xAPPLICACTION -x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x
241
+
242
+ def non_max_suppression_fast(boxes, overlapThresh):
243
+ try:
244
+ if len(boxes) == 0:
245
+ return []
246
+
247
+ if boxes.dtype.kind == "i":
248
+ boxes = boxes.astype("float")
249
+
250
+ pick = []
251
+
252
+ x1 = boxes[:, 0]
253
+ y1 = boxes[:, 1]
254
+ x2 = boxes[:, 2]
255
+ y2 = boxes[:, 3]
256
+
257
+ area = (x2 - x1 + 1) * (y2 - y1 + 1)
258
+ idxs = np.argsort(y2)
259
+
260
+ while len(idxs) > 0:
261
+ last = len(idxs) - 1
262
+ i = idxs[last]
263
+ pick.append(i)
264
+
265
+ xx1 = np.maximum(x1[i], x1[idxs[:last]])
266
+ yy1 = np.maximum(y1[i], y1[idxs[:last]])
267
+ xx2 = np.minimum(x2[i], x2[idxs[:last]])
268
+ yy2 = np.minimum(y2[i], y2[idxs[:last]])
269
+
270
+ w = np.maximum(0, xx2 - xx1 + 1)
271
+ h = np.maximum(0, yy2 - yy1 + 1)
272
+
273
+ overlap = (w * h) / area[idxs[:last]]
274
+
275
+ idxs = np.delete(idxs, np.concatenate(([last],
276
+ np.where(overlap > overlapThresh)[0])))
277
+
278
+ return boxes[pick].astype("int")
279
+ except Exception as e:
280
+ print("Exception occurred in non_max_suppression : {}".format(e))
281
+
282
+
283
+ protopath = "MobileNetSSD_deploy.prototxt"
284
+ modelpath = "MobileNetSSD_deploy.caffemodel"
285
+ detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
286
+ # Only enable it if you are using OpenVino environment
287
+ # detector.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
288
+ # detector.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
289
+
290
+
291
+ CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
292
+ "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
293
+ "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
294
+ "sofa", "train", "tvmonitor"]
295
+
296
+ tracker = CentroidTracker(maxDisappeared=80, maxDistance=90)
297
+
298
+ st.markdown(
299
+ """
300
+ <style>
301
+ [data-testid="stSidebar"][aria-expanded="true"] > div:first-child{
302
+ width: 350px
303
+ }
304
+ [data-testid="stSidebar"][aria-expanded="false"] > div:first-child{
305
+ width: 350px
306
+ margin-left: -350px
307
+ }
308
+ </style>
309
+ """,
310
+ unsafe_allow_html=True,
311
+ )
312
+ hide_streamlit_style = """
313
+ <style>
314
+ #MainMenu {visibility: hidden;}
315
+ footer {visibility: hidden;}
316
+ </style>
317
+ """
318
+ st.markdown(hide_streamlit_style, unsafe_allow_html=True)
319
+ # Create Sidebar
320
+ st.sidebar.title('FaceMesh Sidebar')
321
+ st.sidebar.subheader('Parameter')
322
+
323
+ # Define available pages in selection box
324
+ app_mode = st.sidebar.selectbox(
325
+ 'App Mode',
326
+ ['About','Application']
327
+ )
328
+
329
+ # Resize Images to fit Container
330
+ @st.cache()
331
+ # Get Image Dimensions
332
+ def image_resize(image, width=None, height=None, inter=cv.INTER_AREA):
333
+ dim = None
334
+ (h,w) = image.shape[:2]
335
+
336
+ if width is None and height is None:
337
+ return image
338
+
339
+ if width is None:
340
+ r = width/float(w)
341
+ dim = (int(w*r),height)
342
+
343
+ else:
344
+ r = width/float(w)
345
+ dim = width, int(h*r)
346
+
347
+ # Resize image
348
+ resized = cv.resize(image,dim,interpolation=inter)
349
+
350
+ return resized
351
+
352
+ # About Page
353
+ # authenticator.logout('Logout','sidebar')
354
+ if app_mode == 'About':
355
+ st.title('About Product And Team')
356
+ st.markdown('''
357
+ Imran Bhai Project
358
+ ''')
359
+ st.markdown(
360
+ """
361
+ <style>
362
+ [data-testid="stSidebar"][aria-expanded="true"] > div:first-child{
363
+ width: 350px
364
+ }
365
+ [data-testid="stSidebar"][aria-expanded="false"] > div:first-child{
366
+ width: 350px
367
+ margin-left: -350px
368
+ }
369
+ </style>
370
+ """,
371
+ unsafe_allow_html=True,
372
+ )
373
+
374
+
375
+
376
+
377
+ elif app_mode == 'Application':
378
+
379
+ st.set_option('deprecation.showfileUploaderEncoding', False)
380
+
381
+ use_webcam = st.button('Use Webcam')
382
+ # record = st.sidebar.checkbox("Record Video")
383
+
384
+ # if record:
385
+ # st.checkbox('Recording', True)
386
+
387
+ # drawing_spec = mp.solutions.drawing_utils.DrawingSpec(thickness=2, circle_radius=1)
388
+
389
+ # st.sidebar.markdown('---')
390
+
391
+ # ## Add Sidebar and Window style
392
+ # st.markdown(
393
+ # """
394
+ # <style>
395
+ # [data-testid="stSidebar"][aria-expanded="true"] > div:first-child{
396
+ # width: 350px
397
+ # }
398
+ # [data-testid="stSidebar"][aria-expanded="false"] > div:first-child{
399
+ # width: 350px
400
+ # margin-left: -350px
401
+ # }
402
+ # </style>
403
+ # """,
404
+ # unsafe_allow_html=True,
405
+ # )
406
+
407
+ # max_faces = st.sidebar.number_input('Maximum Number of Faces', value=5, min_value=1)
408
+ # st.sidebar.markdown('---')
409
+ # detection_confidence = st.sidebar.slider('Min Detection Confidence', min_value=0.0,max_value=1.0,value=0.5)
410
+ # tracking_confidence = st.sidebar.slider('Min Tracking Confidence', min_value=0.0,max_value=1.0,value=0.5)
411
+ # st.sidebar.markdown('---')
412
+
413
+ ## Get Video
414
+ stframe = st.empty()
415
+ video_file_buffer = st.file_uploader("Upload a Video", type=['mp4', 'mov', 'avi', 'asf', 'm4v'])
416
+ temp_file = tempfile.NamedTemporaryFile(delete=False)
417
+
418
+
419
+ if not video_file_buffer:
420
+ if use_webcam:
421
+ video = cv.VideoCapture(0)
422
+ else:
423
+ try:
424
+ video = cv.VideoCapture(1)
425
+ temp_file.name = video
426
+ except:
427
+ pass
428
+ else:
429
+ temp_file.write(video_file_buffer.read())
430
+ video = cv.VideoCapture(temp_file.name)
431
+
432
+ width = int(video.get(cv.CAP_PROP_FRAME_WIDTH))
433
+ height = int(video.get(cv.CAP_PROP_FRAME_HEIGHT))
434
+ fps_input = int(video.get(cv.CAP_PROP_FPS))
435
+
436
+ ## Recording
437
+ codec = cv.VideoWriter_fourcc('a','v','c','1')
438
+ out = cv.VideoWriter('output1.mp4', codec, fps_input, (width,height))
439
+
440
+ st.sidebar.text('Input Video')
441
+ # st.sidebar.video(temp_file.name)
442
+
443
+ fps = 0
444
+ i = 0
445
+
446
+ drawing_spec = mp.solutions.drawing_utils.DrawingSpec(thickness=2, circle_radius=1)
447
+
448
+ kpil, kpil2, kpil3,kpil4,kpil5, kpil6 = st.columns(6)
449
+
450
+ with kpil:
451
+ st.markdown('**Frame Rate**')
452
+ kpil_text = st.markdown('0')
453
+
454
+ with kpil2:
455
+ st.markdown('**detection ID**')
456
+ kpil2_text = st.markdown('0')
457
+
458
+ with kpil3:
459
+ st.markdown('**Mobile**')
460
+ kpil3_text = st.markdown('0')
461
+ with kpil4:
462
+ st.markdown('**Watch**')
463
+ kpil4_text = st.markdown('0')
464
+ with kpil5:
465
+ st.markdown('**Count**')
466
+ kpil5_text = st.markdown('0')
467
+ with kpil6:
468
+ st.markdown('**Img Res**')
469
+ kpil6_text = st.markdown('0')
470
+
471
+
472
+
473
+ st.markdown('<hr/>', unsafe_allow_html=True)
474
+ # try:
475
+ def main():
476
+ db = {}
477
+
478
+ # cap = cv2.VideoCapture('//home//anas//PersonTracking//WebUI//movement.mp4')
479
+ path='/usr/local/lib/python3.10/dist-packages/yolo0vs5/yolov5s-int8.tflite'
480
+ #count=0
481
+ custom = 'yolov5s'
482
+
483
+ model = torch.hub.load('/usr/local/lib/python3.10/dist-packages/yolovs5', custom, path,source='local',force_reload=True)
484
+
485
+ b=model.names[0] = 'person'
486
+ mobile = model.names[67] = 'cell phone'
487
+ watch = model.names[75] = 'clock'
488
+
489
+ fps_start_time = datetime.datetime.now()
490
+ fps = 0
491
+ size=416
492
+
493
+ count=0
494
+ counter=0
495
+
496
+
497
+ color=(0,0,255)
498
+
499
+ cy1=250
500
+ offset=6
501
+
502
+
503
+ pt1 = (120, 100)
504
+ pt2 = (980, 1150)
505
+ color = (0, 255, 0)
506
+
507
+ pt3 = (283, 103)
508
+ pt4 = (1500, 1150)
509
+
510
+ cy2 = 500
511
+ color = (0, 255, 0)
512
+ total_frames = 0
513
+ prevTime = 0
514
+ cur_frame = 0
515
+ count=0
516
+ counter=0
517
+ fps_start_time = datetime.datetime.now()
518
+ fps = 0
519
+ total_frames = 0
520
+ lpc_count = 0
521
+ opc_count = 0
522
+ object_id_list = []
523
+ # success = True
524
+ if st.button("Detect"):
525
+ try:
526
+ while video.isOpened():
527
+
528
+ ret, frame = video.read()
529
+ frame = imutils.resize(frame, width=600)
530
+ total_frames = total_frames + 1
531
+
532
+ (H, W) = frame.shape[:2]
533
+
534
+ blob = cv2.dnn.blobFromImage(frame, 0.007843, (W, H), 127.5)
535
+
536
+ detector.setInput(blob)
537
+ person_detections = detector.forward()
538
+ rects = []
539
+ for i in np.arange(0, person_detections.shape[2]):
540
+ confidence = person_detections[0, 0, i, 2]
541
+ if confidence > 0.5:
542
+ idx = int(person_detections[0, 0, i, 1])
543
+
544
+ if CLASSES[idx] != "person":
545
+ continue
546
+
547
+ person_box = person_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
548
+ (startX, startY, endX, endY) = person_box.astype("int")
549
+ rects.append(person_box)
550
+
551
+ boundingboxes = np.array(rects)
552
+ boundingboxes = boundingboxes.astype(int)
553
+ rects = non_max_suppression_fast(boundingboxes, 0.3)
554
+
555
+ objects = tracker.update(rects)
556
+ for (objectId, bbox) in objects.items():
557
+ x1, y1, x2, y2 = bbox
558
+ x1 = int(x1)
559
+ y1 = int(y1)
560
+ x2 = int(x2)
561
+ y2 = int(y2)
562
+
563
+ cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 255), 2)
564
+ text = "ID: {}".format(objectId)
565
+ # print(text)
566
+ cv2.putText(frame, text, (x1, y1-5), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
567
+ if objectId not in object_id_list:
568
+ object_id_list.append(objectId)
569
+ fps_end_time = datetime.datetime.now()
570
+ time_diff = fps_end_time - fps_start_time
571
+ if time_diff.seconds == 0:
572
+ fps = 0.0
573
+ else:
574
+ fps = (total_frames / time_diff.seconds)
575
+
576
+ fps_text = "FPS: {:.2f}".format(fps)
577
+
578
+ cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
579
+ lpc_count = len(objects)
580
+ opc_count = len(object_id_list)
581
+
582
+ lpc_txt = "LPC: {}".format(lpc_count)
583
+ opc_txt = "OPC: {}".format(opc_count)
584
+
585
+ count += 1
586
+ if count % 4 != 0:
587
+ continue
588
+ # frame=cv.resize(frame, (600,500))
589
+ # cv2.line(frame, pt1, pt2,color,2)
590
+ # cv2.line(frame, pt3, pt4,color,2)
591
+ results = model(frame,size)
592
+ components = results.pandas().xyxy[0]
593
+ for index, row in results.pandas().xyxy[0].iterrows():
594
+ x1 = int(row['xmin'])
595
+ y1 = int(row['ymin'])
596
+ x2 = int(row['xmax'])
597
+ y2 = int(row['ymax'])
598
+ confidence = (row['confidence'])
599
+ obj = (row['class'])
600
+
601
+
602
+ # min':x1,'ymin':y1,'xmax':x2,'ymax':y2,'confidence':confidence,'Object':obj}
603
+ # if lpc_txt is not None:
604
+ # try:
605
+ # db["student Count"] = [lpc_txt]
606
+ # except:
607
+ # db["student Count"] = ['N/A']
608
+ if obj == 0:
609
+ cv2.rectangle(frame,(x1,y1),(x2,y2),(0,0,255),2)
610
+ rectx1,recty1 = ((x1+x2)/2,(y1+y2)/2)
611
+ rectcenter = int(rectx1),int(recty1)
612
+ cx = rectcenter[0]
613
+ cy = rectcenter[1]
614
+ cv2.circle(frame,(cx,cy),3,(0,255,0),-1)
615
+ cv2.putText(frame,str(b), (x1,y1), cv2.FONT_HERSHEY_PLAIN,2,(255,255,255),2)
616
+
617
+ db["student Count"] = [lpc_txt]
618
+ db['Date'] = [date_time]
619
+ db['id'] = ['N/A']
620
+ db['Mobile']=['N/A']
621
+ db['Watch'] = ['N/A']
622
+ if cy<(cy1+offset) and cy>(cy1-offset):
623
+ DB = []
624
+ counter+=1
625
+ DB.append(counter)
626
+
627
+ ff = DB[-1]
628
+ fx = str(ff)
629
+ # cv2.line(frame, pt1, pt2,(0, 0, 255),2)
630
+ # if cy<(cy2+offset) and cy>(cy2-offset):
631
+
632
+ # cv2.line(frame, pt3, pt4,(0, 0, 255),2)
633
+ font = cv2.FONT_HERSHEY_TRIPLEX
634
+ cv2.putText(frame,fx,(50, 50),font, 1,(0, 0, 255),2,cv2.LINE_4)
635
+ cv2.putText(frame,"Movement",(70, 70),font, 1,(0, 0, 255),2,cv2.LINE_4)
636
+ kpil2_text.write(f"<h5 style='text-align: left; color:red;'>{text}</h5>", unsafe_allow_html=True)
637
+
638
+
639
+ db['id'] = [text]
640
+
641
+
642
+
643
+ if obj == 67:
644
+ cv2.rectangle(frame,(x1,y1),(x2,y2),(0,0,255),2)
645
+ rectx1,recty1 = ((x1+x2)/2,(y1+y2)/2)
646
+ rectcenter = int(rectx1),int(recty1)
647
+ cx = rectcenter[0]
648
+ cy = rectcenter[1]
649
+ cv2.circle(frame,(cx,cy),3,(0,255,0),-1)
650
+ cv2.putText(frame,str(mobile), (x1,y1), cv2.FONT_HERSHEY_PLAIN,2,(255,255,255),2)
651
+ cv2.putText(frame,'Mobile',(50, 50),cv2.FONT_HERSHEY_PLAIN, 1,(0, 0, 255),2,cv2.LINE_4)
652
+ kpil3_text.write(f"<h5 style='text-align: left; color:red;'>{mobile}{text}</h5>", unsafe_allow_html=True)
653
+
654
+ db['Mobile']=mobile+' '+text
655
+
656
+
657
+
658
+ if obj == 75:
659
+ cv2.rectangle(frame,(x1,y1),(x2,y2),(0,0,255),2)
660
+ rectx1,recty1 = ((x1+x2)/2,(y1+y2)/2)
661
+ rectcenter = int(rectx1),int(recty1)
662
+ cx = rectcenter[0]
663
+ cy = rectcenter[1]
664
+ cv2.circle(frame,(cx,cy),3,(0,255,0),-1)
665
+ cv2.putText(frame,str(watch), (x1,y1), cv2.FONT_HERSHEY_PLAIN,2,(255,255,255),2)
666
+ cv2.putText(frame,'Watch',(50, 50),cv2.FONT_HERSHEY_PLAIN, 1,(0, 0, 255),2,cv2.LINE_4)
667
+ kpil6_text.write(f"<h5 style='text-align: left; color:red;'>{watch}</h5>", unsafe_allow_html=True)
668
+
669
+
670
+ db['Watch']=watch
671
+
672
+
673
+
674
+ kpil_text.write(f"<h5 style='text-align: left; color:red;'>{int(fps)}</h5>", unsafe_allow_html=True)
675
+ kpil5_text.write(f"<h5 style='text-align: left; color:red;'>{lpc_txt}</h5>", unsafe_allow_html=True)
676
+ kpil6_text.write(f"<h5 style='text-align: left; color:red;'>{width*height}</h5>",
677
+ unsafe_allow_html=True)
678
+
679
+
680
+ frame = cv.resize(frame,(0,0), fx=0.8, fy=0.8)
681
+ frame = image_resize(image=frame, width=640)
682
+ stframe.image(frame,channels='BGR', use_column_width=True)
683
+ df = pd.DataFrame(db)
684
+ df.to_csv('final.csv',mode='a',header=False,index=False)
685
+ except:
686
+ pass
687
+ with open('final.csv') as f:
688
+ st.download_button(label = 'Download Cheating Report',data=f,file_name='data.csv')
689
+
690
+ os.remove("final.csv")
691
+ main()
face_detections.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import datetime
3
+ import imutils
4
+ import numpy as np
5
+
6
+ protopath = "deploy.prototxt"
7
+ modelpath = "res10_300x300_ssd_iter_140000.caffemodel"
8
+ detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
9
+ # Only enable it if you are using OpenVino environment
10
+ # detector.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
11
+ # detector.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
12
+
13
+ def main():
14
+ cap = cv2.VideoCapture('test_video.mp4')
15
+
16
+ fps_start_time = datetime.datetime.now()
17
+ fps = 0
18
+ total_frames = 0
19
+
20
+ while True:
21
+ ret, frame = cap.read()
22
+ frame = imutils.resize(frame, width=600)
23
+ total_frames = total_frames + 1
24
+
25
+ (H, W) = frame.shape[:2]
26
+
27
+ face_blob = cv2.dnn.blobFromImage(cv2.resize(frame, (300, 300)), 1.0, (300, 300), (104.0, 177.0, 123.0), False, False)
28
+
29
+ detector.setInput(face_blob)
30
+ face_detections = detector.forward()
31
+
32
+ for i in np.arange(0, face_detections.shape[2]):
33
+ confidence = face_detections[0, 0, i, 2]
34
+ if confidence > 0.5:
35
+
36
+ face_box = face_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
37
+ (startX, startY, endX, endY) = face_box.astype("int")
38
+
39
+ cv2.rectangle(frame, (startX, startY), (endX, endY), (0, 0, 255), 2)
40
+
41
+ fps_end_time = datetime.datetime.now()
42
+ time_diff = fps_end_time - fps_start_time
43
+ if time_diff.seconds == 0:
44
+ fps = 0.0
45
+ else:
46
+ fps = (total_frames / time_diff.seconds)
47
+
48
+ fps_text = "FPS: {:.2f}".format(fps)
49
+
50
+ cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
51
+
52
+ cv2.imshow("Application", frame)
53
+ key = cv2.waitKey(1)
54
+ if key == ord('q'):
55
+ break
56
+
57
+ cv2.destroyAllWindows()
58
+
59
+
60
+ main()
face_mask_detector.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
2
+ from tensorflow.keras.preprocessing.image import img_to_array
3
+ from tensorflow.keras.models import load_model
4
+ from imutils.video import VideoStream
5
+ import numpy as np
6
+ import argparse
7
+ import imutils
8
+ import time
9
+ import cv2
10
+ import os
11
+ import datetime
12
+
13
+ proto_txt_path = 'deploy.prototxt'
14
+ model_path = 'res10_300x300_ssd_iter_140000.caffemodel'
15
+ face_detector = cv2.dnn.readNetFromCaffe(proto_txt_path, model_path)
16
+
17
+ mask_detector = load_model('mask_detector.model')
18
+
19
+ cap = cv2.VideoCapture('mask.mp4')
20
+
21
+ while True:
22
+ ret, frame = cap.read()
23
+ frame = imutils.resize(frame, width=400)
24
+ (h, w) = frame.shape[:2]
25
+ blob = cv2.dnn.blobFromImage(frame, 1.0, (300, 300), (104, 177, 123))
26
+
27
+ face_detector.setInput(blob)
28
+ detections = face_detector.forward()
29
+
30
+ faces = []
31
+ bbox = []
32
+ results = []
33
+
34
+ for i in range(0, detections.shape[2]):
35
+ confidence = detections[0, 0, i, 2]
36
+
37
+ if confidence > 0.5:
38
+ box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
39
+ (startX, startY, endX, endY) = box.astype("int")
40
+
41
+ face = frame[startY:endY, startX:endX]
42
+ face = cv2.cvtColor(face, cv2.COLOR_BGR2RGB)
43
+ face = cv2.resize(face, (224, 224))
44
+ face = img_to_array(face)
45
+ face = preprocess_input(face)
46
+ face = np.expand_dims(face, axis=0)
47
+
48
+ faces.append(face)
49
+ bbox.append((startX, startY, endX, endY))
50
+
51
+ if len(faces) > 0:
52
+ results = mask_detector.predict(faces)
53
+
54
+ for (face_box, result) in zip(bbox, results):
55
+ (startX, startY, endX, endY) = face_box
56
+ (mask, withoutMask) = result
57
+
58
+ label = ""
59
+ if mask > withoutMask:
60
+ label = "Mask"
61
+ color = (0, 255, 0)
62
+ else:
63
+ label = "No Mask"
64
+ color = (0, 0, 255)
65
+
66
+ cv2.putText(frame, label, (startX, startY-10), cv2.FONT_HERSHEY_SIMPLEX, 0.45, color, 2)
67
+ cv2.rectangle(frame, (startX, startY), (endX, endY), color, 2)
68
+
69
+ cv2.imshow("Frame", frame)
70
+ key = cv2.waitKey(1) & 0xFF
71
+
72
+ if key == ord('q'):
73
+ break
fps_example.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import datetime
3
+ import imutils
4
+
5
+
6
+ def main():
7
+ cap = cv2.VideoCapture('test_video.mp4')
8
+
9
+ fps_start_time = datetime.datetime.now()
10
+ fps = 0
11
+ total_frames = 0
12
+
13
+ while True:
14
+ ret, frame = cap.read()
15
+ frame = imutils.resize(frame, width=800)
16
+ total_frames = total_frames + 1
17
+
18
+ fps_end_time = datetime.datetime.now()
19
+ time_diff = fps_end_time - fps_start_time
20
+ if time_diff.seconds == 0:
21
+ fps = 0.0
22
+ else:
23
+ fps = (total_frames / time_diff.seconds)
24
+
25
+ fps_text = "FPS: {:.2f}".format(fps)
26
+
27
+ cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
28
+
29
+ cv2.imshow("Application", frame)
30
+ key = cv2.waitKey(1)
31
+ if key == ord('q'):
32
+ break
33
+
34
+ cv2.destroyAllWindows()
35
+
36
+
37
+ main()
generate_keys.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pickle
2
+ from pathlib import Path
3
+ import streamlit_authenticator as stauth
4
+ # print("Done !!!")
5
+
6
+ names = ["dmin", "ser"]
7
+
8
+ username =["admin", "user"]
9
+
10
+ password =["admin123", "user123"]
11
+
12
+ hashed_passwords =stauth.Hasher(password).generate()
13
+
14
+ file_path = Path(__file__).parent / "hashed_pw.pkl"
15
+
16
+ with file_path.open("wb") as file:
17
+ pickle.dump(hashed_passwords, file)
img/cat.jpg ADDED
img/dog.jpg ADDED
img/input_image.jpg ADDED
img/people.jpg ADDED
logo.jpeg ADDED
mask.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4dc1d0ed71d79c29eaa4b8503c829fcf7c840cab93756baabf97238f999432e6
3
+ size 6143986
mask_detector.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a62288c0832df0fad0e97b881b5268d3deb40ec372611b7d81c913715799af00
3
+ size 11483536
model files/face detection model/deploy.prototxt ADDED
@@ -0,0 +1,1789 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ input: "data"
2
+ input_shape {
3
+ dim: 1
4
+ dim: 3
5
+ dim: 300
6
+ dim: 300
7
+ }
8
+
9
+ layer {
10
+ name: "data_bn"
11
+ type: "BatchNorm"
12
+ bottom: "data"
13
+ top: "data_bn"
14
+ param {
15
+ lr_mult: 0.0
16
+ }
17
+ param {
18
+ lr_mult: 0.0
19
+ }
20
+ param {
21
+ lr_mult: 0.0
22
+ }
23
+ }
24
+ layer {
25
+ name: "data_scale"
26
+ type: "Scale"
27
+ bottom: "data_bn"
28
+ top: "data_bn"
29
+ param {
30
+ lr_mult: 1.0
31
+ decay_mult: 1.0
32
+ }
33
+ param {
34
+ lr_mult: 2.0
35
+ decay_mult: 1.0
36
+ }
37
+ scale_param {
38
+ bias_term: true
39
+ }
40
+ }
41
+ layer {
42
+ name: "conv1_h"
43
+ type: "Convolution"
44
+ bottom: "data_bn"
45
+ top: "conv1_h"
46
+ param {
47
+ lr_mult: 1.0
48
+ decay_mult: 1.0
49
+ }
50
+ param {
51
+ lr_mult: 2.0
52
+ decay_mult: 1.0
53
+ }
54
+ convolution_param {
55
+ num_output: 32
56
+ pad: 3
57
+ kernel_size: 7
58
+ stride: 2
59
+ weight_filler {
60
+ type: "msra"
61
+ variance_norm: FAN_OUT
62
+ }
63
+ bias_filler {
64
+ type: "constant"
65
+ value: 0.0
66
+ }
67
+ }
68
+ }
69
+ layer {
70
+ name: "conv1_bn_h"
71
+ type: "BatchNorm"
72
+ bottom: "conv1_h"
73
+ top: "conv1_h"
74
+ param {
75
+ lr_mult: 0.0
76
+ }
77
+ param {
78
+ lr_mult: 0.0
79
+ }
80
+ param {
81
+ lr_mult: 0.0
82
+ }
83
+ }
84
+ layer {
85
+ name: "conv1_scale_h"
86
+ type: "Scale"
87
+ bottom: "conv1_h"
88
+ top: "conv1_h"
89
+ param {
90
+ lr_mult: 1.0
91
+ decay_mult: 1.0
92
+ }
93
+ param {
94
+ lr_mult: 2.0
95
+ decay_mult: 1.0
96
+ }
97
+ scale_param {
98
+ bias_term: true
99
+ }
100
+ }
101
+ layer {
102
+ name: "conv1_relu"
103
+ type: "ReLU"
104
+ bottom: "conv1_h"
105
+ top: "conv1_h"
106
+ }
107
+ layer {
108
+ name: "conv1_pool"
109
+ type: "Pooling"
110
+ bottom: "conv1_h"
111
+ top: "conv1_pool"
112
+ pooling_param {
113
+ kernel_size: 3
114
+ stride: 2
115
+ }
116
+ }
117
+ layer {
118
+ name: "layer_64_1_conv1_h"
119
+ type: "Convolution"
120
+ bottom: "conv1_pool"
121
+ top: "layer_64_1_conv1_h"
122
+ param {
123
+ lr_mult: 1.0
124
+ decay_mult: 1.0
125
+ }
126
+ convolution_param {
127
+ num_output: 32
128
+ bias_term: false
129
+ pad: 1
130
+ kernel_size: 3
131
+ stride: 1
132
+ weight_filler {
133
+ type: "msra"
134
+ }
135
+ bias_filler {
136
+ type: "constant"
137
+ value: 0.0
138
+ }
139
+ }
140
+ }
141
+ layer {
142
+ name: "layer_64_1_bn2_h"
143
+ type: "BatchNorm"
144
+ bottom: "layer_64_1_conv1_h"
145
+ top: "layer_64_1_conv1_h"
146
+ param {
147
+ lr_mult: 0.0
148
+ }
149
+ param {
150
+ lr_mult: 0.0
151
+ }
152
+ param {
153
+ lr_mult: 0.0
154
+ }
155
+ }
156
+ layer {
157
+ name: "layer_64_1_scale2_h"
158
+ type: "Scale"
159
+ bottom: "layer_64_1_conv1_h"
160
+ top: "layer_64_1_conv1_h"
161
+ param {
162
+ lr_mult: 1.0
163
+ decay_mult: 1.0
164
+ }
165
+ param {
166
+ lr_mult: 2.0
167
+ decay_mult: 1.0
168
+ }
169
+ scale_param {
170
+ bias_term: true
171
+ }
172
+ }
173
+ layer {
174
+ name: "layer_64_1_relu2"
175
+ type: "ReLU"
176
+ bottom: "layer_64_1_conv1_h"
177
+ top: "layer_64_1_conv1_h"
178
+ }
179
+ layer {
180
+ name: "layer_64_1_conv2_h"
181
+ type: "Convolution"
182
+ bottom: "layer_64_1_conv1_h"
183
+ top: "layer_64_1_conv2_h"
184
+ param {
185
+ lr_mult: 1.0
186
+ decay_mult: 1.0
187
+ }
188
+ convolution_param {
189
+ num_output: 32
190
+ bias_term: false
191
+ pad: 1
192
+ kernel_size: 3
193
+ stride: 1
194
+ weight_filler {
195
+ type: "msra"
196
+ }
197
+ bias_filler {
198
+ type: "constant"
199
+ value: 0.0
200
+ }
201
+ }
202
+ }
203
+ layer {
204
+ name: "layer_64_1_sum"
205
+ type: "Eltwise"
206
+ bottom: "layer_64_1_conv2_h"
207
+ bottom: "conv1_pool"
208
+ top: "layer_64_1_sum"
209
+ }
210
+ layer {
211
+ name: "layer_128_1_bn1_h"
212
+ type: "BatchNorm"
213
+ bottom: "layer_64_1_sum"
214
+ top: "layer_128_1_bn1_h"
215
+ param {
216
+ lr_mult: 0.0
217
+ }
218
+ param {
219
+ lr_mult: 0.0
220
+ }
221
+ param {
222
+ lr_mult: 0.0
223
+ }
224
+ }
225
+ layer {
226
+ name: "layer_128_1_scale1_h"
227
+ type: "Scale"
228
+ bottom: "layer_128_1_bn1_h"
229
+ top: "layer_128_1_bn1_h"
230
+ param {
231
+ lr_mult: 1.0
232
+ decay_mult: 1.0
233
+ }
234
+ param {
235
+ lr_mult: 2.0
236
+ decay_mult: 1.0
237
+ }
238
+ scale_param {
239
+ bias_term: true
240
+ }
241
+ }
242
+ layer {
243
+ name: "layer_128_1_relu1"
244
+ type: "ReLU"
245
+ bottom: "layer_128_1_bn1_h"
246
+ top: "layer_128_1_bn1_h"
247
+ }
248
+ layer {
249
+ name: "layer_128_1_conv1_h"
250
+ type: "Convolution"
251
+ bottom: "layer_128_1_bn1_h"
252
+ top: "layer_128_1_conv1_h"
253
+ param {
254
+ lr_mult: 1.0
255
+ decay_mult: 1.0
256
+ }
257
+ convolution_param {
258
+ num_output: 128
259
+ bias_term: false
260
+ pad: 1
261
+ kernel_size: 3
262
+ stride: 2
263
+ weight_filler {
264
+ type: "msra"
265
+ }
266
+ bias_filler {
267
+ type: "constant"
268
+ value: 0.0
269
+ }
270
+ }
271
+ }
272
+ layer {
273
+ name: "layer_128_1_bn2"
274
+ type: "BatchNorm"
275
+ bottom: "layer_128_1_conv1_h"
276
+ top: "layer_128_1_conv1_h"
277
+ param {
278
+ lr_mult: 0.0
279
+ }
280
+ param {
281
+ lr_mult: 0.0
282
+ }
283
+ param {
284
+ lr_mult: 0.0
285
+ }
286
+ }
287
+ layer {
288
+ name: "layer_128_1_scale2"
289
+ type: "Scale"
290
+ bottom: "layer_128_1_conv1_h"
291
+ top: "layer_128_1_conv1_h"
292
+ param {
293
+ lr_mult: 1.0
294
+ decay_mult: 1.0
295
+ }
296
+ param {
297
+ lr_mult: 2.0
298
+ decay_mult: 1.0
299
+ }
300
+ scale_param {
301
+ bias_term: true
302
+ }
303
+ }
304
+ layer {
305
+ name: "layer_128_1_relu2"
306
+ type: "ReLU"
307
+ bottom: "layer_128_1_conv1_h"
308
+ top: "layer_128_1_conv1_h"
309
+ }
310
+ layer {
311
+ name: "layer_128_1_conv2"
312
+ type: "Convolution"
313
+ bottom: "layer_128_1_conv1_h"
314
+ top: "layer_128_1_conv2"
315
+ param {
316
+ lr_mult: 1.0
317
+ decay_mult: 1.0
318
+ }
319
+ convolution_param {
320
+ num_output: 128
321
+ bias_term: false
322
+ pad: 1
323
+ kernel_size: 3
324
+ stride: 1
325
+ weight_filler {
326
+ type: "msra"
327
+ }
328
+ bias_filler {
329
+ type: "constant"
330
+ value: 0.0
331
+ }
332
+ }
333
+ }
334
+ layer {
335
+ name: "layer_128_1_conv_expand_h"
336
+ type: "Convolution"
337
+ bottom: "layer_128_1_bn1_h"
338
+ top: "layer_128_1_conv_expand_h"
339
+ param {
340
+ lr_mult: 1.0
341
+ decay_mult: 1.0
342
+ }
343
+ convolution_param {
344
+ num_output: 128
345
+ bias_term: false
346
+ pad: 0
347
+ kernel_size: 1
348
+ stride: 2
349
+ weight_filler {
350
+ type: "msra"
351
+ }
352
+ bias_filler {
353
+ type: "constant"
354
+ value: 0.0
355
+ }
356
+ }
357
+ }
358
+ layer {
359
+ name: "layer_128_1_sum"
360
+ type: "Eltwise"
361
+ bottom: "layer_128_1_conv2"
362
+ bottom: "layer_128_1_conv_expand_h"
363
+ top: "layer_128_1_sum"
364
+ }
365
+ layer {
366
+ name: "layer_256_1_bn1"
367
+ type: "BatchNorm"
368
+ bottom: "layer_128_1_sum"
369
+ top: "layer_256_1_bn1"
370
+ param {
371
+ lr_mult: 0.0
372
+ }
373
+ param {
374
+ lr_mult: 0.0
375
+ }
376
+ param {
377
+ lr_mult: 0.0
378
+ }
379
+ }
380
+ layer {
381
+ name: "layer_256_1_scale1"
382
+ type: "Scale"
383
+ bottom: "layer_256_1_bn1"
384
+ top: "layer_256_1_bn1"
385
+ param {
386
+ lr_mult: 1.0
387
+ decay_mult: 1.0
388
+ }
389
+ param {
390
+ lr_mult: 2.0
391
+ decay_mult: 1.0
392
+ }
393
+ scale_param {
394
+ bias_term: true
395
+ }
396
+ }
397
+ layer {
398
+ name: "layer_256_1_relu1"
399
+ type: "ReLU"
400
+ bottom: "layer_256_1_bn1"
401
+ top: "layer_256_1_bn1"
402
+ }
403
+ layer {
404
+ name: "layer_256_1_conv1"
405
+ type: "Convolution"
406
+ bottom: "layer_256_1_bn1"
407
+ top: "layer_256_1_conv1"
408
+ param {
409
+ lr_mult: 1.0
410
+ decay_mult: 1.0
411
+ }
412
+ convolution_param {
413
+ num_output: 256
414
+ bias_term: false
415
+ pad: 1
416
+ kernel_size: 3
417
+ stride: 2
418
+ weight_filler {
419
+ type: "msra"
420
+ }
421
+ bias_filler {
422
+ type: "constant"
423
+ value: 0.0
424
+ }
425
+ }
426
+ }
427
+ layer {
428
+ name: "layer_256_1_bn2"
429
+ type: "BatchNorm"
430
+ bottom: "layer_256_1_conv1"
431
+ top: "layer_256_1_conv1"
432
+ param {
433
+ lr_mult: 0.0
434
+ }
435
+ param {
436
+ lr_mult: 0.0
437
+ }
438
+ param {
439
+ lr_mult: 0.0
440
+ }
441
+ }
442
+ layer {
443
+ name: "layer_256_1_scale2"
444
+ type: "Scale"
445
+ bottom: "layer_256_1_conv1"
446
+ top: "layer_256_1_conv1"
447
+ param {
448
+ lr_mult: 1.0
449
+ decay_mult: 1.0
450
+ }
451
+ param {
452
+ lr_mult: 2.0
453
+ decay_mult: 1.0
454
+ }
455
+ scale_param {
456
+ bias_term: true
457
+ }
458
+ }
459
+ layer {
460
+ name: "layer_256_1_relu2"
461
+ type: "ReLU"
462
+ bottom: "layer_256_1_conv1"
463
+ top: "layer_256_1_conv1"
464
+ }
465
+ layer {
466
+ name: "layer_256_1_conv2"
467
+ type: "Convolution"
468
+ bottom: "layer_256_1_conv1"
469
+ top: "layer_256_1_conv2"
470
+ param {
471
+ lr_mult: 1.0
472
+ decay_mult: 1.0
473
+ }
474
+ convolution_param {
475
+ num_output: 256
476
+ bias_term: false
477
+ pad: 1
478
+ kernel_size: 3
479
+ stride: 1
480
+ weight_filler {
481
+ type: "msra"
482
+ }
483
+ bias_filler {
484
+ type: "constant"
485
+ value: 0.0
486
+ }
487
+ }
488
+ }
489
+ layer {
490
+ name: "layer_256_1_conv_expand"
491
+ type: "Convolution"
492
+ bottom: "layer_256_1_bn1"
493
+ top: "layer_256_1_conv_expand"
494
+ param {
495
+ lr_mult: 1.0
496
+ decay_mult: 1.0
497
+ }
498
+ convolution_param {
499
+ num_output: 256
500
+ bias_term: false
501
+ pad: 0
502
+ kernel_size: 1
503
+ stride: 2
504
+ weight_filler {
505
+ type: "msra"
506
+ }
507
+ bias_filler {
508
+ type: "constant"
509
+ value: 0.0
510
+ }
511
+ }
512
+ }
513
+ layer {
514
+ name: "layer_256_1_sum"
515
+ type: "Eltwise"
516
+ bottom: "layer_256_1_conv2"
517
+ bottom: "layer_256_1_conv_expand"
518
+ top: "layer_256_1_sum"
519
+ }
520
+ layer {
521
+ name: "layer_512_1_bn1"
522
+ type: "BatchNorm"
523
+ bottom: "layer_256_1_sum"
524
+ top: "layer_512_1_bn1"
525
+ param {
526
+ lr_mult: 0.0
527
+ }
528
+ param {
529
+ lr_mult: 0.0
530
+ }
531
+ param {
532
+ lr_mult: 0.0
533
+ }
534
+ }
535
+ layer {
536
+ name: "layer_512_1_scale1"
537
+ type: "Scale"
538
+ bottom: "layer_512_1_bn1"
539
+ top: "layer_512_1_bn1"
540
+ param {
541
+ lr_mult: 1.0
542
+ decay_mult: 1.0
543
+ }
544
+ param {
545
+ lr_mult: 2.0
546
+ decay_mult: 1.0
547
+ }
548
+ scale_param {
549
+ bias_term: true
550
+ }
551
+ }
552
+ layer {
553
+ name: "layer_512_1_relu1"
554
+ type: "ReLU"
555
+ bottom: "layer_512_1_bn1"
556
+ top: "layer_512_1_bn1"
557
+ }
558
+ layer {
559
+ name: "layer_512_1_conv1_h"
560
+ type: "Convolution"
561
+ bottom: "layer_512_1_bn1"
562
+ top: "layer_512_1_conv1_h"
563
+ param {
564
+ lr_mult: 1.0
565
+ decay_mult: 1.0
566
+ }
567
+ convolution_param {
568
+ num_output: 128
569
+ bias_term: false
570
+ pad: 1
571
+ kernel_size: 3
572
+ stride: 1 # 2
573
+ weight_filler {
574
+ type: "msra"
575
+ }
576
+ bias_filler {
577
+ type: "constant"
578
+ value: 0.0
579
+ }
580
+ }
581
+ }
582
+ layer {
583
+ name: "layer_512_1_bn2_h"
584
+ type: "BatchNorm"
585
+ bottom: "layer_512_1_conv1_h"
586
+ top: "layer_512_1_conv1_h"
587
+ param {
588
+ lr_mult: 0.0
589
+ }
590
+ param {
591
+ lr_mult: 0.0
592
+ }
593
+ param {
594
+ lr_mult: 0.0
595
+ }
596
+ }
597
+ layer {
598
+ name: "layer_512_1_scale2_h"
599
+ type: "Scale"
600
+ bottom: "layer_512_1_conv1_h"
601
+ top: "layer_512_1_conv1_h"
602
+ param {
603
+ lr_mult: 1.0
604
+ decay_mult: 1.0
605
+ }
606
+ param {
607
+ lr_mult: 2.0
608
+ decay_mult: 1.0
609
+ }
610
+ scale_param {
611
+ bias_term: true
612
+ }
613
+ }
614
+ layer {
615
+ name: "layer_512_1_relu2"
616
+ type: "ReLU"
617
+ bottom: "layer_512_1_conv1_h"
618
+ top: "layer_512_1_conv1_h"
619
+ }
620
+ layer {
621
+ name: "layer_512_1_conv2_h"
622
+ type: "Convolution"
623
+ bottom: "layer_512_1_conv1_h"
624
+ top: "layer_512_1_conv2_h"
625
+ param {
626
+ lr_mult: 1.0
627
+ decay_mult: 1.0
628
+ }
629
+ convolution_param {
630
+ num_output: 256
631
+ bias_term: false
632
+ pad: 2 # 1
633
+ kernel_size: 3
634
+ stride: 1
635
+ dilation: 2
636
+ weight_filler {
637
+ type: "msra"
638
+ }
639
+ bias_filler {
640
+ type: "constant"
641
+ value: 0.0
642
+ }
643
+ }
644
+ }
645
+ layer {
646
+ name: "layer_512_1_conv_expand_h"
647
+ type: "Convolution"
648
+ bottom: "layer_512_1_bn1"
649
+ top: "layer_512_1_conv_expand_h"
650
+ param {
651
+ lr_mult: 1.0
652
+ decay_mult: 1.0
653
+ }
654
+ convolution_param {
655
+ num_output: 256
656
+ bias_term: false
657
+ pad: 0
658
+ kernel_size: 1
659
+ stride: 1 # 2
660
+ weight_filler {
661
+ type: "msra"
662
+ }
663
+ bias_filler {
664
+ type: "constant"
665
+ value: 0.0
666
+ }
667
+ }
668
+ }
669
+ layer {
670
+ name: "layer_512_1_sum"
671
+ type: "Eltwise"
672
+ bottom: "layer_512_1_conv2_h"
673
+ bottom: "layer_512_1_conv_expand_h"
674
+ top: "layer_512_1_sum"
675
+ }
676
+ layer {
677
+ name: "last_bn_h"
678
+ type: "BatchNorm"
679
+ bottom: "layer_512_1_sum"
680
+ top: "layer_512_1_sum"
681
+ param {
682
+ lr_mult: 0.0
683
+ }
684
+ param {
685
+ lr_mult: 0.0
686
+ }
687
+ param {
688
+ lr_mult: 0.0
689
+ }
690
+ }
691
+ layer {
692
+ name: "last_scale_h"
693
+ type: "Scale"
694
+ bottom: "layer_512_1_sum"
695
+ top: "layer_512_1_sum"
696
+ param {
697
+ lr_mult: 1.0
698
+ decay_mult: 1.0
699
+ }
700
+ param {
701
+ lr_mult: 2.0
702
+ decay_mult: 1.0
703
+ }
704
+ scale_param {
705
+ bias_term: true
706
+ }
707
+ }
708
+ layer {
709
+ name: "last_relu"
710
+ type: "ReLU"
711
+ bottom: "layer_512_1_sum"
712
+ top: "fc7"
713
+ }
714
+
715
+ layer {
716
+ name: "conv6_1_h"
717
+ type: "Convolution"
718
+ bottom: "fc7"
719
+ top: "conv6_1_h"
720
+ param {
721
+ lr_mult: 1
722
+ decay_mult: 1
723
+ }
724
+ param {
725
+ lr_mult: 2
726
+ decay_mult: 0
727
+ }
728
+ convolution_param {
729
+ num_output: 128
730
+ pad: 0
731
+ kernel_size: 1
732
+ stride: 1
733
+ weight_filler {
734
+ type: "xavier"
735
+ }
736
+ bias_filler {
737
+ type: "constant"
738
+ value: 0
739
+ }
740
+ }
741
+ }
742
+ layer {
743
+ name: "conv6_1_relu"
744
+ type: "ReLU"
745
+ bottom: "conv6_1_h"
746
+ top: "conv6_1_h"
747
+ }
748
+ layer {
749
+ name: "conv6_2_h"
750
+ type: "Convolution"
751
+ bottom: "conv6_1_h"
752
+ top: "conv6_2_h"
753
+ param {
754
+ lr_mult: 1
755
+ decay_mult: 1
756
+ }
757
+ param {
758
+ lr_mult: 2
759
+ decay_mult: 0
760
+ }
761
+ convolution_param {
762
+ num_output: 256
763
+ pad: 1
764
+ kernel_size: 3
765
+ stride: 2
766
+ weight_filler {
767
+ type: "xavier"
768
+ }
769
+ bias_filler {
770
+ type: "constant"
771
+ value: 0
772
+ }
773
+ }
774
+ }
775
+ layer {
776
+ name: "conv6_2_relu"
777
+ type: "ReLU"
778
+ bottom: "conv6_2_h"
779
+ top: "conv6_2_h"
780
+ }
781
+ layer {
782
+ name: "conv7_1_h"
783
+ type: "Convolution"
784
+ bottom: "conv6_2_h"
785
+ top: "conv7_1_h"
786
+ param {
787
+ lr_mult: 1
788
+ decay_mult: 1
789
+ }
790
+ param {
791
+ lr_mult: 2
792
+ decay_mult: 0
793
+ }
794
+ convolution_param {
795
+ num_output: 64
796
+ pad: 0
797
+ kernel_size: 1
798
+ stride: 1
799
+ weight_filler {
800
+ type: "xavier"
801
+ }
802
+ bias_filler {
803
+ type: "constant"
804
+ value: 0
805
+ }
806
+ }
807
+ }
808
+ layer {
809
+ name: "conv7_1_relu"
810
+ type: "ReLU"
811
+ bottom: "conv7_1_h"
812
+ top: "conv7_1_h"
813
+ }
814
+ layer {
815
+ name: "conv7_2_h"
816
+ type: "Convolution"
817
+ bottom: "conv7_1_h"
818
+ top: "conv7_2_h"
819
+ param {
820
+ lr_mult: 1
821
+ decay_mult: 1
822
+ }
823
+ param {
824
+ lr_mult: 2
825
+ decay_mult: 0
826
+ }
827
+ convolution_param {
828
+ num_output: 128
829
+ pad: 1
830
+ kernel_size: 3
831
+ stride: 2
832
+ weight_filler {
833
+ type: "xavier"
834
+ }
835
+ bias_filler {
836
+ type: "constant"
837
+ value: 0
838
+ }
839
+ }
840
+ }
841
+ layer {
842
+ name: "conv7_2_relu"
843
+ type: "ReLU"
844
+ bottom: "conv7_2_h"
845
+ top: "conv7_2_h"
846
+ }
847
+ layer {
848
+ name: "conv8_1_h"
849
+ type: "Convolution"
850
+ bottom: "conv7_2_h"
851
+ top: "conv8_1_h"
852
+ param {
853
+ lr_mult: 1
854
+ decay_mult: 1
855
+ }
856
+ param {
857
+ lr_mult: 2
858
+ decay_mult: 0
859
+ }
860
+ convolution_param {
861
+ num_output: 64
862
+ pad: 0
863
+ kernel_size: 1
864
+ stride: 1
865
+ weight_filler {
866
+ type: "xavier"
867
+ }
868
+ bias_filler {
869
+ type: "constant"
870
+ value: 0
871
+ }
872
+ }
873
+ }
874
+ layer {
875
+ name: "conv8_1_relu"
876
+ type: "ReLU"
877
+ bottom: "conv8_1_h"
878
+ top: "conv8_1_h"
879
+ }
880
+ layer {
881
+ name: "conv8_2_h"
882
+ type: "Convolution"
883
+ bottom: "conv8_1_h"
884
+ top: "conv8_2_h"
885
+ param {
886
+ lr_mult: 1
887
+ decay_mult: 1
888
+ }
889
+ param {
890
+ lr_mult: 2
891
+ decay_mult: 0
892
+ }
893
+ convolution_param {
894
+ num_output: 128
895
+ pad: 1
896
+ kernel_size: 3
897
+ stride: 1
898
+ weight_filler {
899
+ type: "xavier"
900
+ }
901
+ bias_filler {
902
+ type: "constant"
903
+ value: 0
904
+ }
905
+ }
906
+ }
907
+ layer {
908
+ name: "conv8_2_relu"
909
+ type: "ReLU"
910
+ bottom: "conv8_2_h"
911
+ top: "conv8_2_h"
912
+ }
913
+ layer {
914
+ name: "conv9_1_h"
915
+ type: "Convolution"
916
+ bottom: "conv8_2_h"
917
+ top: "conv9_1_h"
918
+ param {
919
+ lr_mult: 1
920
+ decay_mult: 1
921
+ }
922
+ param {
923
+ lr_mult: 2
924
+ decay_mult: 0
925
+ }
926
+ convolution_param {
927
+ num_output: 64
928
+ pad: 0
929
+ kernel_size: 1
930
+ stride: 1
931
+ weight_filler {
932
+ type: "xavier"
933
+ }
934
+ bias_filler {
935
+ type: "constant"
936
+ value: 0
937
+ }
938
+ }
939
+ }
940
+ layer {
941
+ name: "conv9_1_relu"
942
+ type: "ReLU"
943
+ bottom: "conv9_1_h"
944
+ top: "conv9_1_h"
945
+ }
946
+ layer {
947
+ name: "conv9_2_h"
948
+ type: "Convolution"
949
+ bottom: "conv9_1_h"
950
+ top: "conv9_2_h"
951
+ param {
952
+ lr_mult: 1
953
+ decay_mult: 1
954
+ }
955
+ param {
956
+ lr_mult: 2
957
+ decay_mult: 0
958
+ }
959
+ convolution_param {
960
+ num_output: 128
961
+ pad: 1
962
+ kernel_size: 3
963
+ stride: 1
964
+ weight_filler {
965
+ type: "xavier"
966
+ }
967
+ bias_filler {
968
+ type: "constant"
969
+ value: 0
970
+ }
971
+ }
972
+ }
973
+ layer {
974
+ name: "conv9_2_relu"
975
+ type: "ReLU"
976
+ bottom: "conv9_2_h"
977
+ top: "conv9_2_h"
978
+ }
979
+ layer {
980
+ name: "conv4_3_norm"
981
+ type: "Normalize"
982
+ bottom: "layer_256_1_bn1"
983
+ top: "conv4_3_norm"
984
+ norm_param {
985
+ across_spatial: false
986
+ scale_filler {
987
+ type: "constant"
988
+ value: 20
989
+ }
990
+ channel_shared: false
991
+ }
992
+ }
993
+ layer {
994
+ name: "conv4_3_norm_mbox_loc"
995
+ type: "Convolution"
996
+ bottom: "conv4_3_norm"
997
+ top: "conv4_3_norm_mbox_loc"
998
+ param {
999
+ lr_mult: 1
1000
+ decay_mult: 1
1001
+ }
1002
+ param {
1003
+ lr_mult: 2
1004
+ decay_mult: 0
1005
+ }
1006
+ convolution_param {
1007
+ num_output: 16
1008
+ pad: 1
1009
+ kernel_size: 3
1010
+ stride: 1
1011
+ weight_filler {
1012
+ type: "xavier"
1013
+ }
1014
+ bias_filler {
1015
+ type: "constant"
1016
+ value: 0
1017
+ }
1018
+ }
1019
+ }
1020
+ layer {
1021
+ name: "conv4_3_norm_mbox_loc_perm"
1022
+ type: "Permute"
1023
+ bottom: "conv4_3_norm_mbox_loc"
1024
+ top: "conv4_3_norm_mbox_loc_perm"
1025
+ permute_param {
1026
+ order: 0
1027
+ order: 2
1028
+ order: 3
1029
+ order: 1
1030
+ }
1031
+ }
1032
+ layer {
1033
+ name: "conv4_3_norm_mbox_loc_flat"
1034
+ type: "Flatten"
1035
+ bottom: "conv4_3_norm_mbox_loc_perm"
1036
+ top: "conv4_3_norm_mbox_loc_flat"
1037
+ flatten_param {
1038
+ axis: 1
1039
+ }
1040
+ }
1041
+ layer {
1042
+ name: "conv4_3_norm_mbox_conf"
1043
+ type: "Convolution"
1044
+ bottom: "conv4_3_norm"
1045
+ top: "conv4_3_norm_mbox_conf"
1046
+ param {
1047
+ lr_mult: 1
1048
+ decay_mult: 1
1049
+ }
1050
+ param {
1051
+ lr_mult: 2
1052
+ decay_mult: 0
1053
+ }
1054
+ convolution_param {
1055
+ num_output: 8 # 84
1056
+ pad: 1
1057
+ kernel_size: 3
1058
+ stride: 1
1059
+ weight_filler {
1060
+ type: "xavier"
1061
+ }
1062
+ bias_filler {
1063
+ type: "constant"
1064
+ value: 0
1065
+ }
1066
+ }
1067
+ }
1068
+ layer {
1069
+ name: "conv4_3_norm_mbox_conf_perm"
1070
+ type: "Permute"
1071
+ bottom: "conv4_3_norm_mbox_conf"
1072
+ top: "conv4_3_norm_mbox_conf_perm"
1073
+ permute_param {
1074
+ order: 0
1075
+ order: 2
1076
+ order: 3
1077
+ order: 1
1078
+ }
1079
+ }
1080
+ layer {
1081
+ name: "conv4_3_norm_mbox_conf_flat"
1082
+ type: "Flatten"
1083
+ bottom: "conv4_3_norm_mbox_conf_perm"
1084
+ top: "conv4_3_norm_mbox_conf_flat"
1085
+ flatten_param {
1086
+ axis: 1
1087
+ }
1088
+ }
1089
+ layer {
1090
+ name: "conv4_3_norm_mbox_priorbox"
1091
+ type: "PriorBox"
1092
+ bottom: "conv4_3_norm"
1093
+ bottom: "data"
1094
+ top: "conv4_3_norm_mbox_priorbox"
1095
+ prior_box_param {
1096
+ min_size: 30.0
1097
+ max_size: 60.0
1098
+ aspect_ratio: 2
1099
+ flip: true
1100
+ clip: false
1101
+ variance: 0.1
1102
+ variance: 0.1
1103
+ variance: 0.2
1104
+ variance: 0.2
1105
+ step: 8
1106
+ offset: 0.5
1107
+ }
1108
+ }
1109
+ layer {
1110
+ name: "fc7_mbox_loc"
1111
+ type: "Convolution"
1112
+ bottom: "fc7"
1113
+ top: "fc7_mbox_loc"
1114
+ param {
1115
+ lr_mult: 1
1116
+ decay_mult: 1
1117
+ }
1118
+ param {
1119
+ lr_mult: 2
1120
+ decay_mult: 0
1121
+ }
1122
+ convolution_param {
1123
+ num_output: 24
1124
+ pad: 1
1125
+ kernel_size: 3
1126
+ stride: 1
1127
+ weight_filler {
1128
+ type: "xavier"
1129
+ }
1130
+ bias_filler {
1131
+ type: "constant"
1132
+ value: 0
1133
+ }
1134
+ }
1135
+ }
1136
+ layer {
1137
+ name: "fc7_mbox_loc_perm"
1138
+ type: "Permute"
1139
+ bottom: "fc7_mbox_loc"
1140
+ top: "fc7_mbox_loc_perm"
1141
+ permute_param {
1142
+ order: 0
1143
+ order: 2
1144
+ order: 3
1145
+ order: 1
1146
+ }
1147
+ }
1148
+ layer {
1149
+ name: "fc7_mbox_loc_flat"
1150
+ type: "Flatten"
1151
+ bottom: "fc7_mbox_loc_perm"
1152
+ top: "fc7_mbox_loc_flat"
1153
+ flatten_param {
1154
+ axis: 1
1155
+ }
1156
+ }
1157
+ layer {
1158
+ name: "fc7_mbox_conf"
1159
+ type: "Convolution"
1160
+ bottom: "fc7"
1161
+ top: "fc7_mbox_conf"
1162
+ param {
1163
+ lr_mult: 1
1164
+ decay_mult: 1
1165
+ }
1166
+ param {
1167
+ lr_mult: 2
1168
+ decay_mult: 0
1169
+ }
1170
+ convolution_param {
1171
+ num_output: 12 # 126
1172
+ pad: 1
1173
+ kernel_size: 3
1174
+ stride: 1
1175
+ weight_filler {
1176
+ type: "xavier"
1177
+ }
1178
+ bias_filler {
1179
+ type: "constant"
1180
+ value: 0
1181
+ }
1182
+ }
1183
+ }
1184
+ layer {
1185
+ name: "fc7_mbox_conf_perm"
1186
+ type: "Permute"
1187
+ bottom: "fc7_mbox_conf"
1188
+ top: "fc7_mbox_conf_perm"
1189
+ permute_param {
1190
+ order: 0
1191
+ order: 2
1192
+ order: 3
1193
+ order: 1
1194
+ }
1195
+ }
1196
+ layer {
1197
+ name: "fc7_mbox_conf_flat"
1198
+ type: "Flatten"
1199
+ bottom: "fc7_mbox_conf_perm"
1200
+ top: "fc7_mbox_conf_flat"
1201
+ flatten_param {
1202
+ axis: 1
1203
+ }
1204
+ }
1205
+ layer {
1206
+ name: "fc7_mbox_priorbox"
1207
+ type: "PriorBox"
1208
+ bottom: "fc7"
1209
+ bottom: "data"
1210
+ top: "fc7_mbox_priorbox"
1211
+ prior_box_param {
1212
+ min_size: 60.0
1213
+ max_size: 111.0
1214
+ aspect_ratio: 2
1215
+ aspect_ratio: 3
1216
+ flip: true
1217
+ clip: false
1218
+ variance: 0.1
1219
+ variance: 0.1
1220
+ variance: 0.2
1221
+ variance: 0.2
1222
+ step: 16
1223
+ offset: 0.5
1224
+ }
1225
+ }
1226
+ layer {
1227
+ name: "conv6_2_mbox_loc"
1228
+ type: "Convolution"
1229
+ bottom: "conv6_2_h"
1230
+ top: "conv6_2_mbox_loc"
1231
+ param {
1232
+ lr_mult: 1
1233
+ decay_mult: 1
1234
+ }
1235
+ param {
1236
+ lr_mult: 2
1237
+ decay_mult: 0
1238
+ }
1239
+ convolution_param {
1240
+ num_output: 24
1241
+ pad: 1
1242
+ kernel_size: 3
1243
+ stride: 1
1244
+ weight_filler {
1245
+ type: "xavier"
1246
+ }
1247
+ bias_filler {
1248
+ type: "constant"
1249
+ value: 0
1250
+ }
1251
+ }
1252
+ }
1253
+ layer {
1254
+ name: "conv6_2_mbox_loc_perm"
1255
+ type: "Permute"
1256
+ bottom: "conv6_2_mbox_loc"
1257
+ top: "conv6_2_mbox_loc_perm"
1258
+ permute_param {
1259
+ order: 0
1260
+ order: 2
1261
+ order: 3
1262
+ order: 1
1263
+ }
1264
+ }
1265
+ layer {
1266
+ name: "conv6_2_mbox_loc_flat"
1267
+ type: "Flatten"
1268
+ bottom: "conv6_2_mbox_loc_perm"
1269
+ top: "conv6_2_mbox_loc_flat"
1270
+ flatten_param {
1271
+ axis: 1
1272
+ }
1273
+ }
1274
+ layer {
1275
+ name: "conv6_2_mbox_conf"
1276
+ type: "Convolution"
1277
+ bottom: "conv6_2_h"
1278
+ top: "conv6_2_mbox_conf"
1279
+ param {
1280
+ lr_mult: 1
1281
+ decay_mult: 1
1282
+ }
1283
+ param {
1284
+ lr_mult: 2
1285
+ decay_mult: 0
1286
+ }
1287
+ convolution_param {
1288
+ num_output: 12 # 126
1289
+ pad: 1
1290
+ kernel_size: 3
1291
+ stride: 1
1292
+ weight_filler {
1293
+ type: "xavier"
1294
+ }
1295
+ bias_filler {
1296
+ type: "constant"
1297
+ value: 0
1298
+ }
1299
+ }
1300
+ }
1301
+ layer {
1302
+ name: "conv6_2_mbox_conf_perm"
1303
+ type: "Permute"
1304
+ bottom: "conv6_2_mbox_conf"
1305
+ top: "conv6_2_mbox_conf_perm"
1306
+ permute_param {
1307
+ order: 0
1308
+ order: 2
1309
+ order: 3
1310
+ order: 1
1311
+ }
1312
+ }
1313
+ layer {
1314
+ name: "conv6_2_mbox_conf_flat"
1315
+ type: "Flatten"
1316
+ bottom: "conv6_2_mbox_conf_perm"
1317
+ top: "conv6_2_mbox_conf_flat"
1318
+ flatten_param {
1319
+ axis: 1
1320
+ }
1321
+ }
1322
+ layer {
1323
+ name: "conv6_2_mbox_priorbox"
1324
+ type: "PriorBox"
1325
+ bottom: "conv6_2_h"
1326
+ bottom: "data"
1327
+ top: "conv6_2_mbox_priorbox"
1328
+ prior_box_param {
1329
+ min_size: 111.0
1330
+ max_size: 162.0
1331
+ aspect_ratio: 2
1332
+ aspect_ratio: 3
1333
+ flip: true
1334
+ clip: false
1335
+ variance: 0.1
1336
+ variance: 0.1
1337
+ variance: 0.2
1338
+ variance: 0.2
1339
+ step: 32
1340
+ offset: 0.5
1341
+ }
1342
+ }
1343
+ layer {
1344
+ name: "conv7_2_mbox_loc"
1345
+ type: "Convolution"
1346
+ bottom: "conv7_2_h"
1347
+ top: "conv7_2_mbox_loc"
1348
+ param {
1349
+ lr_mult: 1
1350
+ decay_mult: 1
1351
+ }
1352
+ param {
1353
+ lr_mult: 2
1354
+ decay_mult: 0
1355
+ }
1356
+ convolution_param {
1357
+ num_output: 24
1358
+ pad: 1
1359
+ kernel_size: 3
1360
+ stride: 1
1361
+ weight_filler {
1362
+ type: "xavier"
1363
+ }
1364
+ bias_filler {
1365
+ type: "constant"
1366
+ value: 0
1367
+ }
1368
+ }
1369
+ }
1370
+ layer {
1371
+ name: "conv7_2_mbox_loc_perm"
1372
+ type: "Permute"
1373
+ bottom: "conv7_2_mbox_loc"
1374
+ top: "conv7_2_mbox_loc_perm"
1375
+ permute_param {
1376
+ order: 0
1377
+ order: 2
1378
+ order: 3
1379
+ order: 1
1380
+ }
1381
+ }
1382
+ layer {
1383
+ name: "conv7_2_mbox_loc_flat"
1384
+ type: "Flatten"
1385
+ bottom: "conv7_2_mbox_loc_perm"
1386
+ top: "conv7_2_mbox_loc_flat"
1387
+ flatten_param {
1388
+ axis: 1
1389
+ }
1390
+ }
1391
+ layer {
1392
+ name: "conv7_2_mbox_conf"
1393
+ type: "Convolution"
1394
+ bottom: "conv7_2_h"
1395
+ top: "conv7_2_mbox_conf"
1396
+ param {
1397
+ lr_mult: 1
1398
+ decay_mult: 1
1399
+ }
1400
+ param {
1401
+ lr_mult: 2
1402
+ decay_mult: 0
1403
+ }
1404
+ convolution_param {
1405
+ num_output: 12 # 126
1406
+ pad: 1
1407
+ kernel_size: 3
1408
+ stride: 1
1409
+ weight_filler {
1410
+ type: "xavier"
1411
+ }
1412
+ bias_filler {
1413
+ type: "constant"
1414
+ value: 0
1415
+ }
1416
+ }
1417
+ }
1418
+ layer {
1419
+ name: "conv7_2_mbox_conf_perm"
1420
+ type: "Permute"
1421
+ bottom: "conv7_2_mbox_conf"
1422
+ top: "conv7_2_mbox_conf_perm"
1423
+ permute_param {
1424
+ order: 0
1425
+ order: 2
1426
+ order: 3
1427
+ order: 1
1428
+ }
1429
+ }
1430
+ layer {
1431
+ name: "conv7_2_mbox_conf_flat"
1432
+ type: "Flatten"
1433
+ bottom: "conv7_2_mbox_conf_perm"
1434
+ top: "conv7_2_mbox_conf_flat"
1435
+ flatten_param {
1436
+ axis: 1
1437
+ }
1438
+ }
1439
+ layer {
1440
+ name: "conv7_2_mbox_priorbox"
1441
+ type: "PriorBox"
1442
+ bottom: "conv7_2_h"
1443
+ bottom: "data"
1444
+ top: "conv7_2_mbox_priorbox"
1445
+ prior_box_param {
1446
+ min_size: 162.0
1447
+ max_size: 213.0
1448
+ aspect_ratio: 2
1449
+ aspect_ratio: 3
1450
+ flip: true
1451
+ clip: false
1452
+ variance: 0.1
1453
+ variance: 0.1
1454
+ variance: 0.2
1455
+ variance: 0.2
1456
+ step: 64
1457
+ offset: 0.5
1458
+ }
1459
+ }
1460
+ layer {
1461
+ name: "conv8_2_mbox_loc"
1462
+ type: "Convolution"
1463
+ bottom: "conv8_2_h"
1464
+ top: "conv8_2_mbox_loc"
1465
+ param {
1466
+ lr_mult: 1
1467
+ decay_mult: 1
1468
+ }
1469
+ param {
1470
+ lr_mult: 2
1471
+ decay_mult: 0
1472
+ }
1473
+ convolution_param {
1474
+ num_output: 16
1475
+ pad: 1
1476
+ kernel_size: 3
1477
+ stride: 1
1478
+ weight_filler {
1479
+ type: "xavier"
1480
+ }
1481
+ bias_filler {
1482
+ type: "constant"
1483
+ value: 0
1484
+ }
1485
+ }
1486
+ }
1487
+ layer {
1488
+ name: "conv8_2_mbox_loc_perm"
1489
+ type: "Permute"
1490
+ bottom: "conv8_2_mbox_loc"
1491
+ top: "conv8_2_mbox_loc_perm"
1492
+ permute_param {
1493
+ order: 0
1494
+ order: 2
1495
+ order: 3
1496
+ order: 1
1497
+ }
1498
+ }
1499
+ layer {
1500
+ name: "conv8_2_mbox_loc_flat"
1501
+ type: "Flatten"
1502
+ bottom: "conv8_2_mbox_loc_perm"
1503
+ top: "conv8_2_mbox_loc_flat"
1504
+ flatten_param {
1505
+ axis: 1
1506
+ }
1507
+ }
1508
+ layer {
1509
+ name: "conv8_2_mbox_conf"
1510
+ type: "Convolution"
1511
+ bottom: "conv8_2_h"
1512
+ top: "conv8_2_mbox_conf"
1513
+ param {
1514
+ lr_mult: 1
1515
+ decay_mult: 1
1516
+ }
1517
+ param {
1518
+ lr_mult: 2
1519
+ decay_mult: 0
1520
+ }
1521
+ convolution_param {
1522
+ num_output: 8 # 84
1523
+ pad: 1
1524
+ kernel_size: 3
1525
+ stride: 1
1526
+ weight_filler {
1527
+ type: "xavier"
1528
+ }
1529
+ bias_filler {
1530
+ type: "constant"
1531
+ value: 0
1532
+ }
1533
+ }
1534
+ }
1535
+ layer {
1536
+ name: "conv8_2_mbox_conf_perm"
1537
+ type: "Permute"
1538
+ bottom: "conv8_2_mbox_conf"
1539
+ top: "conv8_2_mbox_conf_perm"
1540
+ permute_param {
1541
+ order: 0
1542
+ order: 2
1543
+ order: 3
1544
+ order: 1
1545
+ }
1546
+ }
1547
+ layer {
1548
+ name: "conv8_2_mbox_conf_flat"
1549
+ type: "Flatten"
1550
+ bottom: "conv8_2_mbox_conf_perm"
1551
+ top: "conv8_2_mbox_conf_flat"
1552
+ flatten_param {
1553
+ axis: 1
1554
+ }
1555
+ }
1556
+ layer {
1557
+ name: "conv8_2_mbox_priorbox"
1558
+ type: "PriorBox"
1559
+ bottom: "conv8_2_h"
1560
+ bottom: "data"
1561
+ top: "conv8_2_mbox_priorbox"
1562
+ prior_box_param {
1563
+ min_size: 213.0
1564
+ max_size: 264.0
1565
+ aspect_ratio: 2
1566
+ flip: true
1567
+ clip: false
1568
+ variance: 0.1
1569
+ variance: 0.1
1570
+ variance: 0.2
1571
+ variance: 0.2
1572
+ step: 100
1573
+ offset: 0.5
1574
+ }
1575
+ }
1576
+ layer {
1577
+ name: "conv9_2_mbox_loc"
1578
+ type: "Convolution"
1579
+ bottom: "conv9_2_h"
1580
+ top: "conv9_2_mbox_loc"
1581
+ param {
1582
+ lr_mult: 1
1583
+ decay_mult: 1
1584
+ }
1585
+ param {
1586
+ lr_mult: 2
1587
+ decay_mult: 0
1588
+ }
1589
+ convolution_param {
1590
+ num_output: 16
1591
+ pad: 1
1592
+ kernel_size: 3
1593
+ stride: 1
1594
+ weight_filler {
1595
+ type: "xavier"
1596
+ }
1597
+ bias_filler {
1598
+ type: "constant"
1599
+ value: 0
1600
+ }
1601
+ }
1602
+ }
1603
+ layer {
1604
+ name: "conv9_2_mbox_loc_perm"
1605
+ type: "Permute"
1606
+ bottom: "conv9_2_mbox_loc"
1607
+ top: "conv9_2_mbox_loc_perm"
1608
+ permute_param {
1609
+ order: 0
1610
+ order: 2
1611
+ order: 3
1612
+ order: 1
1613
+ }
1614
+ }
1615
+ layer {
1616
+ name: "conv9_2_mbox_loc_flat"
1617
+ type: "Flatten"
1618
+ bottom: "conv9_2_mbox_loc_perm"
1619
+ top: "conv9_2_mbox_loc_flat"
1620
+ flatten_param {
1621
+ axis: 1
1622
+ }
1623
+ }
1624
+ layer {
1625
+ name: "conv9_2_mbox_conf"
1626
+ type: "Convolution"
1627
+ bottom: "conv9_2_h"
1628
+ top: "conv9_2_mbox_conf"
1629
+ param {
1630
+ lr_mult: 1
1631
+ decay_mult: 1
1632
+ }
1633
+ param {
1634
+ lr_mult: 2
1635
+ decay_mult: 0
1636
+ }
1637
+ convolution_param {
1638
+ num_output: 8 # 84
1639
+ pad: 1
1640
+ kernel_size: 3
1641
+ stride: 1
1642
+ weight_filler {
1643
+ type: "xavier"
1644
+ }
1645
+ bias_filler {
1646
+ type: "constant"
1647
+ value: 0
1648
+ }
1649
+ }
1650
+ }
1651
+ layer {
1652
+ name: "conv9_2_mbox_conf_perm"
1653
+ type: "Permute"
1654
+ bottom: "conv9_2_mbox_conf"
1655
+ top: "conv9_2_mbox_conf_perm"
1656
+ permute_param {
1657
+ order: 0
1658
+ order: 2
1659
+ order: 3
1660
+ order: 1
1661
+ }
1662
+ }
1663
+ layer {
1664
+ name: "conv9_2_mbox_conf_flat"
1665
+ type: "Flatten"
1666
+ bottom: "conv9_2_mbox_conf_perm"
1667
+ top: "conv9_2_mbox_conf_flat"
1668
+ flatten_param {
1669
+ axis: 1
1670
+ }
1671
+ }
1672
+ layer {
1673
+ name: "conv9_2_mbox_priorbox"
1674
+ type: "PriorBox"
1675
+ bottom: "conv9_2_h"
1676
+ bottom: "data"
1677
+ top: "conv9_2_mbox_priorbox"
1678
+ prior_box_param {
1679
+ min_size: 264.0
1680
+ max_size: 315.0
1681
+ aspect_ratio: 2
1682
+ flip: true
1683
+ clip: false
1684
+ variance: 0.1
1685
+ variance: 0.1
1686
+ variance: 0.2
1687
+ variance: 0.2
1688
+ step: 300
1689
+ offset: 0.5
1690
+ }
1691
+ }
1692
+ layer {
1693
+ name: "mbox_loc"
1694
+ type: "Concat"
1695
+ bottom: "conv4_3_norm_mbox_loc_flat"
1696
+ bottom: "fc7_mbox_loc_flat"
1697
+ bottom: "conv6_2_mbox_loc_flat"
1698
+ bottom: "conv7_2_mbox_loc_flat"
1699
+ bottom: "conv8_2_mbox_loc_flat"
1700
+ bottom: "conv9_2_mbox_loc_flat"
1701
+ top: "mbox_loc"
1702
+ concat_param {
1703
+ axis: 1
1704
+ }
1705
+ }
1706
+ layer {
1707
+ name: "mbox_conf"
1708
+ type: "Concat"
1709
+ bottom: "conv4_3_norm_mbox_conf_flat"
1710
+ bottom: "fc7_mbox_conf_flat"
1711
+ bottom: "conv6_2_mbox_conf_flat"
1712
+ bottom: "conv7_2_mbox_conf_flat"
1713
+ bottom: "conv8_2_mbox_conf_flat"
1714
+ bottom: "conv9_2_mbox_conf_flat"
1715
+ top: "mbox_conf"
1716
+ concat_param {
1717
+ axis: 1
1718
+ }
1719
+ }
1720
+ layer {
1721
+ name: "mbox_priorbox"
1722
+ type: "Concat"
1723
+ bottom: "conv4_3_norm_mbox_priorbox"
1724
+ bottom: "fc7_mbox_priorbox"
1725
+ bottom: "conv6_2_mbox_priorbox"
1726
+ bottom: "conv7_2_mbox_priorbox"
1727
+ bottom: "conv8_2_mbox_priorbox"
1728
+ bottom: "conv9_2_mbox_priorbox"
1729
+ top: "mbox_priorbox"
1730
+ concat_param {
1731
+ axis: 2
1732
+ }
1733
+ }
1734
+
1735
+ layer {
1736
+ name: "mbox_conf_reshape"
1737
+ type: "Reshape"
1738
+ bottom: "mbox_conf"
1739
+ top: "mbox_conf_reshape"
1740
+ reshape_param {
1741
+ shape {
1742
+ dim: 0
1743
+ dim: -1
1744
+ dim: 2
1745
+ }
1746
+ }
1747
+ }
1748
+ layer {
1749
+ name: "mbox_conf_softmax"
1750
+ type: "Softmax"
1751
+ bottom: "mbox_conf_reshape"
1752
+ top: "mbox_conf_softmax"
1753
+ softmax_param {
1754
+ axis: 2
1755
+ }
1756
+ }
1757
+ layer {
1758
+ name: "mbox_conf_flatten"
1759
+ type: "Flatten"
1760
+ bottom: "mbox_conf_softmax"
1761
+ top: "mbox_conf_flatten"
1762
+ flatten_param {
1763
+ axis: 1
1764
+ }
1765
+ }
1766
+
1767
+ layer {
1768
+ name: "detection_out"
1769
+ type: "DetectionOutput"
1770
+ bottom: "mbox_loc"
1771
+ bottom: "mbox_conf_flatten"
1772
+ bottom: "mbox_priorbox"
1773
+ top: "detection_out"
1774
+ include {
1775
+ phase: TEST
1776
+ }
1777
+ detection_output_param {
1778
+ num_classes: 2
1779
+ share_location: true
1780
+ background_label_id: 0
1781
+ nms_param {
1782
+ nms_threshold: 0.45
1783
+ top_k: 400
1784
+ }
1785
+ code_type: CENTER_SIZE
1786
+ keep_top_k: 200
1787
+ confidence_threshold: 0.01
1788
+ }
1789
+ }
model files/face detection model/readme.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ This model can detect face in any frame or person image.
model files/face detection model/res10_300x300_ssd_iter_140000.caffemodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a56a11a57a4a295956b0660b4a3d76bbdca2206c4961cea8efe7d95c7cb2f2d
3
+ size 10666211
model files/face mask detection model/mask_detector.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a62288c0832df0fad0e97b881b5268d3deb40ec372611b7d81c913715799af00
3
+ size 11483536
model files/generic object detection model/MobileNetSSD_deploy.caffemodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:761c86fbae3d8361dd454f7c740a964f62975ed32f4324b8b85994edec30f6af
3
+ size 23147564
model files/generic object detection model/MobileNetSSD_deploy.prototxt ADDED
@@ -0,0 +1,1912 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "MobileNet-SSD"
2
+ input: "data"
3
+ input_shape {
4
+ dim: 1
5
+ dim: 3
6
+ dim: 300
7
+ dim: 300
8
+ }
9
+ layer {
10
+ name: "conv0"
11
+ type: "Convolution"
12
+ bottom: "data"
13
+ top: "conv0"
14
+ param {
15
+ lr_mult: 1.0
16
+ decay_mult: 1.0
17
+ }
18
+ param {
19
+ lr_mult: 2.0
20
+ decay_mult: 0.0
21
+ }
22
+ convolution_param {
23
+ num_output: 32
24
+ pad: 1
25
+ kernel_size: 3
26
+ stride: 2
27
+ weight_filler {
28
+ type: "msra"
29
+ }
30
+ bias_filler {
31
+ type: "constant"
32
+ value: 0.0
33
+ }
34
+ }
35
+ }
36
+ layer {
37
+ name: "conv0/relu"
38
+ type: "ReLU"
39
+ bottom: "conv0"
40
+ top: "conv0"
41
+ }
42
+ layer {
43
+ name: "conv1/dw"
44
+ type: "Convolution"
45
+ bottom: "conv0"
46
+ top: "conv1/dw"
47
+ param {
48
+ lr_mult: 1.0
49
+ decay_mult: 1.0
50
+ }
51
+ param {
52
+ lr_mult: 2.0
53
+ decay_mult: 0.0
54
+ }
55
+ convolution_param {
56
+ num_output: 32
57
+ pad: 1
58
+ kernel_size: 3
59
+ group: 32
60
+ engine: CAFFE
61
+ weight_filler {
62
+ type: "msra"
63
+ }
64
+ bias_filler {
65
+ type: "constant"
66
+ value: 0.0
67
+ }
68
+ }
69
+ }
70
+ layer {
71
+ name: "conv1/dw/relu"
72
+ type: "ReLU"
73
+ bottom: "conv1/dw"
74
+ top: "conv1/dw"
75
+ }
76
+ layer {
77
+ name: "conv1"
78
+ type: "Convolution"
79
+ bottom: "conv1/dw"
80
+ top: "conv1"
81
+ param {
82
+ lr_mult: 1.0
83
+ decay_mult: 1.0
84
+ }
85
+ param {
86
+ lr_mult: 2.0
87
+ decay_mult: 0.0
88
+ }
89
+ convolution_param {
90
+ num_output: 64
91
+ kernel_size: 1
92
+ weight_filler {
93
+ type: "msra"
94
+ }
95
+ bias_filler {
96
+ type: "constant"
97
+ value: 0.0
98
+ }
99
+ }
100
+ }
101
+ layer {
102
+ name: "conv1/relu"
103
+ type: "ReLU"
104
+ bottom: "conv1"
105
+ top: "conv1"
106
+ }
107
+ layer {
108
+ name: "conv2/dw"
109
+ type: "Convolution"
110
+ bottom: "conv1"
111
+ top: "conv2/dw"
112
+ param {
113
+ lr_mult: 1.0
114
+ decay_mult: 1.0
115
+ }
116
+ param {
117
+ lr_mult: 2.0
118
+ decay_mult: 0.0
119
+ }
120
+ convolution_param {
121
+ num_output: 64
122
+ pad: 1
123
+ kernel_size: 3
124
+ stride: 2
125
+ group: 64
126
+ engine: CAFFE
127
+ weight_filler {
128
+ type: "msra"
129
+ }
130
+ bias_filler {
131
+ type: "constant"
132
+ value: 0.0
133
+ }
134
+ }
135
+ }
136
+ layer {
137
+ name: "conv2/dw/relu"
138
+ type: "ReLU"
139
+ bottom: "conv2/dw"
140
+ top: "conv2/dw"
141
+ }
142
+ layer {
143
+ name: "conv2"
144
+ type: "Convolution"
145
+ bottom: "conv2/dw"
146
+ top: "conv2"
147
+ param {
148
+ lr_mult: 1.0
149
+ decay_mult: 1.0
150
+ }
151
+ param {
152
+ lr_mult: 2.0
153
+ decay_mult: 0.0
154
+ }
155
+ convolution_param {
156
+ num_output: 128
157
+ kernel_size: 1
158
+ weight_filler {
159
+ type: "msra"
160
+ }
161
+ bias_filler {
162
+ type: "constant"
163
+ value: 0.0
164
+ }
165
+ }
166
+ }
167
+ layer {
168
+ name: "conv2/relu"
169
+ type: "ReLU"
170
+ bottom: "conv2"
171
+ top: "conv2"
172
+ }
173
+ layer {
174
+ name: "conv3/dw"
175
+ type: "Convolution"
176
+ bottom: "conv2"
177
+ top: "conv3/dw"
178
+ param {
179
+ lr_mult: 1.0
180
+ decay_mult: 1.0
181
+ }
182
+ param {
183
+ lr_mult: 2.0
184
+ decay_mult: 0.0
185
+ }
186
+ convolution_param {
187
+ num_output: 128
188
+ pad: 1
189
+ kernel_size: 3
190
+ group: 128
191
+ engine: CAFFE
192
+ weight_filler {
193
+ type: "msra"
194
+ }
195
+ bias_filler {
196
+ type: "constant"
197
+ value: 0.0
198
+ }
199
+ }
200
+ }
201
+ layer {
202
+ name: "conv3/dw/relu"
203
+ type: "ReLU"
204
+ bottom: "conv3/dw"
205
+ top: "conv3/dw"
206
+ }
207
+ layer {
208
+ name: "conv3"
209
+ type: "Convolution"
210
+ bottom: "conv3/dw"
211
+ top: "conv3"
212
+ param {
213
+ lr_mult: 1.0
214
+ decay_mult: 1.0
215
+ }
216
+ param {
217
+ lr_mult: 2.0
218
+ decay_mult: 0.0
219
+ }
220
+ convolution_param {
221
+ num_output: 128
222
+ kernel_size: 1
223
+ weight_filler {
224
+ type: "msra"
225
+ }
226
+ bias_filler {
227
+ type: "constant"
228
+ value: 0.0
229
+ }
230
+ }
231
+ }
232
+ layer {
233
+ name: "conv3/relu"
234
+ type: "ReLU"
235
+ bottom: "conv3"
236
+ top: "conv3"
237
+ }
238
+ layer {
239
+ name: "conv4/dw"
240
+ type: "Convolution"
241
+ bottom: "conv3"
242
+ top: "conv4/dw"
243
+ param {
244
+ lr_mult: 1.0
245
+ decay_mult: 1.0
246
+ }
247
+ param {
248
+ lr_mult: 2.0
249
+ decay_mult: 0.0
250
+ }
251
+ convolution_param {
252
+ num_output: 128
253
+ pad: 1
254
+ kernel_size: 3
255
+ stride: 2
256
+ group: 128
257
+ engine: CAFFE
258
+ weight_filler {
259
+ type: "msra"
260
+ }
261
+ bias_filler {
262
+ type: "constant"
263
+ value: 0.0
264
+ }
265
+ }
266
+ }
267
+ layer {
268
+ name: "conv4/dw/relu"
269
+ type: "ReLU"
270
+ bottom: "conv4/dw"
271
+ top: "conv4/dw"
272
+ }
273
+ layer {
274
+ name: "conv4"
275
+ type: "Convolution"
276
+ bottom: "conv4/dw"
277
+ top: "conv4"
278
+ param {
279
+ lr_mult: 1.0
280
+ decay_mult: 1.0
281
+ }
282
+ param {
283
+ lr_mult: 2.0
284
+ decay_mult: 0.0
285
+ }
286
+ convolution_param {
287
+ num_output: 256
288
+ kernel_size: 1
289
+ weight_filler {
290
+ type: "msra"
291
+ }
292
+ bias_filler {
293
+ type: "constant"
294
+ value: 0.0
295
+ }
296
+ }
297
+ }
298
+ layer {
299
+ name: "conv4/relu"
300
+ type: "ReLU"
301
+ bottom: "conv4"
302
+ top: "conv4"
303
+ }
304
+ layer {
305
+ name: "conv5/dw"
306
+ type: "Convolution"
307
+ bottom: "conv4"
308
+ top: "conv5/dw"
309
+ param {
310
+ lr_mult: 1.0
311
+ decay_mult: 1.0
312
+ }
313
+ param {
314
+ lr_mult: 2.0
315
+ decay_mult: 0.0
316
+ }
317
+ convolution_param {
318
+ num_output: 256
319
+ pad: 1
320
+ kernel_size: 3
321
+ group: 256
322
+ engine: CAFFE
323
+ weight_filler {
324
+ type: "msra"
325
+ }
326
+ bias_filler {
327
+ type: "constant"
328
+ value: 0.0
329
+ }
330
+ }
331
+ }
332
+ layer {
333
+ name: "conv5/dw/relu"
334
+ type: "ReLU"
335
+ bottom: "conv5/dw"
336
+ top: "conv5/dw"
337
+ }
338
+ layer {
339
+ name: "conv5"
340
+ type: "Convolution"
341
+ bottom: "conv5/dw"
342
+ top: "conv5"
343
+ param {
344
+ lr_mult: 1.0
345
+ decay_mult: 1.0
346
+ }
347
+ param {
348
+ lr_mult: 2.0
349
+ decay_mult: 0.0
350
+ }
351
+ convolution_param {
352
+ num_output: 256
353
+ kernel_size: 1
354
+ weight_filler {
355
+ type: "msra"
356
+ }
357
+ bias_filler {
358
+ type: "constant"
359
+ value: 0.0
360
+ }
361
+ }
362
+ }
363
+ layer {
364
+ name: "conv5/relu"
365
+ type: "ReLU"
366
+ bottom: "conv5"
367
+ top: "conv5"
368
+ }
369
+ layer {
370
+ name: "conv6/dw"
371
+ type: "Convolution"
372
+ bottom: "conv5"
373
+ top: "conv6/dw"
374
+ param {
375
+ lr_mult: 1.0
376
+ decay_mult: 1.0
377
+ }
378
+ param {
379
+ lr_mult: 2.0
380
+ decay_mult: 0.0
381
+ }
382
+ convolution_param {
383
+ num_output: 256
384
+ pad: 1
385
+ kernel_size: 3
386
+ stride: 2
387
+ group: 256
388
+ engine: CAFFE
389
+ weight_filler {
390
+ type: "msra"
391
+ }
392
+ bias_filler {
393
+ type: "constant"
394
+ value: 0.0
395
+ }
396
+ }
397
+ }
398
+ layer {
399
+ name: "conv6/dw/relu"
400
+ type: "ReLU"
401
+ bottom: "conv6/dw"
402
+ top: "conv6/dw"
403
+ }
404
+ layer {
405
+ name: "conv6"
406
+ type: "Convolution"
407
+ bottom: "conv6/dw"
408
+ top: "conv6"
409
+ param {
410
+ lr_mult: 1.0
411
+ decay_mult: 1.0
412
+ }
413
+ param {
414
+ lr_mult: 2.0
415
+ decay_mult: 0.0
416
+ }
417
+ convolution_param {
418
+ num_output: 512
419
+ kernel_size: 1
420
+ weight_filler {
421
+ type: "msra"
422
+ }
423
+ bias_filler {
424
+ type: "constant"
425
+ value: 0.0
426
+ }
427
+ }
428
+ }
429
+ layer {
430
+ name: "conv6/relu"
431
+ type: "ReLU"
432
+ bottom: "conv6"
433
+ top: "conv6"
434
+ }
435
+ layer {
436
+ name: "conv7/dw"
437
+ type: "Convolution"
438
+ bottom: "conv6"
439
+ top: "conv7/dw"
440
+ param {
441
+ lr_mult: 1.0
442
+ decay_mult: 1.0
443
+ }
444
+ param {
445
+ lr_mult: 2.0
446
+ decay_mult: 0.0
447
+ }
448
+ convolution_param {
449
+ num_output: 512
450
+ pad: 1
451
+ kernel_size: 3
452
+ group: 512
453
+ engine: CAFFE
454
+ weight_filler {
455
+ type: "msra"
456
+ }
457
+ bias_filler {
458
+ type: "constant"
459
+ value: 0.0
460
+ }
461
+ }
462
+ }
463
+ layer {
464
+ name: "conv7/dw/relu"
465
+ type: "ReLU"
466
+ bottom: "conv7/dw"
467
+ top: "conv7/dw"
468
+ }
469
+ layer {
470
+ name: "conv7"
471
+ type: "Convolution"
472
+ bottom: "conv7/dw"
473
+ top: "conv7"
474
+ param {
475
+ lr_mult: 1.0
476
+ decay_mult: 1.0
477
+ }
478
+ param {
479
+ lr_mult: 2.0
480
+ decay_mult: 0.0
481
+ }
482
+ convolution_param {
483
+ num_output: 512
484
+ kernel_size: 1
485
+ weight_filler {
486
+ type: "msra"
487
+ }
488
+ bias_filler {
489
+ type: "constant"
490
+ value: 0.0
491
+ }
492
+ }
493
+ }
494
+ layer {
495
+ name: "conv7/relu"
496
+ type: "ReLU"
497
+ bottom: "conv7"
498
+ top: "conv7"
499
+ }
500
+ layer {
501
+ name: "conv8/dw"
502
+ type: "Convolution"
503
+ bottom: "conv7"
504
+ top: "conv8/dw"
505
+ param {
506
+ lr_mult: 1.0
507
+ decay_mult: 1.0
508
+ }
509
+ param {
510
+ lr_mult: 2.0
511
+ decay_mult: 0.0
512
+ }
513
+ convolution_param {
514
+ num_output: 512
515
+ pad: 1
516
+ kernel_size: 3
517
+ group: 512
518
+ engine: CAFFE
519
+ weight_filler {
520
+ type: "msra"
521
+ }
522
+ bias_filler {
523
+ type: "constant"
524
+ value: 0.0
525
+ }
526
+ }
527
+ }
528
+ layer {
529
+ name: "conv8/dw/relu"
530
+ type: "ReLU"
531
+ bottom: "conv8/dw"
532
+ top: "conv8/dw"
533
+ }
534
+ layer {
535
+ name: "conv8"
536
+ type: "Convolution"
537
+ bottom: "conv8/dw"
538
+ top: "conv8"
539
+ param {
540
+ lr_mult: 1.0
541
+ decay_mult: 1.0
542
+ }
543
+ param {
544
+ lr_mult: 2.0
545
+ decay_mult: 0.0
546
+ }
547
+ convolution_param {
548
+ num_output: 512
549
+ kernel_size: 1
550
+ weight_filler {
551
+ type: "msra"
552
+ }
553
+ bias_filler {
554
+ type: "constant"
555
+ value: 0.0
556
+ }
557
+ }
558
+ }
559
+ layer {
560
+ name: "conv8/relu"
561
+ type: "ReLU"
562
+ bottom: "conv8"
563
+ top: "conv8"
564
+ }
565
+ layer {
566
+ name: "conv9/dw"
567
+ type: "Convolution"
568
+ bottom: "conv8"
569
+ top: "conv9/dw"
570
+ param {
571
+ lr_mult: 1.0
572
+ decay_mult: 1.0
573
+ }
574
+ param {
575
+ lr_mult: 2.0
576
+ decay_mult: 0.0
577
+ }
578
+ convolution_param {
579
+ num_output: 512
580
+ pad: 1
581
+ kernel_size: 3
582
+ group: 512
583
+ engine: CAFFE
584
+ weight_filler {
585
+ type: "msra"
586
+ }
587
+ bias_filler {
588
+ type: "constant"
589
+ value: 0.0
590
+ }
591
+ }
592
+ }
593
+ layer {
594
+ name: "conv9/dw/relu"
595
+ type: "ReLU"
596
+ bottom: "conv9/dw"
597
+ top: "conv9/dw"
598
+ }
599
+ layer {
600
+ name: "conv9"
601
+ type: "Convolution"
602
+ bottom: "conv9/dw"
603
+ top: "conv9"
604
+ param {
605
+ lr_mult: 1.0
606
+ decay_mult: 1.0
607
+ }
608
+ param {
609
+ lr_mult: 2.0
610
+ decay_mult: 0.0
611
+ }
612
+ convolution_param {
613
+ num_output: 512
614
+ kernel_size: 1
615
+ weight_filler {
616
+ type: "msra"
617
+ }
618
+ bias_filler {
619
+ type: "constant"
620
+ value: 0.0
621
+ }
622
+ }
623
+ }
624
+ layer {
625
+ name: "conv9/relu"
626
+ type: "ReLU"
627
+ bottom: "conv9"
628
+ top: "conv9"
629
+ }
630
+ layer {
631
+ name: "conv10/dw"
632
+ type: "Convolution"
633
+ bottom: "conv9"
634
+ top: "conv10/dw"
635
+ param {
636
+ lr_mult: 1.0
637
+ decay_mult: 1.0
638
+ }
639
+ param {
640
+ lr_mult: 2.0
641
+ decay_mult: 0.0
642
+ }
643
+ convolution_param {
644
+ num_output: 512
645
+ pad: 1
646
+ kernel_size: 3
647
+ group: 512
648
+ engine: CAFFE
649
+ weight_filler {
650
+ type: "msra"
651
+ }
652
+ bias_filler {
653
+ type: "constant"
654
+ value: 0.0
655
+ }
656
+ }
657
+ }
658
+ layer {
659
+ name: "conv10/dw/relu"
660
+ type: "ReLU"
661
+ bottom: "conv10/dw"
662
+ top: "conv10/dw"
663
+ }
664
+ layer {
665
+ name: "conv10"
666
+ type: "Convolution"
667
+ bottom: "conv10/dw"
668
+ top: "conv10"
669
+ param {
670
+ lr_mult: 1.0
671
+ decay_mult: 1.0
672
+ }
673
+ param {
674
+ lr_mult: 2.0
675
+ decay_mult: 0.0
676
+ }
677
+ convolution_param {
678
+ num_output: 512
679
+ kernel_size: 1
680
+ weight_filler {
681
+ type: "msra"
682
+ }
683
+ bias_filler {
684
+ type: "constant"
685
+ value: 0.0
686
+ }
687
+ }
688
+ }
689
+ layer {
690
+ name: "conv10/relu"
691
+ type: "ReLU"
692
+ bottom: "conv10"
693
+ top: "conv10"
694
+ }
695
+ layer {
696
+ name: "conv11/dw"
697
+ type: "Convolution"
698
+ bottom: "conv10"
699
+ top: "conv11/dw"
700
+ param {
701
+ lr_mult: 1.0
702
+ decay_mult: 1.0
703
+ }
704
+ param {
705
+ lr_mult: 2.0
706
+ decay_mult: 0.0
707
+ }
708
+ convolution_param {
709
+ num_output: 512
710
+ pad: 1
711
+ kernel_size: 3
712
+ group: 512
713
+ engine: CAFFE
714
+ weight_filler {
715
+ type: "msra"
716
+ }
717
+ bias_filler {
718
+ type: "constant"
719
+ value: 0.0
720
+ }
721
+ }
722
+ }
723
+ layer {
724
+ name: "conv11/dw/relu"
725
+ type: "ReLU"
726
+ bottom: "conv11/dw"
727
+ top: "conv11/dw"
728
+ }
729
+ layer {
730
+ name: "conv11"
731
+ type: "Convolution"
732
+ bottom: "conv11/dw"
733
+ top: "conv11"
734
+ param {
735
+ lr_mult: 1.0
736
+ decay_mult: 1.0
737
+ }
738
+ param {
739
+ lr_mult: 2.0
740
+ decay_mult: 0.0
741
+ }
742
+ convolution_param {
743
+ num_output: 512
744
+ kernel_size: 1
745
+ weight_filler {
746
+ type: "msra"
747
+ }
748
+ bias_filler {
749
+ type: "constant"
750
+ value: 0.0
751
+ }
752
+ }
753
+ }
754
+ layer {
755
+ name: "conv11/relu"
756
+ type: "ReLU"
757
+ bottom: "conv11"
758
+ top: "conv11"
759
+ }
760
+ layer {
761
+ name: "conv12/dw"
762
+ type: "Convolution"
763
+ bottom: "conv11"
764
+ top: "conv12/dw"
765
+ param {
766
+ lr_mult: 1.0
767
+ decay_mult: 1.0
768
+ }
769
+ param {
770
+ lr_mult: 2.0
771
+ decay_mult: 0.0
772
+ }
773
+ convolution_param {
774
+ num_output: 512
775
+ pad: 1
776
+ kernel_size: 3
777
+ stride: 2
778
+ group: 512
779
+ engine: CAFFE
780
+ weight_filler {
781
+ type: "msra"
782
+ }
783
+ bias_filler {
784
+ type: "constant"
785
+ value: 0.0
786
+ }
787
+ }
788
+ }
789
+ layer {
790
+ name: "conv12/dw/relu"
791
+ type: "ReLU"
792
+ bottom: "conv12/dw"
793
+ top: "conv12/dw"
794
+ }
795
+ layer {
796
+ name: "conv12"
797
+ type: "Convolution"
798
+ bottom: "conv12/dw"
799
+ top: "conv12"
800
+ param {
801
+ lr_mult: 1.0
802
+ decay_mult: 1.0
803
+ }
804
+ param {
805
+ lr_mult: 2.0
806
+ decay_mult: 0.0
807
+ }
808
+ convolution_param {
809
+ num_output: 1024
810
+ kernel_size: 1
811
+ weight_filler {
812
+ type: "msra"
813
+ }
814
+ bias_filler {
815
+ type: "constant"
816
+ value: 0.0
817
+ }
818
+ }
819
+ }
820
+ layer {
821
+ name: "conv12/relu"
822
+ type: "ReLU"
823
+ bottom: "conv12"
824
+ top: "conv12"
825
+ }
826
+ layer {
827
+ name: "conv13/dw"
828
+ type: "Convolution"
829
+ bottom: "conv12"
830
+ top: "conv13/dw"
831
+ param {
832
+ lr_mult: 1.0
833
+ decay_mult: 1.0
834
+ }
835
+ param {
836
+ lr_mult: 2.0
837
+ decay_mult: 0.0
838
+ }
839
+ convolution_param {
840
+ num_output: 1024
841
+ pad: 1
842
+ kernel_size: 3
843
+ group: 1024
844
+ engine: CAFFE
845
+ weight_filler {
846
+ type: "msra"
847
+ }
848
+ bias_filler {
849
+ type: "constant"
850
+ value: 0.0
851
+ }
852
+ }
853
+ }
854
+ layer {
855
+ name: "conv13/dw/relu"
856
+ type: "ReLU"
857
+ bottom: "conv13/dw"
858
+ top: "conv13/dw"
859
+ }
860
+ layer {
861
+ name: "conv13"
862
+ type: "Convolution"
863
+ bottom: "conv13/dw"
864
+ top: "conv13"
865
+ param {
866
+ lr_mult: 1.0
867
+ decay_mult: 1.0
868
+ }
869
+ param {
870
+ lr_mult: 2.0
871
+ decay_mult: 0.0
872
+ }
873
+ convolution_param {
874
+ num_output: 1024
875
+ kernel_size: 1
876
+ weight_filler {
877
+ type: "msra"
878
+ }
879
+ bias_filler {
880
+ type: "constant"
881
+ value: 0.0
882
+ }
883
+ }
884
+ }
885
+ layer {
886
+ name: "conv13/relu"
887
+ type: "ReLU"
888
+ bottom: "conv13"
889
+ top: "conv13"
890
+ }
891
+ layer {
892
+ name: "conv14_1"
893
+ type: "Convolution"
894
+ bottom: "conv13"
895
+ top: "conv14_1"
896
+ param {
897
+ lr_mult: 1.0
898
+ decay_mult: 1.0
899
+ }
900
+ param {
901
+ lr_mult: 2.0
902
+ decay_mult: 0.0
903
+ }
904
+ convolution_param {
905
+ num_output: 256
906
+ kernel_size: 1
907
+ weight_filler {
908
+ type: "msra"
909
+ }
910
+ bias_filler {
911
+ type: "constant"
912
+ value: 0.0
913
+ }
914
+ }
915
+ }
916
+ layer {
917
+ name: "conv14_1/relu"
918
+ type: "ReLU"
919
+ bottom: "conv14_1"
920
+ top: "conv14_1"
921
+ }
922
+ layer {
923
+ name: "conv14_2"
924
+ type: "Convolution"
925
+ bottom: "conv14_1"
926
+ top: "conv14_2"
927
+ param {
928
+ lr_mult: 1.0
929
+ decay_mult: 1.0
930
+ }
931
+ param {
932
+ lr_mult: 2.0
933
+ decay_mult: 0.0
934
+ }
935
+ convolution_param {
936
+ num_output: 512
937
+ pad: 1
938
+ kernel_size: 3
939
+ stride: 2
940
+ weight_filler {
941
+ type: "msra"
942
+ }
943
+ bias_filler {
944
+ type: "constant"
945
+ value: 0.0
946
+ }
947
+ }
948
+ }
949
+ layer {
950
+ name: "conv14_2/relu"
951
+ type: "ReLU"
952
+ bottom: "conv14_2"
953
+ top: "conv14_2"
954
+ }
955
+ layer {
956
+ name: "conv15_1"
957
+ type: "Convolution"
958
+ bottom: "conv14_2"
959
+ top: "conv15_1"
960
+ param {
961
+ lr_mult: 1.0
962
+ decay_mult: 1.0
963
+ }
964
+ param {
965
+ lr_mult: 2.0
966
+ decay_mult: 0.0
967
+ }
968
+ convolution_param {
969
+ num_output: 128
970
+ kernel_size: 1
971
+ weight_filler {
972
+ type: "msra"
973
+ }
974
+ bias_filler {
975
+ type: "constant"
976
+ value: 0.0
977
+ }
978
+ }
979
+ }
980
+ layer {
981
+ name: "conv15_1/relu"
982
+ type: "ReLU"
983
+ bottom: "conv15_1"
984
+ top: "conv15_1"
985
+ }
986
+ layer {
987
+ name: "conv15_2"
988
+ type: "Convolution"
989
+ bottom: "conv15_1"
990
+ top: "conv15_2"
991
+ param {
992
+ lr_mult: 1.0
993
+ decay_mult: 1.0
994
+ }
995
+ param {
996
+ lr_mult: 2.0
997
+ decay_mult: 0.0
998
+ }
999
+ convolution_param {
1000
+ num_output: 256
1001
+ pad: 1
1002
+ kernel_size: 3
1003
+ stride: 2
1004
+ weight_filler {
1005
+ type: "msra"
1006
+ }
1007
+ bias_filler {
1008
+ type: "constant"
1009
+ value: 0.0
1010
+ }
1011
+ }
1012
+ }
1013
+ layer {
1014
+ name: "conv15_2/relu"
1015
+ type: "ReLU"
1016
+ bottom: "conv15_2"
1017
+ top: "conv15_2"
1018
+ }
1019
+ layer {
1020
+ name: "conv16_1"
1021
+ type: "Convolution"
1022
+ bottom: "conv15_2"
1023
+ top: "conv16_1"
1024
+ param {
1025
+ lr_mult: 1.0
1026
+ decay_mult: 1.0
1027
+ }
1028
+ param {
1029
+ lr_mult: 2.0
1030
+ decay_mult: 0.0
1031
+ }
1032
+ convolution_param {
1033
+ num_output: 128
1034
+ kernel_size: 1
1035
+ weight_filler {
1036
+ type: "msra"
1037
+ }
1038
+ bias_filler {
1039
+ type: "constant"
1040
+ value: 0.0
1041
+ }
1042
+ }
1043
+ }
1044
+ layer {
1045
+ name: "conv16_1/relu"
1046
+ type: "ReLU"
1047
+ bottom: "conv16_1"
1048
+ top: "conv16_1"
1049
+ }
1050
+ layer {
1051
+ name: "conv16_2"
1052
+ type: "Convolution"
1053
+ bottom: "conv16_1"
1054
+ top: "conv16_2"
1055
+ param {
1056
+ lr_mult: 1.0
1057
+ decay_mult: 1.0
1058
+ }
1059
+ param {
1060
+ lr_mult: 2.0
1061
+ decay_mult: 0.0
1062
+ }
1063
+ convolution_param {
1064
+ num_output: 256
1065
+ pad: 1
1066
+ kernel_size: 3
1067
+ stride: 2
1068
+ weight_filler {
1069
+ type: "msra"
1070
+ }
1071
+ bias_filler {
1072
+ type: "constant"
1073
+ value: 0.0
1074
+ }
1075
+ }
1076
+ }
1077
+ layer {
1078
+ name: "conv16_2/relu"
1079
+ type: "ReLU"
1080
+ bottom: "conv16_2"
1081
+ top: "conv16_2"
1082
+ }
1083
+ layer {
1084
+ name: "conv17_1"
1085
+ type: "Convolution"
1086
+ bottom: "conv16_2"
1087
+ top: "conv17_1"
1088
+ param {
1089
+ lr_mult: 1.0
1090
+ decay_mult: 1.0
1091
+ }
1092
+ param {
1093
+ lr_mult: 2.0
1094
+ decay_mult: 0.0
1095
+ }
1096
+ convolution_param {
1097
+ num_output: 64
1098
+ kernel_size: 1
1099
+ weight_filler {
1100
+ type: "msra"
1101
+ }
1102
+ bias_filler {
1103
+ type: "constant"
1104
+ value: 0.0
1105
+ }
1106
+ }
1107
+ }
1108
+ layer {
1109
+ name: "conv17_1/relu"
1110
+ type: "ReLU"
1111
+ bottom: "conv17_1"
1112
+ top: "conv17_1"
1113
+ }
1114
+ layer {
1115
+ name: "conv17_2"
1116
+ type: "Convolution"
1117
+ bottom: "conv17_1"
1118
+ top: "conv17_2"
1119
+ param {
1120
+ lr_mult: 1.0
1121
+ decay_mult: 1.0
1122
+ }
1123
+ param {
1124
+ lr_mult: 2.0
1125
+ decay_mult: 0.0
1126
+ }
1127
+ convolution_param {
1128
+ num_output: 128
1129
+ pad: 1
1130
+ kernel_size: 3
1131
+ stride: 2
1132
+ weight_filler {
1133
+ type: "msra"
1134
+ }
1135
+ bias_filler {
1136
+ type: "constant"
1137
+ value: 0.0
1138
+ }
1139
+ }
1140
+ }
1141
+ layer {
1142
+ name: "conv17_2/relu"
1143
+ type: "ReLU"
1144
+ bottom: "conv17_2"
1145
+ top: "conv17_2"
1146
+ }
1147
+ layer {
1148
+ name: "conv11_mbox_loc"
1149
+ type: "Convolution"
1150
+ bottom: "conv11"
1151
+ top: "conv11_mbox_loc"
1152
+ param {
1153
+ lr_mult: 1.0
1154
+ decay_mult: 1.0
1155
+ }
1156
+ param {
1157
+ lr_mult: 2.0
1158
+ decay_mult: 0.0
1159
+ }
1160
+ convolution_param {
1161
+ num_output: 12
1162
+ kernel_size: 1
1163
+ weight_filler {
1164
+ type: "msra"
1165
+ }
1166
+ bias_filler {
1167
+ type: "constant"
1168
+ value: 0.0
1169
+ }
1170
+ }
1171
+ }
1172
+ layer {
1173
+ name: "conv11_mbox_loc_perm"
1174
+ type: "Permute"
1175
+ bottom: "conv11_mbox_loc"
1176
+ top: "conv11_mbox_loc_perm"
1177
+ permute_param {
1178
+ order: 0
1179
+ order: 2
1180
+ order: 3
1181
+ order: 1
1182
+ }
1183
+ }
1184
+ layer {
1185
+ name: "conv11_mbox_loc_flat"
1186
+ type: "Flatten"
1187
+ bottom: "conv11_mbox_loc_perm"
1188
+ top: "conv11_mbox_loc_flat"
1189
+ flatten_param {
1190
+ axis: 1
1191
+ }
1192
+ }
1193
+ layer {
1194
+ name: "conv11_mbox_conf"
1195
+ type: "Convolution"
1196
+ bottom: "conv11"
1197
+ top: "conv11_mbox_conf"
1198
+ param {
1199
+ lr_mult: 1.0
1200
+ decay_mult: 1.0
1201
+ }
1202
+ param {
1203
+ lr_mult: 2.0
1204
+ decay_mult: 0.0
1205
+ }
1206
+ convolution_param {
1207
+ num_output: 63
1208
+ kernel_size: 1
1209
+ weight_filler {
1210
+ type: "msra"
1211
+ }
1212
+ bias_filler {
1213
+ type: "constant"
1214
+ value: 0.0
1215
+ }
1216
+ }
1217
+ }
1218
+ layer {
1219
+ name: "conv11_mbox_conf_perm"
1220
+ type: "Permute"
1221
+ bottom: "conv11_mbox_conf"
1222
+ top: "conv11_mbox_conf_perm"
1223
+ permute_param {
1224
+ order: 0
1225
+ order: 2
1226
+ order: 3
1227
+ order: 1
1228
+ }
1229
+ }
1230
+ layer {
1231
+ name: "conv11_mbox_conf_flat"
1232
+ type: "Flatten"
1233
+ bottom: "conv11_mbox_conf_perm"
1234
+ top: "conv11_mbox_conf_flat"
1235
+ flatten_param {
1236
+ axis: 1
1237
+ }
1238
+ }
1239
+ layer {
1240
+ name: "conv11_mbox_priorbox"
1241
+ type: "PriorBox"
1242
+ bottom: "conv11"
1243
+ bottom: "data"
1244
+ top: "conv11_mbox_priorbox"
1245
+ prior_box_param {
1246
+ min_size: 60.0
1247
+ aspect_ratio: 2.0
1248
+ flip: true
1249
+ clip: false
1250
+ variance: 0.1
1251
+ variance: 0.1
1252
+ variance: 0.2
1253
+ variance: 0.2
1254
+ offset: 0.5
1255
+ }
1256
+ }
1257
+ layer {
1258
+ name: "conv13_mbox_loc"
1259
+ type: "Convolution"
1260
+ bottom: "conv13"
1261
+ top: "conv13_mbox_loc"
1262
+ param {
1263
+ lr_mult: 1.0
1264
+ decay_mult: 1.0
1265
+ }
1266
+ param {
1267
+ lr_mult: 2.0
1268
+ decay_mult: 0.0
1269
+ }
1270
+ convolution_param {
1271
+ num_output: 24
1272
+ kernel_size: 1
1273
+ weight_filler {
1274
+ type: "msra"
1275
+ }
1276
+ bias_filler {
1277
+ type: "constant"
1278
+ value: 0.0
1279
+ }
1280
+ }
1281
+ }
1282
+ layer {
1283
+ name: "conv13_mbox_loc_perm"
1284
+ type: "Permute"
1285
+ bottom: "conv13_mbox_loc"
1286
+ top: "conv13_mbox_loc_perm"
1287
+ permute_param {
1288
+ order: 0
1289
+ order: 2
1290
+ order: 3
1291
+ order: 1
1292
+ }
1293
+ }
1294
+ layer {
1295
+ name: "conv13_mbox_loc_flat"
1296
+ type: "Flatten"
1297
+ bottom: "conv13_mbox_loc_perm"
1298
+ top: "conv13_mbox_loc_flat"
1299
+ flatten_param {
1300
+ axis: 1
1301
+ }
1302
+ }
1303
+ layer {
1304
+ name: "conv13_mbox_conf"
1305
+ type: "Convolution"
1306
+ bottom: "conv13"
1307
+ top: "conv13_mbox_conf"
1308
+ param {
1309
+ lr_mult: 1.0
1310
+ decay_mult: 1.0
1311
+ }
1312
+ param {
1313
+ lr_mult: 2.0
1314
+ decay_mult: 0.0
1315
+ }
1316
+ convolution_param {
1317
+ num_output: 126
1318
+ kernel_size: 1
1319
+ weight_filler {
1320
+ type: "msra"
1321
+ }
1322
+ bias_filler {
1323
+ type: "constant"
1324
+ value: 0.0
1325
+ }
1326
+ }
1327
+ }
1328
+ layer {
1329
+ name: "conv13_mbox_conf_perm"
1330
+ type: "Permute"
1331
+ bottom: "conv13_mbox_conf"
1332
+ top: "conv13_mbox_conf_perm"
1333
+ permute_param {
1334
+ order: 0
1335
+ order: 2
1336
+ order: 3
1337
+ order: 1
1338
+ }
1339
+ }
1340
+ layer {
1341
+ name: "conv13_mbox_conf_flat"
1342
+ type: "Flatten"
1343
+ bottom: "conv13_mbox_conf_perm"
1344
+ top: "conv13_mbox_conf_flat"
1345
+ flatten_param {
1346
+ axis: 1
1347
+ }
1348
+ }
1349
+ layer {
1350
+ name: "conv13_mbox_priorbox"
1351
+ type: "PriorBox"
1352
+ bottom: "conv13"
1353
+ bottom: "data"
1354
+ top: "conv13_mbox_priorbox"
1355
+ prior_box_param {
1356
+ min_size: 105.0
1357
+ max_size: 150.0
1358
+ aspect_ratio: 2.0
1359
+ aspect_ratio: 3.0
1360
+ flip: true
1361
+ clip: false
1362
+ variance: 0.1
1363
+ variance: 0.1
1364
+ variance: 0.2
1365
+ variance: 0.2
1366
+ offset: 0.5
1367
+ }
1368
+ }
1369
+ layer {
1370
+ name: "conv14_2_mbox_loc"
1371
+ type: "Convolution"
1372
+ bottom: "conv14_2"
1373
+ top: "conv14_2_mbox_loc"
1374
+ param {
1375
+ lr_mult: 1.0
1376
+ decay_mult: 1.0
1377
+ }
1378
+ param {
1379
+ lr_mult: 2.0
1380
+ decay_mult: 0.0
1381
+ }
1382
+ convolution_param {
1383
+ num_output: 24
1384
+ kernel_size: 1
1385
+ weight_filler {
1386
+ type: "msra"
1387
+ }
1388
+ bias_filler {
1389
+ type: "constant"
1390
+ value: 0.0
1391
+ }
1392
+ }
1393
+ }
1394
+ layer {
1395
+ name: "conv14_2_mbox_loc_perm"
1396
+ type: "Permute"
1397
+ bottom: "conv14_2_mbox_loc"
1398
+ top: "conv14_2_mbox_loc_perm"
1399
+ permute_param {
1400
+ order: 0
1401
+ order: 2
1402
+ order: 3
1403
+ order: 1
1404
+ }
1405
+ }
1406
+ layer {
1407
+ name: "conv14_2_mbox_loc_flat"
1408
+ type: "Flatten"
1409
+ bottom: "conv14_2_mbox_loc_perm"
1410
+ top: "conv14_2_mbox_loc_flat"
1411
+ flatten_param {
1412
+ axis: 1
1413
+ }
1414
+ }
1415
+ layer {
1416
+ name: "conv14_2_mbox_conf"
1417
+ type: "Convolution"
1418
+ bottom: "conv14_2"
1419
+ top: "conv14_2_mbox_conf"
1420
+ param {
1421
+ lr_mult: 1.0
1422
+ decay_mult: 1.0
1423
+ }
1424
+ param {
1425
+ lr_mult: 2.0
1426
+ decay_mult: 0.0
1427
+ }
1428
+ convolution_param {
1429
+ num_output: 126
1430
+ kernel_size: 1
1431
+ weight_filler {
1432
+ type: "msra"
1433
+ }
1434
+ bias_filler {
1435
+ type: "constant"
1436
+ value: 0.0
1437
+ }
1438
+ }
1439
+ }
1440
+ layer {
1441
+ name: "conv14_2_mbox_conf_perm"
1442
+ type: "Permute"
1443
+ bottom: "conv14_2_mbox_conf"
1444
+ top: "conv14_2_mbox_conf_perm"
1445
+ permute_param {
1446
+ order: 0
1447
+ order: 2
1448
+ order: 3
1449
+ order: 1
1450
+ }
1451
+ }
1452
+ layer {
1453
+ name: "conv14_2_mbox_conf_flat"
1454
+ type: "Flatten"
1455
+ bottom: "conv14_2_mbox_conf_perm"
1456
+ top: "conv14_2_mbox_conf_flat"
1457
+ flatten_param {
1458
+ axis: 1
1459
+ }
1460
+ }
1461
+ layer {
1462
+ name: "conv14_2_mbox_priorbox"
1463
+ type: "PriorBox"
1464
+ bottom: "conv14_2"
1465
+ bottom: "data"
1466
+ top: "conv14_2_mbox_priorbox"
1467
+ prior_box_param {
1468
+ min_size: 150.0
1469
+ max_size: 195.0
1470
+ aspect_ratio: 2.0
1471
+ aspect_ratio: 3.0
1472
+ flip: true
1473
+ clip: false
1474
+ variance: 0.1
1475
+ variance: 0.1
1476
+ variance: 0.2
1477
+ variance: 0.2
1478
+ offset: 0.5
1479
+ }
1480
+ }
1481
+ layer {
1482
+ name: "conv15_2_mbox_loc"
1483
+ type: "Convolution"
1484
+ bottom: "conv15_2"
1485
+ top: "conv15_2_mbox_loc"
1486
+ param {
1487
+ lr_mult: 1.0
1488
+ decay_mult: 1.0
1489
+ }
1490
+ param {
1491
+ lr_mult: 2.0
1492
+ decay_mult: 0.0
1493
+ }
1494
+ convolution_param {
1495
+ num_output: 24
1496
+ kernel_size: 1
1497
+ weight_filler {
1498
+ type: "msra"
1499
+ }
1500
+ bias_filler {
1501
+ type: "constant"
1502
+ value: 0.0
1503
+ }
1504
+ }
1505
+ }
1506
+ layer {
1507
+ name: "conv15_2_mbox_loc_perm"
1508
+ type: "Permute"
1509
+ bottom: "conv15_2_mbox_loc"
1510
+ top: "conv15_2_mbox_loc_perm"
1511
+ permute_param {
1512
+ order: 0
1513
+ order: 2
1514
+ order: 3
1515
+ order: 1
1516
+ }
1517
+ }
1518
+ layer {
1519
+ name: "conv15_2_mbox_loc_flat"
1520
+ type: "Flatten"
1521
+ bottom: "conv15_2_mbox_loc_perm"
1522
+ top: "conv15_2_mbox_loc_flat"
1523
+ flatten_param {
1524
+ axis: 1
1525
+ }
1526
+ }
1527
+ layer {
1528
+ name: "conv15_2_mbox_conf"
1529
+ type: "Convolution"
1530
+ bottom: "conv15_2"
1531
+ top: "conv15_2_mbox_conf"
1532
+ param {
1533
+ lr_mult: 1.0
1534
+ decay_mult: 1.0
1535
+ }
1536
+ param {
1537
+ lr_mult: 2.0
1538
+ decay_mult: 0.0
1539
+ }
1540
+ convolution_param {
1541
+ num_output: 126
1542
+ kernel_size: 1
1543
+ weight_filler {
1544
+ type: "msra"
1545
+ }
1546
+ bias_filler {
1547
+ type: "constant"
1548
+ value: 0.0
1549
+ }
1550
+ }
1551
+ }
1552
+ layer {
1553
+ name: "conv15_2_mbox_conf_perm"
1554
+ type: "Permute"
1555
+ bottom: "conv15_2_mbox_conf"
1556
+ top: "conv15_2_mbox_conf_perm"
1557
+ permute_param {
1558
+ order: 0
1559
+ order: 2
1560
+ order: 3
1561
+ order: 1
1562
+ }
1563
+ }
1564
+ layer {
1565
+ name: "conv15_2_mbox_conf_flat"
1566
+ type: "Flatten"
1567
+ bottom: "conv15_2_mbox_conf_perm"
1568
+ top: "conv15_2_mbox_conf_flat"
1569
+ flatten_param {
1570
+ axis: 1
1571
+ }
1572
+ }
1573
+ layer {
1574
+ name: "conv15_2_mbox_priorbox"
1575
+ type: "PriorBox"
1576
+ bottom: "conv15_2"
1577
+ bottom: "data"
1578
+ top: "conv15_2_mbox_priorbox"
1579
+ prior_box_param {
1580
+ min_size: 195.0
1581
+ max_size: 240.0
1582
+ aspect_ratio: 2.0
1583
+ aspect_ratio: 3.0
1584
+ flip: true
1585
+ clip: false
1586
+ variance: 0.1
1587
+ variance: 0.1
1588
+ variance: 0.2
1589
+ variance: 0.2
1590
+ offset: 0.5
1591
+ }
1592
+ }
1593
+ layer {
1594
+ name: "conv16_2_mbox_loc"
1595
+ type: "Convolution"
1596
+ bottom: "conv16_2"
1597
+ top: "conv16_2_mbox_loc"
1598
+ param {
1599
+ lr_mult: 1.0
1600
+ decay_mult: 1.0
1601
+ }
1602
+ param {
1603
+ lr_mult: 2.0
1604
+ decay_mult: 0.0
1605
+ }
1606
+ convolution_param {
1607
+ num_output: 24
1608
+ kernel_size: 1
1609
+ weight_filler {
1610
+ type: "msra"
1611
+ }
1612
+ bias_filler {
1613
+ type: "constant"
1614
+ value: 0.0
1615
+ }
1616
+ }
1617
+ }
1618
+ layer {
1619
+ name: "conv16_2_mbox_loc_perm"
1620
+ type: "Permute"
1621
+ bottom: "conv16_2_mbox_loc"
1622
+ top: "conv16_2_mbox_loc_perm"
1623
+ permute_param {
1624
+ order: 0
1625
+ order: 2
1626
+ order: 3
1627
+ order: 1
1628
+ }
1629
+ }
1630
+ layer {
1631
+ name: "conv16_2_mbox_loc_flat"
1632
+ type: "Flatten"
1633
+ bottom: "conv16_2_mbox_loc_perm"
1634
+ top: "conv16_2_mbox_loc_flat"
1635
+ flatten_param {
1636
+ axis: 1
1637
+ }
1638
+ }
1639
+ layer {
1640
+ name: "conv16_2_mbox_conf"
1641
+ type: "Convolution"
1642
+ bottom: "conv16_2"
1643
+ top: "conv16_2_mbox_conf"
1644
+ param {
1645
+ lr_mult: 1.0
1646
+ decay_mult: 1.0
1647
+ }
1648
+ param {
1649
+ lr_mult: 2.0
1650
+ decay_mult: 0.0
1651
+ }
1652
+ convolution_param {
1653
+ num_output: 126
1654
+ kernel_size: 1
1655
+ weight_filler {
1656
+ type: "msra"
1657
+ }
1658
+ bias_filler {
1659
+ type: "constant"
1660
+ value: 0.0
1661
+ }
1662
+ }
1663
+ }
1664
+ layer {
1665
+ name: "conv16_2_mbox_conf_perm"
1666
+ type: "Permute"
1667
+ bottom: "conv16_2_mbox_conf"
1668
+ top: "conv16_2_mbox_conf_perm"
1669
+ permute_param {
1670
+ order: 0
1671
+ order: 2
1672
+ order: 3
1673
+ order: 1
1674
+ }
1675
+ }
1676
+ layer {
1677
+ name: "conv16_2_mbox_conf_flat"
1678
+ type: "Flatten"
1679
+ bottom: "conv16_2_mbox_conf_perm"
1680
+ top: "conv16_2_mbox_conf_flat"
1681
+ flatten_param {
1682
+ axis: 1
1683
+ }
1684
+ }
1685
+ layer {
1686
+ name: "conv16_2_mbox_priorbox"
1687
+ type: "PriorBox"
1688
+ bottom: "conv16_2"
1689
+ bottom: "data"
1690
+ top: "conv16_2_mbox_priorbox"
1691
+ prior_box_param {
1692
+ min_size: 240.0
1693
+ max_size: 285.0
1694
+ aspect_ratio: 2.0
1695
+ aspect_ratio: 3.0
1696
+ flip: true
1697
+ clip: false
1698
+ variance: 0.1
1699
+ variance: 0.1
1700
+ variance: 0.2
1701
+ variance: 0.2
1702
+ offset: 0.5
1703
+ }
1704
+ }
1705
+ layer {
1706
+ name: "conv17_2_mbox_loc"
1707
+ type: "Convolution"
1708
+ bottom: "conv17_2"
1709
+ top: "conv17_2_mbox_loc"
1710
+ param {
1711
+ lr_mult: 1.0
1712
+ decay_mult: 1.0
1713
+ }
1714
+ param {
1715
+ lr_mult: 2.0
1716
+ decay_mult: 0.0
1717
+ }
1718
+ convolution_param {
1719
+ num_output: 24
1720
+ kernel_size: 1
1721
+ weight_filler {
1722
+ type: "msra"
1723
+ }
1724
+ bias_filler {
1725
+ type: "constant"
1726
+ value: 0.0
1727
+ }
1728
+ }
1729
+ }
1730
+ layer {
1731
+ name: "conv17_2_mbox_loc_perm"
1732
+ type: "Permute"
1733
+ bottom: "conv17_2_mbox_loc"
1734
+ top: "conv17_2_mbox_loc_perm"
1735
+ permute_param {
1736
+ order: 0
1737
+ order: 2
1738
+ order: 3
1739
+ order: 1
1740
+ }
1741
+ }
1742
+ layer {
1743
+ name: "conv17_2_mbox_loc_flat"
1744
+ type: "Flatten"
1745
+ bottom: "conv17_2_mbox_loc_perm"
1746
+ top: "conv17_2_mbox_loc_flat"
1747
+ flatten_param {
1748
+ axis: 1
1749
+ }
1750
+ }
1751
+ layer {
1752
+ name: "conv17_2_mbox_conf"
1753
+ type: "Convolution"
1754
+ bottom: "conv17_2"
1755
+ top: "conv17_2_mbox_conf"
1756
+ param {
1757
+ lr_mult: 1.0
1758
+ decay_mult: 1.0
1759
+ }
1760
+ param {
1761
+ lr_mult: 2.0
1762
+ decay_mult: 0.0
1763
+ }
1764
+ convolution_param {
1765
+ num_output: 126
1766
+ kernel_size: 1
1767
+ weight_filler {
1768
+ type: "msra"
1769
+ }
1770
+ bias_filler {
1771
+ type: "constant"
1772
+ value: 0.0
1773
+ }
1774
+ }
1775
+ }
1776
+ layer {
1777
+ name: "conv17_2_mbox_conf_perm"
1778
+ type: "Permute"
1779
+ bottom: "conv17_2_mbox_conf"
1780
+ top: "conv17_2_mbox_conf_perm"
1781
+ permute_param {
1782
+ order: 0
1783
+ order: 2
1784
+ order: 3
1785
+ order: 1
1786
+ }
1787
+ }
1788
+ layer {
1789
+ name: "conv17_2_mbox_conf_flat"
1790
+ type: "Flatten"
1791
+ bottom: "conv17_2_mbox_conf_perm"
1792
+ top: "conv17_2_mbox_conf_flat"
1793
+ flatten_param {
1794
+ axis: 1
1795
+ }
1796
+ }
1797
+ layer {
1798
+ name: "conv17_2_mbox_priorbox"
1799
+ type: "PriorBox"
1800
+ bottom: "conv17_2"
1801
+ bottom: "data"
1802
+ top: "conv17_2_mbox_priorbox"
1803
+ prior_box_param {
1804
+ min_size: 285.0
1805
+ max_size: 300.0
1806
+ aspect_ratio: 2.0
1807
+ aspect_ratio: 3.0
1808
+ flip: true
1809
+ clip: false
1810
+ variance: 0.1
1811
+ variance: 0.1
1812
+ variance: 0.2
1813
+ variance: 0.2
1814
+ offset: 0.5
1815
+ }
1816
+ }
1817
+ layer {
1818
+ name: "mbox_loc"
1819
+ type: "Concat"
1820
+ bottom: "conv11_mbox_loc_flat"
1821
+ bottom: "conv13_mbox_loc_flat"
1822
+ bottom: "conv14_2_mbox_loc_flat"
1823
+ bottom: "conv15_2_mbox_loc_flat"
1824
+ bottom: "conv16_2_mbox_loc_flat"
1825
+ bottom: "conv17_2_mbox_loc_flat"
1826
+ top: "mbox_loc"
1827
+ concat_param {
1828
+ axis: 1
1829
+ }
1830
+ }
1831
+ layer {
1832
+ name: "mbox_conf"
1833
+ type: "Concat"
1834
+ bottom: "conv11_mbox_conf_flat"
1835
+ bottom: "conv13_mbox_conf_flat"
1836
+ bottom: "conv14_2_mbox_conf_flat"
1837
+ bottom: "conv15_2_mbox_conf_flat"
1838
+ bottom: "conv16_2_mbox_conf_flat"
1839
+ bottom: "conv17_2_mbox_conf_flat"
1840
+ top: "mbox_conf"
1841
+ concat_param {
1842
+ axis: 1
1843
+ }
1844
+ }
1845
+ layer {
1846
+ name: "mbox_priorbox"
1847
+ type: "Concat"
1848
+ bottom: "conv11_mbox_priorbox"
1849
+ bottom: "conv13_mbox_priorbox"
1850
+ bottom: "conv14_2_mbox_priorbox"
1851
+ bottom: "conv15_2_mbox_priorbox"
1852
+ bottom: "conv16_2_mbox_priorbox"
1853
+ bottom: "conv17_2_mbox_priorbox"
1854
+ top: "mbox_priorbox"
1855
+ concat_param {
1856
+ axis: 2
1857
+ }
1858
+ }
1859
+ layer {
1860
+ name: "mbox_conf_reshape"
1861
+ type: "Reshape"
1862
+ bottom: "mbox_conf"
1863
+ top: "mbox_conf_reshape"
1864
+ reshape_param {
1865
+ shape {
1866
+ dim: 0
1867
+ dim: -1
1868
+ dim: 21
1869
+ }
1870
+ }
1871
+ }
1872
+ layer {
1873
+ name: "mbox_conf_softmax"
1874
+ type: "Softmax"
1875
+ bottom: "mbox_conf_reshape"
1876
+ top: "mbox_conf_softmax"
1877
+ softmax_param {
1878
+ axis: 2
1879
+ }
1880
+ }
1881
+ layer {
1882
+ name: "mbox_conf_flatten"
1883
+ type: "Flatten"
1884
+ bottom: "mbox_conf_softmax"
1885
+ top: "mbox_conf_flatten"
1886
+ flatten_param {
1887
+ axis: 1
1888
+ }
1889
+ }
1890
+ layer {
1891
+ name: "detection_out"
1892
+ type: "DetectionOutput"
1893
+ bottom: "mbox_loc"
1894
+ bottom: "mbox_conf_flatten"
1895
+ bottom: "mbox_priorbox"
1896
+ top: "detection_out"
1897
+ include {
1898
+ phase: TEST
1899
+ }
1900
+ detection_output_param {
1901
+ num_classes: 21
1902
+ share_location: true
1903
+ background_label_id: 0
1904
+ nms_param {
1905
+ nms_threshold: 0.45
1906
+ top_k: 100
1907
+ }
1908
+ code_type: CENTER_SIZE
1909
+ keep_top_k: 100
1910
+ confidence_threshold: 0.25
1911
+ }
1912
+ }
model files/generic object detection model/readme.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ This model can detect multiple objects like person, cat, dog, bus, car, airplane etc.
2
+
3
+ Here is the full list:
4
+
5
+ "background", "aeroplane", "bicycle", "bird", "boat",
6
+ "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
7
+ "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
8
+ "sofa", "train", "tvmonitor"
opencv-example.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import imutils
3
+
4
+ # image = cv2.imread('input_image.jpg')
5
+ cap = cv2.VideoCapture(1)
6
+
7
+ while True:
8
+ ret, frame = cap.read()
9
+ frame = imutils.resize(frame, width=800)
10
+
11
+ text = "This is my custom text"
12
+ cv2.putText(frame, text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
13
+
14
+ cv2.rectangle(frame, (50, 50), (500, 500), (0, 0, 255), 2)
15
+
16
+ cv2.imshow('Application', frame)
17
+
18
+ key = cv2.waitKey(1)
19
+ if key == ord('q'):
20
+ break
21
+
22
+ cv2.destroyAllWindows()
pages/Login.py ADDED
@@ -0,0 +1,679 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import datetime
3
+ import imutils
4
+ import numpy as np
5
+ from centroidtracker import CentroidTracker
6
+ import pandas as pd
7
+ import torch
8
+ import streamlit as st
9
+ import mediapipe as mp
10
+ import cv2 as cv
11
+ import numpy as np
12
+ import tempfile
13
+ import time
14
+ from PIL import Image
15
+ import pandas as pd
16
+ import torch
17
+ import base64
18
+ import streamlit.components.v1 as components
19
+ import csv
20
+ import pickle
21
+ from pathlib import Path
22
+ import streamlit_authenticator as stauth
23
+ import os
24
+ import csv
25
+ from streamlit_option_menu import option_menu
26
+ # x-x-x-x-x-x-x-x-x-x-x-x-x-x LOGIN FORM x-x-x-x-x-x-x-x-x
27
+
28
+
29
+ import streamlit as st
30
+ import pandas as pd
31
+ import hashlib
32
+ import sqlite3
33
+ #
34
+
35
+ import pickle
36
+ from pathlib import Path
37
+ import streamlit_authenticator as stauth
38
+ import pyautogui
39
+
40
+ # print("Done !!!")
41
+
42
+ data = ["student Count",'Date','Id','Mobile','Watch']
43
+ with open('final.csv', 'w') as file:
44
+ writer = csv.writer(file)
45
+ writer.writerow(data)
46
+
47
+
48
+ # # l1 = []
49
+ # # l2 = []
50
+ # # if st.button('signup'):
51
+
52
+
53
+ # # usernames = st.text_input('Username')
54
+ # # pwd = st.text_input('Password')
55
+ # # l1.append(usernames)
56
+ # # l2.append(pwd)
57
+
58
+ # # names = ["dmin", "ser"]
59
+ # # if st.button("signupsss"):
60
+ # # username =l1
61
+
62
+ # # password =l2
63
+
64
+ # # hashed_passwords =stauth.Hasher(password).generate()
65
+
66
+ # # file_path = Path(__file__).parent / "hashed_pw.pkl"
67
+
68
+ # # with file_path.open("wb") as file:
69
+ # # pickle.dump(hashed_passwords, file)
70
+
71
+
72
+ # # elif st.button('Logins'):
73
+ # names = ['dmin', 'ser']
74
+
75
+ # username = []
76
+
77
+ # file_path = Path(__file__).parent / 'hashed_pw.pkl'
78
+
79
+ # with file_path.open('rb') as file:
80
+ # hashed_passwords = pickle.load(file)
81
+
82
+ # authenticator = stauth.Authenticate(names,username,hashed_passwords,'Cheating Detection','abcdefg',cookie_expiry_days=180)
83
+
84
+ # name,authentication_status,username= authenticator.login('Login','main')
85
+
86
+
87
+ # if authentication_status == False:
88
+ # st.error('Username/Password is incorrect')
89
+
90
+ # if authentication_status == None:
91
+ # st.error('Please enter a username and password')
92
+
93
+ @st.experimental_memo
94
+ def get_img_as_base64(file):
95
+ with open(file, "rb") as f:
96
+ data = f.read()
97
+ return base64.b64encode(data).decode()
98
+
99
+
100
+ #img = get_img_as_base64("/home/anas/PersonTracking/WebUI/attendence.jpg")
101
+
102
+ page_bg_img = f"""
103
+ <style>
104
+ [data-testid="stAppViewContainer"] > .main {{
105
+ background-image: url("https://www.xmple.com/wallpaper/blue-gradient-black-linear-1920x1080-c2-87cefa-000000-a-180-f-14.svg");
106
+ background-size: 180%;
107
+ background-position: top left;
108
+ background-repeat: no-repeat;
109
+ background-attachment: local;
110
+ }}
111
+
112
+ [data-testid="stHeader"] {{
113
+ background: rgba(0,0,0,0);
114
+ }}
115
+ [data-testid="stToolbar"] {{
116
+ right: 2rem;
117
+ }}
118
+ </style>
119
+ """
120
+
121
+ st.markdown(page_bg_img, unsafe_allow_html=True)
122
+ files = pd.read_csv('LoginStatus.csv')
123
+
124
+
125
+ idS = list(files['Id'])
126
+ Pwd = list(files['Password'].astype(str))
127
+
128
+ # print(type(Pwd))
129
+ ids = st.sidebar.text_input('Enter a username')
130
+ Pswd = st.sidebar.text_input('Enter a password',type="password",key="password")
131
+
132
+ # print('list : ',type(Pwd))
133
+
134
+
135
+
136
+ if (ids in idS) and(str(Pswd) in Pwd):
137
+
138
+ # st.empty()
139
+ date_time = time.strftime("%b %d %Y %-I:%M %p")
140
+ date = date_time.split()
141
+ dates = date[0:3]
142
+ times = date[3:5]
143
+ # x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-xAPPLICACTION -x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x
144
+
145
+ def non_max_suppression_fast(boxes, overlapThresh):
146
+ try:
147
+ if len(boxes) == 0:
148
+ return []
149
+
150
+ if boxes.dtype.kind == "i":
151
+ boxes = boxes.astype("float")
152
+
153
+ pick = []
154
+
155
+ x1 = boxes[:, 0]
156
+ y1 = boxes[:, 1]
157
+ x2 = boxes[:, 2]
158
+ y2 = boxes[:, 3]
159
+
160
+ area = (x2 - x1 + 1) * (y2 - y1 + 1)
161
+ idxs = np.argsort(y2)
162
+
163
+ while len(idxs) > 0:
164
+ last = len(idxs) - 1
165
+ i = idxs[last]
166
+ pick.append(i)
167
+
168
+ xx1 = np.maximum(x1[i], x1[idxs[:last]])
169
+ yy1 = np.maximum(y1[i], y1[idxs[:last]])
170
+ xx2 = np.minimum(x2[i], x2[idxs[:last]])
171
+ yy2 = np.minimum(y2[i], y2[idxs[:last]])
172
+
173
+ w = np.maximum(0, xx2 - xx1 + 1)
174
+ h = np.maximum(0, yy2 - yy1 + 1)
175
+
176
+ overlap = (w * h) / area[idxs[:last]]
177
+
178
+ idxs = np.delete(idxs, np.concatenate(([last],
179
+ np.where(overlap > overlapThresh)[0])))
180
+
181
+ return boxes[pick].astype("int")
182
+ except Exception as e:
183
+ print("Exception occurred in non_max_suppression : {}".format(e))
184
+
185
+
186
+ protopath = "MobileNetSSD_deploy.prototxt"
187
+ modelpath = "MobileNetSSD_deploy.caffemodel"
188
+ detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
189
+ # Only enable it if you are using OpenVino environment
190
+ # detector.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
191
+ # detector.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
192
+
193
+
194
+ CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
195
+ "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
196
+ "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
197
+ "sofa", "train", "tvmonitor"]
198
+
199
+ tracker = CentroidTracker(maxDisappeared=80, maxDistance=90)
200
+
201
+ st.markdown(
202
+ """
203
+ <style>
204
+ [data-testid="stSidebar"][aria-expanded="true"] > div:first-child{
205
+ width: 350px
206
+ }
207
+ [data-testid="stSidebar"][aria-expanded="false"] > div:first-child{
208
+ width: 350px
209
+ margin-left: -350px
210
+ }
211
+ </style>
212
+ """,
213
+ unsafe_allow_html=True,
214
+ )
215
+ hide_streamlit_style = """
216
+ <style>
217
+ #MainMenu {visibility: hidden;}
218
+ footer {visibility: hidden;}
219
+ </style>
220
+ """
221
+ st.markdown(hide_streamlit_style, unsafe_allow_html=True)
222
+
223
+
224
+ # Resize Images to fit Container
225
+ @st.cache()
226
+ # Get Image Dimensions
227
+ def image_resize(image, width=None, height=None, inter=cv.INTER_AREA):
228
+ dim = None
229
+ (h,w) = image.shape[:2]
230
+
231
+ if width is None and height is None:
232
+ return image
233
+
234
+ if width is None:
235
+ r = width/float(w)
236
+ dim = (int(w*r),height)
237
+
238
+ else:
239
+ r = width/float(w)
240
+ dim = width, int(h*r)
241
+
242
+ # Resize image
243
+ resized = cv.resize(image,dim,interpolation=inter)
244
+
245
+ return resized
246
+
247
+ # About Page
248
+ # authenticator.logout('Logout')
249
+ EXAMPLE_NO = 3
250
+
251
+
252
+ def streamlit_menu(example=1):
253
+ if example == 1:
254
+ # 1. as sidebar menu
255
+ with st.sidebar:
256
+ selected = option_menu(
257
+ menu_title="Main Menu", # required
258
+ options=["Home", "Projects", "Contact"], # required
259
+ icons=["house", "book", "envelope"], # optional
260
+ menu_icon="cast", # optional
261
+ default_index=0, # optional
262
+ )
263
+ return selected
264
+
265
+ if example == 2:
266
+ # 2. horizontal menu w/o custom style
267
+ selected = option_menu(
268
+ menu_title=None, # required
269
+ options=["Home", "Projects", "Contact"], # required
270
+ icons=["house", "book", "envelope"], # optional
271
+ menu_icon="cast", # optional
272
+ default_index=0, # optional
273
+ orientation="horizontal",
274
+ )
275
+ return selected
276
+
277
+ if example == 3:
278
+ # 2. horizontal menu with custom style
279
+ selected = option_menu(
280
+ menu_title=None, # required
281
+ options=["Home", "Projects", "Contact"], # required
282
+ icons=["house", "book", "envelope"], # optional
283
+ menu_icon="cast", # optional
284
+ default_index=0, # optional
285
+ orientation="horizontal",
286
+ styles={
287
+ "container": {"padding": "0!important", "background-color": "#eaeaea"},
288
+ "icon": {"color": "#080602", "font-size": "18px"},
289
+ "nav-link": {
290
+ "font-size": "18px",
291
+ "text-align": "left",
292
+ "color": "#000000",
293
+ "margin": "0px",
294
+ "--hover-color": "#E1A031",
295
+ },
296
+ "nav-link-selected": {"background-color": "#ffffff"},
297
+ },
298
+ )
299
+ return selected
300
+
301
+
302
+ selected = streamlit_menu(example=EXAMPLE_NO)
303
+
304
+ if selected == "Home":
305
+ st.title(f"You have selected {selected}")
306
+ # if selected == "Projects":
307
+ # st.title(f"You have selected {selected}")
308
+ if selected == "Contact":
309
+ st.title(f"You have selected {selected}")
310
+ # app_mode = st.sidebar.selectbox(
311
+ # 'App Mode',
312
+ # ['Application']
313
+ # )
314
+ if selected == 'Projects':
315
+ # 2. horizontal menu with custom style
316
+ # selected = option_menu(
317
+ # menu_title=None, # required
318
+ # options=["Home", "Projects", "Contact"], # required
319
+ # icons=["house", "book", "envelope"], # optional
320
+ # menu_icon="cast", # optional
321
+ # default_index=0, # optional
322
+ # orientation="horizontal",
323
+ # styles={
324
+ # "container": {"padding": "0!important", "background-color": "#fafafa"},
325
+ # "icon": {"color": "orange", "font-size": "25px"},
326
+ # "nav-link": {
327
+ # "font-size": "25px",
328
+ # "text-align": "left",
329
+ # "margin": "0px",
330
+ # "--hover-color": "#eee",
331
+ # },
332
+ # "nav-link-selected": {"background-color": "blue"},
333
+ # },
334
+ # )
335
+ # if app_mode == 'About':
336
+ # st.title('About Product And Team')
337
+ # st.markdown('''
338
+ # Imran Bhai Project
339
+ # ''')
340
+ # st.markdown(
341
+ # """
342
+ # <style>
343
+ # [data-testid="stSidebar"][aria-expanded="true"] > div:first-child{
344
+ # width: 350px
345
+ # }
346
+ # [data-testid="stSidebar"][aria-expanded="false"] > div:first-child{
347
+ # width: 350px
348
+ # margin-left: -350px
349
+ # }
350
+ # </style>
351
+ # """,
352
+ # unsafe_allow_html=True,
353
+ # )
354
+
355
+
356
+
357
+
358
+ # elif app_mode == 'Application':
359
+
360
+ st.set_option('deprecation.showfileUploaderEncoding', False)
361
+
362
+ use_webcam = "pass"
363
+ # record = st.sidebar.checkbox("Record Video")
364
+
365
+ # if record:
366
+ # st.checkbox('Recording', True)
367
+
368
+ # drawing_spec = mp.solutions.drawing_utils.DrawingSpec(thickness=2, circle_radius=1)
369
+
370
+ # st.sidebar.markdown('---')
371
+
372
+ # ## Add Sidebar and Window style
373
+ # st.markdown(
374
+ # """
375
+ # <style>
376
+ # [data-testid="stSidebar"][aria-expanded="true"] > div:first-child{
377
+ # width: 350px
378
+ # }
379
+ # [data-testid="stSidebar"][aria-expanded="false"] > div:first-child{
380
+ # width: 350px
381
+ # margin-left: -350px
382
+ # }
383
+ # </style>
384
+ # """,
385
+ # unsafe_allow_html=True,
386
+ # )
387
+
388
+ # max_faces = st.sidebar.number_input('Maximum Number of Faces', value=5, min_value=1)
389
+ # st.sidebar.markdown('---')
390
+ # detection_confidence = st.sidebar.slider('Min Detection Confidence', min_value=0.0,max_value=1.0,value=0.5)
391
+ # tracking_confidence = st.sidebar.slider('Min Tracking Confidence', min_value=0.0,max_value=1.0,value=0.5)
392
+ # st.sidebar.markdown('---')
393
+
394
+ ## Get Video
395
+ stframe = st.empty()
396
+ video_file_buffer = st.file_uploader("Upload a Video", type=['mp4', 'mov', 'avi', 'asf', 'm4v'])
397
+ temp_file = tempfile.NamedTemporaryFile(delete=False)
398
+
399
+
400
+ if not video_file_buffer:
401
+ if use_webcam:
402
+ video = cv.VideoCapture(0)
403
+ else:
404
+ try:
405
+ video = cv.VideoCapture(1)
406
+ temp_file.name = video
407
+ except:
408
+ pass
409
+ else:
410
+ temp_file.write(video_file_buffer.read())
411
+ video = cv.VideoCapture(temp_file.name)
412
+
413
+ width = int(video.get(cv.CAP_PROP_FRAME_WIDTH))
414
+ height = int(video.get(cv.CAP_PROP_FRAME_HEIGHT))
415
+ fps_input = int(video.get(cv.CAP_PROP_FPS))
416
+
417
+ ## Recording
418
+ codec = cv.VideoWriter_fourcc('a','v','c','1')
419
+ out = cv.VideoWriter('output1.mp4', codec, fps_input, (width,height))
420
+
421
+ # st.sidebar.text('Input Video')
422
+ # st.sidebar.video(temp_file.name)
423
+
424
+ fps = 0
425
+ i = 0
426
+
427
+ drawing_spec = mp.solutions.drawing_utils.DrawingSpec(thickness=2, circle_radius=1)
428
+
429
+ kpil, kpil2, kpil3,kpil4,kpil5, kpil6 = st.columns(6)
430
+
431
+ with kpil:
432
+ st.markdown('**Frame Rate**')
433
+ kpil_text = st.markdown('0')
434
+
435
+ with kpil2:
436
+ st.markdown('**detection ID**')
437
+ kpil2_text = st.markdown('0')
438
+
439
+ with kpil3:
440
+ st.markdown('**Mobile**')
441
+ kpil3_text = st.markdown('0')
442
+ with kpil4:
443
+ st.markdown('**Watch**')
444
+ kpil4_text = st.markdown('0')
445
+ with kpil5:
446
+ st.markdown('**Count**')
447
+ kpil5_text = st.markdown('0')
448
+ with kpil6:
449
+ st.markdown('**Img Res**')
450
+ kpil6_text = st.markdown('0')
451
+
452
+
453
+
454
+ st.markdown('<hr/>', unsafe_allow_html=True)
455
+ # try:
456
+ def main():
457
+ db = {}
458
+
459
+ # cap = cv2.VideoCapture('//home//anas//PersonTracking//WebUI//movement.mp4')
460
+ path='/usr/local/lib/python3.10/dist-packages/yolo0vs5/yolov5s-int8.tflite'
461
+ #count=0
462
+ custom = 'yolov5s'
463
+
464
+ model = torch.hub.load('/usr/local/lib/python3.10/dist-packages/yolovs5', custom, path,source='local',force_reload=True)
465
+
466
+ b=model.names[0] = 'person'
467
+ mobile = model.names[67] = 'cell phone'
468
+ watch = model.names[75] = 'clock'
469
+
470
+ fps_start_time = datetime.datetime.now()
471
+ fps = 0
472
+ size=416
473
+
474
+ count=0
475
+ counter=0
476
+
477
+
478
+ color=(0,0,255)
479
+
480
+ cy1=250
481
+ offset=6
482
+
483
+
484
+ pt1 = (120, 100)
485
+ pt2 = (980, 1150)
486
+ color = (0, 255, 0)
487
+
488
+ pt3 = (283, 103)
489
+ pt4 = (1500, 1150)
490
+
491
+ cy2 = 500
492
+ color = (0, 255, 0)
493
+ total_frames = 0
494
+ prevTime = 0
495
+ cur_frame = 0
496
+ count=0
497
+ counter=0
498
+ fps_start_time = datetime.datetime.now()
499
+ fps = 0
500
+ total_frames = 0
501
+ lpc_count = 0
502
+ opc_count = 0
503
+ object_id_list = []
504
+ # success = True
505
+ if st.button("Detect"):
506
+ try:
507
+ while video.isOpened():
508
+
509
+ ret, frame = video.read()
510
+ frame = imutils.resize(frame, width=600)
511
+ total_frames = total_frames + 1
512
+
513
+ (H, W) = frame.shape[:2]
514
+
515
+ blob = cv2.dnn.blobFromImage(frame, 0.007843, (W, H), 127.5)
516
+
517
+ detector.setInput(blob)
518
+ person_detections = detector.forward()
519
+ rects = []
520
+ for i in np.arange(0, person_detections.shape[2]):
521
+ confidence = person_detections[0, 0, i, 2]
522
+ if confidence > 0.5:
523
+ idx = int(person_detections[0, 0, i, 1])
524
+
525
+ if CLASSES[idx] != "person":
526
+ continue
527
+
528
+ person_box = person_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
529
+ (startX, startY, endX, endY) = person_box.astype("int")
530
+ rects.append(person_box)
531
+
532
+ boundingboxes = np.array(rects)
533
+ boundingboxes = boundingboxes.astype(int)
534
+ rects = non_max_suppression_fast(boundingboxes, 0.3)
535
+
536
+ objects = tracker.update(rects)
537
+ for (objectId, bbox) in objects.items():
538
+ x1, y1, x2, y2 = bbox
539
+ x1 = int(x1)
540
+ y1 = int(y1)
541
+ x2 = int(x2)
542
+ y2 = int(y2)
543
+
544
+ cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 255), 2)
545
+ text = "ID: {}".format(objectId)
546
+ # print(text)
547
+ cv2.putText(frame, text, (x1, y1-5), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
548
+ if objectId not in object_id_list:
549
+ object_id_list.append(objectId)
550
+ fps_end_time = datetime.datetime.now()
551
+ time_diff = fps_end_time - fps_start_time
552
+ if time_diff.seconds == 0:
553
+ fps = 0.0
554
+ else:
555
+ fps = (total_frames / time_diff.seconds)
556
+
557
+ fps_text = "FPS: {:.2f}".format(fps)
558
+
559
+ cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
560
+ lpc_count = len(objects)
561
+ opc_count = len(object_id_list)
562
+
563
+ lpc_txt = "LPC: {}".format(lpc_count)
564
+ opc_txt = "OPC: {}".format(opc_count)
565
+
566
+ count += 1
567
+ if count % 4 != 0:
568
+ continue
569
+ # frame=cv.resize(frame, (600,500))
570
+ # cv2.line(frame, pt1, pt2,color,2)
571
+ # cv2.line(frame, pt3, pt4,color,2)
572
+ results = model(frame,size)
573
+ components = results.pandas().xyxy[0]
574
+ for index, row in results.pandas().xyxy[0].iterrows():
575
+ x1 = int(row['xmin'])
576
+ y1 = int(row['ymin'])
577
+ x2 = int(row['xmax'])
578
+ y2 = int(row['ymax'])
579
+ confidence = (row['confidence'])
580
+ obj = (row['class'])
581
+
582
+
583
+ # min':x1,'ymin':y1,'xmax':x2,'ymax':y2,'confidence':confidence,'Object':obj}
584
+ # if lpc_txt is not None:
585
+ # try:
586
+ # db["student Count"] = [lpc_txt]
587
+ # except:
588
+ # db["student Count"] = ['N/A']
589
+ if obj == 0:
590
+ cv2.rectangle(frame,(x1,y1),(x2,y2),(0,0,255),2)
591
+ rectx1,recty1 = ((x1+x2)/2,(y1+y2)/2)
592
+ rectcenter = int(rectx1),int(recty1)
593
+ cx = rectcenter[0]
594
+ cy = rectcenter[1]
595
+ cv2.circle(frame,(cx,cy),3,(0,255,0),-1)
596
+ cv2.putText(frame,str(b), (x1,y1), cv2.FONT_HERSHEY_PLAIN,2,(255,255,255),2)
597
+
598
+ db["student Count"] = [lpc_txt]
599
+ db['Date'] = [date_time]
600
+ db['id'] = ['N/A']
601
+ db['Mobile']=['N/A']
602
+ db['Watch'] = ['N/A']
603
+ if cy<(cy1+offset) and cy>(cy1-offset):
604
+ DB = []
605
+ counter+=1
606
+ DB.append(counter)
607
+
608
+ ff = DB[-1]
609
+ fx = str(ff)
610
+ # cv2.line(frame, pt1, pt2,(0, 0, 255),2)
611
+ # if cy<(cy2+offset) and cy>(cy2-offset):
612
+
613
+ # cv2.line(frame, pt3, pt4,(0, 0, 255),2)
614
+ font = cv2.FONT_HERSHEY_TRIPLEX
615
+ cv2.putText(frame,fx,(50, 50),font, 1,(0, 0, 255),2,cv2.LINE_4)
616
+ cv2.putText(frame,"Movement",(70, 70),font, 1,(0, 0, 255),2,cv2.LINE_4)
617
+ kpil2_text.write(f"<h5 style='text-align: left; color:red;'>{text}</h5>", unsafe_allow_html=True)
618
+
619
+
620
+ db['id'] = [text]
621
+ # myScreenshot = pyautogui.screenshot()
622
+ # if st.buttn("Dowload ss"):
623
+ # myScreenshot.save(r'name.png')
624
+ # myScreenshot.save(r'/home/anas/PersonTracking/AIComputerVision-master/pages/name.png')
625
+ if obj == 67:
626
+ cv2.rectangle(frame,(x1,y1),(x2,y2),(0,0,255),2)
627
+ rectx1,recty1 = ((x1+x2)/2,(y1+y2)/2)
628
+ rectcenter = int(rectx1),int(recty1)
629
+ cx = rectcenter[0]
630
+ cy = rectcenter[1]
631
+ cv2.circle(frame,(cx,cy),3,(0,255,0),-1)
632
+ cv2.putText(frame,str(mobile), (x1,y1), cv2.FONT_HERSHEY_PLAIN,2,(255,255,255),2)
633
+ cv2.putText(frame,'Mobile',(50, 50),cv2.FONT_HERSHEY_PLAIN, 1,(0, 0, 255),2,cv2.LINE_4)
634
+ kpil3_text.write(f"<h5 style='text-align: left; color:red;'>{mobile}{text}</h5>", unsafe_allow_html=True)
635
+
636
+ db['Mobile']=mobile+' '+text
637
+ # myScreenshot = pyautogui.screenshot()
638
+ # if st.buttn("Dowload ss"):
639
+ # myScreenshot.save(r'/home/anas/PersonTracking/AIComputerVision-master/pages/name.png')
640
+ # myScreenshot.save(r'name.png')
641
+
642
+ if obj == 75:
643
+ cv2.rectangle(frame,(x1,y1),(x2,y2),(0,0,255),2)
644
+ rectx1,recty1 = ((x1+x2)/2,(y1+y2)/2)
645
+ rectcenter = int(rectx1),int(recty1)
646
+ cx = rectcenter[0]
647
+ cy = rectcenter[1]
648
+ cv2.circle(frame,(cx,cy),3,(0,255,0),-1)
649
+ cv2.putText(frame,str(watch), (x1,y1), cv2.FONT_HERSHEY_PLAIN,2,(255,255,255),2)
650
+ cv2.putText(frame,'Watch',(50, 50),cv2.FONT_HERSHEY_PLAIN, 1,(0, 0, 255),2,cv2.LINE_4)
651
+ kpil6_text.write(f"<h5 style='text-align: left; color:red;'>{watch}</h5>", unsafe_allow_html=True)
652
+
653
+
654
+ db['Watch']=watch
655
+ myScreenshot = pyautogui.screenshot()
656
+ # if st.buttn("Dowload ss"):
657
+ # myScreenshot.save(r'/home/anas/PersonTracking/AIComputerVision-master/pages/name.png')
658
+ # myScreenshot.save(r'name.png')
659
+
660
+
661
+
662
+ kpil_text.write(f"<h5 style='text-align: left; color:red;'>{int(fps)}</h5>", unsafe_allow_html=True)
663
+ kpil5_text.write(f"<h5 style='text-align: left; color:red;'>{lpc_txt}</h5>", unsafe_allow_html=True)
664
+ kpil6_text.write(f"<h5 style='text-align: left; color:red;'>{width*height}</h5>",
665
+ unsafe_allow_html=True)
666
+
667
+
668
+ frame = cv.resize(frame,(0,0), fx=0.8, fy=0.8)
669
+ frame = image_resize(image=frame, width=640)
670
+ stframe.image(frame,channels='BGR', use_column_width=True)
671
+ df = pd.DataFrame(db)
672
+ df.to_csv('final.csv',mode='a',header=False,index=False)
673
+ except:
674
+ pass
675
+ with open('final.csv') as f:
676
+ st.download_button(label = 'Download Cheating Report',data=f,file_name='data.csv')
677
+
678
+ os.remove("final.csv")
679
+ main()
pages/LoginStatus.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Id,Password
2
+ ,gjk
3
+ yg,ghhg
pages/hashed_pw.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec0a6ccf9debf1c16781445c4b9106080d00478b0559469336db7c7b7b9711c8
3
+ size 5
pages/signup.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pickle
2
+ from pathlib import Path
3
+ import streamlit as st
4
+ import os
5
+ import pandas as pd
6
+ import csv
7
+ data = ['Id','Password']
8
+
9
+ # with open('LoginStatus.csv', 'w') as file:
10
+ # writer = csv.writer(file)
11
+ # writer.writerow(data)
12
+ db = {}
13
+
14
+ l1 = []
15
+ l2 = []
16
+ ids = st.text_input("Email Address")
17
+ password = st.text_input("Password",type="password",key="password")
18
+ # l1.append(ids)
19
+ # l2.append(password)
20
+
21
+ # l1.append(ids)
22
+ # l2.append(password)
23
+ key1 = "Id"
24
+ db.setdefault(key1, [])
25
+ db[key1].append(ids)
26
+
27
+ key2 = "password"
28
+ db.setdefault(key2, [])
29
+ db[key2].append(password)
30
+
31
+ # print(db)
32
+ # db['Id'] = l1
33
+ # db['Password'] = l2
34
+ # for i in db:
35
+ df = pd.DataFrame(db)
36
+ # st.write(db)
37
+ # df
38
+ if st.button("Add Data"):
39
+ df.to_csv('LoginStatus.csv', mode='a', header=False, index=False)
40
+
41
+
42
+
43
+ # import streamlit as st
44
+ # def check_password():
45
+ # """Returns `True` if the user had a correct password."""
46
+
47
+ # def password_entered():
48
+ # """Checks whether a password entered by the user is correct."""
49
+ # if (
50
+ # st.session_state["username"] in st.secrets["passwords"]
51
+ # and st.session_state["password"]
52
+ # == st.secrets["passwords"][st.session_state["username"]]
53
+ # ):
54
+ # st.session_state["password_correct"] = True
55
+ # del st.session_state["password"] # don't store username + password
56
+ # del st.session_state["username"]
57
+ # else:
58
+ # st.session_state["password_correct"] = False
59
+
60
+ # if "password_correct" not in st.session_state:
61
+ # # First run, show inputs for username + password.
62
+ # st.text_input("Username", on_change=password_entered, key="username")
63
+ # st.text_input(
64
+ # "Password", type="password", on_change=password_entered, key="password"
65
+ # )
66
+ # return False
67
+ # elif not st.session_state["password_correct"]:
68
+ # # Password not correct, show input + error.
69
+ # st.text_input("Username", on_change=password_entered, key="username")
70
+ # st.text_input(
71
+ # "Password", type="password", on_change=password_entered, key="password"
72
+ # )
73
+ # st.error("😕 User not known or password incorrect")
74
+ # return False
75
+ # else:
76
+ # # Password correct.
77
+ # return True
78
+
79
+ # if check_password():
80
+ # st.write("Here goes your normal Streamlit app...")
81
+ # st.button("Click me")
person_counter.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import datetime
3
+ import imutils
4
+ import numpy as np
5
+ from centroidtracker import CentroidTracker
6
+
7
+ protopath = "MobileNetSSD_deploy.prototxt"
8
+ modelpath = "MobileNetSSD_deploy.caffemodel"
9
+ detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
10
+ detector.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
11
+ detector.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
12
+
13
+
14
+ CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
15
+ "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
16
+ "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
17
+ "sofa", "train", "tvmonitor"]
18
+
19
+ tracker = CentroidTracker(maxDisappeared=80, maxDistance=90)
20
+
21
+
22
+ def non_max_suppression_fast(boxes, overlapThresh):
23
+ try:
24
+ if len(boxes) == 0:
25
+ return []
26
+
27
+ if boxes.dtype.kind == "i":
28
+ boxes = boxes.astype("float")
29
+
30
+ pick = []
31
+
32
+ x1 = boxes[:, 0]
33
+ y1 = boxes[:, 1]
34
+ x2 = boxes[:, 2]
35
+ y2 = boxes[:, 3]
36
+
37
+ area = (x2 - x1 + 1) * (y2 - y1 + 1)
38
+ idxs = np.argsort(y2)
39
+
40
+ while len(idxs) > 0:
41
+ last = len(idxs) - 1
42
+ i = idxs[last]
43
+ pick.append(i)
44
+
45
+ xx1 = np.maximum(x1[i], x1[idxs[:last]])
46
+ yy1 = np.maximum(y1[i], y1[idxs[:last]])
47
+ xx2 = np.minimum(x2[i], x2[idxs[:last]])
48
+ yy2 = np.minimum(y2[i], y2[idxs[:last]])
49
+
50
+ w = np.maximum(0, xx2 - xx1 + 1)
51
+ h = np.maximum(0, yy2 - yy1 + 1)
52
+
53
+ overlap = (w * h) / area[idxs[:last]]
54
+
55
+ idxs = np.delete(idxs, np.concatenate(([last],
56
+ np.where(overlap > overlapThresh)[0])))
57
+
58
+ return boxes[pick].astype("int")
59
+ except Exception as e:
60
+ print("Exception occurred in non_max_suppression : {}".format(e))
61
+
62
+
63
+ def main():
64
+ cap = cv2.VideoCapture('test_video.mp4')
65
+
66
+ fps_start_time = datetime.datetime.now()
67
+ fps = 0
68
+ total_frames = 0
69
+ lpc_count = 0
70
+ opc_count = 0
71
+ object_id_list = []
72
+ while True:
73
+ ret, frame = cap.read()
74
+ frame = imutils.resize(frame, width=600)
75
+ total_frames = total_frames + 1
76
+
77
+ (H, W) = frame.shape[:2]
78
+
79
+ blob = cv2.dnn.blobFromImage(frame, 0.007843, (W, H), 127.5)
80
+
81
+ detector.setInput(blob)
82
+ person_detections = detector.forward()
83
+ rects = []
84
+ for i in np.arange(0, person_detections.shape[2]):
85
+ confidence = person_detections[0, 0, i, 2]
86
+ if confidence > 0.5:
87
+ idx = int(person_detections[0, 0, i, 1])
88
+
89
+ if CLASSES[idx] != "person":
90
+ continue
91
+
92
+ person_box = person_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
93
+ (startX, startY, endX, endY) = person_box.astype("int")
94
+ rects.append(person_box)
95
+
96
+ boundingboxes = np.array(rects)
97
+ boundingboxes = boundingboxes.astype(int)
98
+ rects = non_max_suppression_fast(boundingboxes, 0.3)
99
+
100
+ objects = tracker.update(rects)
101
+ for (objectId, bbox) in objects.items():
102
+ x1, y1, x2, y2 = bbox
103
+ x1 = int(x1)
104
+ y1 = int(y1)
105
+ x2 = int(x2)
106
+ y2 = int(y2)
107
+
108
+ cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 255), 2)
109
+ text = "ID: {}".format(objectId)
110
+ cv2.putText(frame, text, (x1, y1-5), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
111
+
112
+ if objectId not in object_id_list:
113
+ object_id_list.append(objectId)
114
+
115
+ fps_end_time = datetime.datetime.now()
116
+ time_diff = fps_end_time - fps_start_time
117
+ if time_diff.seconds == 0:
118
+ fps = 0.0
119
+ else:
120
+ fps = (total_frames / time_diff.seconds)
121
+
122
+ fps_text = "FPS: {:.2f}".format(fps)
123
+
124
+ cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
125
+
126
+ lpc_count = len(objects)
127
+ opc_count = len(object_id_list)
128
+
129
+ lpc_txt = "LPC: {}".format(lpc_count)
130
+ opc_txt = "OPC: {}".format(opc_count)
131
+
132
+ cv2.putText(frame, lpc_txt, (5, 60), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
133
+ cv2.putText(frame, opc_txt, (5, 90), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
134
+
135
+ cv2.imshow("Application", frame)
136
+ key = cv2.waitKey(1)
137
+ if key == ord('q'):
138
+ break
139
+
140
+ cv2.destroyAllWindows()
141
+
142
+
143
+ main()
person_detection_image.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import numpy as np
3
+ import imutils
4
+
5
+ protopath = "MobileNetSSD_deploy.prototxt"
6
+ modelpath = "MobileNetSSD_deploy.caffemodel"
7
+ detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
8
+
9
+ CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
10
+ "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
11
+ "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
12
+ "sofa", "train", "tvmonitor"]
13
+
14
+
15
+ def main():
16
+ image = cv2.imread('people.jpg')
17
+ image = imutils.resize(image, width=600)
18
+
19
+ (H, W) = image.shape[:2]
20
+
21
+ blob = cv2.dnn.blobFromImage(image, 0.007843, (W, H), 127.5)
22
+
23
+ detector.setInput(blob)
24
+ person_detections = detector.forward()
25
+
26
+ for i in np.arange(0, person_detections.shape[2]):
27
+ confidence = person_detections[0, 0, i, 2]
28
+ if confidence > 0.5:
29
+ idx = int(person_detections[0, 0, i, 1])
30
+
31
+ if CLASSES[idx] != "person":
32
+ continue
33
+
34
+ person_box = person_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
35
+ (startX, startY, endX, endY) = person_box.astype("int")
36
+
37
+ cv2.rectangle(image, (startX, startY), (endX, endY), (0, 0, 255), 2)
38
+
39
+ cv2.imshow("Results", image)
40
+ cv2.waitKey(0)
41
+ cv2.destroyAllWindows()
42
+
43
+ main()
person_detection_video.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import datetime
3
+ import imutils
4
+ import numpy as np
5
+
6
+ protopath = "MobileNetSSD_deploy.prototxt"
7
+ modelpath = "MobileNetSSD_deploy.caffemodel"
8
+ detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
9
+ # Only enable it if you are using OpenVino environment
10
+ # detector.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
11
+ # detector.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
12
+
13
+
14
+ CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
15
+ "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
16
+ "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
17
+ "sofa", "train", "tvmonitor"]
18
+
19
+
20
+ def main():
21
+ cap = cv2.VideoCapture('test_video.mp4')
22
+
23
+ fps_start_time = datetime.datetime.now()
24
+ fps = 0
25
+ total_frames = 0
26
+
27
+ while True:
28
+ ret, frame = cap.read()
29
+ frame = imutils.resize(frame, width=600)
30
+ total_frames = total_frames + 1
31
+
32
+ (H, W) = frame.shape[:2]
33
+
34
+ blob = cv2.dnn.blobFromImage(frame, 0.007843, (W, H), 127.5)
35
+
36
+ detector.setInput(blob)
37
+ person_detections = detector.forward()
38
+
39
+ for i in np.arange(0, person_detections.shape[2]):
40
+ confidence = person_detections[0, 0, i, 2]
41
+ if confidence > 0.5:
42
+ idx = int(person_detections[0, 0, i, 1])
43
+
44
+ if CLASSES[idx] != "person":
45
+ continue
46
+
47
+ person_box = person_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
48
+ (startX, startY, endX, endY) = person_box.astype("int")
49
+
50
+ cv2.rectangle(frame, (startX, startY), (endX, endY), (0, 0, 255), 2)
51
+
52
+ fps_end_time = datetime.datetime.now()
53
+ time_diff = fps_end_time - fps_start_time
54
+ if time_diff.seconds == 0:
55
+ fps = 0.0
56
+ else:
57
+ fps = (total_frames / time_diff.seconds)
58
+
59
+ fps_text = "FPS: {:.2f}".format(fps)
60
+
61
+ cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
62
+
63
+ cv2.imshow("Application", frame)
64
+ key = cv2.waitKey(1)
65
+ if key == ord('q'):
66
+ break
67
+
68
+ cv2.destroyAllWindows()
69
+
70
+
71
+ main()
person_tracking.py ADDED
@@ -0,0 +1,542 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import datetime
3
+ import imutils
4
+ import numpy as np
5
+ from centroidtracker import CentroidTracker
6
+ import pandas as pd
7
+ import torch
8
+ import streamlit as st
9
+ import mediapipe as mp
10
+ import cv2 as cv
11
+ import numpy as np
12
+ import tempfile
13
+ import time
14
+ from PIL import Image
15
+ import pandas as pd
16
+ import torch
17
+ import base64
18
+ import streamlit.components.v1 as components
19
+ import csv
20
+ import pickle
21
+ from pathlib import Path
22
+ import streamlit_authenticator as stauth
23
+ import os
24
+ import csv
25
+ # x-x-x-x-x-x-x-x-x-x-x-x-x-x LOGIN FORM x-x-x-x-x-x-x-x-x
26
+
27
+
28
+ import streamlit as st
29
+ import pandas as pd
30
+ import hashlib
31
+ import sqlite3
32
+ #
33
+
34
+ import pickle
35
+ from pathlib import Path
36
+ import streamlit_authenticator as stauth
37
+ # print("Done !!!")
38
+
39
+ data = ["student Count",'Date','Id','Mobile','Watch']
40
+ with open('final.csv', 'w') as file:
41
+ writer = csv.writer(file)
42
+ writer.writerow(data)
43
+
44
+
45
+ l1 = []
46
+ l2 = []
47
+ if st.button('signup'):
48
+
49
+
50
+ usernames = st.text_input('Username')
51
+ pwd = st.text_input('Password')
52
+ l1.append(usernames)
53
+ l2.append(pwd)
54
+
55
+ names = ["dmin", "ser"]
56
+ if st.button("signupsss"):
57
+ username =l1
58
+
59
+ password =l2
60
+
61
+ hashed_passwords =stauth.Hasher(password).generate()
62
+
63
+ file_path = Path(__file__).parent / "hashed_pw.pkl"
64
+
65
+ with file_path.open("wb") as file:
66
+ pickle.dump(hashed_passwords, file)
67
+
68
+
69
+ elif st.button('Logins'):
70
+ names = ['dmin', 'ser']
71
+
72
+ username =l1
73
+
74
+ file_path = Path(__file__).parent / 'hashed_pw.pkl'
75
+
76
+ with file_path.open('rb') as file:
77
+ hashed_passwords = pickle.load(file)
78
+
79
+ authenticator = stauth.Authenticate(names,username,hashed_passwords,'Cheating Detection','abcdefg',cookie_expiry_days=180)
80
+
81
+ name,authentication_status,username= authenticator.login('Login','main')
82
+
83
+
84
+ if authentication_status == False:
85
+ st.error('Username/Password is incorrect')
86
+
87
+ if authentication_status == None:
88
+ st.error('Please enter a username and password')
89
+
90
+ if authentication_status:
91
+ date_time = time.strftime("%b %d %Y %-I:%M %p")
92
+ date = date_time.split()
93
+ dates = date[0:3]
94
+ times = date[3:5]
95
+ # x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-xAPPLICACTION -x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x
96
+
97
+ def non_max_suppression_fast(boxes, overlapThresh):
98
+ try:
99
+ if len(boxes) == 0:
100
+ return []
101
+
102
+ if boxes.dtype.kind == "i":
103
+ boxes = boxes.astype("float")
104
+
105
+ pick = []
106
+
107
+ x1 = boxes[:, 0]
108
+ y1 = boxes[:, 1]
109
+ x2 = boxes[:, 2]
110
+ y2 = boxes[:, 3]
111
+
112
+ area = (x2 - x1 + 1) * (y2 - y1 + 1)
113
+ idxs = np.argsort(y2)
114
+
115
+ while len(idxs) > 0:
116
+ last = len(idxs) - 1
117
+ i = idxs[last]
118
+ pick.append(i)
119
+
120
+ xx1 = np.maximum(x1[i], x1[idxs[:last]])
121
+ yy1 = np.maximum(y1[i], y1[idxs[:last]])
122
+ xx2 = np.minimum(x2[i], x2[idxs[:last]])
123
+ yy2 = np.minimum(y2[i], y2[idxs[:last]])
124
+
125
+ w = np.maximum(0, xx2 - xx1 + 1)
126
+ h = np.maximum(0, yy2 - yy1 + 1)
127
+
128
+ overlap = (w * h) / area[idxs[:last]]
129
+
130
+ idxs = np.delete(idxs, np.concatenate(([last],
131
+ np.where(overlap > overlapThresh)[0])))
132
+
133
+ return boxes[pick].astype("int")
134
+ except Exception as e:
135
+ print("Exception occurred in non_max_suppression : {}".format(e))
136
+
137
+
138
+ protopath = "MobileNetSSD_deploy.prototxt"
139
+ modelpath = "MobileNetSSD_deploy.caffemodel"
140
+ detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
141
+ # Only enable it if you are using OpenVino environment
142
+ # detector.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
143
+ # detector.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
144
+
145
+
146
+ CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
147
+ "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
148
+ "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
149
+ "sofa", "train", "tvmonitor"]
150
+
151
+ tracker = CentroidTracker(maxDisappeared=80, maxDistance=90)
152
+
153
+ st.markdown(
154
+ """
155
+ <style>
156
+ [data-testid="stSidebar"][aria-expanded="true"] > div:first-child{
157
+ width: 350px
158
+ }
159
+ [data-testid="stSidebar"][aria-expanded="false"] > div:first-child{
160
+ width: 350px
161
+ margin-left: -350px
162
+ }
163
+ </style>
164
+ """,
165
+ unsafe_allow_html=True,
166
+ )
167
+ hide_streamlit_style = """
168
+ <style>
169
+ #MainMenu {visibility: hidden;}
170
+ footer {visibility: hidden;}
171
+ </style>
172
+ """
173
+ st.markdown(hide_streamlit_style, unsafe_allow_html=True)
174
+
175
+
176
+ # Resize Images to fit Container
177
+ @st.cache()
178
+ # Get Image Dimensions
179
+ def image_resize(image, width=None, height=None, inter=cv.INTER_AREA):
180
+ dim = None
181
+ (h,w) = image.shape[:2]
182
+
183
+ if width is None and height is None:
184
+ return image
185
+
186
+ if width is None:
187
+ r = width/float(w)
188
+ dim = (int(w*r),height)
189
+
190
+ else:
191
+ r = width/float(w)
192
+ dim = width, int(h*r)
193
+
194
+ # Resize image
195
+ resized = cv.resize(image,dim,interpolation=inter)
196
+
197
+ return resized
198
+
199
+ # About Page
200
+ authenticator.logout('Logout')
201
+ app_mode = st.sidebar.selectbox(
202
+ 'App Mode',
203
+ ['About','Application']
204
+ )
205
+ if app_mode == 'About':
206
+ st.title('About Product And Team')
207
+ st.markdown('''
208
+ Imran Bhai Project
209
+ ''')
210
+ st.markdown(
211
+ """
212
+ <style>
213
+ [data-testid="stSidebar"][aria-expanded="true"] > div:first-child{
214
+ width: 350px
215
+ }
216
+ [data-testid="stSidebar"][aria-expanded="false"] > div:first-child{
217
+ width: 350px
218
+ margin-left: -350px
219
+ }
220
+ </style>
221
+ """,
222
+ unsafe_allow_html=True,
223
+ )
224
+
225
+
226
+
227
+
228
+ elif app_mode == 'Application':
229
+
230
+ st.set_option('deprecation.showfileUploaderEncoding', False)
231
+
232
+ use_webcam = st.button('Use Webcam')
233
+ # record = st.sidebar.checkbox("Record Video")
234
+
235
+ # if record:
236
+ # st.checkbox('Recording', True)
237
+
238
+ # drawing_spec = mp.solutions.drawing_utils.DrawingSpec(thickness=2, circle_radius=1)
239
+
240
+ # st.sidebar.markdown('---')
241
+
242
+ # ## Add Sidebar and Window style
243
+ # st.markdown(
244
+ # """
245
+ # <style>
246
+ # [data-testid="stSidebar"][aria-expanded="true"] > div:first-child{
247
+ # width: 350px
248
+ # }
249
+ # [data-testid="stSidebar"][aria-expanded="false"] > div:first-child{
250
+ # width: 350px
251
+ # margin-left: -350px
252
+ # }
253
+ # </style>
254
+ # """,
255
+ # unsafe_allow_html=True,
256
+ # )
257
+
258
+ # max_faces = st.sidebar.number_input('Maximum Number of Faces', value=5, min_value=1)
259
+ # st.sidebar.markdown('---')
260
+ # detection_confidence = st.sidebar.slider('Min Detection Confidence', min_value=0.0,max_value=1.0,value=0.5)
261
+ # tracking_confidence = st.sidebar.slider('Min Tracking Confidence', min_value=0.0,max_value=1.0,value=0.5)
262
+ # st.sidebar.markdown('---')
263
+
264
+ ## Get Video
265
+ stframe = st.empty()
266
+ video_file_buffer = st.file_uploader("Upload a Video", type=['mp4', 'mov', 'avi', 'asf', 'm4v'])
267
+ temp_file = tempfile.NamedTemporaryFile(delete=False)
268
+
269
+
270
+ if not video_file_buffer:
271
+ if use_webcam:
272
+ video = cv.VideoCapture(0)
273
+ else:
274
+ try:
275
+ video = cv.VideoCapture(1)
276
+ temp_file.name = video
277
+ except:
278
+ pass
279
+ else:
280
+ temp_file.write(video_file_buffer.read())
281
+ video = cv.VideoCapture(temp_file.name)
282
+
283
+ width = int(video.get(cv.CAP_PROP_FRAME_WIDTH))
284
+ height = int(video.get(cv.CAP_PROP_FRAME_HEIGHT))
285
+ fps_input = int(video.get(cv.CAP_PROP_FPS))
286
+
287
+ ## Recording
288
+ codec = cv.VideoWriter_fourcc('a','v','c','1')
289
+ out = cv.VideoWriter('output1.mp4', codec, fps_input, (width,height))
290
+
291
+ st.sidebar.text('Input Video')
292
+ # st.sidebar.video(temp_file.name)
293
+
294
+ fps = 0
295
+ i = 0
296
+
297
+ drawing_spec = mp.solutions.drawing_utils.DrawingSpec(thickness=2, circle_radius=1)
298
+
299
+ kpil, kpil2, kpil3,kpil4,kpil5, kpil6 = st.columns(6)
300
+
301
+ with kpil:
302
+ st.markdown('**Frame Rate**')
303
+ kpil_text = st.markdown('0')
304
+
305
+ with kpil2:
306
+ st.markdown('**detection ID**')
307
+ kpil2_text = st.markdown('0')
308
+
309
+ with kpil3:
310
+ st.markdown('**Mobile**')
311
+ kpil3_text = st.markdown('0')
312
+ with kpil4:
313
+ st.markdown('**Watch**')
314
+ kpil4_text = st.markdown('0')
315
+ with kpil5:
316
+ st.markdown('**Count**')
317
+ kpil5_text = st.markdown('0')
318
+ with kpil6:
319
+ st.markdown('**Img Res**')
320
+ kpil6_text = st.markdown('0')
321
+
322
+
323
+
324
+ st.markdown('<hr/>', unsafe_allow_html=True)
325
+ # try:
326
+ def main():
327
+ db = {}
328
+
329
+ # cap = cv2.VideoCapture('//home//anas//PersonTracking//WebUI//movement.mp4')
330
+ path='/usr/local/lib/python3.10/dist-packages/yolo0vs5/yolov5s-int8.tflite'
331
+ #count=0
332
+ custom = 'yolov5s'
333
+
334
+ model = torch.hub.load('/usr/local/lib/python3.10/dist-packages/yolovs5', custom, path,source='local',force_reload=True)
335
+
336
+ b=model.names[0] = 'person'
337
+ mobile = model.names[67] = 'cell phone'
338
+ watch = model.names[75] = 'clock'
339
+
340
+ fps_start_time = datetime.datetime.now()
341
+ fps = 0
342
+ size=416
343
+
344
+ count=0
345
+ counter=0
346
+
347
+
348
+ color=(0,0,255)
349
+
350
+ cy1=250
351
+ offset=6
352
+
353
+
354
+ pt1 = (120, 100)
355
+ pt2 = (980, 1150)
356
+ color = (0, 255, 0)
357
+
358
+ pt3 = (283, 103)
359
+ pt4 = (1500, 1150)
360
+
361
+ cy2 = 500
362
+ color = (0, 255, 0)
363
+ total_frames = 0
364
+ prevTime = 0
365
+ cur_frame = 0
366
+ count=0
367
+ counter=0
368
+ fps_start_time = datetime.datetime.now()
369
+ fps = 0
370
+ total_frames = 0
371
+ lpc_count = 0
372
+ opc_count = 0
373
+ object_id_list = []
374
+ # success = True
375
+ if st.button("Detect"):
376
+ try:
377
+ while video.isOpened():
378
+
379
+ ret, frame = video.read()
380
+ frame = imutils.resize(frame, width=600)
381
+ total_frames = total_frames + 1
382
+
383
+ (H, W) = frame.shape[:2]
384
+
385
+ blob = cv2.dnn.blobFromImage(frame, 0.007843, (W, H), 127.5)
386
+
387
+ detector.setInput(blob)
388
+ person_detections = detector.forward()
389
+ rects = []
390
+ for i in np.arange(0, person_detections.shape[2]):
391
+ confidence = person_detections[0, 0, i, 2]
392
+ if confidence > 0.5:
393
+ idx = int(person_detections[0, 0, i, 1])
394
+
395
+ if CLASSES[idx] != "person":
396
+ continue
397
+
398
+ person_box = person_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
399
+ (startX, startY, endX, endY) = person_box.astype("int")
400
+ rects.append(person_box)
401
+
402
+ boundingboxes = np.array(rects)
403
+ boundingboxes = boundingboxes.astype(int)
404
+ rects = non_max_suppression_fast(boundingboxes, 0.3)
405
+
406
+ objects = tracker.update(rects)
407
+ for (objectId, bbox) in objects.items():
408
+ x1, y1, x2, y2 = bbox
409
+ x1 = int(x1)
410
+ y1 = int(y1)
411
+ x2 = int(x2)
412
+ y2 = int(y2)
413
+
414
+ cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 255), 2)
415
+ text = "ID: {}".format(objectId)
416
+ # print(text)
417
+ cv2.putText(frame, text, (x1, y1-5), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
418
+ if objectId not in object_id_list:
419
+ object_id_list.append(objectId)
420
+ fps_end_time = datetime.datetime.now()
421
+ time_diff = fps_end_time - fps_start_time
422
+ if time_diff.seconds == 0:
423
+ fps = 0.0
424
+ else:
425
+ fps = (total_frames / time_diff.seconds)
426
+
427
+ fps_text = "FPS: {:.2f}".format(fps)
428
+
429
+ cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
430
+ lpc_count = len(objects)
431
+ opc_count = len(object_id_list)
432
+
433
+ lpc_txt = "LPC: {}".format(lpc_count)
434
+ opc_txt = "OPC: {}".format(opc_count)
435
+
436
+ count += 1
437
+ if count % 4 != 0:
438
+ continue
439
+ # frame=cv.resize(frame, (600,500))
440
+ # cv2.line(frame, pt1, pt2,color,2)
441
+ # cv2.line(frame, pt3, pt4,color,2)
442
+ results = model(frame,size)
443
+ components = results.pandas().xyxy[0]
444
+ for index, row in results.pandas().xyxy[0].iterrows():
445
+ x1 = int(row['xmin'])
446
+ y1 = int(row['ymin'])
447
+ x2 = int(row['xmax'])
448
+ y2 = int(row['ymax'])
449
+ confidence = (row['confidence'])
450
+ obj = (row['class'])
451
+
452
+
453
+ # min':x1,'ymin':y1,'xmax':x2,'ymax':y2,'confidence':confidence,'Object':obj}
454
+ # if lpc_txt is not None:
455
+ # try:
456
+ # db["student Count"] = [lpc_txt]
457
+ # except:
458
+ # db["student Count"] = ['N/A']
459
+ if obj == 0:
460
+ cv2.rectangle(frame,(x1,y1),(x2,y2),(0,0,255),2)
461
+ rectx1,recty1 = ((x1+x2)/2,(y1+y2)/2)
462
+ rectcenter = int(rectx1),int(recty1)
463
+ cx = rectcenter[0]
464
+ cy = rectcenter[1]
465
+ cv2.circle(frame,(cx,cy),3,(0,255,0),-1)
466
+ cv2.putText(frame,str(b), (x1,y1), cv2.FONT_HERSHEY_PLAIN,2,(255,255,255),2)
467
+
468
+ db["student Count"] = [lpc_txt]
469
+ db['Date'] = [date_time]
470
+ db['id'] = ['N/A']
471
+ db['Mobile']=['N/A']
472
+ db['Watch'] = ['N/A']
473
+ if cy<(cy1+offset) and cy>(cy1-offset):
474
+ DB = []
475
+ counter+=1
476
+ DB.append(counter)
477
+
478
+ ff = DB[-1]
479
+ fx = str(ff)
480
+ # cv2.line(frame, pt1, pt2,(0, 0, 255),2)
481
+ # if cy<(cy2+offset) and cy>(cy2-offset):
482
+
483
+ # cv2.line(frame, pt3, pt4,(0, 0, 255),2)
484
+ font = cv2.FONT_HERSHEY_TRIPLEX
485
+ cv2.putText(frame,fx,(50, 50),font, 1,(0, 0, 255),2,cv2.LINE_4)
486
+ cv2.putText(frame,"Movement",(70, 70),font, 1,(0, 0, 255),2,cv2.LINE_4)
487
+ kpil2_text.write(f"<h5 style='text-align: left; color:red;'>{text}</h5>", unsafe_allow_html=True)
488
+
489
+
490
+ db['id'] = [text]
491
+
492
+
493
+
494
+ if obj == 67:
495
+ cv2.rectangle(frame,(x1,y1),(x2,y2),(0,0,255),2)
496
+ rectx1,recty1 = ((x1+x2)/2,(y1+y2)/2)
497
+ rectcenter = int(rectx1),int(recty1)
498
+ cx = rectcenter[0]
499
+ cy = rectcenter[1]
500
+ cv2.circle(frame,(cx,cy),3,(0,255,0),-1)
501
+ cv2.putText(frame,str(mobile), (x1,y1), cv2.FONT_HERSHEY_PLAIN,2,(255,255,255),2)
502
+ cv2.putText(frame,'Mobile',(50, 50),cv2.FONT_HERSHEY_PLAIN, 1,(0, 0, 255),2,cv2.LINE_4)
503
+ kpil3_text.write(f"<h5 style='text-align: left; color:red;'>{mobile}{text}</h5>", unsafe_allow_html=True)
504
+
505
+ db['Mobile']=mobile+' '+text
506
+
507
+
508
+
509
+ if obj == 75:
510
+ cv2.rectangle(frame,(x1,y1),(x2,y2),(0,0,255),2)
511
+ rectx1,recty1 = ((x1+x2)/2,(y1+y2)/2)
512
+ rectcenter = int(rectx1),int(recty1)
513
+ cx = rectcenter[0]
514
+ cy = rectcenter[1]
515
+ cv2.circle(frame,(cx,cy),3,(0,255,0),-1)
516
+ cv2.putText(frame,str(watch), (x1,y1), cv2.FONT_HERSHEY_PLAIN,2,(255,255,255),2)
517
+ cv2.putText(frame,'Watch',(50, 50),cv2.FONT_HERSHEY_PLAIN, 1,(0, 0, 255),2,cv2.LINE_4)
518
+ kpil6_text.write(f"<h5 style='text-align: left; color:red;'>{watch}</h5>", unsafe_allow_html=True)
519
+
520
+
521
+ db['Watch']=watch
522
+
523
+
524
+
525
+ kpil_text.write(f"<h5 style='text-align: left; color:red;'>{int(fps)}</h5>", unsafe_allow_html=True)
526
+ kpil5_text.write(f"<h5 style='text-align: left; color:red;'>{lpc_txt}</h5>", unsafe_allow_html=True)
527
+ kpil6_text.write(f"<h5 style='text-align: left; color:red;'>{width*height}</h5>",
528
+ unsafe_allow_html=True)
529
+
530
+
531
+ frame = cv.resize(frame,(0,0), fx=0.8, fy=0.8)
532
+ frame = image_resize(image=frame, width=640)
533
+ stframe.image(frame,channels='BGR', use_column_width=True)
534
+ df = pd.DataFrame(db)
535
+ df.to_csv('final.csv',mode='a',header=False,index=False)
536
+ except:
537
+ pass
538
+ with open('final.csv') as f:
539
+ st.download_button(label = 'Download Cheating Report',data=f,file_name='data.csv')
540
+
541
+ os.remove("final.csv")
542
+ main()
res10_300x300_ssd_iter_140000.caffemodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a56a11a57a4a295956b0660b4a3d76bbdca2206c4961cea8efe7d95c7cb2f2d
3
+ size 10666211
social_distancing.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import datetime
3
+ import imutils
4
+ import numpy as np
5
+ from centroidtracker import CentroidTracker
6
+ from itertools import combinations
7
+ import math
8
+
9
+ protopath = "MobileNetSSD_deploy.prototxt"
10
+ modelpath = "MobileNetSSD_deploy.caffemodel"
11
+ detector = cv2.dnn.readNetFromCaffe(prototxt=protopath, caffeModel=modelpath)
12
+ # detector.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
13
+ # detector.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
14
+
15
+
16
+ CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
17
+ "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
18
+ "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
19
+ "sofa", "train", "tvmonitor"]
20
+
21
+ tracker = CentroidTracker(maxDisappeared=40, maxDistance=50)
22
+
23
+
24
+ def non_max_suppression_fast(boxes, overlapThresh):
25
+ try:
26
+ if len(boxes) == 0:
27
+ return []
28
+
29
+ if boxes.dtype.kind == "i":
30
+ boxes = boxes.astype("float")
31
+
32
+ pick = []
33
+
34
+ x1 = boxes[:, 0]
35
+ y1 = boxes[:, 1]
36
+ x2 = boxes[:, 2]
37
+ y2 = boxes[:, 3]
38
+
39
+ area = (x2 - x1 + 1) * (y2 - y1 + 1)
40
+ idxs = np.argsort(y2)
41
+
42
+ while len(idxs) > 0:
43
+ last = len(idxs) - 1
44
+ i = idxs[last]
45
+ pick.append(i)
46
+
47
+ xx1 = np.maximum(x1[i], x1[idxs[:last]])
48
+ yy1 = np.maximum(y1[i], y1[idxs[:last]])
49
+ xx2 = np.minimum(x2[i], x2[idxs[:last]])
50
+ yy2 = np.minimum(y2[i], y2[idxs[:last]])
51
+
52
+ w = np.maximum(0, xx2 - xx1 + 1)
53
+ h = np.maximum(0, yy2 - yy1 + 1)
54
+
55
+ overlap = (w * h) / area[idxs[:last]]
56
+
57
+ idxs = np.delete(idxs, np.concatenate(([last],
58
+ np.where(overlap > overlapThresh)[0])))
59
+
60
+ return boxes[pick].astype("int")
61
+ except Exception as e:
62
+ print("Exception occurred in non_max_suppression : {}".format(e))
63
+
64
+
65
+ def main():
66
+ cap = cv2.VideoCapture('testvideo2.mp4')
67
+
68
+ fps_start_time = datetime.datetime.now()
69
+ fps = 0
70
+ total_frames = 0
71
+
72
+ while True:
73
+ ret, frame = cap.read()
74
+ frame = imutils.resize(frame, width=600)
75
+ total_frames = total_frames + 1
76
+
77
+ (H, W) = frame.shape[:2]
78
+
79
+ blob = cv2.dnn.blobFromImage(frame, 0.007843, (W, H), 127.5)
80
+
81
+ detector.setInput(blob)
82
+ person_detections = detector.forward()
83
+ rects = []
84
+ for i in np.arange(0, person_detections.shape[2]):
85
+ confidence = person_detections[0, 0, i, 2]
86
+ if confidence > 0.5:
87
+ idx = int(person_detections[0, 0, i, 1])
88
+
89
+ if CLASSES[idx] != "person":
90
+ continue
91
+
92
+ person_box = person_detections[0, 0, i, 3:7] * np.array([W, H, W, H])
93
+ (startX, startY, endX, endY) = person_box.astype("int")
94
+ rects.append(person_box)
95
+
96
+ boundingboxes = np.array(rects)
97
+ boundingboxes = boundingboxes.astype(int)
98
+ rects = non_max_suppression_fast(boundingboxes, 0.3)
99
+ centroid_dict = dict()
100
+ objects = tracker.update(rects)
101
+ for (objectId, bbox) in objects.items():
102
+ x1, y1, x2, y2 = bbox
103
+ x1 = int(x1)
104
+ y1 = int(y1)
105
+ x2 = int(x2)
106
+ y2 = int(y2)
107
+ cX = int((x1 + x2) / 2.0)
108
+ cY = int((y1 + y2) / 2.0)
109
+
110
+
111
+ centroid_dict[objectId] = (cX, cY, x1, y1, x2, y2)
112
+
113
+ # text = "ID: {}".format(objectId)
114
+ # cv2.putText(frame, text, (x1, y1-5), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
115
+
116
+ red_zone_list = []
117
+ for (id1, p1), (id2, p2) in combinations(centroid_dict.items(), 2):
118
+ dx, dy = p1[0] - p2[0], p1[1] - p2[1]
119
+ distance = math.sqrt(dx * dx + dy * dy)
120
+ if distance < 75.0:
121
+ if id1 not in red_zone_list:
122
+ red_zone_list.append(id1)
123
+ if id2 not in red_zone_list:
124
+ red_zone_list.append(id2)
125
+
126
+ for id, box in centroid_dict.items():
127
+ if id in red_zone_list:
128
+ cv2.rectangle(frame, (box[2], box[3]), (box[4], box[5]), (0, 0, 255), 2)
129
+ else:
130
+ cv2.rectangle(frame, (box[2], box[3]), (box[4], box[5]), (0, 255, 0), 2)
131
+
132
+
133
+ fps_end_time = datetime.datetime.now()
134
+ time_diff = fps_end_time - fps_start_time
135
+ if time_diff.seconds == 0:
136
+ fps = 0.0
137
+ else:
138
+ fps = (total_frames / time_diff.seconds)
139
+
140
+ fps_text = "FPS: {:.2f}".format(fps)
141
+
142
+ cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
143
+
144
+ cv2.imshow("Application", frame)
145
+ key = cv2.waitKey(1)
146
+ if key == ord('q'):
147
+ break
148
+
149
+ cv2.destroyAllWindows()
150
+
151
+
152
+ main()
test4.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+
2
+ student Count,Date,id
3
+
4
+ student Count,Date,id
test_video.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0ba636766524dd0bdfa52a2a62108aafb585acd138cb0e08226d12ae35b64c5
3
+ size 27534166
video/mask.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4dc1d0ed71d79c29eaa4b8503c829fcf7c840cab93756baabf97238f999432e6
3
+ size 6143986
video/test_video.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0ba636766524dd0bdfa52a2a62108aafb585acd138cb0e08226d12ae35b64c5
3
+ size 27534166
video/testvideo2.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15153e2c3d7221d693ec634e5288416fdc330427ccea9f4fc520a362977755e8
3
+ size 5468270
yolov5s.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b3b748c1e592ddd8868022e8732fde20025197328490623cc16c6f24d0782ee
3
+ size 14808437