rezafuad/ferplus-keras

data prepare

Closed this issue · 1 comments

Hi, i saw that you had split the original data to 8 kinds ; can you provide the code of detailing the original data? If you think you can, can you send it to my email 1029373550@qq.com,thank you very much.

import os
import sys
import numpy as np

import csv


# csv name
fname = sys.argv[1]

with open(fname) as csvfile:
    label = csv.reader(csvfile)
    for row in label:
        filename = row[0]
        #--------
        # skip bb
        #--------
        emolabel = list(map(float, row[2:len(row)-2]))
        for i in range(len(emolabel)):
            if emolabel[i] < 1.0 + 1e-10:
                emolabel[i] = 0.0
        ##
        emotion = [0] * 8 # ferplus has 8 emotion + 1
        sumall = sum(emolabel)
        ###
        maxval = max(emolabel)
        if maxval > 0.5 * sumall:
            datalabel = np.argmax(emolabel)
        else:
            continue # skip if voter not consistent
        ####
        # print the results
        print filename, datalabel