Skip to content

Latest commit

 

History

History
327 lines (239 loc) · 8.76 KB

File metadata and controls

327 lines (239 loc) · 8.76 KB

🧼 The IoT Hygiene Ecosystem - AI Model Infrastructure

Transforming Public Sanitation through Real-Time Monitoring & Digital Trust

This directory contains the complete AI model infrastructure for the Smart Toilet Hygiene Monitoring System, designed to restore public trust in toilets using IoT sensors, real-time hygiene scoring, and automated sanitation actions.

🚀 Project Overview

The IoT Hygiene Ecosystem is a smart sanitation solution targeting urban, rural, and institutional public toilets under India's Swachh Bharat Mission (SBM) framework.

📅 Target Deployment: July 2025
🎯 Theme: Smart Cities | IoT | AI | Public Health | Digital India


❗ Problem Statement: The Sanitation Paradox (2025)

India has successfully built toilets, but people still don't trust them.

  • 95%+ villages are ODF Plus certified
  • Only 10% of users trust public toilet maintenance
  • 🚫 68% of people avoid public toilets entirely
  • 🧠 Root cause: Psychological Scarring due to bad odor, dirty floors, no water, and unsafe environments

Result: Infrastructure exists, but usage does not.


💡 Our Solution

We convert a public toilet into a "Living Smart Unit" that:

  • Detects hygiene issues before users arrive
  • Automatically responds using IoT-driven actions
  • Displays a real-time Hygiene Trust Score outside the toilet
  • Rebuilds confidence through pre-entry validation

🔍 Key Features

🧪 Real-Time Hygiene Monitoring

  • Ammonia & odor detection
  • Water and soap level tracking
  • Touchless usage detection

📊 Digital Trust Score

  • Live hygiene score display
  • Last cleaned / disinfected time
  • QR-based hygiene verification for users & tourists

🤖 Automated Sanitation

  • Auto exhaust & odor neutralization
  • UV-C sterilization after usage
  • Touchless flush and taps

🚨 Safety & Inclusion

  • Panic/help button
  • Slip detection (future scope)
  • Women & elderly-friendly design

🧠 Behavioral Research (User-Centric Design)

We conducted a 10-point questionnaire to identify real user pain points:

  • Fear of bad smell & dirty floors
  • Avoidance of water intake
  • Surface-touch anxiety
  • Willingness to pay for guaranteed hygiene
  • Trust in digital hygiene scores

📌 Insight: Smell and first impression decide usage within 3 seconds


🧩 IoT Technical Architecture

🔌 Sensors Used

Sensor Purpose
MQ-135 / MQ-137 Ammonia & odor detection
PIR Sensor User presence detection
Ultrasonic Sensor Water tank level
Flow Sensor Water & soap usage
UV-C Module Post-use sterilization

⚙️ Automated Actions

  • High-speed exhaust activation
  • Ozone / odor neutralization
  • UV sterilization after exit
  • Alert generation for maintenance staff

🌍 Sector-Specific Deployment

🏡 Rural (SBM-Gramin)

  • Solar-powered IoT
  • LoRaWAN communication
  • Low-internet dependency

🏙️ Urban (Malls, Parks, Smart Cities)

  • Premium "Loo-Café" hygiene model
  • Pay-per-use with guaranteed cleanliness

🏫 Schools & Colleges

  • Soap-usage tracking
  • Handwashing compliance monitoring
  • Child-safe hygiene assurance

🧪 Innovation Highlights

  • Pre-Entry Hygiene Validation
  • Psychological Barrier Reduction
  • Global Hygiene QR for Tourists
  • Behavior-first sanitation design

📈 Impact

  • Increased public toilet usage
  • Reduced health risks & infections
  • Higher citizen satisfaction scores
  • Data-driven sanitation governance
  • Alignment with Super Swachh League (2025) metrics

🔮 Future Scope

  • AI-based hygiene prediction
  • Computer vision for cleanliness detection
  • Mobile app for hygiene navigation
  • Government dashboard integration
  • Predictive maintenance alerts

🏁 Conclusion

Public sanitation in 2025 requires more than infrastructure — it requires Digital Trust.

The IoT Hygiene Ecosystem bridges the gap between:

"There is a toilet" and
"I feel safe using this toilet."


📁 AI Model Infrastructure Directory Structure

Directory Structure

