Course: Computational Cognitive Science
Project Type: Mandatory Course Project
This repository contains the code and methodology for automating the Bender Gestalt Test, a classic neuropsychological assessment used to evaluate visual-motor functioning and detect potential neurological impairments or psychological conditions.
The goal of this project is to build an end-to-end AI pipeline that takes scanned handwritten test papers from students, extracts clinical features (such as figure distortion, rotation, and erasures), and predicts a final psychological diagnosis. To achieve this, our 10-member team has split the architecture into two distinct but deeply integrated phases:
- Computer Vision (CV) Pipeline: Detects and classifies drawn figures from raw images.
- Machine Learning (ML) Pipeline: Processes the structured data from the CV model and predicts the final psychological diagnosis.
The dataset provided for this project consists of the following components:
- Raw Scans (
89 images): Scanned handwritten A4 pages (both portrait and landscape) containing student drawings of the 9 standard Bender Gestalt figures. - Ground Truth PDF: Used strictly as the reference for the correct orientation of the figures. Constraint: Images are never artificially rotated during preprocessing or augmentation.
- Clinical Labels (
CSV/Excel): A structured dataset containing demographic data (Age, Gender), drawing sequence, identified Gestalt errors (e.g., closure difficulties, angle alterations), and the final expert diagnosis (Normalvs.Abnormal/Neurosis, etc.).
Key Data Constraints Handled:
- Erasures as Features: Erasures are treated as clinical indicators of psychological state, not as noise.
- Multi-Value Cells: The raw Excel file contains comma-separated features within single cells, requiring strict feature engineering (One-Hot Encoding) before ML training.
- Data Annotation: Annotate the 89 raw images with bounding boxes for figures and erasures using LabelImg/Roboflow.
- Data Augmentation: Apply safe augmentations (brightness, contrast, noise, cropping) to expand the dataset. Strictly no rotation.
- Transfer Learning: Fine-tune YOLOv8 (pre-trained on ImageNet) to detect and classify the drawn figures.
- Inference & Output: Run the trained model on the dataset to generate a structured
cv_final_output.xlsxmatching the expected schema.
- Feature Engineering: Clean the raw dataset by parsing multi-feature cells (
str.split,get_dummies) into binary columns. - Exploratory Data Analysis (EDA): Analyze class distributions, apply SMOTE (if necessary), and create stratified train/test splits.
- Baseline Models: Train Logistic Regression and Random Forest classifiers to establish initial performance benchmarks.
- Advanced Models: Implement complex models (e.g., XGBoost, SVM) to maximize predictive accuracy.
- Model Explainability: Utilize SHAP values to interpret the model and visualize which specific drawing errors most heavily influence the final diagnosis.
bender_gestalt_project/
│
├── data/ # Data directory
│ ├── raw/ # Immutable original data (images, PDFs, raw CSV)
│ ├── interim/ # Data currently being processed (annotations)
│ └── processed/ # Cleaned features and CV model output
│
├── notebooks/ # Interactive experimentation notebooks
│ ├── team1_cv/ # YOLOv8 training, augmentation, and inference
│ └── team2_ml/ # EDA, feature engineering, and model training
│
├── src/ # Production-ready Python scripts
│ ├── cv_pipeline/ # YOLO training and inference scripts
│ └── ml_pipeline/ # Feature engineering, ML training, and evaluation
│
├── models/ # Saved model weights (.pt, .pkl)
├── reports/ # Generated reports, figures, and SHAP visuals
├── README.md # Project documentation
└── requirements.txt # Project dependencies (YOLO, sklearn, pandas, shap)
This project was developed by a 10-person team, divided into two specialized sub-teams working in parallel.
| Name | Role / Sub-Team | GitHub Profile |
|---|---|---|
| [Student Name 1] | Lead Annotator & Data Manager (Team 1 - CV) | @username |
| [Student Name 2] | Augmentation & Preprocessing Specialist (Team 1 - CV) | @username |
| [Student Name 3] | Transfer Learning Engineer (Team 1 - CV) | @username |
| [Student Name 4] | Model Tracking & Optimization (Team 1 - CV) | @username |
| [Student Name 5] | Inference & Output Engineer (Team 1 - CV) | @username |
| [Student Name 6] | Feature Engineering Lead (Team 2 - ML) | @username |
| [Student Name 7] | EDA & Data Preprocessor (Team 2 - ML) | @username |
| [Student Name 8] | Baseline ML Engineer (Team 2 - ML) | @username |
| [Student Name 9] | Advanced Models Engineer (Team 2 - ML) | @username |
| [Student Name 10] | Evaluation & Explainability Specialist (Team 2 - ML) | @username |