Skip to content

Venu22003/Autism-detection-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Autism Detection System

A comprehensive machine learning-based system for detecting Autism Spectrum Disorder (ASD) in children using multiple approaches including questionnaire analysis, video processing, and deep learning CNN models.

Python Django TensorFlow License

๐Ÿ“‹ Table of Contents

๐ŸŽฏ Overview

This project implements a multi-modal autism detection system that combines:

  • Questionnaire-based Assessment: Uses standardized autism screening questions (A-10 questionnaire)
  • Video Analysis: Processes video files to extract behavioral patterns using CNN
  • Machine Learning Models: Multiple ML algorithms (Random Forest, Decision Trees, KNN, Naive Bayes)
  • Deep Learning: Custom CNN architecture for image-based classification
  • Web Application: User-friendly Django-based interface for assessments

The system aims to assist healthcare professionals and parents in early detection of autism spectrum disorder in children, enabling timely intervention and support.

โœจ Features

Core Functionality

  • ๐ŸŽฏ Multi-Modal Detection: Combines questionnaire data with video/image analysis
  • ๐Ÿงช Machine Learning Pipeline: Implements multiple algorithms for comparison and ensemble predictions
  • ๐ŸŽฅ Video Processing: Extracts frames from videos for behavioral analysis
  • ๐Ÿ“Š Data Visualization: Interactive charts and analysis using Streamlit and Plotly
  • ๐Ÿ‘ค User Management: Registration, login, and authentication system
  • ๐Ÿ’พ Database Integration: MySQL database for storing user data and results
  • ๐Ÿ“ˆ Model Training: Includes scripts for training custom CNN models
  • ๐Ÿ”’ Admin Dashboard: Separate admin interface for managing the system

Analysis Features

  • Question-based autism screening (10-question assessment)
  • Video upload and frame extraction
  • CNN-based image classification (Autistic/Non-Autistic)
  • Multiple ML model comparison
  • Result visualization and reporting
  • Historical data tracking

๐Ÿ—๏ธ System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Web Interface โ”‚ (Django)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”
    โ”‚  Views  โ”‚ (Request Handling)
    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
         โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚                         โ”‚
โ”Œโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”
โ”‚ MySQL  โ”‚          โ”‚ ML Pipeline  โ”‚
โ”‚   DB   โ”‚          โ”‚   - CNN      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ”‚   - RF/KNN   โ”‚
                    โ”‚   - Analysis โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ Technologies Used

Backend

  • Python 3.8+: Core programming language
  • Django 2.2.8: Web framework
  • TensorFlow 2.6.2: Deep learning framework
  • Keras 2.6.0: High-level neural networks API
  • OpenCV 4.5.5: Video and image processing

Machine Learning

  • scikit-learn 0.24.2: ML algorithms and preprocessing
  • pandas 1.3.5: Data manipulation and analysis
  • numpy 1.21.6: Numerical computing
  • seaborn 0.11.2: Statistical data visualization
  • plotly 5.13.1: Interactive visualizations

Frontend

  • HTML/CSS: Web interface templates
  • Streamlit 1.19.0: Interactive data apps
  • Bootstrap: Responsive design (implied from templates)

Database

  • MySQL: Primary database
  • mysqlclient 1.4.5: MySQL database connector
  • SQLite3: Secondary database option

๐Ÿ“ฆ Installation

Prerequisites

  • Python 3.8 or higher
  • MySQL Server
  • Git
  • pip (Python package manager)

Step 1: Clone the Repository

git clone https://github.com/Venu22003/Autism-detection-system.git
cd Autism-detection-system

Step 2: Create Virtual Environment

# Windows
python -m venv venv
venv\Scripts\activate

# Linux/Mac
python3 -m venv venv
source venv/bin/activate

Step 3: Install Dependencies

pip install -r requirements.txt

Step 4: Database Setup

  1. Create MySQL Database:
CREATE DATABASE autism;
  1. Import Database Schema:
