zyh-uaiaaaa / Erasing-Attention-Consistency

Official implementation of the ECCV2022 paper: Learn From All: Erasing Attention Consistency for Noisy Label Facial Expression Recognition
78 stars 15 forks source link

help FERplus #18

Closed userguazi closed 1 year ago

userguazi commented 1 year ago

thanks for your great work! can you give me the noise label of FERplus?Thank you!

zyh-uaiaaaa commented 1 year ago

Hi userguazi,

You may use the following code to generate your own noisy label files of AffectNet and FERPlus.

import random
new_file = open("0.2noise_train.txt","w+")
with open("train.txt","r") as file:
     for line in file:
        line = line.strip()
        img_path, label = line.split(' ', 1)
        number = random.uniform(0,1)
        new_label = random.randint(0,6)
        if number <= 0.2:
            while(1):
                new_label = random.randint(0,6)
                if new_label != int(label):
                    new_file.write(img_path + ' ' + str(new_label) +'\n')
                    break
        else:
            new_file.write(img_path + ' ' + str(label) +'\n')