def __init__(self, num_classes, num_distr, num_repeat): super(ManifoldNetR, self).__init__() params = { 'num_classes': num_classes, 'num_distr': num_distr, 'num_repeat': num_repeat } self.complex_conv1 = complex.ComplexConv2Deffgroup( 1, 40, (5, 1), (2, 1)) self.complex_conv2 = complex.ComplexConv2Deffgroup( 40, 40, (5, 1), (2, 1)) self.SURE = SURE(params, 40, 40, (5, 1), (1, 1), calc_next(29, (5, 1), 1, 20)) self.proj2 = complex.manifoldReLUv2angle(40) #complex.ReLU4Dsp(40) self.relu = nn.ReLU() self.conv_1 = nn.Conv2d(40, 50, (5, 1)) self.mp_1 = nn.MaxPool2d((3, 1)) self.conv_2 = nn.Conv2d(50, 60, (5, 1)) self.conv_3 = nn.Conv2d(60, 80, (3, 1)) self.bn_1 = nn.BatchNorm2d(50) self.bn_2 = nn.BatchNorm2d(60) self.bn_3 = nn.BatchNorm2d(80) self.linear_2 = nn.Linear(80, 40) self.linear_4 = nn.Linear(40, 11) self.name = 'Complex Radio' self.loss_weight = torch.nn.Parameter(torch.rand(1), requires_grad=True)
def __init__(self, num_classes, num_distr, num_repeat): super(ManifoldNetComplex, self).__init__() params = { 'num_classes': num_classes, 'num_distr': num_distr, 'num_repeat': num_repeat } self.complex_conv1 = complex.ComplexConv2Deffgroup( 1, 5, (5, 5), (2, 2)) self.complex_conv2 = complex.ComplexConv2Deffgroup( 5, 10, (5, 5), (2, 2)) self.complex_conv3 = complex.ComplexConv2Deffgroup( 10, 20, (5, 5), (2, 2)) self.complex_conv4 = complex.ComplexConv2Deffgroup( 20, 40, (5, 5), (2, 2)) self.SURE = SURE(params, 40, 80, (3, 3), (1, 1), calc_next(3, 3, 1, 5)) self.complex_bn = complex.ComplexBN() self.proj1 = complex.manifoldReLUv2angle(5) #complex.ReLU4Dsp(20) self.proj2 = complex.manifoldReLUv2angle(10) #complex.ReLU4Dsp(40) self.proj3 = complex.manifoldReLUv2angle(20) #complex.ReLU4Dsp(80) self.proj4 = complex.manifoldReLUv2angle(40) #complex.ReLU4Dsp(80) self.proj5 = complex.manifoldReLUv2angle(80) #complex.ReLU4Dsp(80) self.linear1 = nn.Linear(80, 30) self.linear2 = nn.Linear(30, 11) self.relu = nn.ReLU() self.name = 'complex only'
def __init__(self, num_classes, num_distr, num_repeat): super(Test, self).__init__() params = { 'num_classes': num_classes, 'num_distr': num_distr, 'num_repeat': num_repeat } self.complex_conv1 = complex.ComplexConv2Deffgroup( 1, 20, (5, 5), (5, 5)) #20, 20 self.SURE = SURE_pure(params, calc_next(100, 5, 5, 20), 20) self.name = 'complex+standardCNN' self.proj2 = complex.manifoldReLUv2angle(20) #complex.ReLU4Dsp(40) self.relu = nn.ReLU() self.dropout = nn.Dropout(0.3) self.conv_1 = nn.Conv2d(20, 40, (5, 5)) self.mp_1 = nn.MaxPool2d((2, 2)) self.conv_2 = nn.Conv2d(40, 60, (3, 3)) self.mp_2 = nn.MaxPool2d((2, 2)) self.conv_3 = nn.Conv2d(60, 80, (3, 3)) self.bn_1 = nn.BatchNorm2d(40) self.bn_2 = nn.BatchNorm2d(60) self.bn_3 = nn.BatchNorm2d(80) self.linear_2 = nn.Linear(80, 40) self.linear_4 = nn.Linear(40, 11) self.loss_weight = torch.nn.Parameter(torch.rand(1), requires_grad=True)
def __init__(self): super(ManifoldNetAll, self).__init__() self.complex_conv1 = complex.ComplexConv2Deffgroup( 1, 5, (5, 5), (2, 2)) self.complex_conv2 = complex.ComplexConv2Deffgroup( 5, 10, (5, 5), (2, 2)) self.complex_conv3 = complex.ComplexConv2Deffgroup( 10, 20, (5, 5), (2, 2)) self.complex_conv4 = complex.ComplexConv2Deffgroup( 20, 40, (5, 5), (2, 2)) self.complex_conv5 = complex.ComplexConv2Deffgroup( 40, 80, (3, 3), (1, 1)) self.complex_bn = complex.ComplexBN() self.proj1 = complex.manifoldReLUv2angle(5) #complex.ReLU4Dsp(20) self.proj2 = complex.manifoldReLUv2angle(10) #complex.ReLU4Dsp(40) self.proj3 = complex.manifoldReLUv2angle(20) #complex.ReLU4Dsp(80) self.proj4 = complex.manifoldReLUv2angle(40) #complex.ReLU4Dsp(80) self.proj5 = complex.manifoldReLUv2angle(80) #complex.ReLU4Dsp(80) self.complex_fc = complex.ComplexLinearangle(80, 1, 30, 11) #10
def __init__(self): super(ManifoldNetComplex_11, self).__init__() self.complex_conv1 = complex.ComplexConv2Deffgroup( 1, 20, (5, 5), (2, 2)) self.complex_conv2 = complex.ComplexConv2Deffgroup( 20, 20, (5, 5), (2, 2)) self.proj2 = complex.manifoldReLUv2angle(20) #complex.ReLU4Dsp(40) # self.proj3 = complex.manifoldReLUv2angle(30) self.relu = nn.ReLU() self.linear_1 = complex.ComplexLinearangle2Dmw_outfield(20 * 22 * 22) self.conv_1 = nn.Conv2d(20, 30, (5, 5)) self.mp_1 = nn.MaxPool2d((2, 2)) self.conv_2 = nn.Conv2d(30, 40, (5, 5), (3, 3)) self.bn_1 = nn.BatchNorm2d(30) self.bn_2 = nn.BatchNorm2d(40) self.mp_2 = nn.MaxPool2d((3, 3)) self.conv_3 = nn.Conv2d(40, 50, (2, 2)) self.bn_3 = nn.BatchNorm2d(50) self.linear_2 = nn.Linear(50, 30) self.linear_4 = nn.Linear(30, 11)
def __init__(self, num_classes, num_distr, num_repeat): super(ManifoldNetRes1, self).__init__() params = { 'num_classes': num_classes, 'num_distr': num_distr, 'num_repeat': num_repeat } self.complex_conv1 = complex.ComplexConv2Deffgroup( 1, 20, (5, 5), (2, 2)) self.complex_conv2 = complex.ComplexConv2Deffgroup( 20, 20, (5, 5), (2, 2)) self.complex_conv3 = complex.ComplexConv2Deffgroup( 20, 20, (5, 5), (1, 1)) self.SURE = SURE_pure(params, calc_next(22, 5, 1, 20), 20) self.complex_res1 = complex.ResidualLayer(20, 20, 20, (5, 5), (2, 2)) self.complex_res2 = complex.ResidualLayer(20, 20, 20, (5, 5), (1, 1)) self.proj2 = complex.manifoldReLUv2angle(20) #complex.ReLU4Dsp(40) self.relu = nn.ReLU() self.conv_1 = nn.Conv2d(20, 30, (5, 5)) self.mp_1 = nn.MaxPool2d((3, 3)) self.conv_2 = nn.Conv2d(40, 50, (3, 3)) self.conv_3 = nn.Conv2d(60, 70, (2, 2)) self.bn_1 = nn.BatchNorm2d(30) self.bn_2 = nn.BatchNorm2d(50) self.bn_3 = nn.BatchNorm2d(70) self.linear_2 = nn.Linear(70, 40) self.linear_4 = nn.Linear(40, 11) self.name = 'Residual complex for mstar' self.loss_weight = torch.nn.Parameter(torch.rand(1), requires_grad=True) self.res1 = nn.Sequential(*self.make_res_block(30, 40)) self.id1 = nn.Conv2d(30, 40, (1, 1)) self.res2 = nn.Sequential(*self.make_res_block(50, 60)) self.id2 = nn.Conv2d(50, 60, (1, 1))
def make_complex_layer(complex_c, complex_kern, complex_stride): complex_parts = [] prev_c = 1 prev_relu = None for (c, kern, stride) in zip(complex_c, complex_kern, complex_stride): complex_parts.append( complex.ComplexConv2Deffgroup(prev_c, c, (kern, kern), (stride, stride))) if prev_c == c and prev_relu is not None: complex_parts.append(prev_relu) else: prev_relu = complex.manifoldReLUv2angle(c) complex_parts.append(prev_relu) prev_c = c return complex_parts, prev_c