ai_model/
├── data/                    # Data storage and processing
│   ├── raw/                # Raw sensor data from IoT devices
│   ├── processed/          # Cleaned and preprocessed data
│   └── synthetic/          # Augmented and synthetic data
├── models/                 # Trained ML models and artifacts
├── training/               # Model training infrastructure
│   ├── scripts/           # Training scripts and notebooks
│   └── logs/              # Training logs and metrics
├── testing/               # Testing and validation
│   ├── unit_tests/        # Unit tests for model components
│   └── integration_tests/ # End-to-end pipeline tests
├── evaluation/            # Model evaluation and performance metrics
├── utils/                 # Utility functions and helpers
└── config/                # Configuration files and parameters

## Quick Start

### 1. Training the Model
```bash
cd training/scripts
python train_model.py

2. Running Tests

# Unit tests
cd testing/unit_tests
python test_model.py

# Integration tests
cd testing/integration_tests
python test_pipeline.py

3. Data Flow

  1. Raw Data Collection: IoT sensors collect environmental data
  2. Data Processing: Clean and preprocess sensor readings
  3. Model Training: Train hygiene prediction models
  4. Model Testing: Validate model performance
  5. Deployment: Deploy trained models to production

Data Format

Training Features

  • humidity: Relative humidity percentage (0-100)
  • temperature: Temperature in Celsius (15-35°C)
  • ammonia_level: Ammonia concentration (ppm)
  • co2_level: CO2 concentration (ppm)
  • occupancy_duration: Average occupancy time (seconds)
  • usage_count: Number of toilet uses
  • cleaning_frequency: Cleaning frequency per day
  • hygiene_score: Target variable (0-100)

Testing Features

Same as training features but without the target variable (hygiene_score).

Model Architecture

The current implementation uses:

  • Algorithm: Random Forest Regressor
  • Features: 7 environmental and usage metrics
  • Target: Hygiene score (0-100)
  • Evaluation: MSE, R² Score

Performance Metrics

  • MSE: Mean Squared Error
  • R² Score: Coefficient of determination
  • Feature Importance: Ranking of input features

File Descriptions

Data Files

  • sensor_readings.csv: Raw sensor data from IoT devices
  • training_features.csv: Preprocessed training data
  • testing_features.csv: Preprocessed testing data
  • augmented_data.csv: Synthetic and augmented training data

Training Scripts

  • train_model.py: Main training script with model pipeline

Test Files

  • test_model.py: Unit tests for model functionality
  • test_pipeline.py: Integration tests for data pipeline

Usage Examples

Loading and Using the Model

import joblib
import pandas as pd

# Load trained model
model = joblib.load('models/hygiene_predictor.pkl')

# Prepare input data
input_data = pd.DataFrame({
    'humidity': [65.0],
    'temperature': [22.0],
    'ammonia_level': [0.8],
    'co2_level': [450],
    'occupancy_duration': [180],
    'usage_count': [12],
    'cleaning_frequency': [8]
})

# Make prediction
hygiene_score = model.predict(input_data)
print(f"Predicted hygiene score: {hygiene_score[0]:.1f}")

Data Preprocessing

import pandas as pd

def preprocess_sensor_data(raw_data):
    """Preprocess raw sensor data for model input"""
    # Handle missing values
    processed_data = raw_data.fillna(method='forward_fill')
    
    # Normalize features if needed
    # Add feature engineering logic here
    
    return processed_data

Configuration

Model configuration files are stored in the config/ directory:

  • Model hyperparameters
  • Feature engineering settings
  • Evaluation metrics configuration

Testing Strategy

  1. Unit Tests: Test individual model components
  2. Integration Tests: Test complete data pipeline
  3. Performance Tests: Monitor model performance metrics
  4. Data Quality Tests: Validate input data integrity

Future Enhancements

  • Deep learning models (LSTM, CNN)
  • Real-time model updates
  • Advanced feature engineering
  • Model explainability tools
  • Automated hyperparameter tuning
  • Model versioning and A/B testing

Dependencies

  • pandas
  • numpy
  • scikit-learn
  • joblib
  • pytest (for testing)

Contributing

  1. Add new training data to data/raw/
  2. Update preprocessing scripts in training/scripts/
  3. Run tests to ensure model quality
  4. Update documentation and metrics

License

This AI model is part of the Smart Toilet Hygiene Monitoring System.