prajwalsingh / EEGStyleGAN-ADA

Pytorch code of paper "Learning Robust Deep Visual Representations from EEG Brain Recordings". [WACV 2024]
MIT License
27 stars 4 forks source link

How to run with my own dataset. #6

Closed A-Ayerh closed 7 months ago

A-Ayerh commented 7 months ago

It's probably not so simple, but I was wondering how I would format my dataset to work with your model. Let's say I have a set of EEG data and pictures that were presented during the experiment when the EEG data was collected.

Do you know how I could format my dataset to work with your model? Can I structure it to be read like the CVPR40 dataset?

This is probably not enough information to work with, but could get pointed in the right direction for this?

Thank you!

prajwalsingh commented 7 months ago

Hi @A-Ayerh, yes, just arrange the data in CVPR40 dataset format. After that, first train the feature extraction network, that is, the EEG2Feat network, and then use the extracted feature as a condition for EEGStyleGAN-ADA to train and synthesize images.

A-Ayerh commented 7 months ago

Thanks @prajwalsingh!

One last thing, what is CVPR40 dataset format?

prajwalsingh commented 7 months ago

@A-Ayerh, this is the format Numpy file is arranged in:

[image, eeg, image_label, image_id, subject_number]

[H x W x 3, 128 x 440, label, string, int32]

If you only have an image, label, and eeg, you can arrange it in the following way:

[image, eeg, label, None, None]

A-Ayerh commented 7 months ago

You are the man. I'll let you know how it goes 👍

prajwalsingh commented 7 months ago

@A-Ayerh, Do share the results of the experiments on different datasets. Looking forward to it.

A-Ayerh commented 7 months ago

Assume that I have a sample EEG record with its corresponding image and its label. I want to use this sample EEG and generate (synthesize) the image using your model (EEGStyleGAN-ADA). So ideally I was expecting to see a script named inference.py for example so that I could feed my EEG, Image, label (and model checkpoints) and then get the synthesized image.

Now using your current repository and all the existing scripts, how can I generate or synthesize from my current EEG sample, can you please provide the steps?

prajwalsingh commented 7 months ago

@A-Ayerh, for image synthesis, I have shared the command for the same in the txt file.

python generate.py --network out/00001-EEGImageCVPR40-cond-mirror-cifar-batch64-bgcfnc/network-snapshot-005443.pkl --outdir generated_images/4 --seeds 0-10 --data=../dataset/eeg_imagenet40_cvpr_2017_raw/test/* 

Using the above, you can synthesize the image using the cvpr40 dataset, or the test can point to your own dataset. Further, you can explore the code and look around for what you want to do.