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

        self.both_c3d_model = c3d_model(input_channel=3,
                                        model_scope_name='gray_test')
        self.both_c3d_model.encoder_channel_num = [96, 24]
        self.both_c3d_model.encoder_stride_num = [[2, 2, 2], [2, 2, 2]]
        self.both_c3d_model.decoder_channel_num = [
            96, self.both_c3d_model.input_channel
        ]
        self.both_c3d_model.decoder_stride_num = [[2, 2, 2], [2, 2, 2]]

        # self.mid_model = c2d_model(input_channel = 192,model_scope_name='concate_model')
        # self.mid_model.encoder_channel_num = [512,1024,2048]
        # self.mid_model.encoder_stride = [[2, 2], [2, 2], [2, 2]]
        # self.mid_model.decoder_channel_num = [1024,512, self.mid_model.input_channel]
        # self.mid_model.decoder_stride = [[2, 2], [2, 2], [2, 2]]

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

        self.selected_gpu_num = 1

        self.build_model_adn_loss_opt()
        self.Data_Sequence = dataset_sequence(frame_tags=True,
                                              opticalflow_tags=True,
                                              img_num=self.video_imgs_num)

        self.root_path = '/media/room304/TB/TensorFlow_Saver/ANORMLY/COMPARED_VN4_Pathches_VS/'

        self.mid_stage_save_path = self.root_path + 'MODEL_D/'
        self.both_save_path = self.root_path + 'MODEL_BOTH/'

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

        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_Test_ENCODER(input_channel=1,model_scope_name='gray_encoder', bn_tag = False)
        self.gray_encoder.encoder_channel_num = [64,     64,      64,  1]
        self.gray_encoder.encoder_stride_num = [[1, 1, 1],[1, 1, 1],[1, 1, 1],[1, 1, 1] ]
        self.gray_encoder.encoder_kernel_size = [[2, 3, 3],[2, 3, 3],[2, 3, 3],[2, 3, 3]]

        self.gray_decoder = C3D_DECODER(input_channel=1,model_scope_name='gray_decoder', bn_tag = False)
        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_Convert_Model( input_channel = 3,model_scope_name = 'net',s_size=4, attention_uints = 32, attention_hops = 16)

        self.batch_size = 1
        self.video_imgs_num = 4
        self.img_size_h = None
        self.img_size_w = None
        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/Split/'

        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.º 3
0
    def __init__(self):
        self.img_channel = 2

        self.optical_c3d_model = c3d_model(
            input_channel=2, model_scope_name='vn4_optical_flow_test')
        self.optical_c3d_model.not_last_activation = True
        self.optical_c3d_model.encoder_channel_num = [64, 16]
        self.optical_c3d_model.encoder_stride_num = [[2, 1, 1], [2, 1, 1]]
        self.optical_c3d_model.decoder_channel_num = [
            64, self.optical_c3d_model.input_channel
        ]
        self.optical_c3d_model.decoder_stride_num = [[2, 1, 1], [2, 1, 1]]

        self.gray_c3d_model = c3d_model(input_channel=1,
                                        model_scope_name='vn4_gray_test')
        self.gray_c3d_model.encoder_channel_num = [64, 16]
        self.gray_c3d_model.encoder_stride_num = [[2, 1, 1], [2, 1, 1]]
        self.gray_c3d_model.decoder_channel_num = [
            64, self.gray_c3d_model.input_channel
        ]
        self.gray_c3d_model.decoder_stride_num = [[2, 1, 1], [2, 1, 1]]

        self.mid_model = c2d_model(input_channel=32,
                                   model_scope_name='vn4_concate_model')
        self.mid_model.encoder_channel_num = [512, 256]
        self.mid_model.encoder_stride = [[2, 2], [2, 2]]
        self.mid_model.decoder_channel_num = [
            512, self.mid_model.input_channel
        ]
        self.mid_model.decoder_stride = [[2, 2], [2, 2]]

        self.batch_size = 16
        self.video_imgs_num = 4
        self.img_size_h = None
        self.img_size_w = None
        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/ONLY_DENSE_TEMPORAL/'

        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.º 4
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.º 5
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
Exemplo n.º 6
0
    def __init__(self):
        self.img_channel = 2

        self.optical_c3d_model = c3d_model(input_channel=2,model_scope_name='optical_flow_test')
        self.optical_c3d_model.encoder_channel_num = [8,        32,         128]
        self.optical_c3d_model.encoder_stride_num = [[2, 2, 2],[2, 2, 2],[2, 2, 2]]
        self.optical_c3d_model.decoder_channel_num = [32,        8,      self.optical_c3d_model.input_channel]
        self.optical_c3d_model.decoder_stride_num = [[2, 2, 2],[2, 2, 2],[2, 2, 2]]

        self.gray_c3d_model = c3d_model(input_channel=1,model_scope_name='gray_test')
        self.gray_c3d_model.encoder_channel_num = [4,       16,          64]
        self.gray_c3d_model.encoder_stride_num = [[2, 2, 2],[2, 2, 2],[2, 2, 2]]
        self.gray_c3d_model.decoder_channel_num = [64,       32,          self.gray_c3d_model.input_channel]
        self.gray_c3d_model.decoder_stride_num = [[2, 2, 2],[2, 2, 2],[2, 2, 2]]

        self.mid_model = c2d_model(input_channel = 192,model_scope_name='concate_model')
        self.mid_model.encoder_channel_num = [512,1024,2048]
        self.mid_model.encoder_stride = [[2, 2], [2, 2], [2, 2]]
        self.mid_model.decoder_channel_num = [1024,512, self.mid_model.input_channel]
        self.mid_model.decoder_stride = [[2, 2], [2, 2], [2, 2]]

        self.batch_size = 8
        self.video_imgs_num = 4
        self.img_size_h = None
        self.img_size_w = None
        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.Data_Sequence = dataset_sequence(frame_tags = True,opticalflow_tags=True,img_num=self.video_imgs_num)

        self.optical_save_path = '/media/room304/TB/TensorFlow_Saver/ANORMLY/MID_LR_X3_VN4/MODEL_OPTICAL/'
        self.gray_save_path = '/media/room304/TB/TensorFlow_Saver/ANORMLY/MID_LR_X3_VN4/MODEL_GRAY/'
        self.mid_stage_save_path = '/media/room304/TB/TensorFlow_Saver/ANORMLY/MID_LR_X3_VN4/MODEL_D/'

        self.summaries_dir = '/media/room304/TB/TensorFlow_Saver/ANORMLY/MID_LR_X3_VN4/SUMMARY/'

        self.optical_img_save_path = '/media/room304/TB/TensorFlow_Saver/ANORMLY/MID_LR_X3_VN4/RESULT/MODEL_OPTICAL/'
        self.gray_img_save_path = '/media/room304/TB/TensorFlow_Saver/ANORMLY/MID_LR_X3_VN4/RESULT/MODEL_GRAY/'
        self.mid_stage_img_save_path = '/media/room304/TB/TensorFlow_Saver/ANORMLY/MID_LR_X3_VN4/RESULT/MODEL_MID_STAGE/'
        self.full_datat_set_path = '/media/room304/TB/TensorFlow_Saver/ANORMLY/MID_LR_X3_VN4/RESULT/Data_Set_UCSD_Path/'
        self.full_ucsd_datatset_path = '/media/room304/TB/TensorFlow_Saver/ANORMLY/MID_LR_X3_VN4/RESULT/FULL_Data_Set/UCSD_Path/'
        self.full_shanghai_datatset_path = '/media/room304/TB/TensorFlow_Saver/ANORMLY/MID_LR_X3_VN4/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