AI for Passenger Counting: Technical Implementation of a System for Indian Buses
AI Solution for Transport Systems: How It Works
Modern artificial intelligence (AI) technologies are unlocking new possibilities for solving challenges in the transportation sector. One such challenge is the accurate counting of passengers on Indian buses, where systemic fraud by personnel leads to significant financial losses. This article delves into the technical side of the project, covering the system architecture, the development of a custom neural network, and compliance with India's data protection legislation.
From Idea to Implementation: Data Collection and Preparation
The project began with a detailed analysis of bus operating conditions in India. A field trip was organized to study vehicle design, determine optimal camera mounting angles, and collect a primary dataset. Over five days, about an hour of 4K video was recorded, forming the IndiaBus-v1.0 dataset. This material helped identify key detection challenges like occlusions, reflections, and lighting variations, and defined hardware requirements.
The results formed the basis for camera installation guidelines and data transfer protocols. Data from buses is uploaded via WiFi or GSM at terminal stops, minimizing infrastructure costs. Transfer speeds reach 400 Mbps, with upload times per trip taking 5–10 minutes. This approach enables the rapid processing of large data volumes without delays.
System Architecture: A Three-Tiered Approach
The passenger counting system is built on three tiers, each with specific tasks:
- Onboard Tier: Includes cameras for recording passenger entry and exit, a GPS module for location tracking, and an SSD for data storage during the trip (approx. 15 GB per trip).
- Upload Tier: Data is transferred to a server at terminal stops via high-speed WiFi or GSM.
- Server Tier: AI processing occurs here. First, a YOLO model detects faces, then images are cropped, followed by embedding extraction using the custom Adaptive Face Extractor neural network. Finally, embeddings are compared for passenger identification, and data is linked to stops via GPS and timestamps.
This approach not only counts passengers accurately but also calculates individual fares based on the distance traveled. The fare formula is simple: the sum of tariffs for all stops between the entry and exit points.
Why a Custom Neural Network: Advantages of the Adaptive Face Extractor
A proprietary Adaptive Face Extractor architecture was developed instead of using off-the-shelf solutions like FaceNet or ArcFace. The reasons are tied to the task's specificity and data:
- Adaptation to Indian Conditions: Pre-trained models on Western datasets showed low accuracy (~90%) with images featuring saris, turbans, and non-standard lighting. The custom network achieved 96.3% accuracy on Indian data.
- Resource Optimization: The model size is only 4.7 MB vs. 98 MB for commercial solutions, with inference time on CPU at 42 ms vs. 280 ms.
- Variable Input Size: The architecture supports processing images of different scales (from 80×80 to 180×160 pixels), crucial given varying passenger heights and distances to the camera.
- Data Control: Using an in-house model eliminates sending biometric data to external APIs, aligning with legal requirements.
- Cost Savings: No licensing fees, which could reach millions of rupees monthly when scaling to 180,000 passengers per day.
The Adaptive Face Extractor architecture includes key blocks: an initial block with Conv2D and BatchNorm, a multi-scale block with parallel branches, a Squeeze-and-Excitation attention mechanism, and final layers for 512D or 1024D embeddings. Training used the IndiaBus-v1.0 dataset with ArcFace Loss and data augmentation for robustness.
Data Synchronization and Fare Calculation
Accurate passenger counting and individual route determination rely on synchronizing camera and GPS data. The receiver supports NavIC L1 and GPS L1/L5, providing up to 10-meter accuracy. Timestamps are synchronized via an NTP server in Mumbai with under 100 ms error. Coordinates are logged every 15 seconds, and each video frame is tagged with location and time data.
Entry and exit embeddings are compared using cosine similarity. The similarity threshold is currently being fine-tuned to balance recognition precision and recall. The comparison code looks like this:
def compare_faces(embedding1, embedding2, threshold):
similarity = np.dot(embedding1, embedding2)
if similarity > threshold:
return True # Same person
else:
return False # Different people
Legal Compliance: Data Protection Under DPDPA 2023
A key project aspect is compliance with India's Digital Personal Data Protection Act (DPDPA 2023). This law is less stringent than GDPR or CCPA but still imposes serious requirements. Maximum penalties for violations can reach 250 crore rupees (approx. $30 million USD), though applied only for severe breaches like data leaks or lack of security measures.
To meet the law's requirements, the following measures were implemented:
- Data is stored exclusively on servers in India (Mumbai region).
- Facial images are retained for only 90 days for debugging, then deleted, while embeddings (which cannot reconstruct original images) are stored longer.
- Informational placards in Marathi, Hindi, and English are placed inside buses for informed consent.
- TLS 1.3 encryption and AES-256-GCM are used.
- Quarterly third-party audits are conducted.
Compliance with DPDPA 2023 not only minimizes risks but also provides a competitive edge, enabling operations where other companies might face restrictions.
Key Takeaways
- Technical Implementation: The three-tier architecture ensures data collection, transfer, and processing for accurate passenger counting.
- Custom Model: The Adaptive Face Extractor outperforms off-the-shelf solutions in accuracy on Indian data (96.3%) and resource optimization (4.7 MB, 42 ms on CPU).
- Legal Compliance: Adherence to DPDPA 2023 minimizes penalty risks and offers a market advantage.
- Data Synchronization: GPS and timestamps enable precise route and fare calculation for each passenger.
— Editorial Team
No comments yet.