def get_model(args): global reg reg = args.reg input_img = Input((3, 32, 32)) x = input_img x = SCL(BN(x)) x = C(x, 128, 7, 2) x = SCRES(x, 128, 16) x = SCL(BN(x)) x = C(x, 128, 3, 2) x = SCRES(x, 128, 16) x = SCL(BN(x)) x = C(x, 128, 3, 2) x = SCRES(x, 128, 16) x = SCL(BN(x)) x = C(x, 128, 3, 2) x = SCRES(x, 128, 16) x = SCL(BN(x)) x = C(x, 128, 3, 2) x = SCRES(x, 128, 16) x = SCL(BN(x)) x = D(x, 128, 3, 2) x = SCRES(x, 128, 16) x = SCL(BN(x)) x = D(x, 128, 3, 2) x = SCRES(x, 128, 16) x = SCL(BN(x)) x = D(x, 128, 3, 2) x = SCRES(x, 128, 16) x = SCL(BN(x)) x = D(x, 128, 3, 2) x = SCRES(x, 128, 16) x = SCL(BN(x)) x = D(x, 3, 7, 2) x = SCL(x) return Model(input_img, x)
def get_model(args): global reg reg = args.reg def RB(x): for _ in range(4): x = SCRES(x, 128, 64) return x input_img = Input((3,32,32)) x = input_img x = SCL(BN(x)) x = C(x, 128, 7, 2) x = RB(x) x = SCL(BN(x)) x = C(x, 128, 3, 2) x = RB(x) x = SCL(BN(x)) x = C(x, 128, 3, 2) x = RB(x) x = SCL(BN(x)) x = C(x, 128, 3, 2) x = SCL(BN(x)) x = C(x, 128, 3, 2) x = SCL(BN(x), name="bottleneck") x = D(x, 128, 3, 2) x = SCL(BN(x)) x = D(x, 128, 3, 2) x = RB(x) x = SCL(BN(x)) x = D(x, 128, 3, 2) x = RB(x) x = SCL(BN(x)) x = D(x, 128, 3, 2) x = RB(x) x = SCL(BN(x)) x = D(x, 3, 7, 2) x = SCL(x) return Model(input_img, x)
def __init__(self, classes=20, p=5, q=3): ''' :param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth multiplier :param q: depth multiplier ''' super(ESPNetEncoder, self).__init__() self.level1 = CBR(3, 16, 3, 2) self.sample1 = InputProjectionA(1) self.sample2 = InputProjectionA(2) self.b1 = BR(16 + 3) self.level2_0 = DownSamplerB(16 + 3, 64) self.level2 = nn.ModuleList() for i in range(0, p): self.level2.append(DilatedParallelResidualBlockB(64, 64)) self.b2 = BR(128 + 3) self.level3_0 = DownSamplerB(128 + 3, 128) self.level3 = nn.ModuleList() for i in range(0, q): self.level3.append(DilatedParallelResidualBlockB(128, 128)) self.b3 = BR(256) self.classifier = C(256, classes, 1, 1)
def get_model(args): global reg reg = args.reg input_img = Input((3, 32, 32)) x = input_img x = R(BN(x)) x = C(x, 128, 7, 2) x = R(BN(x)) x = C(x, 128, 3, 2) x = R(BN(x)) x = C(x, 128, 3, 2) x = R(BN(x)) x = C(x, 128, 3, 2) x = R(BN(x)) x = C(x, 128, 3, 2) x = R(BN(x)) x = D(x, 128, 3, 2) x = R(BN(x)) x = D(x, 128, 3, 2) x = R(BN(x)) x = D(x, 128, 3, 2) x = R(BN(x)) x = D(x, 128, 3, 2) x = R(BN(x)) x = D(x, 3, 7, 2) x = Lambda(lambda x: clip(x, -2.5, 2.5) + 0.001 * x)(x) return Model(input_img, x)