Image Reconstruction from EEG Signals: Unveiling the Brain’s Secrets

Puttimate Hirunuran
3 min readNov 5, 2023

--

ก่อนที่จะเข้าสู่เนื้อหาอยากถามทุกคนว่า เคยโมเม้นต์ที่เวลาดูทีวี ยูทูป หรือระหว่างใช้ชีวิตประจำวัน แล้วมีสิ่งที่รู้สึกว่ามันประทับใจเรามากๆ ซึ่งบางทีสิ่งนั้นอาจจะเป็นไอเดีย หรือแรงบันดาลใจที่สำคัญ แต่พอไม่ได้บันทึกไว้ เวลาผ่านไป บางทีเราพยายามนึกถึงภาพนั้นออกมาแต่ก็จำได้แค่เพียงเลือนลาง หรืออาจจะจำรายละเอียดไม่ได้เลย แล้วจะมีวิธีไหนไหมที่นอกจากการถ่ายรูป และยังสามารถทำให้เราสามารถบันทึกสิ่งเหล่านี้ได้ ซึ่งถ้าพูดถึงสิ่งที่ตามองเห็น สมองส่วนรับภาพจะเป็นสิ่งที่จัดเรียงและแปลผลข้อมูลออกมา แล้วจะเป็นไปได้ไหม ถ้าจะจับสัญญาณสมองแล้วแปลงกลับมาเป็นรูปภาพที่เราต้องการ

โดยบทความนี้จะเป็นการศึกษาเกี่ยวกับการสร้างภาพจาก EEG โดยจุดประสงค์หลักต้องการเรียนรู้ และกระบวนการพัฒนาแบบจำลอง EEG image reconstruction ขึ้นมา

Electroencephalography (EEG) เป็นเทคนิคการตรวจวัดคลื่นไฟฟ้าสมอง โดยเป็นการตรวจการทำงานของเซลล์ประสาทสมองโดยดูจากการเปลี่ยนแปลงทางไฟฟ้าเพื่อที่จะเข้าใจการทำงานของสมองของมนุษย์เรา โดยการบันทึกกิจกรรมไฟฟ้าในสมอง EEG ทำให้สามารถเข้าใจใน cognitive processes, emotions และ neurological disorders แต่จะเป็นอย่างไร ถ้าเราสามารถก้าวไปอีกขั้น โดยการแปลงข้อมูล EEG ให้กลายเป็นภาพแทนการทำงานของสมองได้ สิ่งนี้จึงเป็นขอบเขตการศึกษาที่มีความน่าสนใจ

Dataset ที่ใช้ในการศึกษา

  • Name : EEG ImageNet
  • 40 classes and 50 image/class
  • 6 subjects
  • EEG contains 128 channels
  • 500 Step on each channel

! Image .png are not present in this folder; the images is required from Kaggle

S. Palazzo, C. Spampinato, I. Kavasidis, D. Giordano, J. Schmidt, M. Shah, Decoding Brain Representations by Multimodal Learning of Neural Activity and Visual Features, IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, 2020, doi: 10.1109/TPAMI.2020.2995909

Model and Workflow

Step 1 : เป็นการทดสอบเกี่ยวกับว่าข้อมูล EEG นั้นสามารถใช้โมเดลในการจำแนกประเภทแต่ละ categories ได้หรือไม่

เพราะหากไม่สามารถแยกได้อาจจะต้องหาวิธีในการ pre-processing เพิ่มเติมเพื่อทำให้โมเดลสามารถเรียนรู้ได้ง่ายขึ้น เพราะหาก categories แยกประเภทของรูปยังไม่สามารถทำได้ ก็ไม่มีทางที่จะ image reconstruction ขึ้นมาได้

Figure : model for classification EEG and reconstruction image from blip embedding

ซึ่งการประเมินผลของตัว model นี้ได้ Accuracy อยู่ที่ 91%

Figure : Confusion matrix of model for classification EEG

Step 2 : เป็นการทดสอบเกี่ยวกับว่าสามารถใช้ reconstruction model เพื่อที่จะ regression image embedding จาก EEG signal ได้หรือไม่

หลังจากนั้นถ้านำ embedding ที่ได้จากการ fusion ระหว่าง predict categories embedding กับ predict image embedding จะได้ image reconstruction ที่เหมือนต้นฉบับมากกว่าเดิมหรือไม่