mysql -u root -p autism < database/autism.sql
  1. Configure Database Settings in textutils/settings.py:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'autism',
        'USER': 'root',
        'PASSWORD': 'your_password',
        'HOST': 'localhost',
        'PORT': '3306',
    }
}

Step 5: Run Migrations

python manage.py migrate

Step 6: Create Directories

# Create necessary directories
mkdir -p output_frames
mkdir -p static/uploads

๐Ÿš€ Usage

Running the Django Web Application

# Start the development server
python manage.py runserver

# Access the application at:
# http://localhost:8000

Or use the provided batch file (Windows):

run.bat

Running the Streamlit Dashboard

streamlit run first.py

Training the CNN Model

# Train the CNN model on your dataset
python cnn.py

This will:

  • Load training and test data from dataset/
  • Train the model for 25 epochs
  • Save the model as autism_detection_model.h5

Video Processing

# Process a video file to extract frames
python main.py path/to/video.mp4

๐Ÿ“ Project Structure

autism-detection-system/
โ”œโ”€โ”€ manage.py                    # Django management script
โ”œโ”€โ”€ requirements.txt             # Python dependencies
โ”œโ”€โ”€ README.md                    # Project documentation
โ”œโ”€โ”€ LICENSE                      # License file
โ”œโ”€โ”€ .gitignore                   # Git ignore rules
โ”‚
โ”œโ”€โ”€ textutils/                   # Main Django app
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ settings.py              # Django settings
โ”‚   โ”œโ”€โ”€ urls.py                  # URL routing
โ”‚   โ”œโ”€โ”€ views.py                 # View functions
โ”‚   โ”œโ”€โ”€ models.py                # Database models
โ”‚   โ”œโ”€โ”€ wsgi.py                  # WSGI config
โ”‚   โ””โ”€โ”€ asgi.py                  # ASGI config
โ”‚
โ”œโ”€โ”€ templates/                   # HTML templates
โ”‚   โ”œโ”€โ”€ index.html               # Home page
โ”‚   โ”œโ”€โ”€ login.html               # User login
โ”‚   โ”œโ”€โ”€ registration.html        # User registration
โ”‚   โ”œโ”€โ”€ autism.html              # Assessment results
โ”‚   โ”œโ”€โ”€ find_artism.html         # Assessment form
โ”‚   โ”œโ”€โ”€ analyze1.html            # Admin dashboard
โ”‚   โ”œโ”€โ”€ analyze2.html            # Video upload
โ”‚   โ”œโ”€โ”€ analyze3.html            # Video listing
โ”‚   โ”œโ”€โ”€ analyze4.html            # Results display
โ”‚   โ””โ”€โ”€ style.css                # Stylesheet
โ”‚
โ”œโ”€โ”€ static/                      # Static files
โ”‚   โ””โ”€โ”€ uploads/                 # Uploaded videos
โ”‚
โ”œโ”€โ”€ data/                        # Data files
โ”‚   โ”œโ”€โ”€ Autism-Child-Data.csv    # Raw dataset
โ”‚   โ””โ”€โ”€ temp.csv                 # Temporary data
โ”‚
โ”œโ”€โ”€ dataset/                     # Training/test images
โ”‚   โ”œโ”€โ”€ training_set/
โ”‚   โ”‚   โ”œโ”€โ”€ Autistic/            # Autistic class images
โ”‚   โ”‚   โ””โ”€โ”€ Non_Autistic/        # Non-autistic class images
โ”‚   โ””โ”€โ”€ test_set/
โ”‚       โ”œโ”€โ”€ Autistic/
โ”‚       โ””โ”€โ”€ Non_Autistic/
โ”‚
โ”œโ”€โ”€ database/                    # Database files
โ”‚   โ””โ”€โ”€ autism.sql               # MySQL schema
โ”‚
โ”œโ”€โ”€ output_frames/               # Extracted video frames
โ”‚
โ”œโ”€โ”€ Models & Scripts:
โ”œโ”€โ”€ cnn.py                       # CNN model training
โ”œโ”€โ”€ predict.py                   # Prediction script
โ”œโ”€โ”€ main.py                      # Video frame extraction
โ”œโ”€โ”€ first.py                     # Streamlit dashboard
โ”œโ”€โ”€ views.py                     # Additional views
โ”œโ”€โ”€ test_mysql.py                # Database test
โ”‚
โ”œโ”€โ”€ Data Files:
โ”œโ”€โ”€ dataset2.csv                 # Questionnaire dataset
โ”œโ”€โ”€ featuresdb6.csv              # Feature database
โ”œโ”€โ”€ pcdb6.csv                    # Principal components
โ”œโ”€โ”€ outputs_main.csv             # Model outputs
โ”œโ”€โ”€ autism_detection_model.h5    # Trained CNN model
โ”‚
โ””โ”€โ”€ Documentation:
    โ”œโ”€โ”€ SETUP_INSTRUCTIONS.md    # Setup guide
    โ”œโ”€โ”€ QUICKSTART.md            # Quick start guide
    โ”œโ”€โ”€ CONTRIBUTING.md          # Contribution guidelines
    โ”œโ”€โ”€ MYSQL_SETUP.md           # MySQL setup guide
    โ””โ”€โ”€ GITHUB_SETUP.md          # GitHub setup guide

