Exemplo n.º 1
0
    def __init__(self):
        self.img_channel = 1

        self.optical_encoder = C3D_ENCODER(
            input_channel=2,
            model_scope_name='optical_flow_encoder',
            bn_tag=False,
            relu_tag=True)
        self.optical_encoder.encoder_channel_num = [64, 16]
        self.optical_encoder.encoder_stride_num = [[2, 2, 2], [2, 2, 2]]

        self.optical_decoder = C3D_DECODER(
            input_channel=2,
            model_scope_name='optical_flow_decoder',
            bn_tag=False,
            relu_tag=True)
        self.optical_decoder.not_last_activation = True
        self.optical_decoder.decoder_channel_num = [
            64, self.optical_decoder.input_channel
        ]
        self.optical_decoder.decoder_stride_num = [[2, 2, 2], [2, 2, 2]]

        self.gray_encoder = C3D_ENCODER(input_channel=1,
                                        model_scope_name='gray_encoder',
                                        bn_tag=False,
                                        relu_tag=True)
        self.gray_encoder.encoder_channel_num = [64, 32]
        self.gray_encoder.encoder_stride_num = [[2, 2, 2], [2, 2, 2]]

        self.gray_decoder = C3D_DECODER(input_channel=1,
                                        model_scope_name='gray_decoder',
                                        bn_tag=False,
                                        relu_tag=True)
        self.gray_decoder.decoder_channel_num = [
            64, self.gray_decoder.input_channel
        ]
        self.gray_decoder.decoder_stride_num = [[2, 2, 2], [2, 2, 2]]

        self.mid_model = Attention_Model(input_channel=512,
                                         model_scope_name='vn4_concate_model',
                                         attention_uints=512,
                                         attention_hops=256)

        self.batch_size = 1
        self.video_imgs_num = 4
        self.img_size_h = 224
        self.img_size_w = 224
        self.encoder_lr = 1e-3
        self.decoder_lr = 1e-4
        self.autoencoder_lr = 1e-3

        self.selected_gpu_num = 0

        self.build_model_adn_loss_opt()
        self.root_path = '/home/room304/TB/TB/TensorFlow_Saver/ANORMLY/Attention_test_attention_without_pretrain/'

        self.optical_save_path = self.root_path + 'MODEL_OPTICAL/'
        self.gray_save_path = self.root_path + 'MODEL_GRAY/'
        self.mid_stage_save_path = self.root_path + 'MODEL_D/'

        self.summaries_dir = self.root_path + 'SUMMARY/'

        self.optical_img_save_path = self.root_path + 'RESULT/MODEL_OPTICAL/'
        self.gray_img_save_path = self.root_path + 'RESULT/MODEL_GRAY/'
        self.mid_stage_img_save_path = self.root_path + 'RESULT/MODEL_MID_STAGE/'
        self.full_datat_set_path = self.root_path + 'RESULT/Data_Set_UCSD_Path/'
        self.full_ucsd_datatset_path = self.root_path + 'RESULT/FULL_Data_Set/UCSD_Path/'
        self.full_shanghai_datatset_path = self.root_path + 'RESULT/FULL_Data_Set/Shanghai/'

        tmp_dir_list = []
        tmp_dir_list.append(self.optical_save_path)
        tmp_dir_list.append(self.gray_save_path)
        tmp_dir_list.append(self.mid_stage_save_path)
        tmp_dir_list.append(self.summaries_dir)
        tmp_dir_list.append(self.optical_img_save_path)
        tmp_dir_list.append(self.gray_img_save_path)
        tmp_dir_list.append(self.mid_stage_img_save_path)
        tmp_dir_list.append(self.full_datat_set_path)
        tmp_dir_list.append(self.full_ucsd_datatset_path)
        tmp_dir_list.append(self.full_shanghai_datatset_path)
        mk_dirs(tmp_dir_list)

        return
Exemplo n.º 2
0
    def __init__(self):
        self.img_channel = 2
        self.gray_encoder = C3D_ENCODER(input_channel=1,
                                        model_scope_name='gray_encoder',
                                        bn_tag=False)
        self.gray_encoder.encoder_channel_num = [32, 64]
        self.gray_encoder.encoder_stride_num = [[2, 2, 2], [2, 2, 2]]
        self.gray_decoder = C3D_DECODER(input_channel=1,
                                        model_scope_name='gray_decoder',
                                        bn_tag=False)
        self.gray_decoder.decoder_channel_num = [
            32, self.gray_decoder.input_channel
        ]
        self.gray_decoder.decoder_stride_num = [[2, 2, 2], [2, 2, 2]]

        self.discriminator_model = gan_model(input_channel=3,
                                             model_scope_name='discriminator',
                                             s_size=4,
                                             xt_num=64,
                                             attention_uints=512,
                                             attention_hops=256,
                                             bn_tag=False,
                                             attention_tag=False,
                                             dense_tag=False,
                                             not_last_activation=True)
        self.discriminator_model.encoder_channel_num = [32, 32, 32]
        self.discriminator_model.encoder_stride_num = [[1, 1], [1, 1], [1, 1]]

        self.batch_size = 2
        self.video_imgs_num = 4
        self.img_size_h = 256
        self.img_size_w = 256
        self.encoder_lr = 1e-3
        self.decoder_lr = 1e-4
        self.autoencoder_lr = 1e-3

        self.selected_gpu_num = 0

        self.build_model_adn_loss_opt()
        self.root_path = '/home/room304/TB/TB/TensorFlow_Saver/ANORMLY/GAN_T1/'

        self.optical_save_path = self.root_path + 'MODEL_OPTICAL/'
        self.gray_save_path = self.root_path + 'MODEL_GRAY/'
        self.discriminator_save_path = self.root_path + 'MODEL_DISCRIMINATOR/'
        self.mid_stage_save_path = self.root_path + 'MODEL_D/'

        self.summaries_dir = self.root_path + 'SUMMARY/'

        self.optical_img_save_path = self.root_path + 'RESULT/MODEL_OPTICAL/'
        self.gray_img_save_path = self.root_path + 'RESULT/MODEL_GRAY/'
        self.mid_stage_img_save_path = self.root_path + 'RESULT/MODEL_MID_STAGE/'
        self.full_datat_set_path = self.root_path + 'RESULT/Data_Set_UCSD_Path/'
        self.full_ucsd_datatset_path = self.root_path + 'RESULT/FULL_Data_Set/UCSD_Path/'
        self.full_shanghai_datatset_path = self.root_path + 'RESULT/FULL_Data_Set/Shanghai/'

        tmp_dir_list = []
        tmp_dir_list.append(self.optical_save_path)
        tmp_dir_list.append(self.gray_save_path)
        tmp_dir_list.append(self.mid_stage_save_path)
        tmp_dir_list.append(self.summaries_dir)
        tmp_dir_list.append(self.optical_img_save_path)
        tmp_dir_list.append(self.gray_img_save_path)
        tmp_dir_list.append(self.mid_stage_img_save_path)
        tmp_dir_list.append(self.full_datat_set_path)
        tmp_dir_list.append(self.full_ucsd_datatset_path)
        tmp_dir_list.append(self.full_shanghai_datatset_path)
        mk_dirs(tmp_dir_list)

        return