Figure : model for classification and regression EEG and reconstruction image from blip embedding

ซึ่งการประเมินผลของตัว model นี้ได้ Accuracy อยู่ที่ 90%

Figure : Confusion matrix of model for classification and regression

Result image reconstruction

Figure : Image reconstruction from embedding prediction through a stable diffusion model

จะเห็นว่าการใช้เพียง regression embedding ที่ผ่านจากใช้โมเดล reconstruction model จาก EEG signal ยังได้ผลลัพธ์ที่ยังไม่ค่อยดี อาจเป็นเพราะสัญญาณ EEG ที่ไม่ได้มีการ pre-processing อย่างเหมาะสมกับการนำไปใช้เลยทำให้มี noise อยู่ใน data ที่ค่อนข้างเยอะ เลยทำให้ regression embedding ไม่ดีเท่าที่ควร

ส่วนสำหรับ categories embedding และ fusion embedding ได้ผลลัพธ์ที่ค่อนข้างตรง categories แต่ยังไม่สามารถวัดได้ว่าอันไหนสามารถสร้างรูปที่มีความเหมือนกับรูปต้นฉบับได้มากกว่ากัน

Conclusion & Future work

โดยสรุปเกี่ยวกับการศึกษาครั้งนี้ จะพบว่าการแปลง EEG data ไป image reconstruction นั้นเป็นสิ่งที่สามารถทำได้ แต่ยังมีอีกหลายๆอย่างที่จำเป็นต้องปรับปรุง และแก้ไขเพื่อที่จะได้ภาพที่มีความคล้ายกับรูปต้นฉบับมากขึ้น ไม่ว่าจะเป็น การ analyst เพื่อดูการตอบสนองของสัญญาณ EEG ว่าแต่ละส่วนในความเป็นจริงมีการตอบสนองเป็นอย่างไร เพื่อที่จะ pre-processing แล้วเลือกเฉพาะ feature ที่มีความสำคัญต่อการประมวลผลของภาพ รวมไปถึงการใช้ loss ที่มีความเหมาะสมกับงานมากขึ้น ซึ่งเป็นสิ่งที่ค่อนข้างท้าทาย และค่อนข้างน่าสนใจมากๆ

  • Explore data and understand inside of data for pre-processing to get only important feature to model
  • Apply low-level reconstruction to generate embeddings that achieve a level of similarity or resemblance to the original for fusion embedding with this model
  • Using new loss that appropriate to this work e.g., Structural Similarity Index(SSIM)

References

  1. S. Palazzo, C. Spampinato, I. Kavasidis, D. Giordano, J. Schmidt, M. Shah, Decoding Brain Representations by Multimodal Learning of Neural Activity and Visual Features, IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, 2020, doi: 10.1109/TPAMI.2020.2995909
  2. C. Spampinato, S. Palazzo, I. Kavasidis, D. Giordano, N. Souly, M. Shah, Deep Learning Human Mind for Automated Visual Classification, International Conference on Computer Vision and Pattern Recognition, CVPR 2017
  3. Scotti*, Banerjee*, Goode†, Shabalin, Nguyen, Cohen, Dempster, Verlinde, Yundler, Weisberg, Norman‡, & Abraham‡. Reconstructing the Mind’s Eye: fMRI-to-Image with Contrastive Learning and Diffusion Priors. arXiv (2023). arXiv:2305.18274.
  4. Allen, St-Yves, Wu, Breedlove, Prince, Dowdle, Nau, Caron, Pestilli, Charest, Hutchinson, Naselaris*, & Kay*. A massive 7T fMRI dataset to bridge cognitive neuroscience and artificial intelligence. Nature Neuroscience (2021).
  5. Ferrante, M., Ozcelik, F., Boccato, T., VanRullen, R., & Toschi, N. (Year). Brain Captioning: Decoding human brain activity into images and text. Proceedings of the Conference Name (NeurIPS 2023). DOI: https://doi.org/10.48550/arXiv.2305.11560

This article is part of a project presented to Brain Code Camp 2023

ขอขอบคุณอาจารย์ทุกท่าน รวมไปถึงอาจารย์อู๋ และพี่ปัญผู้เป็น Mentor

ของ group g ซึ่งเป็นผู้ให้คำปรึกษาตั้งแต่เริ่มโปรเจคจนสำเร็จลุล่วง

--

--