''' CONV_DEFS = [ mobilenet_v1.Conv(kernel=[3, 3], stride=2, depth=32), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=64), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=2, depth=128), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=128), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=2, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256) ] ''' CONV_DEFS = [ mobilenet_v1.Conv(kernel=[3, 3], stride=2, depth=96), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=2, depth=384), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=512), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=2, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256) ]
def _get_mobilenet_conv_no_last_stride_defs(conv_depth_ratio_in_percentage): if conv_depth_ratio_in_percentage not in [25, 50, 75, 100]: raise ValueError( 'Only the following ratio percentages are supported: 25, 50, 75, 100') conv_depth_ratio_in_percentage = float(conv_depth_ratio_in_percentage) / 100.0 channels = np.array([ 32, 64, 128, 128, 256, 256, 512, 512, 512, 512, 512, 512, 1024, 1024 ], dtype=np.float32) channels = (channels * conv_depth_ratio_in_percentage).astype(np.int32) return [ mobilenet_v1.Conv(kernel=[3, 3], stride=2, depth=channels[0]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=channels[1]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=2, depth=channels[2]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=channels[3]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=2, depth=channels[4]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=channels[5]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=2, depth=channels[6]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=channels[7]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=channels[8]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=channels[9]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=channels[10]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=channels[11]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=channels[12]), mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=channels[13]) ]
def _create_modified_mobilenet_config(): conv_defs = copy.deepcopy(mobilenet_v1.MOBILENETV1_CONV_DEFS) conv_defs[-2] = mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=2, depth=512) conv_defs[-1] = mobilenet_v1.DepthSepConv(kernel=[3, 3], stride=1, depth=256) return conv_defs