A Service that EEG-based ERP analysis to recommend personalized fashion coordination and virtually apply the outfits to user images.
This BCI project leverages EEG measurements to analyze ERP signals, identifying user preferences.
Based on these insights, it recommends omnivore-inspired fashion coordination, combining tops and bottoms, and virtually applies the selected outfits to user images using advanced AI.
To install the necessary packages, run:
# clone project
git clone https://github.com/jinseok19/CODEEG.git
cd codeeg
# [OPTIONAL] create conda environment
conda create -n myenv python=3.7
conda activate codeeg
# install requirements
pip install -r requirements.txtTo start the application, execute:
python app.pyWearing the MAVE EEG device, we test top and bottom images. Using P300 signals, we select the top and bottom images to create combination images. These results are then processed using the Replicate API with the IDM-VTON model to virtually dress the user image.
- Test the top clothing items.
- Test the bottom clothing items.
- Test the clothing combinations.
- Proceed with the virtual dressing:
- 2.1 Upload your full-body image.
- 2.2 Click the 'Dress Up' button.
- Click the 'View Report' button to see the results.
This is the current best-in-class virtual try-on model, created by the Korea Advanced Institute of Science & Technology (KAIST). Itβs capable of virtual try-on βin the wildβ which has notoriously been difficult for generative models to tackle, until now!
IDM-VTON : Improving Diffusion Models for Authentic Virtual Try-on in the Wild This is an official implementation of paper βImproving Diffusion Models for Authentic Virtual Try-on in the Wildβ
- Purpose: The main Flask web application for the project.
- Key Features:
- Handles routing (
/step1,/step2,/step3). - Manages image uploads and user sessions.
- Facilitates virtual try-on functionality by invoking
dress_up.py. - Supports asynchronous task handling and result rendering.
- Handles routing (
- Objective: Recommends the Top 5 images for tops and bottoms based on EEG data.
- Workflow:
- Image Preprocessing: Resizes images for tops and bottoms.
- ERP Analysis: Uses
erp_combination.pyto extract P300 peaks from EEG data. - Recommendation: Invokes
recommendation.pyto extract Top 5 images based on P300 peaks. - Storage: Saves recommended images in a specified directory.
- Objective: Recommends the Top 3 top-bottom combinations based on EEG data.
- Workflow:
- Uses
task.pyto extract Top 5 images for both tops and bottoms. - Combination Generation: Creates 25 top-bottom combination images and resizes them.
- ERP Analysis: Uses
erp_combination2.pyto analyze EEG data for combination images. - Recommendation: Invokes
recommendation2.pyto select the Top 3 combinations based on P300 peaks. - Storage: Saves the selected combinations, including their corresponding top and bottom images, in a specified directory.
- Uses
erp_combination.pyanderp_combination2.pyanalyze EEG data to detect P300 peaks, which indicate user preferences.
recommendation.py: Recommends Top 5 images for tops and bottoms.recommendation2.py: Recommends Top 3 top-bottom combinations.
task.py: Resizes top and bottom images.task2.py: Creates and resizes top-bottom combination images.
dress_up.py:- Generates virtual try-on images for tops and bottoms using the Replicate API.
- Saves the results in specified directories.
- Processes EEG data:
- Includes filtering, normalization, and epoch extraction.
- Handles image preprocessing:
- Resizes and combines images within specified directories.
- Applies Butterworth filters (bandpass, lowpass, highpass) to EEG signals for noise reduction.
- Provides tools for ERP analysis.
- Supports data preprocessing and synchronization.
- Visualizes EEG data and frequency analysis results.
- Key Functions:
PlotEEG: Visualizes EEG channel data.
static/uploads: Temporarily stores uploaded images.static/images/result: Stores processed results (tops, bottoms, combinations).templates: Contains HTML templates for the Flask web application.
CODEEG/
βββ __pycache__/ # Compiled Python bytecode cache
βββ data/ # Directory for storing EEG data
βββ event/ # Directory for storing event data
βββ images/ # Repository for original images
βββ plot/ # Directory for storing ERP analysis plots
β βββ bottoms/ # Plots related to bottoms
β βββ combination/ # Plots related to combinations
β βββ tops/ # Plots related to tops
βββ run/ # Scripts for execution
βββ src/ # Source code directory
β βββ __pycache__/ # Python cache
β βββ analysis.py # EEG analysis module
β βββ iir.py # Signal filtering module
β βββ plot.py # Data visualization module
β βββ preprocess.py # Data preprocessing module
β βββ recommendation.py # Clothing recommendation algorithm
β βββ recommendation2.py # Improved clothing recommendation algorithm
β βββ task.py # Basic experiment task
β βββ task2.py # Improved experiment task
βββ static/ # Web static files
β βββ css/ # Stylesheets
β βββ data/ # Data files for web
β βββ images/ # Images for web
β βββ result # recommended images results (top garments, bottom garments, combinations)
β βββ js/ # JavaScript files
β βββ uploads/ # User-uploaded files
βββ templates/ # HTML templates
β βββ dress_up.html # Virtual fitting page
β βββ index.html # Main page
β βββ report.html # Result report page
β βββ start_page.html # Start page
β βββ step1.html # Step 1 experiment page
β βββ step2.html # Step 2 experiment page
β βββ step3.html # Step 3 experiment page
βββ app.py # Flask web application
βββ dress_up.py # Virtual fitting logic
βββ erp_combination.py # ERP-based clothing combination analysis
βββ erp_combination2.py # Improved clothing combination analysis
βββ README.md # Project documentation
task.py: Selects the top 5 recommended images for tops and bottoms.task2.py: Selects the top 3 recommended top-bottom combinations.
erp_combination.py: Analyzes user preferences for tops and bottoms.erp_combination2.py: Analyzes user preferences for top-bottom combinations.
dress_up.py: Generates virtual try-on images.
- The user uploads their image.
- EEG data and images are used to recommend tops and bottoms (
task.py). - Top-bottom combination images are generated and final recommendations are made (
task2.py). - Virtual try-on images are generated (
dress_up.py). - Results are displayed via the web application.