๐Ÿ“Š Dataset Information

Questionnaire Dataset (dataset2.csv)

  • Questions: 10 autism screening questions (Q1-Q10)
  • Demographics: Age, gender
  • Medical History: Jaundice history, family ASD history
  • Target: Class label (Autistic/Non-Autistic)
  • Source: Based on standardized autism screening questionnaires

Image Dataset (dataset/)

  • Classes: Autistic, Non_Autistic
  • Structure: Organized in training_set and test_set folders
  • Format: Images (JPG/PNG)
  • Size: 64x64 pixels (resized during preprocessing)

Features

  • 10 behavioral assessment scores
  • Age (numerical)
  • Gender (categorical)
  • Jaundice history (Yes/No)
  • Family ASD history (Yes/No)

๐Ÿค– Model Details

CNN Architecture

Model: Sequential
_________________________________________________________________
Layer (type)                 Output Shape              Params
=================================================================
Conv2D (32 filters, 3x3)     (None, 62, 62, 32)       896
MaxPooling2D (2x2)           (None, 31, 31, 32)       0
Conv2D (32 filters, 3x3)     (None, 29, 29, 32)       9248
MaxPooling2D (2x2)           (None, 14, 14, 32)       0
Flatten                      (None, 6272)              0
Dense (128 units, ReLU)      (None, 128)               802944
Dense (1 unit, Sigmoid)      (None, 1)                 129
=================================================================
Total params: 813,217
Trainable params: 813,217

Training Configuration

  • Optimizer: Adam
  • Loss Function: Binary Crossentropy
  • Metrics: Accuracy
  • Epochs: 25
  • Batch Size: 32
  • Input Shape: (64, 64, 3)
  • Data Augmentation: Rescaling (1./255)

Machine Learning Models

The system also implements traditional ML algorithms:

  • Random Forest Classifier
  • K-Nearest Neighbors (KNN)
  • Decision Trees
  • Naive Bayes
  • Logistic Regression

๐Ÿ–ฅ๏ธ Web Interface

User Pages

  1. Home Page (/)

    • Welcome page with system overview
    • Navigation to login/registration
  2. Registration (/registration)

    • New user registration
    • Fields: Name, Email, Mobile, User ID, Password
  3. Login (/login)

    • User authentication
    • Redirects to assessment page
  4. Autism Assessment (/analyze)

    • 10-question autism screening
    • Demographic information collection
    • Instant result display
  5. Video Upload (/analyze2)

    • Upload video files for analysis
    • Video description input
  6. Results (/autism)

    • Display assessment results
    • Classification: Autistic/Non-Autistic

