forked from hellochick/PSPNet-tensorflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_eager.py
816 lines (710 loc) · 72 KB
/
model_eager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
import tensorflow as tf
import numpy as np
DEFAULT_DATAFORMAT = 'channels_last'
class ConstantWeightsInitializer(object):
def __init__(self, path):
self.weights_dict = np.load(path,allow_pickle=True).item()
def conv2D_init(self, name, bias=False):
kernel_init = tf.constant_initializer(self.weights_dict[name+'/kernel'])
if bias:
bias_init = tf.constant_initializer(self.weights_dict[name+'/biases'])
return kernel_init,bias_init
else:
return kernel_init
def bn_init(self, name):
gamma_init = tf.constant_initializer(self.weights_dict[name+'/gamma'])
beta_init = tf.constant_initializer(self.weights_dict[name+'/beta'])
moving_mean_init = tf.constant_initializer(self.weights_dict[name+'/moving_mean'])
moving_variance_init = tf.constant_initializer(self.weights_dict[name+'/moving_variance'])
return gamma_init,beta_init,moving_mean_init,moving_variance_init
class PSPNet50(tf.keras.Model):
def __init__(self, num_classes=150, checkpoint_npy_path=None):
super(PSPNet50, self).__init__()
if checkpoint_npy_path: # initializa with checkpoint
initializer = ConstantWeightsInitializer(checkpoint_npy_path)
# PSPNet layers with initializer
name = 'conv1_1_3x3_s2'
kernel_init = initializer.conv2D_init(name=name)
self.conv1_1_3x3_s2 = tf.keras.layers.Conv2D(64, [3, 3], [2, 2], padding='SAME', use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv1_1_3x3_s2_bn'
gamma_init,beta_init,moving_mean_init,moving_variance_innit = initializer.bn_init(name)
self.conv1_1_3x3_s2_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv1_2_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv1_2_3x3 = tf.keras.layers.Conv2D(64, [3, 3], [1, 1], padding='SAME', use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv1_2_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv1_2_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv1_3_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv1_3_3x3 = tf.keras.layers.Conv2D(128, [3, 3], [1, 1], padding='SAME', use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv1_3_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv1_3_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv2_1_1x1_proj'
kernel_init = initializer.conv2D_init(name=name)
self.conv2_1_1x1_proj = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv2_1_1x1_proj_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv2_1_1x1_proj_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv2_1_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv2_1_1x1_reduce = tf.keras.layers.Conv2D(64, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv2_1_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv2_1_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv2_1_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv2_1_3x3 = tf.keras.layers.Conv2D(64, [3, 3], [1, 1], use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv2_1_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv2_1_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv2_1_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv2_1_1x1_increase = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv2_1_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv2_1_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv2_2_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv2_2_1x1_reduce = tf.keras.layers.Conv2D(64, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv2_2_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv2_2_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv2_2_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv2_2_3x3 = tf.keras.layers.Conv2D(64, [3, 3], [1, 1], use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv2_2_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv2_2_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv2_2_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv2_2_1x1_increase = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv2_2_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv2_2_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv2_3_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv2_3_1x1_reduce = tf.keras.layers.Conv2D(64, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv2_3_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv2_3_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv2_3_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv2_3_3x3 = tf.keras.layers.Conv2D(64, [3, 3], [1, 1], use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv2_3_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv2_3_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv2_3_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv2_3_1x1_increase = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv2_3_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv2_3_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_1_1x1_proj'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_1_1x1_proj = tf.keras.layers.Conv2D(512, [1, 1], [2, 2], use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv3_1_1x1_proj_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_1_1x1_proj_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_1_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_1_1x1_reduce = tf.keras.layers.Conv2D(128, [1, 1], [2, 2], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv3_1_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_1_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_1_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_1_3x3 = tf.keras.layers.Conv2D(128, [3, 3], [1, 1], use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv3_1_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_1_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_1_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_1_1x1_increase = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv3_1_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_1_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_2_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_2_1x1_reduce = tf.keras.layers.Conv2D(128, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv3_2_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_2_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_2_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_2_3x3 = tf.keras.layers.Conv2D(128, [3, 3], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv3_2_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_2_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_2_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_2_1x1_increase = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv3_2_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_2_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_3_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_3_1x1_reduce = tf.keras.layers.Conv2D(128, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv3_3_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_3_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_3_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_3_3x3 = tf.keras.layers.Conv2D(128, [3, 3], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv3_3_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_3_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_3_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_3_1x1_increase = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv3_3_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_3_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_4_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_4_1x1_reduce = tf.keras.layers.Conv2D(128, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv3_4_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_4_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_4_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_4_3x3 = tf.keras.layers.Conv2D(128, [3, 3], [1, 1], use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv3_4_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_4_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv3_4_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv3_4_1x1_increase = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv3_4_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv3_4_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_1_1x1_proj'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_1_1x1_proj = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_1_1x1_proj_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_1_1x1_proj_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_1_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_1_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_1_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_1_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_1_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_1_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv4_1_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_1_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_1_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_1_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_1_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_1_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_2_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_2_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_2_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_2_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_2_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_2_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv4_2_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_2_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_2_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_2_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_2_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_2_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_3_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_3_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_3_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_3_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_3_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_3_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv4_3_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_3_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_3_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_3_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_3_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_3_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_4_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_4_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_4_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_4_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_4_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_4_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv4_4_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_4_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_4_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_4_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_4_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_4_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_5_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_5_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_5_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_5_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_5_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_5_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv4_5_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_5_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_5_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_5_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_5_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_5_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_6_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_6_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_6_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_6_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_6_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_6_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv4_6_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_6_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv4_6_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv4_6_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv4_6_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv4_6_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_1_1x1_proj'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_1_1x1_proj = tf.keras.layers.Conv2D(2048, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv5_1_1x1_proj_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_1_1x1_proj_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_1_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_1_1x1_reduce = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv5_1_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_1_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_1_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_1_3x3 = tf.keras.layers.Conv2D(512, [3, 3], dilation_rate=4, use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv5_1_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_1_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_1_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_1_1x1_increase = tf.keras.layers.Conv2D(2048, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv5_1_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_1_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_2_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_2_1x1_reduce = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv5_2_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_2_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_2_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_2_3x3 = tf.keras.layers.Conv2D(512, [3, 3], dilation_rate=4, use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv5_2_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_2_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_2_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_2_1x1_increase = tf.keras.layers.Conv2D(2048, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv5_2_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_2_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_3_1x1_reduce'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_3_1x1_reduce = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv5_3_1x1_reduce_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_3_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_3_3x3'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_3_3x3 = tf.keras.layers.Conv2D(512, [3, 3], dilation_rate=4, use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv5_3_3x3_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_3_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_3_1x1_increase'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_3_1x1_increase = tf.keras.layers.Conv2D(2048, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv5_3_1x1_increase_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_3_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_3_pool1_conv'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_3_pool1_conv = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv5_3_pool1_conv_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_3_pool1_conv_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_3_pool2_conv'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_3_pool2_conv = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv5_3_pool2_conv_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_3_pool2_conv_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_3_pool3_conv'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_3_pool3_conv = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv5_3_pool3_conv_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_3_pool3_conv_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_3_pool6_conv'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_3_pool6_conv = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name=name,kernel_initializer=kernel_init)
name = 'conv5_3_pool6_conv_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_3_pool6_conv_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv5_4'
kernel_init = initializer.conv2D_init(name=name)
self.conv5_4 = tf.keras.layers.Conv2D(512, [3, 3], [1, 1], padding='SAME', use_bias=False, name=name,kernel_initializer=kernel_init)
name = 'conv5_4_bn'
gamma_init, beta_init, moving_mean_init, moving_variance_innit = initializer.bn_init(name)
self.conv5_4_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name=name,gamma_initializer=gamma_init,beta_initializer=beta_init,moving_mean_initializer=moving_mean_init,moving_variance_initializer=moving_variance_innit)
name = 'conv6'
kernel_init, bias_init = initializer.conv2D_init(name=name,bias=True)
self.conv6 = tf.keras.layers.Conv2D(num_classes, [1, 1], [1, 1], use_bias=True,name=name,kernel_initializer=kernel_init, bias_initializer=bias_init)
else:
self.conv1_1_3x3_s2 = tf.keras.layers.Conv2D(64, [3, 3], [2, 2], padding='SAME', use_bias=False, name='conv1_1_3x3_s2')
self.conv1_1_3x3_s2_bn = tf.keras.layers.BatchNormalization(momentum=0.95,epsilon=1e-5,name='conv1_1_3x3_s2_bn')
self.conv1_2_3x3 = tf.keras.layers.Conv2D(64, [3, 3], [1, 1], padding='SAME', use_bias=False, name='conv1_2_3x3')
self.conv1_2_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95,epsilon=1e-5,name='conv1_2_3x3_bn')
self.conv1_3_3x3 = tf.keras.layers.Conv2D(128, [3, 3], [1, 1], padding='SAME', use_bias=False,name='conv1_3_3x3')
self.conv1_3_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95,epsilon=1e-5,name='conv1_3_3x3_bn')
self.conv2_1_1x1_proj = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name='conv2_1_1x1_proj')
self.conv2_1_1x1_proj_bn = tf.keras.layers.BatchNormalization(momentum=0.95,epsilon=1e-5,name='conv2_1_1x1_proj_bn')
self.conv2_1_1x1_reduce = tf.keras.layers.Conv2D(64, [1,1], [1,1], use_bias=False,name='conv2_1_1x1_reduce')
self.conv2_1_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv2_1_1x1_reduce_bn')
self.conv2_1_3x3 = tf.keras.layers.Conv2D(64, [3,3], [1,1], use_bias=False,name='conv2_1_3x3')
self.conv2_1_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv2_1_3x3_bn')
self.conv2_1_1x1_increase = tf.keras.layers.Conv2D(256, [1,1], [1,1], use_bias=False,name='conv2_1_1x1_increase')
self.conv2_1_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv2_1_1x1_increase_bn')
self.conv2_2_1x1_reduce = tf.keras.layers.Conv2D(64, [1,1], [1,1], use_bias=False,name='conv2_2_1x1_reduce')
self.conv2_2_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv2_2_1x1_reduce_bn')
self.conv2_2_3x3 = tf.keras.layers.Conv2D(64, [3,3], [1,1], use_bias=False,name='conv2_2_3x3')
self.conv2_2_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv2_2_3x3_bn')
self.conv2_2_1x1_increase = tf.keras.layers.Conv2D(256, [1,1], [1,1], use_bias=False,name='conv2_2_1x1_increase')
self.conv2_2_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv2_2_1x1_increase_bn')
self.conv2_3_1x1_reduce = tf.keras.layers.Conv2D(64, [1, 1], [1, 1], use_bias=False,name='conv2_3_1x1_reduce')
self.conv2_3_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv2_3_1x1_reduce_bn')
self.conv2_3_3x3 = tf.keras.layers.Conv2D(64, [3, 3], [1, 1], use_bias=False,name='conv2_3_3x3')
self.conv2_3_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv2_3_3x3_bn')
self.conv2_3_1x1_increase = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name='conv2_3_1x1_increase')
self.conv2_3_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv2_3_1x1_increase_bn')
self.conv3_1_1x1_proj = tf.keras.layers.Conv2D(512, [1, 1], [2, 2], use_bias=False,name='conv3_1_1x1_proj')
self.conv3_1_1x1_proj_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv3_1_1x1_proj_bn')
self.conv3_1_1x1_reduce = tf.keras.layers.Conv2D(128, [1, 1], [2, 2], use_bias=False,name='conv3_1_1x1_reduce')
self.conv3_1_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv3_1_1x1_reduce_bn')
self.conv3_1_3x3 = tf.keras.layers.Conv2D(128, [3, 3], [1, 1], use_bias=False,name='conv3_1_3x3')
self.conv3_1_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv3_1_3x3_bn')
self.conv3_1_1x1_increase = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name='conv3_1_1x1_increase')
self.conv3_1_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv3_1_1x1_increase_bn')
self.conv3_2_1x1_reduce = tf.keras.layers.Conv2D(128, [1, 1], [1, 1], use_bias=False,name='conv3_2_1x1_reduce')
self.conv3_2_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv3_2_1x1_reduce_bn')
self.conv3_2_3x3 = tf.keras.layers.Conv2D(128, [3, 3], [1, 1], use_bias=False,name='conv3_2_3x3')
self.conv3_2_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv3_2_3x3_bn')
self.conv3_2_1x1_increase = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False, name='conv3_2_1x1_increase')
self.conv3_2_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv3_2_1x1_increase_bn')
self.conv3_3_1x1_reduce = tf.keras.layers.Conv2D(128, [1, 1], [1, 1], use_bias=False,name='conv3_3_1x1_reduce')
self.conv3_3_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv3_3_1x1_reduce_bn')
self.conv3_3_3x3 = tf.keras.layers.Conv2D(128, [3, 3], [1, 1], use_bias=False,name='conv3_3_3x3')
self.conv3_3_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv3_3_3x3_bn')
self.conv3_3_1x1_increase = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name='conv3_3_1x1_increase')
self.conv3_3_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv3_3_1x1_increase_bn')
self.conv3_4_1x1_reduce = tf.keras.layers.Conv2D(128, [1, 1], [1, 1], use_bias=False,name='conv3_4_1x1_reduce')
self.conv3_4_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv3_4_1x1_reduce_bn')
self.conv3_4_3x3 = tf.keras.layers.Conv2D(128, [3, 3], [1, 1], use_bias=False,name='conv3_4_3x3')
self.conv3_4_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv3_4_3x3_bn')
self.conv3_4_1x1_increase = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name='conv3_4_1x1_increase')
self.conv3_4_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv3_4_1x1_increase_bn')
self.conv4_1_1x1_proj = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name='conv4_1_1x1_proj')
self.conv4_1_1x1_proj_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_1_1x1_proj_bn')
self.conv4_1_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name='conv4_1_1x1_reduce')
self.conv4_1_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_1_1x1_reduce_bn')
self.conv4_1_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False,name='conv4_1_3x3')
self.conv4_1_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv4_1_3x3_bn')
self.conv4_1_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name='conv4_1_1x1_increase')
self.conv4_1_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_1_1x1_increase_bn')
self.conv4_2_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name='conv4_2_1x1_reduce')
self.conv4_2_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_2_1x1_reduce_bn')
self.conv4_2_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False,name='conv4_2_3x3')
self.conv4_2_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv4_2_3x3_bn')
self.conv4_2_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name='conv4_2_1x1_increase')
self.conv4_2_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_2_1x1_increase_bn')
self.conv4_3_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name='conv4_3_1x1_reduce')
self.conv4_3_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_3_1x1_reduce_bn')
self.conv4_3_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False,name='conv4_3_3x3')
self.conv4_3_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv4_3_3x3_bn')
self.conv4_3_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name='conv4_3_1x1_increase')
self.conv4_3_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_3_1x1_increase_bn')
self.conv4_4_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name='conv4_4_1x1_reduce')
self.conv4_4_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_4_1x1_reduce_bn')
self.conv4_4_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False,name='conv4_4_3x3')
self.conv4_4_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv4_4_3x3_bn')
self.conv4_4_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name='conv4_4_1x1_increase')
self.conv4_4_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_4_1x1_increase_bn')
self.conv4_5_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name='conv4_5_1x1_reduce')
self.conv4_5_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_5_1x1_reduce_bn')
self.conv4_5_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False,name='conv4_5_3x3')
self.conv4_5_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv4_5_3x3_bn')
self.conv4_5_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name='conv4_5_1x1_increase')
self.conv4_5_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_5_1x1_increase_bn')
self.conv4_6_1x1_reduce = tf.keras.layers.Conv2D(256, [1, 1], [1, 1], use_bias=False,name='conv4_6_1x1_reduce')
self.conv4_6_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_6_1x1_reduce_bn')
self.conv4_6_3x3 = tf.keras.layers.Conv2D(256, [3, 3], dilation_rate=2, use_bias=False,name='conv4_6_3x3')
self.conv4_6_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv4_6_3x3_bn')
self.conv4_6_1x1_increase = tf.keras.layers.Conv2D(1024, [1, 1], [1, 1], use_bias=False,name='conv4_6_1x1_increase')
self.conv4_6_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv4_6_1x1_increase_bn')
self.conv5_1_1x1_proj = tf.keras.layers.Conv2D(2048, [1, 1], [1, 1], use_bias=False,name='conv5_1_1x1_proj')
self.conv5_1_1x1_proj_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv5_1_1x1_proj_bn')
self.conv5_1_1x1_reduce = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name='conv5_1_1x1_reduce')
self.conv5_1_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv5_1_1x1_reduce_bn')
self.conv5_1_3x3 = tf.keras.layers.Conv2D(512, [3, 3], dilation_rate=4, use_bias=False,name='conv5_1_3x3')
self.conv5_1_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv5_1_3x3_bn')
self.conv5_1_1x1_increase = tf.keras.layers.Conv2D(2048, [1, 1], [1, 1], use_bias=False,name='conv5_1_1x1_increase')
self.conv5_1_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv5_1_1x1_increase_bn')
self.conv5_2_1x1_reduce = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name='conv5_2_1x1_reduce')
self.conv5_2_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv5_2_1x1_reduce_bn')
self.conv5_2_3x3 = tf.keras.layers.Conv2D(512, [3, 3], dilation_rate=4, use_bias=False,name='conv5_2_3x3')
self.conv5_2_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv5_2_3x3_bn')
self.conv5_2_1x1_increase = tf.keras.layers.Conv2D(2048, [1, 1], [1, 1], use_bias=False,name='conv5_2_1x1_increase')
self.conv5_2_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv5_2_1x1_increase_bn')
self.conv5_3_1x1_reduce = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name='conv5_3_1x1_reduce')
self.conv5_3_1x1_reduce_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv5_3_1x1_reduce_bn')
self.conv5_3_3x3 = tf.keras.layers.Conv2D(512, [3, 3], dilation_rate=4, use_bias=False,name='conv5_3_3x3')
self.conv5_3_3x3_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv5_3_3x3_bn')
self.conv5_3_1x1_increase = tf.keras.layers.Conv2D(2048, [1, 1], [1, 1], use_bias=False,name='conv5_3_1x1_increase')
self.conv5_3_1x1_increase_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv5_3_1x1_increase_bn')
self.conv5_3_pool1_conv = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name='conv5_3_pool1_conv')
self.conv5_3_pool1_conv_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv5_3_pool1_conv_bn')
self.conv5_3_pool2_conv = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name='conv5_3_pool2_conv')
self.conv5_3_pool2_conv_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5, name='conv5_3_pool2_conv_bn')
self.conv5_3_pool3_conv = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name='conv5_3_pool3_conv')
self.conv5_3_pool3_conv_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv5_3_pool3_conv_bn')
self.conv5_3_pool6_conv = tf.keras.layers.Conv2D(512, [1, 1], [1, 1], use_bias=False,name='conv5_3_pool6_conv')
self.conv5_3_pool6_conv_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv5_3_pool6_conv_bn')
self.conv5_4 = tf.keras.layers.Conv2D(512, [3, 3], [1, 1], padding='SAME', use_bias=False,name='conv5_4')
self.conv5_4_bn = tf.keras.layers.BatchNormalization(momentum=0.95, epsilon=1e-5,name='conv5_4_bn')
self.conv6 = tf.keras.layers.Conv2D(num_classes, [1, 1], [1, 1], use_bias=True,name='conv6')
def call(self, input, is_training=False):
output_conv1_1_3x3_s2 = self.conv1_1_3x3_s2(input)
output_conv1_1_3x3_s2_bn = tf.nn.relu(self.conv1_1_3x3_s2_bn(output_conv1_1_3x3_s2, is_training))
output_conv1_2_3x3 = self.conv1_2_3x3(output_conv1_1_3x3_s2_bn)
output_conv1_2_3x3_bn = tf.nn.relu(self.conv1_2_3x3_bn(output_conv1_2_3x3, is_training))
output_conv1_3_3x3 = self.conv1_3_3x3(output_conv1_2_3x3_bn)
output_conv1_3_3x3_bn = tf.nn.relu(self.conv1_3_3x3_bn(output_conv1_3_3x3,is_training))
output_pool1_3x3_s2 = tf.nn.max_pool(output_conv1_3_3x3_bn, [1, 3, 3, 1], [1, 2, 2, 1], padding='SAME', data_format='NHWC', name='pool1_3x3_s2')
output_conv2_1_1x1_proj = self.conv2_1_1x1_proj(output_pool1_3x3_s2)
output_conv2_1_1x1_proj_bn = self.conv2_1_1x1_proj_bn(output_conv2_1_1x1_proj, is_training)
output_conv2_1_1x1_reduce = self.conv2_1_1x1_reduce(output_pool1_3x3_s2)
output_conv2_1_1x1_reduce_bn = tf.nn.relu(self.conv2_1_1x1_reduce_bn(output_conv2_1_1x1_reduce, is_training))
pad_mat = np.array([[0, 0], [1, 1], [1, 1], [0, 0]])
output_padding1 = tf.pad(output_conv2_1_1x1_reduce_bn, paddings=pad_mat, name='padding1')
output_conv2_1_3x3 = self.conv2_1_3x3(output_padding1)
output_conv2_1_3x3_bn = tf.nn.relu(self.conv2_1_3x3_bn(output_conv2_1_3x3,is_training))
output_conv2_1_1x1_increase = self.conv2_1_1x1_increase(output_conv2_1_3x3_bn)
output_conv2_1_1x1_increase_bn = self.conv2_1_1x1_increase_bn(output_conv2_1_1x1_increase, is_training)
output_conv2_1 = tf.add_n([output_conv2_1_1x1_proj_bn,output_conv2_1_1x1_increase_bn], name='conv2_1')
output_conv2_1_relu = tf.nn.relu(output_conv2_1, name='conv2_1/relu')
output_conv2_2_1x1_reduce = self.conv2_2_1x1_reduce(output_conv2_1_relu)
output_conv2_2_1x1_reduce_bn = tf.nn.relu(self.conv2_2_1x1_reduce_bn(output_conv2_2_1x1_reduce,is_training))
pad_mat = np.array([[0, 0], [1, 1], [1, 1], [0, 0]])
output_padding2 = tf.pad(output_conv2_2_1x1_reduce_bn, paddings=pad_mat, name='padding2')
output_conv2_2_3x3 = self.conv2_2_3x3(output_padding2)
output_conv2_2_3x3_bn = tf.nn.relu(self.conv2_2_3x3_bn(output_conv2_2_3x3,is_training))
output_conv2_2_1x1_increase = self.conv2_2_1x1_increase(output_conv2_2_3x3_bn)
output_conv2_2_1x1_increase_bn = self.conv2_2_1x1_increase_bn(output_conv2_2_1x1_increase,is_training)
output_conv2_2 = tf.add_n([output_conv2_1_relu,output_conv2_2_1x1_increase_bn],name='conv2_2')
output_conv2_2_relu = tf.nn.relu(output_conv2_2, name='conv2_2/relu')
output_conv2_3_1x1_reduce = self.conv2_3_1x1_reduce(output_conv2_2_relu)
output_conv2_3_1x1_reduce_bn = tf.nn.relu(self.conv2_3_1x1_reduce_bn(output_conv2_3_1x1_reduce, is_training))
pad_mat = np.array([[0, 0], [1, 1], [1, 1], [0, 0]])
output_padding3 = tf.pad(output_conv2_3_1x1_reduce_bn, paddings=pad_mat, name='padding3')
output_conv2_3_3x3 = self.conv2_3_3x3(output_padding3)
output_conv2_3_3x3_bn = tf.nn.relu(self.conv2_3_3x3_bn(output_conv2_3_3x3, is_training))
output_conv2_3_1x1_increase = self.conv2_3_1x1_increase(output_conv2_3_3x3_bn)
output_conv2_3_1x1_increase_bn = self.conv2_3_1x1_increase_bn(output_conv2_3_1x1_increase, is_training)
output_conv2_3 = tf.add_n([output_conv2_2_relu, output_conv2_3_1x1_increase_bn], name='conv2_3')
output_conv2_3_relu = tf.nn.relu(output_conv2_3, name='conv2_3/relu')
output_conv3_1_1x1_proj = self.conv3_1_1x1_proj(output_conv2_3_relu)
output_conv3_1_1x1_proj_bn = self.conv3_1_1x1_proj_bn(output_conv3_1_1x1_proj,is_training)
output_conv3_1_1x1_reduce = self.conv3_1_1x1_reduce(output_conv2_3_relu)
output_conv3_1_1x1_reduce_bn = tf.nn.relu(self.conv3_1_1x1_reduce_bn(output_conv3_1_1x1_reduce, is_training))
pad_mat = np.array([[0, 0], [1, 1], [1, 1], [0, 0]])
output_padding4 = tf.pad(output_conv3_1_1x1_reduce_bn, paddings=pad_mat, name='padding4')
output_conv3_1_3x3 = self.conv3_1_3x3(output_padding4)
output_conv3_1_3x3_bn = tf.nn.relu(self.conv3_1_3x3_bn(output_conv3_1_3x3,is_training))
output_conv3_1_1x1_increase = self.conv3_1_1x1_increase(output_conv3_1_3x3_bn)
output_conv3_1_1x1_increase_bn = self.conv3_1_1x1_increase_bn(output_conv3_1_1x1_increase,is_training)
output_conv3_1 = tf.add_n([output_conv3_1_1x1_proj_bn,output_conv3_1_1x1_increase_bn],name='conv3_1')
output_conv3_1_relu = tf.nn.relu(output_conv3_1, name='conv3_1/relu')
output_conv3_2_1x1_reduce = self.conv3_2_1x1_reduce(output_conv3_1_relu)
output_conv3_2_1x1_reduce_bn = tf.nn.relu(self.conv3_2_1x1_reduce_bn(output_conv3_2_1x1_reduce,is_training))
pad_mat = np.array([[0, 0], [1, 1], [1, 1], [0, 0]])
output_padding5 = tf.pad(output_conv3_2_1x1_reduce_bn, paddings=pad_mat, name='padding5')
output_conv3_2_3x3 = self.conv3_2_3x3(output_padding5)
output_conv3_2_3x3_bn = tf.nn.relu(self.conv3_2_3x3_bn(output_conv3_2_3x3,is_training))
output_conv3_2_1x1_increase = self.conv3_2_1x1_increase(output_conv3_2_3x3_bn)
output_conv3_2_1x1_increase_bn = self.conv3_2_1x1_increase_bn(output_conv3_2_1x1_increase,is_training)
output_conv3_2 = tf.add_n([output_conv3_1_relu, output_conv3_2_1x1_increase_bn], name='conv3_2')
output_conv3_2_relu = tf.nn.relu(output_conv3_2, name='conv3_2/relu')
output_conv3_3_1x1_reduce = self.conv3_3_1x1_reduce(output_conv3_2_relu)
output_conv3_3_1x1_reduce_bn = tf.nn.relu(self.conv3_3_1x1_reduce_bn(output_conv3_3_1x1_reduce, is_training))
pad_mat = np.array([[0, 0], [1, 1], [1, 1], [0, 0]])
output_padding6 = tf.pad(output_conv3_3_1x1_reduce_bn, paddings=pad_mat, name='padding6')
output_conv3_3_3x3 = self.conv3_3_3x3(output_padding6)
output_conv3_3_3x3_bn = tf.nn.relu(self.conv3_3_3x3_bn(output_conv3_3_3x3, is_training))
output_conv3_3_1x1_increase = self.conv3_3_1x1_increase(output_conv3_3_3x3_bn)
output_conv3_3_1x1_increase_bn = self.conv3_3_1x1_increase_bn(output_conv3_3_1x1_increase, is_training)
output_conv3_3 = tf.add_n([output_conv3_2_relu, output_conv3_3_1x1_increase_bn], name='conv3_3')
output_conv3_3_relu = tf.nn.relu(output_conv3_3, name='conv3_3/relu')
output_conv3_4_1x1_reduce = self.conv3_4_1x1_reduce(output_conv3_3_relu)
output_conv3_4_1x1_reduce_bn = tf.nn.relu(self.conv3_4_1x1_reduce_bn(output_conv3_4_1x1_reduce, is_training))
pad_mat = np.array([[0, 0], [1, 1], [1, 1], [0, 0]])
output_padding7 = tf.pad(output_conv3_4_1x1_reduce_bn, paddings=pad_mat, name='padding7')
output_conv3_4_3x3 = self.conv3_4_3x3(output_padding7)
output_conv3_4_3x3_bn = tf.nn.relu(self.conv3_4_3x3_bn(output_conv3_4_3x3, is_training))
output_conv3_4_1x1_increase = self.conv3_4_1x1_increase(output_conv3_4_3x3_bn)
output_conv3_4_1x1_increase_bn = self.conv3_4_1x1_increase_bn(output_conv3_4_1x1_increase, is_training)
output_conv3_4 = tf.add_n([output_conv3_3_relu, output_conv3_4_1x1_increase_bn], name='conv3_4')
output_conv3_4_relu = tf.nn.relu(output_conv3_4, name='conv3_4/relu')
output_conv4_1_1x1_proj = self.conv4_1_1x1_proj(output_conv3_4_relu)
output_conv4_1_1x1_proj_bn = self.conv4_1_1x1_proj_bn(output_conv4_1_1x1_proj, is_training)
output_conv4_1_1x1_reduce = self.conv4_1_1x1_reduce(output_conv3_4_relu)
output_conv4_1_1x1_reduce_bn = tf.nn.relu(self.conv4_1_1x1_reduce_bn(output_conv4_1_1x1_reduce))
pad_mat = np.array([[0, 0], [2, 2], [2, 2], [0, 0]])
output_padding8 = tf.pad(output_conv4_1_1x1_reduce_bn, paddings=pad_mat, name='padding8')
output_conv4_1_3x3 = self.conv4_1_3x3(output_padding8)
output_conv4_1_3x3_bn = tf.nn.relu(self.conv4_1_3x3_bn(output_conv4_1_3x3, is_training))
output_conv4_1_1x1_increase = self.conv4_1_1x1_increase(output_conv4_1_3x3_bn)
output_conv4_1_1x1_increase_bn = self.conv4_1_1x1_increase_bn(output_conv4_1_1x1_increase, is_training)
output_conv4_1 = tf.add_n([output_conv4_1_1x1_proj_bn, output_conv4_1_1x1_increase_bn], name='conv4_1')
output_conv4_1_relu = tf.nn.relu(output_conv4_1, name='conv4_1/relu')
output_conv4_2_1x1_reduce = self.conv4_2_1x1_reduce(output_conv4_1_relu)
output_conv4_2_1x1_reduce_bn = tf.nn.relu(self.conv4_2_1x1_reduce_bn(output_conv4_2_1x1_reduce, is_training))
pad_mat = np.array([[0, 0], [2, 2], [2, 2], [0, 0]])
output_padding9 = tf.pad(output_conv4_2_1x1_reduce_bn, paddings=pad_mat, name='padding9')
output_conv4_2_3x3 = self.conv4_2_3x3(output_padding9)
output_conv4_2_3x3_bn = tf.nn.relu(self.conv4_2_3x3_bn(output_conv4_2_3x3, is_training))
output_conv4_2_1x1_increase = self.conv4_2_1x1_increase(output_conv4_2_3x3_bn)
output_conv4_2_1x1_increase_bn = self.conv4_2_1x1_increase_bn(output_conv4_2_1x1_increase,is_training)
output_conv4_2 = tf.add_n([output_conv4_1_relu,output_conv4_2_1x1_increase_bn], name='conv4_2')
output_conv4_2_relu = tf.nn.relu(output_conv4_2, name='conv4_2/relu')
output_conv4_3_1x1_reduce = self.conv4_3_1x1_reduce(output_conv4_2_relu)
output_conv4_3_1x1_reduce_bn = tf.nn.relu(self.conv4_3_1x1_reduce_bn(output_conv4_3_1x1_reduce,is_training))
pad_mat = np.array([[0, 0], [2, 2], [2, 2], [0, 0]])
output_padding10 = tf.pad(output_conv4_3_1x1_reduce_bn, paddings=pad_mat, name='padding10')
output_conv4_3_3x3 = self.conv4_3_3x3(output_padding10)
output_conv4_3_3x3_bn = tf.nn.relu(self.conv4_3_3x3_bn(output_conv4_3_3x3,is_training))
output_conv4_3_1x1_increase = self.conv4_3_1x1_increase(output_conv4_3_3x3_bn)
output_conv4_3_1x1_increase_bn = self.conv4_3_1x1_increase_bn(output_conv4_3_1x1_increase,is_training)
output_conv4_3 = tf.add_n([output_conv4_2_relu, output_conv4_3_1x1_increase_bn], name='conv4_3')
output_conv4_3_relu = tf.nn.relu(output_conv4_3, name='conv4_3/relu')
output_conv4_4_1x1_reduce = self.conv4_4_1x1_reduce(output_conv4_3_relu)
output_conv4_4_1x1_reduce_bn = tf.nn.relu(self.conv4_4_1x1_reduce_bn(output_conv4_4_1x1_reduce, is_training))
pad_mat = np.array([[0, 0], [2, 2], [2, 2], [0, 0]])
output_padding11 = tf.pad(output_conv4_4_1x1_reduce_bn, paddings=pad_mat, name='padding11')
output_conv4_4_3x3 = self.conv4_4_3x3(output_padding11)
output_conv4_4_3x3_bn = tf.nn.relu(self.conv4_4_3x3_bn(output_conv4_4_3x3, is_training))
output_conv4_4_1x1_increase = self.conv4_4_1x1_increase(output_conv4_4_3x3_bn)
output_conv4_4_1x1_increase_bn = self.conv4_4_1x1_increase_bn(output_conv4_4_1x1_increase, is_training)
output_conv4_4 = tf.add_n([output_conv4_3_relu, output_conv4_4_1x1_increase_bn], name='conv4_4')
output_conv4_4_relu = tf.nn.relu(output_conv4_4, name='conv4_4/relu')
output_conv4_5_1x1_reduce = self.conv4_5_1x1_reduce(output_conv4_4_relu)
output_conv4_5_1x1_reduce_bn = tf.nn.relu(self.conv4_5_1x1_reduce_bn(output_conv4_5_1x1_reduce, is_training))
pad_mat = np.array([[0, 0], [2, 2], [2, 2], [0, 0]])
output_padding12 = tf.pad(output_conv4_5_1x1_reduce_bn, paddings=pad_mat, name='padding12')
output_conv4_5_3x3 = self.conv4_5_3x3(output_padding12)
output_conv4_5_3x3_bn = tf.nn.relu(self.conv4_5_3x3_bn(output_conv4_5_3x3, is_training))
output_conv4_5_1x1_increase = self.conv4_5_1x1_increase(output_conv4_5_3x3_bn)
output_conv4_5_1x1_increase_bn = self.conv4_5_1x1_increase_bn(output_conv4_5_1x1_increase, is_training)
output_conv4_5 = tf.add_n([output_conv4_4_relu, output_conv4_5_1x1_increase_bn], name='conv4_5')
output_conv4_5_relu = tf.nn.relu(output_conv4_5, name='conv4_5/relu')
output_conv4_6_1x1_reduce = self.conv4_6_1x1_reduce(output_conv4_5_relu)
output_conv4_6_1x1_reduce_bn = tf.nn.relu(self.conv4_6_1x1_reduce_bn(output_conv4_6_1x1_reduce, is_training))
pad_mat = np.array([[0, 0], [2, 2], [2, 2], [0, 0]])
output_padding13 = tf.pad(output_conv4_6_1x1_reduce_bn, paddings=pad_mat, name='padding13')
output_conv4_6_3x3 = self.conv4_6_3x3(output_padding13)
output_conv4_6_3x3_bn = tf.nn.relu(self.conv4_6_3x3_bn(output_conv4_6_3x3, is_training))
output_conv4_6_1x1_increase = self.conv4_6_1x1_increase(output_conv4_6_3x3_bn)
output_conv4_6_1x1_increase_bn = self.conv4_6_1x1_increase_bn(output_conv4_6_1x1_increase, is_training)
output_conv4_6 = tf.add_n([output_conv4_5_relu,output_conv4_6_1x1_increase_bn], name='conv4_6')
output_conv4_6_relu = tf.nn.relu(output_conv4_6,name='conv4_6/relu')
output_conv5_1_1x1_proj = self.conv5_1_1x1_proj(output_conv4_6_relu)
output_conv5_1_1x1_proj_bn = self.conv5_1_1x1_proj_bn(output_conv5_1_1x1_proj)
output_conv5_1_1x1_reduce = self.conv5_1_1x1_reduce(output_conv4_6_relu)
output_conv5_1_1x1_reduce_bn = tf.nn.relu(self.conv5_1_1x1_reduce_bn(output_conv5_1_1x1_reduce,is_training))
pad_mat = np.array([[0, 0], [4, 4], [4, 4], [0, 0]])
output_padding31 = tf.pad(output_conv5_1_1x1_reduce_bn, paddings=pad_mat, name='padding31')
output_conv5_1_3x3 = self.conv5_1_3x3(output_padding31)
output_conv5_1_3x3_bn = tf.nn.relu(self.conv5_1_3x3_bn(output_conv5_1_3x3,is_training))
output_conv5_1_1x1_increase = self.conv5_1_1x1_increase(output_conv5_1_3x3_bn)
output_conv5_1_1x1_increase_bn = self.conv5_1_1x1_increase_bn(output_conv5_1_1x1_increase)
output_conv5_1 = tf.add_n([output_conv5_1_1x1_proj_bn,output_conv5_1_1x1_increase_bn], name='conv5_1')
output_conv5_1_relu = tf.nn.relu(output_conv5_1,name='conv5_1/relu')
output_conv5_2_1x1_reduce = self.conv5_2_1x1_reduce(output_conv5_1_relu)
output_conv5_2_1x1_reduce_bn = tf.nn.relu(self.conv5_2_1x1_reduce_bn(output_conv5_2_1x1_reduce, is_training))
pad_mat = np.array([[0, 0], [4, 4], [4, 4], [0, 0]])
output_padding32 = tf.pad(output_conv5_2_1x1_reduce_bn, paddings=pad_mat, name='padding32')
output_conv5_2_3x3 = self.conv5_2_3x3(output_padding32)
output_conv5_2_3x3_bn = tf.nn.relu(self.conv5_2_3x3_bn(output_conv5_2_3x3, is_training))
output_conv5_2_1x1_increase = self.conv5_2_1x1_increase(output_conv5_2_3x3_bn)
output_conv5_2_1x1_increase_bn = self.conv5_2_1x1_increase_bn(output_conv5_2_1x1_increase)
output_conv5_2 = tf.add_n([output_conv5_1_relu,output_conv5_2_1x1_increase_bn], name='conv5_2')
output_conv5_2_relu = tf.nn.relu(output_conv5_2, name='conv5_2/relu')
output_conv5_3_1x1_reduce = self.conv5_3_1x1_reduce(output_conv5_2_relu)
output_conv5_3_1x1_reduce_bn = tf.nn.relu(self.conv5_3_1x1_reduce_bn(output_conv5_3_1x1_reduce,is_training))
pad_mat = np.array([[0, 0], [4, 4], [4, 4], [0, 0]])
output_padding33 = tf.pad(output_conv5_3_1x1_reduce_bn, paddings=pad_mat, name='padding33')
output_conv5_3_3x3 = self.conv5_3_3x3(output_padding33)
output_conv5_3_3x3_bn = tf.nn.relu(self.conv5_3_3x3_bn(output_conv5_3_3x3,is_training))
output_conv5_3_1x1_increase = self.conv5_3_1x1_increase(output_conv5_3_3x3_bn)
output_conv5_3_1x1_increase_bn = tf.nn.relu(self.conv5_3_1x1_increase_bn(output_conv5_3_1x1_increase,is_training))
output_conv5_3 = tf.add_n([output_conv5_2_relu, output_conv5_3_1x1_increase_bn], name='conv5_3')
output_conv5_3_relu = tf.nn.relu(output_conv5_3, name='conv5_3_relu')
shape = tf.shape(output_conv5_3_relu)[1:3]
output_conv5_3_pool1 = tf.nn.avg_pool(output_conv5_3_relu, [60, 60], [60, 60], padding='VALID', name='conv5_3_pool1')
output_conv5_3_pool1_conv = self.conv5_3_pool1_conv(output_conv5_3_pool1)
output_conv5_3_pool1_conv_bn = tf.nn.relu(self.conv5_3_pool1_conv_bn(output_conv5_3_pool1_conv, is_training))
output_conv5_3_pool1_interp = tf.image.resize(output_conv5_3_pool1_conv_bn,size=shape,name='conv5_3_pool1_interp')
output_conv5_3_pool2 = tf.nn.avg_pool(output_conv5_3_relu, [30,30], [30,30], padding='VALID', name='conv5_3_pool2')
output_conv5_3_pool2_conv = self.conv5_3_pool2_conv(output_conv5_3_pool2)
output_conv5_3_pool2_conv_bn = tf.nn.relu(self.conv5_3_pool2_conv_bn(output_conv5_3_pool2_conv, is_training))
output_conv5_3_pool2_interp = tf.image.resize(output_conv5_3_pool2_conv_bn, size=shape, name='conv5_3_pool2_interp')
output_conv5_3_pool3 = tf.nn.avg_pool(output_conv5_3_relu, [20, 20], [20, 20], padding='VALID',name='conv5_3_pool3')
output_conv5_3_pool3_conv = self.conv5_3_pool3_conv(output_conv5_3_pool3)
output_conv5_3_pool3_conv_bn = tf.nn.relu(self.conv5_3_pool3_conv_bn(output_conv5_3_pool3_conv, is_training))
output_conv5_3_pool3_interp = tf.image.resize(output_conv5_3_pool3_conv_bn, size=shape,name='conv5_3_pool3_interp')
output_conv5_3_pool6 = tf.nn.avg_pool(output_conv5_3_relu, [10, 10], [10, 10], padding='VALID',name='conv5_3_pool6')
output_conv5_3_pool6_conv = self.conv5_3_pool6_conv(output_conv5_3_pool6)
output_conv5_3_pool6_conv_bn = tf.nn.relu(self.conv5_3_pool6_conv_bn(output_conv5_3_pool6_conv, is_training))
output_conv5_3_pool6_interp = tf.image.resize(output_conv5_3_pool6_conv_bn, size=shape,name='conv5_3_pool6_interp')
output_conv5_3_concat = tf.concat(axis=-1, values=[output_conv5_3_relu,output_conv5_3_pool6_interp,
output_conv5_3_pool3_interp,output_conv5_3_pool2_interp,
output_conv5_3_pool1_interp], name='conv5_3_concat')
output_conv5_4 = self.conv5_4(output_conv5_3_concat)
output_conv5_4_bn = tf.nn.relu(self.conv5_4_bn(output_conv5_4,is_training))
output_conv6 = self.conv6(output_conv5_4_bn)
return output_conv6