-
Notifications
You must be signed in to change notification settings - Fork 1
/
GoogLeNet_V1_Model.py
773 lines (701 loc) · 61.3 KB
/
GoogLeNet_V1_Model.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
import h5py
import numpy as np
import tensorflow as tf
import scipy.io
import collections
import random
import sys
class CNN_Triplet_Metric(object):
def __init__(self,sess):
np.set_printoptions(threshold=np.nan)
self.var_dict = self.Variables_Dict()
img_a = tf.placeholder(tf.float32, [None, 227, 227, 3])
self.sess = sess
print 'loding image mean file'
image_mean = scipy.io.loadmat('imagenet_mean.mat')
image_mean = image_mean['image_mean']
image_mean = np.transpose(image_mean,(1,2,0))
image_mean = np.expand_dims(image_mean,axis=0)
print 'done loading image mean file'
print 'constructing model'
with tf.variable_scope("") as scope:
a_output = self.CNN_Metric_Model(img_a)
print 'done constructing model'
print 'initialize variables '
self.sess.run(tf.global_variables_initializer())
print 'done initializing'
def Variables_Dict(self):
print 'Loading MAT file for pretrained'
pretrained_weights = scipy.io.loadmat('tf_ckpt_from_caffe.mat')
Conv2d_1a_7x7 = tf.constant(np.transpose(pretrained_weights['conv1/7x7_s2'],(2,3,1,0)))
Conv2d_2b_1x1 = tf.constant(np.transpose(pretrained_weights['conv2/3x3_reduce'],(2,3,1,0)))
Conv2d_2c_3x3 = tf.constant(np.transpose(pretrained_weights['conv2/3x3'],(2,3,1,0)))
Conv2d_1a_7x7_bias = tf.constant(pretrained_weights['conv1/7x7_s2_bias'].flatten())
Conv2d_2b_1x1_bias = tf.constant(pretrained_weights['conv2/3x3_reduce_bias'].flatten())
Conv2d_2c_3x3_bias = tf.constant(pretrained_weights['conv2/3x3_bias'].flatten())
# first inception
Mixed_3b_Branch_0_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_3a/1x1'],(2,3,1,0)))
Mixed_3b_Branch_1_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_3a/3x3_reduce'], (2,3, 1, 0)))
Mixed_3b_Branch_1_Conv2d_0b_3x3 = tf.constant(np.transpose(pretrained_weights['inception_3a/3x3'], (2,3, 1, 0)))
Mixed_3b_Branch_2_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_3a/5x5_reduce'], (2,3, 1, 0)))
Mixed_3b_Branch_2_Conv2d_0b_5x5 = tf.constant(np.transpose(pretrained_weights['inception_3a/5x5'], (2,3, 1, 0)))
Mixed_3b_Branch_3_Conv2d_0b_1x1 = tf.constant(np.transpose(pretrained_weights['inception_3a/pool_proj'], (2,3, 1, 0)))
# first inception bias
Mixed_3b_Branch_0_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_3a/1x1_bias'].flatten())
Mixed_3b_Branch_1_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_3a/3x3_reduce_bias'].flatten())
Mixed_3b_Branch_1_Conv2d_0b_3x3_bias = tf.constant(pretrained_weights['inception_3a/3x3_bias'].flatten())
Mixed_3b_Branch_2_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_3a/5x5_reduce_bias'].flatten())
Mixed_3b_Branch_2_Conv2d_0b_5x5_bias = tf.constant(pretrained_weights['inception_3a/5x5_bias'].flatten())
Mixed_3b_Branch_3_Conv2d_0b_1x1_bias = tf.constant(pretrained_weights['inception_3a/pool_proj_bias'].flatten())
# second inception
Mixed_3c_Branch_0_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_3b/1x1'], (2,3, 1, 0)))
Mixed_3c_Branch_1_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_3b/3x3_reduce'], (2,3, 1, 0)))
Mixed_3c_Branch_1_Conv2d_0b_3x3 = tf.constant(np.transpose(pretrained_weights['inception_3b/3x3'], (2,3, 1, 0)))
Mixed_3c_Branch_2_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_3b/5x5_reduce'], (2,3, 1, 0)))
Mixed_3c_Branch_2_Conv2d_0b_5x5 = tf.constant(np.transpose(pretrained_weights['inception_3b/5x5'], (2,3, 1, 0)))
Mixed_3c_Branch_3_Conv2d_0b_1x1 = tf.constant(np.transpose(pretrained_weights['inception_3b/pool_proj'], (2,3, 1, 0)))
# second inception bias
Mixed_3c_Branch_0_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_3b/1x1_bias'].flatten())
Mixed_3c_Branch_1_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_3b/3x3_reduce_bias'].flatten())
Mixed_3c_Branch_1_Conv2d_0b_3x3_bias = tf.constant(pretrained_weights['inception_3b/3x3_bias'].flatten())
Mixed_3c_Branch_2_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_3b/5x5_reduce_bias'].flatten())
Mixed_3c_Branch_2_Conv2d_0b_5x5_bias = tf.constant(pretrained_weights['inception_3b/5x5_bias'].flatten())
Mixed_3c_Branch_3_Conv2d_0b_1x1_bias = tf.constant(pretrained_weights['inception_3b/pool_proj_bias'].flatten())
# third inception
Mixed_4b_Branch_0_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4a/1x1'], (2,3, 1, 0)))
Mixed_4b_Branch_1_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4a/3x3_reduce'], (2,3, 1, 0)))
Mixed_4b_Branch_1_Conv2d_0b_3x3 = tf.constant(np.transpose(pretrained_weights['inception_4a/3x3'], (2,3, 1, 0)))
Mixed_4b_Branch_2_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4a/5x5_reduce'], (2,3, 1, 0)))
Mixed_4b_Branch_2_Conv2d_0b_5x5 = tf.constant(np.transpose(pretrained_weights['inception_4a/5x5'], (2,3, 1, 0)))
Mixed_4b_Branch_3_Conv2d_0b_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4a/pool_proj'], (2,3, 1, 0)))
# third inception bias
Mixed_4b_Branch_0_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4a/1x1_bias'].flatten())
Mixed_4b_Branch_1_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4a/3x3_reduce_bias'].flatten())
Mixed_4b_Branch_1_Conv2d_0b_3x3_bias = tf.constant(pretrained_weights['inception_4a/3x3_bias'].flatten())
Mixed_4b_Branch_2_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4a/5x5_reduce_bias'].flatten())
Mixed_4b_Branch_2_Conv2d_0b_5x5_bias = tf.constant(pretrained_weights['inception_4a/5x5_bias'].flatten())
Mixed_4b_Branch_3_Conv2d_0b_1x1_bias = tf.constant(pretrained_weights['inception_4a/pool_proj_bias'].flatten())
# fourth inception
Mixed_4c_Branch_0_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4b/1x1'], (2,3, 1, 0)))
Mixed_4c_Branch_1_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4b/3x3_reduce'], (2,3, 1, 0)))
Mixed_4c_Branch_1_Conv2d_0b_3x3 = tf.constant(np.transpose(pretrained_weights['inception_4b/3x3'], (2,3, 1, 0)))
Mixed_4c_Branch_2_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4b/5x5_reduce'], (2,3, 1, 0)))
Mixed_4c_Branch_2_Conv2d_0b_5x5 = tf.constant(np.transpose(pretrained_weights['inception_4b/5x5'], (2,3, 1, 0)))
Mixed_4c_Branch_3_Conv2d_0b_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4b/pool_proj'], (2,3, 1, 0)))
# fourth inception bias
Mixed_4c_Branch_0_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4b/1x1_bias'].flatten())
Mixed_4c_Branch_1_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4b/3x3_reduce_bias'].flatten())
Mixed_4c_Branch_1_Conv2d_0b_3x3_bias = tf.constant(pretrained_weights['inception_4b/3x3_bias'].flatten())
Mixed_4c_Branch_2_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4b/5x5_reduce_bias'].flatten())
Mixed_4c_Branch_2_Conv2d_0b_5x5_bias = tf.constant(pretrained_weights['inception_4b/5x5_bias'].flatten())
Mixed_4c_Branch_3_Conv2d_0b_1x1_bias = tf.constant(pretrained_weights['inception_4b/pool_proj_bias'].flatten())
# fifth inception
Mixed_4d_Branch_0_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4c/1x1'], (2,3, 1, 0)))
Mixed_4d_Branch_1_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4c/3x3_reduce'], (2,3, 1, 0)))
Mixed_4d_Branch_1_Conv2d_0b_3x3 = tf.constant(np.transpose(pretrained_weights['inception_4c/3x3'], (2,3, 1, 0)))
Mixed_4d_Branch_2_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4c/5x5_reduce'], (2,3, 1, 0)))
Mixed_4d_Branch_2_Conv2d_0b_5x5 = tf.constant(np.transpose(pretrained_weights['inception_4c/5x5'], (2,3, 1, 0)))
Mixed_4d_Branch_3_Conv2d_0b_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4c/pool_proj'], (2,3, 1, 0)))
# fifth inception bias
Mixed_4d_Branch_0_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4c/1x1_bias'].flatten())
Mixed_4d_Branch_1_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4c/3x3_reduce_bias'].flatten())
Mixed_4d_Branch_1_Conv2d_0b_3x3_bias = tf.constant(pretrained_weights['inception_4c/3x3_bias'].flatten())
Mixed_4d_Branch_2_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4c/5x5_reduce_bias'].flatten())
Mixed_4d_Branch_2_Conv2d_0b_5x5_bias = tf.constant(pretrained_weights['inception_4c/5x5_bias'].flatten())
Mixed_4d_Branch_3_Conv2d_0b_1x1_bias = tf.constant(pretrained_weights['inception_4c/pool_proj_bias'].flatten())
# sixth inception
Mixed_4e_Branch_0_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4d/1x1'], (2,3, 1, 0)))
Mixed_4e_Branch_1_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4d/3x3_reduce'], (2,3, 1, 0)))
Mixed_4e_Branch_1_Conv2d_0b_3x3 = tf.constant(np.transpose(pretrained_weights['inception_4d/3x3'], (2,3, 1, 0)))
Mixed_4e_Branch_2_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4d/5x5_reduce'], (2,3, 1, 0)))
Mixed_4e_Branch_2_Conv2d_0b_5x5 = tf.constant(np.transpose(pretrained_weights['inception_4d/5x5'], (2,3, 1, 0)))
Mixed_4e_Branch_3_Conv2d_0b_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4d/pool_proj'], (2,3, 1, 0)))
# sixth inception bias
Mixed_4e_Branch_0_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4d/1x1_bias'].flatten())
Mixed_4e_Branch_1_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4d/3x3_reduce_bias'].flatten())
Mixed_4e_Branch_1_Conv2d_0b_3x3_bias = tf.constant(pretrained_weights['inception_4d/3x3_bias'].flatten())
Mixed_4e_Branch_2_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4d/5x5_reduce_bias'].flatten())
Mixed_4e_Branch_2_Conv2d_0b_5x5_bias = tf.constant(pretrained_weights['inception_4d/5x5_bias'].flatten())
Mixed_4e_Branch_3_Conv2d_0b_1x1_bias = tf.constant(pretrained_weights['inception_4d/pool_proj_bias'].flatten())
# seventh inception
Mixed_4f_Branch_0_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4e/1x1'], (2,3, 1, 0)))
Mixed_4f_Branch_1_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4e/3x3_reduce'], (2,3, 1, 0)))
Mixed_4f_Branch_1_Conv2d_0b_3x3 = tf.constant(np.transpose(pretrained_weights['inception_4e/3x3'], (2,3, 1, 0)))
Mixed_4f_Branch_2_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4e/5x5_reduce'], (2,3, 1, 0)))
Mixed_4f_Branch_2_Conv2d_0b_5x5 = tf.constant(np.transpose(pretrained_weights['inception_4e/5x5'], (2,3, 1, 0)))
Mixed_4f_Branch_3_Conv2d_0b_1x1 = tf.constant(np.transpose(pretrained_weights['inception_4e/pool_proj'], (2,3, 1, 0)))
# seventh inception bias
Mixed_4f_Branch_0_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4e/1x1_bias'].flatten())
Mixed_4f_Branch_1_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4e/3x3_reduce_bias'].flatten())
Mixed_4f_Branch_1_Conv2d_0b_3x3_bias = tf.constant(pretrained_weights['inception_4e/3x3_bias'].flatten())
Mixed_4f_Branch_2_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_4e/5x5_reduce_bias'].flatten())
Mixed_4f_Branch_2_Conv2d_0b_5x5_bias = tf.constant(pretrained_weights['inception_4e/5x5_bias'].flatten())
Mixed_4f_Branch_3_Conv2d_0b_1x1_bias = tf.constant(pretrained_weights['inception_4e/pool_proj_bias'].flatten())
# eighth inception
Mixed_5b_Branch_0_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_5a/1x1'], (2,3, 1, 0)))
Mixed_5b_Branch_1_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_5a/3x3_reduce'], (2,3, 1, 0)))
Mixed_5b_Branch_1_Conv2d_0b_3x3 = tf.constant(np.transpose(pretrained_weights['inception_5a/3x3'], (2,3, 1, 0)))
Mixed_5b_Branch_2_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_5a/5x5_reduce'], (2,3, 1, 0)))
Mixed_5b_Branch_2_Conv2d_0b_5x5 = tf.constant(np.transpose(pretrained_weights['inception_5a/5x5'], (2,3, 1, 0)))
Mixed_5b_Branch_3_Conv2d_0b_1x1 = tf.constant(np.transpose(pretrained_weights['inception_5a/pool_proj'], (2,3, 1, 0)))
# eighth inception bias
Mixed_5b_Branch_0_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_5a/1x1_bias'].flatten())
Mixed_5b_Branch_1_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_5a/3x3_reduce_bias'].flatten())
Mixed_5b_Branch_1_Conv2d_0b_3x3_bias = tf.constant(pretrained_weights['inception_5a/3x3_bias'].flatten())
Mixed_5b_Branch_2_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_5a/5x5_reduce_bias'].flatten())
Mixed_5b_Branch_2_Conv2d_0b_5x5_bias = tf.constant(pretrained_weights['inception_5a/5x5_bias'].flatten())
Mixed_5b_Branch_3_Conv2d_0b_1x1_bias = tf.constant(pretrained_weights['inception_5a/pool_proj_bias'].flatten())
#ninth inception
Mixed_5c_Branch_0_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_5b/1x1'], (2,3, 1, 0)))
Mixed_5c_Branch_1_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_5b/3x3_reduce'], (2,3, 1, 0)))
Mixed_5c_Branch_1_Conv2d_0b_3x3 = tf.constant(np.transpose(pretrained_weights['inception_5b/3x3'], (2,3, 1, 0)))
Mixed_5c_Branch_2_Conv2d_0a_1x1 = tf.constant(np.transpose(pretrained_weights['inception_5b/5x5_reduce'], (2,3, 1, 0)))
Mixed_5c_Branch_2_Conv2d_0b_5x5 = tf.constant(np.transpose(pretrained_weights['inception_5b/5x5'], (2,3, 1, 0)))
Mixed_5c_Branch_3_Conv2d_0b_1x1 = tf.constant(np.transpose(pretrained_weights['inception_5b/pool_proj'], (2,3, 1, 0)))
# ninth inception bias
Mixed_5c_Branch_0_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_5b/1x1_bias'].flatten())
Mixed_5c_Branch_1_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_5b/3x3_reduce_bias'].flatten())
Mixed_5c_Branch_1_Conv2d_0b_3x3_bias = tf.constant(pretrained_weights['inception_5b/3x3_bias'].flatten())
Mixed_5c_Branch_2_Conv2d_0a_1x1_bias = tf.constant(pretrained_weights['inception_5b/5x5_reduce_bias'].flatten())
Mixed_5c_Branch_2_Conv2d_0b_5x5_bias = tf.constant(pretrained_weights['inception_5b/5x5_bias'].flatten())
Mixed_5c_Branch_3_Conv2d_0b_1x1_bias = tf.constant(pretrained_weights['inception_5b/pool_proj_bias'].flatten())
print 'Finished loading'
variables = {
'InceptionV1/Conv2d_1a_7x7/weights':tf.get_variable(name='InceptionV1/Conv2d_1a_7x7/weights',initializer=Conv2d_1a_7x7),
'InceptionV1/Conv2d_2b_1x1/weights': tf.get_variable(name='InceptionV1/Conv2d_2b_1x1/weights',initializer=Conv2d_2b_1x1),
'InceptionV1/Conv2d_2c_3x3/weights': tf.get_variable(name='InceptionV1/Conv2d_2c_3x3/weights',initializer=Conv2d_2c_3x3),
'InceptionV1/Conv2d_1a_7x7/bias': tf.get_variable(name='InceptionV1/Conv2d_1a_7x7/bias',initializer=Conv2d_1a_7x7_bias),
'InceptionV1/Conv2d_2b_1x1/bias': tf.get_variable(name='InceptionV1/Conv2d_2b_1x1/bias',initializer=Conv2d_2b_1x1_bias),
'InceptionV1/Conv2d_2c_3x3/bias': tf.get_variable(name='InceptionV1/Conv2d_2c_3x3/bias',initializer=Conv2d_2c_3x3_bias),
#first inception
'InceptionV1/Mixed_3b/Branch_0/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_0/Conv2d_0a_1x1/weights',initializer=Mixed_3b_Branch_0_Conv2d_0a_1x1),
'InceptionV1/Mixed_3b/Branch_1/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_1/Conv2d_0a_1x1/weights',initializer=Mixed_3b_Branch_1_Conv2d_0a_1x1),
'InceptionV1/Mixed_3b/Branch_1/Conv2d_0b_3x3/weights': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_1/Conv2d_0b_3x3/weights',initializer=Mixed_3b_Branch_1_Conv2d_0b_3x3),
'InceptionV1/Mixed_3b/Branch_2/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_2/Conv2d_0a_1x1/weights',initializer=Mixed_3b_Branch_2_Conv2d_0a_1x1),
'InceptionV1/Mixed_3b/Branch_2/Conv2d_0b_5x5/weights': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_2/Conv2d_0b_5x5/weights',initializer=Mixed_3b_Branch_2_Conv2d_0b_5x5),
'InceptionV1/Mixed_3b/Branch_3/Conv2d_0b_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_3/Conv2d_0b_1x1/weights',initializer=Mixed_3b_Branch_3_Conv2d_0b_1x1),
# first inception bias
'InceptionV1/Mixed_3b/Branch_0/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_0/Conv2d_0a_1x1/bias',initializer=Mixed_3b_Branch_0_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_3b/Branch_1/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_1/Conv2d_0a_1x1/bias',initializer=Mixed_3b_Branch_1_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_3b/Branch_1/Conv2d_0b_3x3/bias': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_1/Conv2d_0b_3x3/bias',initializer=Mixed_3b_Branch_1_Conv2d_0b_3x3_bias),
'InceptionV1/Mixed_3b/Branch_2/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_2/Conv2d_0a_1x1/bias',initializer=Mixed_3b_Branch_2_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_3b/Branch_2/Conv2d_0b_5x5/bias': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_2/Conv2d_0b_5x5/bias',initializer=Mixed_3b_Branch_2_Conv2d_0b_5x5_bias),
'InceptionV1/Mixed_3b/Branch_3/Conv2d_0b_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_3b/Branch_3/Conv2d_0b_1x1/bias',initializer=Mixed_3b_Branch_3_Conv2d_0b_1x1_bias),
#second inception
'InceptionV1/Mixed_3c/Branch_0/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_0/Conv2d_0a_1x1/weights',initializer=Mixed_3c_Branch_0_Conv2d_0a_1x1),
'InceptionV1/Mixed_3c/Branch_1/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_1/Conv2d_0a_1x1/weights',initializer=Mixed_3c_Branch_1_Conv2d_0a_1x1),
'InceptionV1/Mixed_3c/Branch_1/Conv2d_0b_3x3/weights': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_1/Conv2d_0b_3x3/weights',initializer=Mixed_3c_Branch_1_Conv2d_0b_3x3),
'InceptionV1/Mixed_3c/Branch_2/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_2/Conv2d_0a_1x1/weights',initializer=Mixed_3c_Branch_2_Conv2d_0a_1x1),
'InceptionV1/Mixed_3c/Branch_2/Conv2d_0b_5x5/weights': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_2/Conv2d_0b_5x5/weights',initializer=Mixed_3c_Branch_2_Conv2d_0b_5x5),
'InceptionV1/Mixed_3c/Branch_3/Conv2d_0b_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_3/Conv2d_0b_1x1/weights',initializer=Mixed_3c_Branch_3_Conv2d_0b_1x1),
# second inception bias
'InceptionV1/Mixed_3c/Branch_0/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_0/Conv2d_0a_1x1/bias',initializer=Mixed_3c_Branch_0_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_3c/Branch_1/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_1/Conv2d_0a_1x1/bias',initializer=Mixed_3c_Branch_1_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_3c/Branch_1/Conv2d_0b_3x3/bias': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_1/Conv2d_0b_3x3/bias',initializer=Mixed_3c_Branch_1_Conv2d_0b_3x3_bias),
'InceptionV1/Mixed_3c/Branch_2/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_2/Conv2d_0a_1x1/bias',initializer=Mixed_3c_Branch_2_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_3c/Branch_2/Conv2d_0b_5x5/bias': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_2/Conv2d_0b_5x5/bias',initializer=Mixed_3c_Branch_2_Conv2d_0b_5x5_bias),
'InceptionV1/Mixed_3c/Branch_3/Conv2d_0b_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_3c/Branch_3/Conv2d_0b_1x1/bias',initializer=Mixed_3c_Branch_3_Conv2d_0b_1x1_bias),
#third inception
'InceptionV1/Mixed_4b/Branch_0/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_0/Conv2d_0a_1x1/weights',initializer=Mixed_4b_Branch_0_Conv2d_0a_1x1),
'InceptionV1/Mixed_4b/Branch_1/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_1/Conv2d_0a_1x1/weights',initializer=Mixed_4b_Branch_1_Conv2d_0a_1x1),
'InceptionV1/Mixed_4b/Branch_1/Conv2d_0b_3x3/weights': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_1/Conv2d_0b_3x3/weights',initializer=Mixed_4b_Branch_1_Conv2d_0b_3x3),
'InceptionV1/Mixed_4b/Branch_2/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_2/Conv2d_0a_1x1/weights',initializer=Mixed_4b_Branch_2_Conv2d_0a_1x1),
'InceptionV1/Mixed_4b/Branch_2/Conv2d_0b_5x5/weights': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_2/Conv2d_0b_5x5/weights',initializer=Mixed_4b_Branch_2_Conv2d_0b_5x5),
'InceptionV1/Mixed_4b/Branch_3/Conv2d_0b_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_3/Conv2d_0b_1x1/weights',initializer=Mixed_4b_Branch_3_Conv2d_0b_1x1),
# third inception bias
'InceptionV1/Mixed_4b/Branch_0/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_0/Conv2d_0a_1x1/bias',initializer=Mixed_4b_Branch_0_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4b/Branch_1/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_1/Conv2d_0a_1x1/bias',initializer=Mixed_4b_Branch_1_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4b/Branch_1/Conv2d_0b_3x3/bias': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_1/Conv2d_0b_3x3/bias',initializer=Mixed_4b_Branch_1_Conv2d_0b_3x3_bias),
'InceptionV1/Mixed_4b/Branch_2/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_2/Conv2d_0a_1x1/bias',initializer=Mixed_4b_Branch_2_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4b/Branch_2/Conv2d_0b_5x5/bias': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_2/Conv2d_0b_5x5/bias',initializer=Mixed_4b_Branch_2_Conv2d_0b_5x5_bias),
'InceptionV1/Mixed_4b/Branch_3/Conv2d_0b_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4b/Branch_3/Conv2d_0b_1x1/bias',initializer=Mixed_4b_Branch_3_Conv2d_0b_1x1_bias),
# fourth inception
'InceptionV1/Mixed_4c/Branch_0/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_0/Conv2d_0a_1x1/weights',initializer=Mixed_4c_Branch_0_Conv2d_0a_1x1),
'InceptionV1/Mixed_4c/Branch_1/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_1/Conv2d_0a_1x1/weights',initializer=Mixed_4c_Branch_1_Conv2d_0a_1x1),
'InceptionV1/Mixed_4c/Branch_1/Conv2d_0b_3x3/weights': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_1/Conv2d_0b_3x3/weights',initializer=Mixed_4c_Branch_1_Conv2d_0b_3x3),
'InceptionV1/Mixed_4c/Branch_2/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_2/Conv2d_0a_1x1/weights',initializer=Mixed_4c_Branch_2_Conv2d_0a_1x1),
'InceptionV1/Mixed_4c/Branch_2/Conv2d_0b_5x5/weights': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_2/Conv2d_0b_5x5/weights',initializer=Mixed_4c_Branch_2_Conv2d_0b_5x5),
'InceptionV1/Mixed_4c/Branch_3/Conv2d_0b_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_3/Conv2d_0b_1x1/weights',initializer=Mixed_4c_Branch_3_Conv2d_0b_1x1),
# fourth inception bias
'InceptionV1/Mixed_4c/Branch_0/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_0/Conv2d_0a_1x1/bias',initializer=Mixed_4c_Branch_0_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4c/Branch_1/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_1/Conv2d_0a_1x1/bias',initializer=Mixed_4c_Branch_1_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4c/Branch_1/Conv2d_0b_3x3/bias': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_1/Conv2d_0b_3x3/bias',initializer=Mixed_4c_Branch_1_Conv2d_0b_3x3_bias),
'InceptionV1/Mixed_4c/Branch_2/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_2/Conv2d_0a_1x1/bias',initializer=Mixed_4c_Branch_2_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4c/Branch_2/Conv2d_0b_5x5/bias': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_2/Conv2d_0b_5x5/bias',initializer=Mixed_4c_Branch_2_Conv2d_0b_5x5_bias),
'InceptionV1/Mixed_4c/Branch_3/Conv2d_0b_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4c/Branch_3/Conv2d_0b_1x1/bias',initializer=Mixed_4c_Branch_3_Conv2d_0b_1x1_bias),
# fifth inception
'InceptionV1/Mixed_4d/Branch_0/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_0/Conv2d_0a_1x1/weights',initializer=Mixed_4d_Branch_0_Conv2d_0a_1x1),
'InceptionV1/Mixed_4d/Branch_1/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_1/Conv2d_0a_1x1/weights',initializer=Mixed_4d_Branch_1_Conv2d_0a_1x1),
'InceptionV1/Mixed_4d/Branch_1/Conv2d_0b_3x3/weights': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_1/Conv2d_0b_3x3/weights',initializer=Mixed_4d_Branch_1_Conv2d_0b_3x3),
'InceptionV1/Mixed_4d/Branch_2/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_2/Conv2d_0a_1x1/weights',initializer=Mixed_4d_Branch_2_Conv2d_0a_1x1),
'InceptionV1/Mixed_4d/Branch_2/Conv2d_0b_5x5/weights': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_2/Conv2d_0b_5x5/weights',initializer=Mixed_4d_Branch_2_Conv2d_0b_5x5),
'InceptionV1/Mixed_4d/Branch_3/Conv2d_0b_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_3/Conv2d_0b_1x1/weights',initializer=Mixed_4d_Branch_3_Conv2d_0b_1x1),
# fifth inception bias
'InceptionV1/Mixed_4d/Branch_0/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_0/Conv2d_0a_1x1/bias',initializer=Mixed_4d_Branch_0_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4d/Branch_1/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_1/Conv2d_0a_1x1/bias',initializer=Mixed_4d_Branch_1_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4d/Branch_1/Conv2d_0b_3x3/bias': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_1/Conv2d_0b_3x3/bias',initializer=Mixed_4d_Branch_1_Conv2d_0b_3x3_bias),
'InceptionV1/Mixed_4d/Branch_2/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_2/Conv2d_0a_1x1/bias',initializer=Mixed_4d_Branch_2_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4d/Branch_2/Conv2d_0b_5x5/bias': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_2/Conv2d_0b_5x5/bias',initializer=Mixed_4d_Branch_2_Conv2d_0b_5x5_bias),
'InceptionV1/Mixed_4d/Branch_3/Conv2d_0b_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4d/Branch_3/Conv2d_0b_1x1/bias',initializer=Mixed_4d_Branch_3_Conv2d_0b_1x1_bias),
# sixth inception
'InceptionV1/Mixed_4e/Branch_0/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_0/Conv2d_0a_1x1/weights',initializer=Mixed_4e_Branch_0_Conv2d_0a_1x1),
'InceptionV1/Mixed_4e/Branch_1/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_1/Conv2d_0a_1x1/weights',initializer=Mixed_4e_Branch_1_Conv2d_0a_1x1),
'InceptionV1/Mixed_4e/Branch_1/Conv2d_0b_3x3/weights': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_1/Conv2d_0b_3x3/weights',initializer=Mixed_4e_Branch_1_Conv2d_0b_3x3),
'InceptionV1/Mixed_4e/Branch_2/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_2/Conv2d_0a_1x1/weights',initializer=Mixed_4e_Branch_2_Conv2d_0a_1x1),
'InceptionV1/Mixed_4e/Branch_2/Conv2d_0b_5x5/weights': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_2/Conv2d_0b_5x5/weights',initializer=Mixed_4e_Branch_2_Conv2d_0b_5x5),
'InceptionV1/Mixed_4e/Branch_3/Conv2d_0b_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_3/Conv2d_0b_1x1/weights',initializer=Mixed_4e_Branch_3_Conv2d_0b_1x1),
# sixth inception bias
'InceptionV1/Mixed_4e/Branch_0/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_0/Conv2d_0a_1x1/bias',initializer=Mixed_4e_Branch_0_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4e/Branch_1/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_1/Conv2d_0a_1x1/bias',initializer=Mixed_4e_Branch_1_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4e/Branch_1/Conv2d_0b_3x3/bias': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_1/Conv2d_0b_3x3/bias',initializer=Mixed_4e_Branch_1_Conv2d_0b_3x3_bias),
'InceptionV1/Mixed_4e/Branch_2/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_2/Conv2d_0a_1x1/bias',initializer=Mixed_4e_Branch_2_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4e/Branch_2/Conv2d_0b_5x5/bias': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_2/Conv2d_0b_5x5/bias',initializer=Mixed_4e_Branch_2_Conv2d_0b_5x5_bias),
'InceptionV1/Mixed_4e/Branch_3/Conv2d_0b_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4e/Branch_3/Conv2d_0b_1x1/bias',initializer=Mixed_4e_Branch_3_Conv2d_0b_1x1_bias),
# seventh inception
'InceptionV1/Mixed_4f/Branch_0/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_0/Conv2d_0a_1x1/weights',initializer=Mixed_4f_Branch_0_Conv2d_0a_1x1),
'InceptionV1/Mixed_4f/Branch_1/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_1/Conv2d_0a_1x1/weights',initializer=Mixed_4f_Branch_1_Conv2d_0a_1x1),
'InceptionV1/Mixed_4f/Branch_1/Conv2d_0b_3x3/weights': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_1/Conv2d_0b_3x3/weights',initializer=Mixed_4f_Branch_1_Conv2d_0b_3x3),
'InceptionV1/Mixed_4f/Branch_2/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_2/Conv2d_0a_1x1/weights',initializer=Mixed_4f_Branch_2_Conv2d_0a_1x1),
'InceptionV1/Mixed_4f/Branch_2/Conv2d_0b_5x5/weights': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_2/Conv2d_0b_5x5/weights',initializer=Mixed_4f_Branch_2_Conv2d_0b_5x5),
'InceptionV1/Mixed_4f/Branch_3/Conv2d_0b_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_3/Conv2d_0b_1x1/weights',initializer=Mixed_4f_Branch_3_Conv2d_0b_1x1),
# seventh inception bias
'InceptionV1/Mixed_4f/Branch_0/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_0/Conv2d_0a_1x1/bias',initializer=Mixed_4f_Branch_0_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4f/Branch_1/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_1/Conv2d_0a_1x1/bias',initializer=Mixed_4f_Branch_1_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4f/Branch_1/Conv2d_0b_3x3/bias': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_1/Conv2d_0b_3x3/bias',initializer=Mixed_4f_Branch_1_Conv2d_0b_3x3_bias),
'InceptionV1/Mixed_4f/Branch_2/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_2/Conv2d_0a_1x1/bias',initializer=Mixed_4f_Branch_2_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_4f/Branch_2/Conv2d_0b_5x5/bias': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_2/Conv2d_0b_5x5/bias',initializer=Mixed_4f_Branch_2_Conv2d_0b_5x5_bias),
'InceptionV1/Mixed_4f/Branch_3/Conv2d_0b_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_4f/Branch_3/Conv2d_0b_1x1/bias',initializer=Mixed_4f_Branch_3_Conv2d_0b_1x1_bias),
# eighth inception
'InceptionV1/Mixed_5b/Branch_0/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_0/Conv2d_0a_1x1/weights',initializer=Mixed_5b_Branch_0_Conv2d_0a_1x1),
'InceptionV1/Mixed_5b/Branch_1/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_1/Conv2d_0a_1x1/weights',initializer=Mixed_5b_Branch_1_Conv2d_0a_1x1),
'InceptionV1/Mixed_5b/Branch_1/Conv2d_0b_3x3/weights': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_1/Conv2d_0b_3x3/weights',initializer=Mixed_5b_Branch_1_Conv2d_0b_3x3),
'InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_1x1/weights',initializer=Mixed_5b_Branch_2_Conv2d_0a_1x1),
'InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_5x5/weights': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_5x5/weights',initializer=Mixed_5b_Branch_2_Conv2d_0b_5x5),
'InceptionV1/Mixed_5b/Branch_3/Conv2d_0b_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_3/Conv2d_0b_1x1/weights',initializer=Mixed_5b_Branch_3_Conv2d_0b_1x1),
# eighth inception bias
'InceptionV1/Mixed_5b/Branch_0/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_0/Conv2d_0a_1x1/bias',initializer=Mixed_5b_Branch_0_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_5b/Branch_1/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_1/Conv2d_0a_1x1/bias',initializer=Mixed_5b_Branch_1_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_5b/Branch_1/Conv2d_0b_3x3/bias': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_1/Conv2d_0b_3x3/bias',initializer=Mixed_5b_Branch_1_Conv2d_0b_3x3_bias),
'InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_1x1/bias',initializer=Mixed_5b_Branch_2_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_5x5/bias': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_5x5/bias',initializer=Mixed_5b_Branch_2_Conv2d_0b_5x5_bias),
'InceptionV1/Mixed_5b/Branch_3/Conv2d_0b_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_5b/Branch_3/Conv2d_0b_1x1/bias',initializer=Mixed_5b_Branch_3_Conv2d_0b_1x1_bias),
# ninth inception
'InceptionV1/Mixed_5c/Branch_0/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_0/Conv2d_0a_1x1/weights',initializer=Mixed_5c_Branch_0_Conv2d_0a_1x1),
'InceptionV1/Mixed_5c/Branch_1/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_1/Conv2d_0a_1x1/weights',initializer=Mixed_5c_Branch_1_Conv2d_0a_1x1),
'InceptionV1/Mixed_5c/Branch_1/Conv2d_0b_3x3/weights': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_1/Conv2d_0b_3x3/weights',initializer=Mixed_5c_Branch_1_Conv2d_0b_3x3),
'InceptionV1/Mixed_5c/Branch_2/Conv2d_0a_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_2/Conv2d_0a_1x1/weights',initializer=Mixed_5c_Branch_2_Conv2d_0a_1x1),
'InceptionV1/Mixed_5c/Branch_2/Conv2d_0b_5x5/weights': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_2/Conv2d_0b_5x5/weights',initializer=Mixed_5c_Branch_2_Conv2d_0b_5x5),
'InceptionV1/Mixed_5c/Branch_3/Conv2d_0b_1x1/weights': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_3/Conv2d_0b_1x1/weights',initializer=Mixed_5c_Branch_3_Conv2d_0b_1x1),
# ninth inception bias
'InceptionV1/Mixed_5c/Branch_0/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_0/Conv2d_0a_1x1/bias',initializer=Mixed_5c_Branch_0_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_5c/Branch_1/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_1/Conv2d_0a_1x1/bias',initializer=Mixed_5c_Branch_1_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_5c/Branch_1/Conv2d_0b_3x3/bias': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_1/Conv2d_0b_3x3/bias',initializer=Mixed_5c_Branch_1_Conv2d_0b_3x3_bias),
'InceptionV1/Mixed_5c/Branch_2/Conv2d_0a_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_2/Conv2d_0a_1x1/bias',initializer=Mixed_5c_Branch_2_Conv2d_0a_1x1_bias),
'InceptionV1/Mixed_5c/Branch_2/Conv2d_0b_5x5/bias': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_2/Conv2d_0b_5x5/bias',initializer=Mixed_5c_Branch_2_Conv2d_0b_5x5_bias),
'InceptionV1/Mixed_5c/Branch_3/Conv2d_0b_1x1/bias': tf.get_variable(name='InceptionV1/Mixed_5c/Branch_3/Conv2d_0b_1x1/bias',initializer=Mixed_5c_Branch_3_Conv2d_0b_1x1_bias),
}
return variables
def CNN_Metric_Model(self,x):
#layer 1 - conv
w_1 = self.var_dict['InceptionV1/Conv2d_1a_7x7/weights']
b_1 = self.var_dict['InceptionV1/Conv2d_1a_7x7/bias']
padding1 = tf.constant([[0,0],[3,3],[3,3],[0,0]])
input_d = tf.pad(x,paddings=padding1)
h_conv1 = tf.nn.conv2d(input_d, w_1, strides=[1, 2, 2, 1], padding='VALID') + b_1
h_conv1 = tf.nn.relu(h_conv1)
#layer 1 - max pool
padding_format = tf.constant([[0,0],[0,1],[0,1],[0,0]])
h_conv1 = tf.pad(h_conv1,paddings=padding_format)
h_pool1 = tf.nn.max_pool(h_conv1, ksize=[1, 3, 3, 1],
strides=[1, 2, 2, 1], padding='VALID')
#h_pool1 = tf.nn.local_response_normalization(h_pool1,depth_radius=5,alpha=0.0001,beta=0.75)
#layer 2 - conv
w_2 = self.var_dict['InceptionV1/Conv2d_2b_1x1/weights']
b_2 = self.var_dict['InceptionV1/Conv2d_2b_1x1/bias']
h_conv2 = tf.nn.conv2d(h_pool1, w_2, strides=[1, 1, 1, 1], padding='VALID') + b_2
h_conv2 = tf.nn.relu(h_conv2)
#layer 3 - conv
padding3 = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
h_conv2 = tf.pad(h_conv2, paddings=padding3)
w_3 = self.var_dict['InceptionV1/Conv2d_2c_3x3/weights']
b_3 = self.var_dict['InceptionV1/Conv2d_2c_3x3/bias']
h_conv3 = tf.nn.conv2d(h_conv2, w_3, strides=[1, 1, 1, 1], padding='VALID') + b_3
h_conv3 = tf.nn.relu(h_conv3)
#h_conv3 = tf.nn.local_response_normalization(h_conv3, depth_radius=5, alpha=0.0001, beta=0.75)
#layer 3 - max pool
h_pool3 = tf.nn.max_pool(h_conv3, ksize=[1, 3, 3, 1],
strides=[1, 2, 2, 1], padding='VALID')
#mixed layer 3b
#first inception
#branch 0
w_4 = self.var_dict['InceptionV1/Mixed_3b/Branch_0/Conv2d_0a_1x1/weights']
b_4 = self.var_dict['InceptionV1/Mixed_3b/Branch_0/Conv2d_0a_1x1/bias']
branch1_0 = tf.nn.conv2d(h_pool3, w_4, strides=[1, 1, 1, 1], padding='VALID') + b_4
branch1_0 = tf.nn.relu(branch1_0)
#branch 1
w_5 = self.var_dict['InceptionV1/Mixed_3b/Branch_1/Conv2d_0a_1x1/weights']
b_5 = self.var_dict['InceptionV1/Mixed_3b/Branch_1/Conv2d_0a_1x1/bias']
branch1_1 = tf.nn.conv2d(h_pool3, w_5, strides=[1, 1, 1, 1], padding='VALID') + b_5
branch1_1 = tf.nn.relu(branch1_1)
padding6 = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch1_1 = tf.pad(branch1_1, paddings=padding6)
w_6 = self.var_dict['InceptionV1/Mixed_3b/Branch_1/Conv2d_0b_3x3/weights']
b_6 = self.var_dict['InceptionV1/Mixed_3b/Branch_1/Conv2d_0b_3x3/bias']
branch1_1 = tf.nn.conv2d(branch1_1, w_6, strides=[1, 1, 1, 1], padding='VALID') + b_6
branch1_1 = tf.nn.relu(branch1_1)
#branch 2
w_7 = self.var_dict['InceptionV1/Mixed_3b/Branch_2/Conv2d_0a_1x1/weights']
b_7 = self.var_dict['InceptionV1/Mixed_3b/Branch_2/Conv2d_0a_1x1/bias']
branch1_2 = tf.nn.conv2d(h_pool3, w_7, strides=[1, 1, 1, 1], padding='VALID') + b_7
branch1_2 = tf.nn.relu(branch1_2)
padding7 = tf.constant([[0, 0], [2, 2], [2, 2], [0, 0]])
branch1_2 = tf.pad(branch1_2, paddings=padding7)
w_8 = self.var_dict['InceptionV1/Mixed_3b/Branch_2/Conv2d_0b_5x5/weights']
b_8 = self.var_dict['InceptionV1/Mixed_3b/Branch_2/Conv2d_0b_5x5/bias']
branch1_2 = tf.nn.conv2d(branch1_2, w_8, strides=[1, 1, 1, 1], padding='VALID') + b_8
branch1_2 = tf.nn.relu(branch1_2)
#branch 3
padding7 = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch1_3 = tf.pad(h_pool3, paddings=padding7)
branch1_3 = tf.nn.max_pool(branch1_3, ksize=[1, 3, 3, 1],
strides=[1, 1, 1, 1], padding='VALID')
w_9 = self.var_dict['InceptionV1/Mixed_3b/Branch_3/Conv2d_0b_1x1/weights']
b_9 = self.var_dict['InceptionV1/Mixed_3b/Branch_3/Conv2d_0b_1x1/bias']
branch1_3 = tf.nn.conv2d(branch1_3, w_9, strides=[1, 1, 1, 1], padding='VALID') + b_9
branch1_3 = tf.nn.relu(branch1_3)
incpt = tf.concat(
axis=3, values=[branch1_0, branch1_1, branch1_2, branch1_3])
#second inception
#branch 0
w_10 = self.var_dict['InceptionV1/Mixed_3c/Branch_0/Conv2d_0a_1x1/weights']
b_10 = self.var_dict['InceptionV1/Mixed_3c/Branch_0/Conv2d_0a_1x1/bias']
branch2_0 = tf.nn.conv2d(incpt, w_10, strides=[1, 1, 1, 1], padding='VALID') + b_10
branch2_0 = tf.nn.relu(branch2_0)
#branch 1
w_11 = self.var_dict['InceptionV1/Mixed_3c/Branch_1/Conv2d_0a_1x1/weights']
b_11 = self.var_dict['InceptionV1/Mixed_3c/Branch_1/Conv2d_0a_1x1/bias']
branch2_1 = tf.nn.conv2d(incpt, w_11, strides=[1, 1, 1, 1], padding='VALID') + b_11
branch2_1 = tf.nn.relu(branch2_1)
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch2_1 = tf.pad(branch2_1, paddings=padding_format)
w_12 = self.var_dict['InceptionV1/Mixed_3c/Branch_1/Conv2d_0b_3x3/weights']
b_12 = self.var_dict['InceptionV1/Mixed_3c/Branch_1/Conv2d_0b_3x3/bias']
branch2_1 = tf.nn.conv2d(branch2_1, w_12, strides=[1, 1, 1, 1], padding='VALID') + b_12
branch2_1 = tf.nn.relu(branch2_1)
#branch 2
w_13 = self.var_dict['InceptionV1/Mixed_3c/Branch_2/Conv2d_0a_1x1/weights']
b_13 = self.var_dict['InceptionV1/Mixed_3c/Branch_2/Conv2d_0a_1x1/bias']
branch2_2 = tf.nn.conv2d(incpt, w_13, strides=[1, 1, 1, 1], padding='VALID') + b_13
branch2_2 = tf.nn.relu(branch2_2)
padding_format = tf.constant([[0, 0], [2, 2], [2, 2], [0, 0]])
branch2_2 = tf.pad(branch2_2, paddings=padding_format)
w_14 = self.var_dict['InceptionV1/Mixed_3c/Branch_2/Conv2d_0b_5x5/weights']
b_14 = self.var_dict['InceptionV1/Mixed_3c/Branch_2/Conv2d_0b_5x5/bias']
branch2_2 = tf.nn.conv2d(branch2_2, w_14, strides=[1, 1, 1, 1], padding='VALID') + b_14
branch2_2 = tf.nn.relu(branch2_2)
#branch 3
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch2_3 = tf.pad(incpt, paddings=padding_format)
branch2_3 = tf.nn.max_pool(branch2_3, ksize=[1, 3, 3, 1],
strides=[1, 1, 1, 1], padding='VALID')
w_15 = self.var_dict['InceptionV1/Mixed_3c/Branch_3/Conv2d_0b_1x1/weights']
b_15 = self.var_dict['InceptionV1/Mixed_3c/Branch_3/Conv2d_0b_1x1/bias']
branch2_3 = tf.nn.conv2d(branch2_3, w_15, strides=[1, 1, 1, 1], padding='VALID') + b_15
branch2_3 = tf.nn.relu(branch2_3)
incpt = tf.concat(
axis=3, values=[branch2_0, branch2_1, branch2_2, branch2_3])
padding_format = tf.constant([[0,0],[0,1],[0,1],[0,0]])
incpt = tf.pad(incpt,paddings=padding_format)
incpt = tf.nn.max_pool(incpt, ksize=[1, 3, 3, 1],
strides=[1, 2, 2, 1], padding='VALID')
#third inception
#branch 0
w_16 = self.var_dict['InceptionV1/Mixed_4b/Branch_0/Conv2d_0a_1x1/weights']
b_16 = self.var_dict['InceptionV1/Mixed_4b/Branch_0/Conv2d_0a_1x1/bias']
branch3_0 = tf.nn.conv2d(incpt, w_16, strides=[1, 1, 1, 1], padding='VALID') + b_16
branch3_0 = tf.nn.relu(branch3_0)
#branch 1
w_17 = self.var_dict['InceptionV1/Mixed_4b/Branch_1/Conv2d_0a_1x1/weights']
b_17 = self.var_dict['InceptionV1/Mixed_4b/Branch_1/Conv2d_0a_1x1/bias']
branch3_1 = tf.nn.conv2d(incpt, w_17, strides=[1, 1, 1, 1], padding='VALID') + b_17
branch3_1 = tf.nn.relu(branch3_1)
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch3_1 = tf.pad(branch3_1, paddings=padding_format)
w_18 = self.var_dict['InceptionV1/Mixed_4b/Branch_1/Conv2d_0b_3x3/weights']
b_18 = self.var_dict['InceptionV1/Mixed_4b/Branch_1/Conv2d_0b_3x3/bias']
branch3_1 = tf.nn.conv2d(branch3_1, w_18, strides=[1, 1, 1, 1], padding='VALID') + b_18
branch3_1 = tf.nn.relu(branch3_1)
#branch 2
w_19 = self.var_dict['InceptionV1/Mixed_4b/Branch_2/Conv2d_0a_1x1/weights']
b_19 = self.var_dict['InceptionV1/Mixed_4b/Branch_2/Conv2d_0a_1x1/bias']
branch3_2 = tf.nn.conv2d(incpt, w_19, strides=[1, 1, 1, 1], padding='VALID') + b_19
branch3_2 = tf.nn.relu(branch3_2)
padding_format = tf.constant([[0, 0], [2, 2], [2, 2], [0, 0]])
branch3_2 = tf.pad(branch3_2, paddings=padding_format)
w_20 = self.var_dict['InceptionV1/Mixed_4b/Branch_2/Conv2d_0b_5x5/weights']
b_20 = self.var_dict['InceptionV1/Mixed_4b/Branch_2/Conv2d_0b_5x5/bias']
branch3_2 = tf.nn.conv2d(branch3_2, w_20, strides=[1, 1, 1, 1], padding='VALID') + b_20
branch3_2 = tf.nn.relu(branch3_2)
#branch 3
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch3_3 = tf.pad(incpt, paddings=padding_format)
branch3_3 = tf.nn.max_pool(branch3_3, ksize=[1, 3, 3, 1],
strides=[1, 1, 1, 1], padding='VALID')
w_21 = self.var_dict['InceptionV1/Mixed_4b/Branch_3/Conv2d_0b_1x1/weights']
b_21 = self.var_dict['InceptionV1/Mixed_4b/Branch_3/Conv2d_0b_1x1/bias']
branch3_3 = tf.nn.conv2d(branch3_3, w_21, strides=[1, 1, 1, 1], padding='VALID') + b_21
branch3_3 = tf.nn.relu(branch3_3)
incpt = tf.concat(
axis=3, values=[branch3_0, branch3_1, branch3_2, branch3_3])
#fourth inception
#branch 0
w_22 = self.var_dict['InceptionV1/Mixed_4c/Branch_0/Conv2d_0a_1x1/weights']
b_22 = self.var_dict['InceptionV1/Mixed_4c/Branch_0/Conv2d_0a_1x1/bias']
branch4_0 = tf.nn.conv2d(incpt, w_22, strides=[1, 1, 1, 1], padding='VALID') + b_22
branch4_0 = tf.nn.relu(branch4_0)
#branch 1
w_23 = self.var_dict['InceptionV1/Mixed_4c/Branch_1/Conv2d_0a_1x1/weights']
b_23 = self.var_dict['InceptionV1/Mixed_4c/Branch_1/Conv2d_0a_1x1/bias']
branch4_1 = tf.nn.conv2d(incpt, w_23, strides=[1, 1, 1, 1], padding='VALID') + b_23
branch4_1 = tf.nn.relu(branch4_1)
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch4_1 = tf.pad(branch4_1, paddings=padding_format)
w_24 = self.var_dict['InceptionV1/Mixed_4c/Branch_1/Conv2d_0b_3x3/weights']
b_24 = self.var_dict['InceptionV1/Mixed_4c/Branch_1/Conv2d_0b_3x3/bias']
branch4_1 = tf.nn.conv2d(branch4_1, w_24, strides=[1, 1, 1, 1], padding='VALID') + b_24
branch4_1 = tf.nn.relu(branch4_1)
#branch 2
w_25 = self.var_dict['InceptionV1/Mixed_4c/Branch_2/Conv2d_0a_1x1/weights']
b_25 = self.var_dict['InceptionV1/Mixed_4c/Branch_2/Conv2d_0a_1x1/bias']
branch4_2 = tf.nn.conv2d(incpt, w_25, strides=[1, 1, 1, 1], padding='VALID') + b_25
branch4_2 = tf.nn.relu(branch4_2)
padding_format = tf.constant([[0, 0], [2, 2], [2, 2], [0, 0]])
branch4_2 = tf.pad(branch4_2, paddings=padding_format)
w_26 = self.var_dict['InceptionV1/Mixed_4c/Branch_2/Conv2d_0b_5x5/weights']
b_26 = self.var_dict['InceptionV1/Mixed_4c/Branch_2/Conv2d_0b_5x5/bias']
branch4_2 = tf.nn.conv2d(branch4_2, w_26, strides=[1, 1, 1, 1], padding='VALID') + b_26
branch4_2 = tf.nn.relu(branch4_2)
#branch 3
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch4_3 = tf.pad(incpt, paddings=padding_format)
branch4_3 = tf.nn.max_pool(branch4_3, ksize=[1, 3, 3, 1],
strides=[1, 1, 1, 1], padding='VALID')
w_27 = self.var_dict['InceptionV1/Mixed_4c/Branch_3/Conv2d_0b_1x1/weights']
b_27 = self.var_dict['InceptionV1/Mixed_4c/Branch_3/Conv2d_0b_1x1/bias']
branch4_3 = tf.nn.conv2d(branch4_3, w_27, strides=[1, 1, 1, 1], padding='VALID') + b_27
branch4_3 = tf.nn.relu(branch4_3)
incpt = tf.concat(
axis=3, values=[branch4_0, branch4_1, branch4_2, branch4_3])
#fifth inception
#branch 0
w_28 = self.var_dict['InceptionV1/Mixed_4d/Branch_0/Conv2d_0a_1x1/weights']
b_28 = self.var_dict['InceptionV1/Mixed_4d/Branch_0/Conv2d_0a_1x1/bias']
branch5_0 = tf.nn.conv2d(incpt, w_28, strides=[1, 1, 1, 1], padding='VALID') + b_28
branch5_0 = tf.nn.relu(branch5_0)
#branch 1
w_29 = self.var_dict['InceptionV1/Mixed_4d/Branch_1/Conv2d_0a_1x1/weights']
b_29 = self.var_dict['InceptionV1/Mixed_4d/Branch_1/Conv2d_0a_1x1/bias']
branch5_1 = tf.nn.conv2d(incpt, w_29, strides=[1, 1, 1, 1], padding='VALID') + b_29
branch5_1 = tf.nn.relu(branch5_1)
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch5_1 = tf.pad(branch5_1, paddings=padding_format)
w_30 = self.var_dict['InceptionV1/Mixed_4d/Branch_1/Conv2d_0b_3x3/weights']
b_30 = self.var_dict['InceptionV1/Mixed_4d/Branch_1/Conv2d_0b_3x3/bias']
branch5_1 = tf.nn.conv2d(branch5_1, w_30, strides=[1, 1, 1, 1], padding='VALID') + b_30
branch5_1 = tf.nn.relu(branch5_1)
#branch 2
w_31 = self.var_dict['InceptionV1/Mixed_4d/Branch_2/Conv2d_0a_1x1/weights']
b_31 = self.var_dict['InceptionV1/Mixed_4d/Branch_2/Conv2d_0a_1x1/bias']
branch5_2 = tf.nn.conv2d(incpt, w_31, strides=[1, 1, 1, 1], padding='VALID') + b_31
branch5_2 = tf.nn.relu(branch5_2)
padding_format = tf.constant([[0, 0], [2, 2], [2, 2], [0, 0]])
branch5_2 = tf.pad(branch5_2, paddings=padding_format)
w_32 = self.var_dict['InceptionV1/Mixed_4d/Branch_2/Conv2d_0b_5x5/weights']
b_32 = self.var_dict['InceptionV1/Mixed_4d/Branch_2/Conv2d_0b_5x5/bias']
branch5_2 = tf.nn.conv2d(branch5_2, w_32, strides=[1, 1, 1, 1], padding='VALID') + b_32
branch5_2 = tf.nn.relu(branch5_2)
#branch 3
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch5_3 = tf.pad(incpt, paddings=padding_format)
branch5_3 = tf.nn.max_pool(branch5_3, ksize=[1, 3, 3, 1],
strides=[1, 1, 1, 1], padding='VALID')
w_33 = self.var_dict['InceptionV1/Mixed_4d/Branch_3/Conv2d_0b_1x1/weights']
b_33 = self.var_dict['InceptionV1/Mixed_4d/Branch_3/Conv2d_0b_1x1/bias']
branch5_3 = tf.nn.conv2d(branch5_3, w_33, strides=[1, 1, 1, 1], padding='VALID') + b_33
branch5_3 = tf.nn.relu(branch5_3)
incpt = tf.concat(
axis=3, values=[branch5_0, branch5_1, branch5_2, branch5_3])
#sixth inception
#branch 0
w_34 = self.var_dict['InceptionV1/Mixed_4e/Branch_0/Conv2d_0a_1x1/weights']
b_34 = self.var_dict['InceptionV1/Mixed_4e/Branch_0/Conv2d_0a_1x1/bias']
branch6_0 = tf.nn.conv2d(incpt, w_34, strides=[1, 1, 1, 1], padding='VALID') + b_34
branch6_0 = tf.nn.relu(branch6_0)
#branch 1
w_35 = self.var_dict['InceptionV1/Mixed_4e/Branch_1/Conv2d_0a_1x1/weights']
b_35 = self.var_dict['InceptionV1/Mixed_4e/Branch_1/Conv2d_0a_1x1/bias']
branch6_1 = tf.nn.conv2d(incpt, w_35, strides=[1, 1, 1, 1], padding='VALID') + b_35
branch6_1 = tf.nn.relu(branch6_1)
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch6_1 = tf.pad(branch6_1, paddings=padding_format)
w_36 = self.var_dict['InceptionV1/Mixed_4e/Branch_1/Conv2d_0b_3x3/weights']
b_36 = self.var_dict['InceptionV1/Mixed_4e/Branch_1/Conv2d_0b_3x3/bias']
branch6_1 = tf.nn.conv2d(branch6_1, w_36, strides=[1, 1, 1, 1], padding='VALID') + b_36
branch6_1 = tf.nn.relu(branch6_1)
#branch 2
w_37 = self.var_dict['InceptionV1/Mixed_4e/Branch_2/Conv2d_0a_1x1/weights']
b_37 = self.var_dict['InceptionV1/Mixed_4e/Branch_2/Conv2d_0a_1x1/bias']
branch6_2 = tf.nn.conv2d(incpt, w_37, strides=[1, 1, 1, 1], padding='VALID') + b_37
branch6_2 = tf.nn.relu(branch6_2)
padding_format = tf.constant([[0, 0], [2, 2], [2, 2], [0, 0]])
branch6_2 = tf.pad(branch6_2, paddings=padding_format)
w_38 = self.var_dict['InceptionV1/Mixed_4e/Branch_2/Conv2d_0b_5x5/weights']
b_38 = self.var_dict['InceptionV1/Mixed_4e/Branch_2/Conv2d_0b_5x5/bias']
branch6_2 = tf.nn.conv2d(branch6_2, w_38, strides=[1, 1, 1, 1], padding='VALID') + b_38
branch6_2 = tf.nn.relu(branch6_2)
#branch 3
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch6_3 = tf.pad(incpt, paddings=padding_format)
branch6_3 = tf.nn.max_pool(branch6_3, ksize=[1, 3, 3, 1],
strides=[1, 1, 1, 1], padding='VALID')
w_39 = self.var_dict['InceptionV1/Mixed_4e/Branch_3/Conv2d_0b_1x1/weights']
b_39 = self.var_dict['InceptionV1/Mixed_4e/Branch_3/Conv2d_0b_1x1/bias']
branch6_3 = tf.nn.conv2d(branch6_3, w_39, strides=[1, 1, 1, 1], padding='VALID') + b_39
branch6_3 = tf.nn.relu(branch6_3)
incpt = tf.concat(
axis=3, values=[branch6_0, branch6_1, branch6_2, branch6_3])
#seventh inception
#branch 0
w_40 = self.var_dict['InceptionV1/Mixed_4f/Branch_0/Conv2d_0a_1x1/weights']
b_40 = self.var_dict['InceptionV1/Mixed_4f/Branch_0/Conv2d_0a_1x1/bias']
branch7_0 = tf.nn.conv2d(incpt, w_40, strides=[1, 1, 1, 1], padding='VALID') + b_40
branch7_0 = tf.nn.relu(branch7_0)
#branch 1
w_41 = self.var_dict['InceptionV1/Mixed_4f/Branch_1/Conv2d_0a_1x1/weights']
b_41 = self.var_dict['InceptionV1/Mixed_4f/Branch_1/Conv2d_0a_1x1/bias']
branch7_1 = tf.nn.conv2d(incpt, w_41, strides=[1, 1, 1, 1], padding='VALID') + b_41
branch7_1 = tf.nn.relu(branch7_1)
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch7_1 = tf.pad(branch7_1, paddings=padding_format)
w_42 = self.var_dict['InceptionV1/Mixed_4f/Branch_1/Conv2d_0b_3x3/weights']
b_42 = self.var_dict['InceptionV1/Mixed_4f/Branch_1/Conv2d_0b_3x3/bias']
branch7_1 = tf.nn.conv2d(branch7_1, w_42, strides=[1, 1, 1, 1], padding='VALID') + b_42
branch7_1 = tf.nn.relu(branch7_1)
#branch 2
w_43 = self.var_dict['InceptionV1/Mixed_4f/Branch_2/Conv2d_0a_1x1/weights']
b_43 = self.var_dict['InceptionV1/Mixed_4f/Branch_2/Conv2d_0a_1x1/bias']
branch7_2 = tf.nn.conv2d(incpt, w_43, strides=[1, 1, 1, 1], padding='VALID') + b_43
branch7_2 = tf.nn.relu(branch7_2)
padding_format = tf.constant([[0, 0], [2, 2], [2, 2], [0, 0]])
branch7_2 = tf.pad(branch7_2, paddings=padding_format)
w_44 = self.var_dict['InceptionV1/Mixed_4f/Branch_2/Conv2d_0b_5x5/weights']
b_44 = self.var_dict['InceptionV1/Mixed_4f/Branch_2/Conv2d_0b_5x5/bias']
branch7_2 = tf.nn.conv2d(branch7_2, w_44, strides=[1, 1, 1, 1], padding='VALID') + b_44
branch7_2 = tf.nn.relu(branch7_2)
#branch 3
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch7_3 = tf.pad(incpt, paddings=padding_format)
branch7_3 = tf.nn.max_pool(branch7_3, ksize=[1, 3, 3, 1],
strides=[1, 1, 1, 1], padding='VALID')
w_45 = self.var_dict['InceptionV1/Mixed_4f/Branch_3/Conv2d_0b_1x1/weights']
b_45 = self.var_dict['InceptionV1/Mixed_4f/Branch_3/Conv2d_0b_1x1/bias']
branch7_3 = tf.nn.conv2d(branch7_3, w_45, strides=[1, 1, 1, 1], padding='VALID') + b_45
branch7_3 = tf.nn.relu(branch7_3)
incpt = tf.concat(
axis=3, values=[branch7_0, branch7_1, branch7_2, branch7_3])
padding_format = tf.constant([[0, 0], [0, 1], [0, 1], [0, 0]])
incpt = tf.pad(incpt, paddings=padding_format)
incpt = tf.nn.max_pool(incpt, ksize=[1, 3, 3, 1],
strides=[1, 2, 2, 1], padding='VALID')
#eighth inception
#branch 0
w_46 = self.var_dict['InceptionV1/Mixed_5b/Branch_0/Conv2d_0a_1x1/weights']
b_46 = self.var_dict['InceptionV1/Mixed_5b/Branch_0/Conv2d_0a_1x1/bias']
branch8_0 = tf.nn.conv2d(incpt, w_46, strides=[1, 1, 1, 1], padding='VALID') + b_46
branch8_0 = tf.nn.relu(branch8_0)
#branch 1
w_47 = self.var_dict['InceptionV1/Mixed_5b/Branch_1/Conv2d_0a_1x1/weights']
b_47 = self.var_dict['InceptionV1/Mixed_5b/Branch_1/Conv2d_0a_1x1/bias']
branch8_1 = tf.nn.conv2d(incpt, w_47, strides=[1, 1, 1, 1], padding='VALID') + b_47
branch8_1 = tf.nn.relu(branch8_1)
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch8_1 = tf.pad(branch8_1, paddings=padding_format)
w_48 = self.var_dict['InceptionV1/Mixed_5b/Branch_1/Conv2d_0b_3x3/weights']
b_48 = self.var_dict['InceptionV1/Mixed_5b/Branch_1/Conv2d_0b_3x3/bias']
branch8_1 = tf.nn.conv2d(branch8_1, w_48, strides=[1, 1, 1, 1], padding='VALID') + b_48
branch8_1 = tf.nn.relu(branch8_1)
#branch 2
w_49 = self.var_dict['InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_1x1/weights']
b_49 = self.var_dict['InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_1x1/bias']
branch8_2 = tf.nn.conv2d(incpt, w_49, strides=[1, 1, 1, 1], padding='VALID') + b_49
branch8_2 = tf.nn.relu(branch8_2)
padding_format = tf.constant([[0, 0], [2, 2], [2, 2], [0, 0]])
branch8_2 = tf.pad(branch8_2, paddings=padding_format)
w_50 = self.var_dict['InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_5x5/weights']
b_50 = self.var_dict['InceptionV1/Mixed_5b/Branch_2/Conv2d_0a_5x5/bias']
branch8_2 = tf.nn.conv2d(branch8_2, w_50, strides=[1, 1, 1, 1], padding='VALID') + b_50
branch8_2 = tf.nn.relu(branch8_2)
#branch 3
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch8_3 = tf.pad(incpt, paddings=padding_format)
branch8_3 = tf.nn.max_pool(branch8_3, ksize=[1, 3, 3, 1],
strides=[1, 1, 1, 1], padding='VALID')
w_51 = self.var_dict['InceptionV1/Mixed_5b/Branch_3/Conv2d_0b_1x1/weights']
b_51 = self.var_dict['InceptionV1/Mixed_5b/Branch_3/Conv2d_0b_1x1/bias']
branch8_3 = tf.nn.conv2d(branch8_3, w_51, strides=[1, 1, 1, 1], padding='VALID') + b_51
branch8_3 = tf.nn.relu(branch8_3)
incpt = tf.concat(
axis=3, values=[branch8_0, branch8_1, branch8_2, branch8_3])
#ninth inception
#branch 0
w_52 = self.var_dict['InceptionV1/Mixed_5c/Branch_0/Conv2d_0a_1x1/weights']
b_52 = self.var_dict['InceptionV1/Mixed_5c/Branch_0/Conv2d_0a_1x1/bias']
branch9_0 = tf.nn.conv2d(incpt, w_52, strides=[1, 1, 1, 1], padding='VALID') + b_52
branch9_0 = tf.nn.relu(branch9_0)
#branch 1
w_53 = self.var_dict['InceptionV1/Mixed_5c/Branch_1/Conv2d_0a_1x1/weights']
b_53 = self.var_dict['InceptionV1/Mixed_5c/Branch_1/Conv2d_0a_1x1/bias']
branch9_1 = tf.nn.conv2d(incpt, w_53, strides=[1, 1, 1, 1], padding='VALID') + b_53
branch9_1 = tf.nn.relu(branch9_1)
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch9_1 = tf.pad(branch9_1, paddings=padding_format)
w_54 = self.var_dict['InceptionV1/Mixed_5c/Branch_1/Conv2d_0b_3x3/weights']
b_54 = self.var_dict['InceptionV1/Mixed_5c/Branch_1/Conv2d_0b_3x3/bias']
branch9_1 = tf.nn.conv2d(branch9_1, w_54, strides=[1, 1, 1, 1], padding='VALID') + b_54
branch9_1 = tf.nn.relu(branch9_1)
#branch 2
w_55 = self.var_dict['InceptionV1/Mixed_5c/Branch_2/Conv2d_0a_1x1/weights']
b_55 = self.var_dict['InceptionV1/Mixed_5c/Branch_2/Conv2d_0a_1x1/bias']
branch9_2 = tf.nn.conv2d(incpt, w_55, strides=[1, 1, 1, 1], padding='VALID') + b_55
branch9_2 = tf.nn.relu(branch9_2)
padding_format = tf.constant([[0, 0], [2, 2], [2, 2], [0, 0]])
branch9_2 = tf.pad(branch9_2, paddings=padding_format)
w_56 = self.var_dict['InceptionV1/Mixed_5c/Branch_2/Conv2d_0b_5x5/weights']
b_56 = self.var_dict['InceptionV1/Mixed_5c/Branch_2/Conv2d_0b_5x5/bias']
branch9_2 = tf.nn.conv2d(branch9_2, w_56, strides=[1, 1, 1, 1], padding='VALID') + b_56
branch9_2 = tf.nn.relu(branch9_2)
#branch 3
padding_format = tf.constant([[0, 0], [1, 1], [1, 1], [0, 0]])
branch9_3 = tf.pad(incpt, paddings=padding_format)
branch9_3 = tf.nn.max_pool(branch9_3, ksize=[1, 3, 3, 1],
strides=[1, 1, 1, 1], padding='VALID')
w_57 = self.var_dict['InceptionV1/Mixed_5c/Branch_3/Conv2d_0b_1x1/weights']
b_57 = self.var_dict['InceptionV1/Mixed_5c/Branch_3/Conv2d_0b_1x1/bias']
branch9_3 = tf.nn.conv2d(branch9_3, w_57, strides=[1, 1, 1, 1], padding='VALID') + b_57
branch9_3 = tf.nn.relu(branch9_3)
nets = tf.concat(
axis=3, values=[branch9_0, branch9_1, branch9_2, branch9_3])
nets = tf.nn.avg_pool(nets, ksize=[1, 7, 7, 1],
strides=[1, 1, 1, 1], padding='VALID')
nets = tf.reshape(nets, [-1, 1024])
#fc layer
# w_58 = tf.get_variable(shape=[1024,64],name='fc_layer_0/weights')
# b_58 = tf.get_variable(shape=[64],name='fc_layer_0/bias')
# nets = tf.reshape(nets,[-1,1024])
# nets = tf.add(tf.matmul(nets,w_58),b_58)
return nets
if __name__ == "__main__":
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
sess = tf.Session(config=config)
cnn_triplet = CNN_Triplet_Metric(sess=sess)