Admin Pages

  1. Admin Login (/login1)

    • Admin credentials: admin/admin
  2. Admin Dashboard (/analyze1)

    • System overview
    • User management
  3. Video Management (/analyze3, /analyze4)

    • View uploaded videos
    • Process video files

๐Ÿ”Œ API Endpoints

Method Endpoint Description
GET / Home page
POST /registration User registration
POST /login User login
POST /login1 Admin login
GET/POST /analyze Autism assessment form
GET /find Assessment page
GET /analyze1 Admin dashboard
POST /analyze2 Video upload
GET /analyze3 Video list view
GET /analyze4 Video results view
POST /output Video processing

๐Ÿ“ˆ Model Performance

The system achieves the following performance metrics (approximate):

  • CNN Model Accuracy: ~85-90% on test set
  • Random Forest Accuracy: ~88% on questionnaire data
  • Precision: High precision for early detection
  • Recall: Optimized for minimizing false negatives

Note: Performance may vary based on dataset quality and size.

๐Ÿ”ง Configuration

Django Settings (textutils/settings.py)

Key configurations to modify:

# Security
SECRET_KEY = 'your-secret-key-here'
DEBUG = False  # Set to False in production

# Database
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'autism',
        'USER': 'your_username',
        'PASSWORD': 'your_password',
        'HOST': 'localhost',
        'PORT': '3306',
    }
}

# Static files
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

# Media files
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static/uploads')

๐Ÿงช Testing

Run Database Tests

python test_mysql.py

Test Model Predictions

python predict.py

Test Video Processing

python main.py test_video.mp4

๐Ÿš€ Deployment

Production Deployment Steps

  1. Set Environment Variables:
export DEBUG=False
export SECRET_KEY='your-production-secret-key'
export DATABASE_URL='mysql://user:pass@host:port/dbname'
  1. Collect Static Files:
python manage.py collectstatic
  1. Use Production Server (e.g., Gunicorn):
pip install gunicorn
gunicorn textutils.wsgi:application --bind 0.0.0.0:8000
  1. Configure Nginx (optional):
server {
    listen 80;
    server_name your-domain.com;

    location /static/ {
        alias /path/to/staticfiles/;
    }

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

๐Ÿค Contributing

We welcome contributions to improve this autism detection system! Please see CONTRIBUTING.md for details.

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guide for Python code
  • Write meaningful commit messages
  • Add tests for new features
  • Update documentation as needed
  • Ensure all tests pass before submitting PR

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Dataset Sources:

    • Autism screening questionnaire data
    • Image datasets for CNN training
  • Frameworks & Libraries:

    • TensorFlow and Keras teams
    • Django community
    • scikit-learn developers
  • Research References:

    • Autism screening methodologies
    • Deep learning for medical diagnosis
    • Early autism detection studies

๐Ÿ“ž Contact & Support

๐Ÿ“ Citation

If you use this project in your research, please cite:

@software{autism_detection_system,
  title={Autism Detection System using Machine Learning and Deep Learning},
  author={Your Name},
  year={2025},
  url={https://github.com/Venu22003/Autism-detection-system}
}

โš ๏ธ Disclaimer

This system is designed as an assistive tool for autism screening and should NOT replace professional medical diagnosis. Always consult qualified healthcare professionals for accurate diagnosis and treatment plans. The predictions made by this system are based on machine learning models and may not be 100% accurate.

๐Ÿ”ฎ Future Enhancements

  • Add more diverse datasets
  • Implement real-time video analysis
  • Add multi-language support
  • Integrate with mobile applications
  • Improve model accuracy with ensemble methods
  • Add detailed reporting and analytics
  • Implement user feedback mechanism
  • Add API for third-party integrations
  • Deploy as cloud service (AWS/Azure/GCP)
  • Add explainable AI features (LIME/SHAP)

Made with โค๏ธ for early autism detection and intervention

Last Updated: November 2025