Exemplo n.º 1
0
# for Valence intensity classification
loss_func_aux2 = 'categorical_crossentropy'  # loss function
metr_aux2 = 'accuracy'  # evaluation metric
weight_aux2 = 0.5  # weight for multitask learning

# Download the data if not present
mosi = MOSI()
covarep = mosi.covarep()  # features
facet = mosi.facet()  # features
embeddings = mosi.embeddings()  # features
sentiments = mosi.sentiments()  # Valence labels
train_ids = mosi.train()
valid_ids = mosi.valid()
test_ids = mosi.test()

bimodal = Dataset.merge(embeddings, covarep)
dataset = bimodal.align('embeddings')

# Some data preprocessing
print("Preparing train and test data...")
# sort through all the video ID, segment ID pairs
train_set_ids = []
for vid in train_ids:
    for sid in dataset['embeddings'][vid].keys():
        if dataset['embeddings'][vid][sid] and dataset['covarep'][vid][sid]:
            train_set_ids.append((vid, sid))

valid_set_ids = []
for vid in valid_ids:
    for sid in dataset['embeddings'][vid].keys():
        if dataset['embeddings'][vid][sid] and dataset['covarep'][vid][sid]:
Exemplo n.º 2
0

if __name__ == "__main__":
    # Download the data if not present
    mosi = Dataloader('http://sorena.multicomp.cs.cmu.edu/downloads/MOSI')
    embeddings = mosi.embeddings()
    facet = mosi.facet()
    covarep = mosi.covarep()
    sentiments = mosi.sentiments(
    )  # sentiment labels, real-valued. for this tutorial we'll binarize them
    train_ids = mosi.train()  # set of video ids in the training set
    valid_ids = mosi.valid()  # set of video ids in the valid set
    test_ids = mosi.test()  # set of video ids in the test set

    # Merge different features and do word level feature alignment (align according to timestamps of embeddings)
    bimodal = Dataset.merge(embeddings, facet)
    trimodal = Dataset.merge(bimodal, covarep)
    dataset = trimodal.align('embeddings')

    # sort through all the video ID, segment ID pairs
    train_set_ids = []
    for vid in train_ids:
        for sid in dataset['embeddings'][vid].keys():
            if dataset['embeddings'][vid][sid] and dataset['facet'][vid][
                    sid] and dataset['covarep'][vid][sid]:
                train_set_ids.append((vid, sid))

    valid_set_ids = []
    for vid in valid_ids:
        for sid in dataset['embeddings'][vid].keys():
            if dataset['embeddings'][vid][sid] and dataset['facet'][vid][
Exemplo n.º 3
0
# for Valence polarity classification
loss_func_aux = 'binary_crossentropy'  # loss function
metr_aux = 'binary_accuracy'  # evaluation metric
weight_aux = 0.5  # weight for multitask learning

# Download the data if not present
mosi = MOSI()
covarep = mosi.covarep()  # features
facet = mosi.facet()  # features
embeddings = mosi.embeddings()  # features
sentiments = mosi.sentiments()  # Valence labels
train_ids = mosi.train()
valid_ids = mosi.valid()
test_ids = mosi.test()

bimodal = Dataset.merge(embeddings, facet)
dataset = bimodal.align('embeddings')

# Some data preprocessing
print("Preparing train and test data...")
# sort through all the video ID, segment ID pairs
train_set_ids = []
for vid in train_ids:
    for sid in dataset['embeddings'][vid].keys():
        if dataset['embeddings'][vid][sid] and dataset['facet'][vid][sid]:
            train_set_ids.append((vid, sid))

valid_set_ids = []
for vid in valid_ids:
    for sid in dataset['embeddings'][vid].keys():
        if dataset['embeddings'][vid][sid] and dataset['facet'][vid][sid]: