def get_model_case6_4(): ''' VAE ''' # 入出力チャンネル数を指定 model = NA_.CAEList( NA_.CAEChain(3, 8, activation=(F.relu, None)), NA_.CAEChain(8, 16, activation=F.relu), NA_.CAEChain(16, 32, activation=F.relu), NA_.CAEChain(32, 64, activation=F.relu), NA_.CAEChain(64, 64, activation=F.relu), NA_.CAEChain(64, 128, activation=F.relu), NA_.CAEChain(128, 256, activation=F.relu), NV_.VAEChain(None, 64, activation=F.relu)) loss = NV_.VAELoss(model, beta=1.0, k=1) return loss
def get_model_case1_z30(): ''' VAE ''' # 入出力チャンネル数を指定 model = NA_.CAEList( NA_.CAEChain(2, 10, activation=(F.relu, None)), # in: 512, 1024 NA_.CAEChain(10, 20), # in: 256 NA_.CAEChain(20, 20), # in: 128 NA_.CAEChain(20, 20), # in: 64 NA_.CAEChain(20, 20), # in: 32 NA_.CAEChain(20, 20), # in: 16 NA_.CAEChain(20, 20), # in: 8 NA_.CAEChain(20, 20), # in: 4 # NA_.LAEChain(None, 40), # in: 10*3*3 NV_.VAEChain(None, 30)) # in: 10*3*3 loss = NV_.VAELoss(model, beta=1.0, k=1) return loss
def get_model_case9_1(): ''' VAE z: 32dim ''' model = NA_.CAEList( NA_.CAEChain(3, 8, activation=(F.sigmoid, None)), NA_.CAEChain(None, 16), NA_.CAEChain(None, 32), NA_.CAEChain(None, 64), NA_.CAEChain(None, 64), NA_.CAEChain(None, 64), NA_.CAEChain(None, 128), # => (128, 3, 3) NA_.LAEChain(None, 288), # 1152 -> 288 (1 / 4) NA_.LAEChain(None, 96), # 288 -> 96 (1 / 3) NV_.VAEChain(None, 32)) # 96 -> 32 (1 / 3) loss = NV_.VAELoss(model) return loss
def get_model_case9_0(): ''' VAE z: 2dim ''' model = NA_.CAEList( NA_.CAEChain(3, 8, activation=(F.sigmoid, None)), NA_.CAEChain(None, 16), NA_.CAEChain(None, 32), NA_.CAEChain(None, 64), NA_.CAEChain(None, 64), NA_.CAEChain(None, 64), NA_.CAEChain(None, 128), # => (128, 3, 3) NA_.LAEChain(None, 128), # 1152 -> 128 (1 / 9) NA_.LAEChain(None, 16), # 128 -> 16 (1 / 8) NV_.VAEChain(None, 2)) # 16 -> 2 (1 / 8) loss = NV_.VAELoss(model) return loss
def get_model_case8_0(): ''' VAE activation: F.relu => F.sigmoid ''' # 入出力チャンネル数を指定 model = NA_.CAEList( NA_.CAEChain(3, 8, activation=(F.sigmoid, None)), NA_.CAEChain(8, 16, activation=F.sigmoid), NA_.CAEChain(16, 32, activation=F.sigmoid), NA_.CAEChain(32, 64, activation=F.sigmoid), NA_.CAEChain(64, 64, activation=F.sigmoid), NA_.CAEChain(64, 128, activation=F.sigmoid), NA_.CAEChain(128, 256, activation=F.sigmoid), # => (256, 3, 3) NV_.VAEChain(None, 64, activation=(None, F.sigmoid))) # 2304 -> 64 (1 / 36) loss = NV_.VAELoss(model, beta=1.0, k=1) return loss
def get_model_case6_3(): ''' VAE ''' # 入出力チャンネル数を指定 model = NA_.CAEList( NA_.CAEChain(3, 8, activation=(F.relu, None), batch_norm='re', padding=True), NA_.CAEChain(8, 16, batch_norm='re', padding=True), NA_.CAEChain(16, 32, batch_norm='re', padding=True), NA_.CAEChain(32, 64, batch_norm='re', padding=True), NA_.CAEChain(64, 64, batch_norm='re', padding=True), NA_.CAEChain(64, 128, batch_norm='re', padding=True), NA_.CAEChain(128, 256, batch_norm='re', padding=True), NV_.VAEChain(None, 64)) loss = NV_.VAELoss(model, beta=1.0, k=1) return loss
def get_model_case9_4(): ''' VAE z: 64dim パラメータ数: ((3*8+8*8+8*16+16*16+16*32+32*32+32*64+64*64+64*64+64*64*128+128*128+128*128+128*128)*3*3+ 1152*384+384*128+128*64)*2=11541808 ''' model = NA_.CAEList( NA_.CAEChain(3, 8, activation=(F.sigmoid, None), ksize=3), NA_.CAEChain(None, 16, ksize=3), NA_.CAEChain(None, 32, ksize=3), NA_.CAEChain(None, 64, ksize=3), NA_.CAEChain(None, 64, ksize=3), NA_.CAEChain(None, 128, ksize=3), NA_.CAEChain(None, 128, ksize=3), # => (128, 3, 3) NA_.LAEChain(None, 384), # 1152 -> 384 (1 / 3) NA_.LAEChain(None, 128), # 384 -> 128 (1 / 3) NV_.VAEChain(None, 64)) # 128 -> 64 (1 / 2) loss = NV_.VAELoss(model) return loss
def get_model_case6(): ''' VAE 1 4 10 22 46 94 190 382 2 6 14 30 62 126 254 510 3 8 18 38 78 158 318 ''' # 入出力チャンネル数を指定 model = NA_.CAEList( NA_.CAEChain(3, 8, activation=(F.relu, None)), NA_.CAEChain(8, 16), NA_.CAEChain(16, 32), NA_.CAEChain(32, 64), NA_.CAEChain(64, 64), NA_.CAEChain(64, 128), NA_.CAEChain(128, 256), NV_.VAEChain(None, 64)) loss = NV_.VAELoss(model, beta=1.0, k=1) return loss
def get_model_case4_1(): ''' VAE 1 4 10 22 46 94 190 382 2 6 14 30 62 126 254 510 3 8 18 38 78 158 318 ''' # 入出力チャンネル数を指定 model = NA_.CAEList( NA_.CAEChain(2, 10, activation=(F.relu, None)), NA_.CAEChain(10, 20), NA_.CAEChain(20, 30), NA_.CAEChain(30, 30), NA_.CAEChain(30, 30), NA_.CAEChain(30, 30), NA_.CAEChain(30, 20), NV_.VAEChain(None, 10)) loss = NV_.VAELoss(model, beta=1.0, k=1) return loss