Skip to main content

A simple and fast CLI for downloading, processing, and loading the THINGS-EEG2 dataset.

Project description

things_eeg2_dataset

PyPI License CI Status

THINGS-EEG2 Raw Data Processing

This package provides tools for downloading, preprocessing raw THINGS-EEG2 EEG data, and generating image embeddings from various vision models.

[!WARNING] This repository builds upon the original data processing by Gifford et al (2022). Please check out their original code and the corresponding paper.

We are in no way associated with the authors. Nonetheless we hope, that this makes things easier (pun intended) to use.

Installation

git clone git@github.com:ZEISS/things_eeg2_dataset.git
cd things_eeg2_dataset

uv sync
uv pip install --editable .
source .venv/bin/activate

things-eeg2 --help
things-eeg2 --install-completion

# Then restart your terminal.
# Example for zsh:
source ~/.zshrc

Usage

uv run things-eeg2 process \
    --project_dir /path/to/project_dir \
    --subjects 1 2 3 4 5 6 7 8 9 10 \


uv run things-eeg2 info \
    --project-dir /path/to/project_dir \
    --subject <EXAMPLE_SUBJECT \
    --session <EXAMPLE_SESSION> \
    --data-index <EXAMPLE_INDEX>

Data Structure

For understanding the data structure that is created by the CLI (and then needed to perform proper preprocessing and loading), please see paths.py. All code is configured to use the structure defined there as its ground truth.

Embedding Generation (embedding_processing/)

The package supports multiple state-of-the-art vision models for generating image embeddings:

Model Embedder Class Description
open-clip-vit-h-14 OpenClipViTH14Embedder OpenCLIP ViT-H/14 (SDXL image encoder)
openai-clip-vit-l-14 OpenAIClipVitL14Embedder OpenAI CLIP ViT-L/14
dinov2 DinoV2Embedder DINOv2 with registers (self-supervised)
ip-adapter IPAdapterEmbedder IP-Adapter Plus projections

Each embedder generates:

  • Pooled embeddings: Single vector per image (e.g., (1024,) for ViT-H-14)
  • Full sequence embeddings: All tokens (e.g., (257, 1280) for ViT-H-14)
  • Text embeddings: Corresponding text features from image captions

Output Files:

embeddings/
├── ViT-H-14_features_training.pt           # Pooled embeddings
├── ViT-H-14_features_training_full.pt      # Full token sequences
├── ViT-H-14_features_test.pt
└── ViT-H-14_features_test_full.pt

References

Using the dataloader

from things_eeg2_dataset.dataloader import ThingsEEGDataset

dataset = ThingsEEGDataset(
    image_model="ViT-H-14",
    data_path="/path/to/processed_data",
    img_directory_training="/path/to/images/train",
    img_directory_test="/path/to/images/test",
    embeddings_dir="/path/to/embeddings",
    train=True,
    time_window=(0.0, 1.0),
)

See things_eeg2_dataloader/README.md for detailed usage.

Citation

We are happy users of the THINGS-EEG2 dataset, but not associated with the original authors. If you use this code, please cite the THINGS-EEG2 paper:

Gifford, A. T., Lahner, B., Saba-Sadiya, S., Vilas, M. G., Lascelles, A., Oliva, A., ... & Cichy, R. M. (2022). The THINGS-EEG2 dataset. Scientific Data.

License

This project follows the original THINGS-EEG2 license terms.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

things_eeg2_dataset-0.0.2.tar.gz (472.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

things_eeg2_dataset-0.0.2-py3-none-any.whl (94.8 kB view details)

Uploaded Python 3

File details

Details for the file things_eeg2_dataset-0.0.2.tar.gz.

File metadata

  • Download URL: things_eeg2_dataset-0.0.2.tar.gz
  • Upload date:
  • Size: 472.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for things_eeg2_dataset-0.0.2.tar.gz
Algorithm Hash digest
SHA256 dfaaa65d9ae2dd6ca7a2fa4d654de312aea41c7b0504b9d696e00b15b189c5d1
MD5 c5a2e1182cea6b02f33987829d68d812
BLAKE2b-256 8a1f2e4b2f0165be75b7018197561dad2696c77a09078a0ea3284ee3962b4c4a

See more details on using hashes here.

File details

Details for the file things_eeg2_dataset-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: things_eeg2_dataset-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 94.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for things_eeg2_dataset-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2a7c3f742406b803fe00b56050d963c6a110679e6010ccca0e5f2e968594e8ac
MD5 d1e1d2ad0828453fb5109eadcecec14d
BLAKE2b-256 c6713b1228d85f6bf0242425c4455f892873ad8c3fd275e419d4f21de02d0748

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page