JLREx / PAtt-Lite

Official implementation for PAtt-Lite: Lightweight Patch and Attention MobileNet for Challenging Facial Expression Recognition
MIT License
35 stars 4 forks source link

Fer2013 result mismatch #9

Open tkurtovic98 opened 7 months ago

tkurtovic98 commented 7 months ago

Hi there, first of all, great work with your research.

I have a question regarding the input dataset you used to train the model.

I tried loading the fer2013.h5 file that I have after preprocessing the original fer2013.csv file like so:

def load_data(split):
    with h5py.File('./fer2013.h5', 'r', driver='core') as data:
        if split == 'Training':
            images = np.array(data['Training_pixel']).reshape((-1, 48, 48, 1))
            labels = np.array(data['Training_label'])
        elif split == 'PublicTest':
            images = np.array(data['PublicTest_pixel']).reshape((-1, 48, 48, 1))
            labels = np.array(data['PublicTest_label'])
        else:
            images = np.array(data['PrivateTest_pixel']).reshape((-1, 48, 48, 1))
            labels = np.array(data['PrivateTest_label'])
    return images, labels

def preprocess_data(data, labels):
    data = np.repeat(data, 3, axis=3)
    return data, labels

X_train, y_train = load_data('Training')
X_train, y_train = preprocess_data(X_train, y_train)

X_valid, y_valid = load_data('PublicTest')
X_valid, y_valid = preprocess_data(X_valid, y_valid)

X_test, y_test = load_data('PrivateTest')
X_test, y_test = preprocess_data(X_test, y_test)

But when I looked at the tensorboard logs I found that the validation accuracy was around 70% after running the notebook you provided.

Is there something I am missing or is my h5 file different that what you used?

Thanks.

JLREx commented 7 months ago

Hi, could it be a mismatch in dimension? Nevertheless, I think the difference is in the image reading when you are compiling the dataset. We were reading the dataset as a color dataset.

Hope this helps.

tkurtovic98 commented 7 months ago

Hi, I set the IMG_SHAPE = (48, 48, 3) in the script before running it.

Also, when I generate the h5 file I store the pixels from each row to either the training, val or test dataset. So I guess there is possibly a mismatch here.

Would you mind providing your fer2013 h5 file or script used to generate the file?

Thanks.

JLREx commented 7 months ago

Hi, I believe we are not allowed to share the dataset, even if it is compiled. We will consider on the script for compiling the datasets.

tkurtovic98 commented 7 months ago

Hi, a script would also be great!

Thanks.

tkurtovic98 commented 7 months ago

Hey there again, are there maybe any updates regarding the dataset compilation script?

Thanks.

JLREx commented 4 months ago

Hey there again, are there maybe any updates regarding the dataset compilation script?

Thanks.

Hi, the data compile code is uploaded.