Skip to content

Instantly share code, notes, and snippets.

@sadimanna
Last active April 11, 2019 05:47
Show Gist options
  • Save sadimanna/38abd9e67426c58be93094bbcdebe6ed to your computer and use it in GitHub Desktop.
Save sadimanna/38abd9e67426c58be93094bbcdebe6ed to your computer and use it in GitHub Desktop.
Inception Resnet A
def incresA(x,scale,name=None):
pad = 'same'
branch0 = conv2d(x,32,1,1,pad,True,name=name+'b0')
branch1 = conv2d(x,32,1,1,pad,True,name=name+'b1_1')
branch1 = conv2d(branch1,32,3,1,pad,True,name=name+'b1_2')
branch2 = conv2d(x,32,1,1,pad,True,name=name+'b2_1')
branch2 = conv2d(branch2,48,3,1,pad,True,name=name+'b2_2')
branch2 = conv2d(branch2,64,3,1,pad,True,name=name+'b2_3')
branches = [branch0,branch1,branch2]
mixed = Concatenate(axis=3, name=name + '_concat')(branches)
filt_exp_1x1 = conv2d(mixed,384,1,1,pad,False,name=name+'filt_exp_1x1')
final_lay = Lambda(lambda inputs, scale: inputs[0] + inputs[1] * scale,
output_shape=backend.int_shape(x)[1:],
arguments={'scale': scale},
name=name+'act_scaling')([x, filt_exp_1x1])
return final_lay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment