Пример #1
0
    if train_mode is not None:
        for layer in vgg_model_new.layers[1:]:
            layer.trainable = True
            print(layer.name, layer.trainable)

    return custom_vgg_model


## READ DATA
train_fn = '../pre-process/Train_face_data.pckl'
val_fn = '../pre-process/Validation_face_data.pckl'
test_fn = '../pre-process/Test_face_data.pckl'

x_train, kpts_train, arousal_train, valence_train, emotion_train, groups_train, folder_train, \
x_val, kpts_val, arousal_val, valence_val, emotion_val, groups_val, folder_val, \
x_test, kpts_test, groups_test, folder_test = read_preprocessed_face_data(train_fn, val_fn, test_fn=test_fn)

x_train_len = x_train.shape[0] / __VIDEO_SEQ_LEN__
x_val_len = x_val.shape[0] / __VIDEO_SEQ_LEN__
x_test_len = x_test.shape[0] / __VIDEO_SEQ_LEN__

train_gt_fn = '/data/DB/OMG/omg_TrainVideos.csv'
val_gt_fn = '/data/DB/OMG/omg_ValidationVideos.csv'
test_gt_fn = '/data/DB/OMG/omg_TestVideos_WithoutLabels.csv'
aligned_val_indexes, gt_arousal, gt_valence = get_aligned_indexes(
    val_gt_fn, folder_val)
aligned_test_indexes = get_aligned_indexes(test_gt_fn, folder_test, test=True)

## PRE-PROCESSING
x_train = x_train.astype('float32') / 255
x_val = x_val.astype('float32') / 255
Пример #2
0
    else:
        custom_vgg_model = Model(inputs, [out_arousal, out_valence])

    if train_mode is not None:
        for layer in vgg_model_new.layers[1:]:
            layer.trainable = True
            print(layer.name, layer.trainable)

    return custom_vgg_model

## READ DATA
train_fn = '../pre-process/Train_face_data.pckl'
val_fn   = '../pre-process/Validation_face_data.pckl'

x_train, kpts_train, arousal_train, valence_train, emotion_train, groups_train, folder_train, \
x_val, kpts_val, arousal_val, valence_val, emotion_val, groups_val, folder_val, = read_preprocessed_face_data(train_fn, val_fn)

x_train_len = x_train.shape[0] / __VIDEO_SEQ_LEN__
x_val_len   = x_val.shape[0] / __VIDEO_SEQ_LEN__

train_gt_fn = '/data/DB/OMG/omg_TrainVideos.csv'
val_gt_fn   = '/data/DB/OMG/omg_ValidationVideos.csv'
aligned_val_indexes, gt_arousal, gt_valence = get_aligned_indexes(val_gt_fn, folder_val)


## PRE-PROCESSING
x_train = x_train.astype('float32') / 255
x_val   = x_val.astype('float32') / 255

mean_train = np.mean(x_train, axis=(1,2),  keepdims=True)
mean_val   = np.mean(x_val, axis=(1,2),  keepdims=True)