AI School Bus Safety Monitor
AI School Bus Safety Monitor is an innovative AI-based project designed to improve student safety while travelling on school buses. The system uses an Image Classifier trained with different student and bus-safety situations, such as a student near the bus door, a student sitting inside the bus, and a student putting their head out of the bus window.
By analyzing images through a webcam or uploaded images, the AI model can identify potentially unsafe situations. This project demonstrates how Artificial Intelligence and image classification can be used to support safer school transportation and help students understand the importance of responsible behaviour on school buses.
Supplies
- Pictoblox Software: Download PictoBlox | Windows, MacOS, Linux, Chromebook, Android & iOS
- Laptop/PC
- Inbuilt or External Camera Setup
- Speaker or Headphones
Step by Step Block Code Guide
This code uses the PictoBlox Image Classifier to detect three situations:
- Student near bus door
- Student head out of the bus window
- Student sitting in the bus
Step 1: Start the Camera
From Video Sensing, add:
This turns on the webcam and displays the camera feed.
Step 2: Create the Continuous Detection Loop
From Control, add:
Inside the forever block, the AI will continuously analyze the camera image.
Step 3: Analyze the Webcam Image
From the Image Classifier / AI extension, add:
Place this inside the forever loop.
So far:
Step 4: Detect "Student near bus door"
From Control, add an if then else block.
Use the AI block:
Complete it as:
Inside this condition, add:
4.1 Display warning
From Looks:
4.2 Display warning on Quarky LED matrix
From Quarky:
4.3 Play warning sound
From Sound:
So this section becomes:
Step 5: Detect "Student Head out of the bus window"
Inside the else section of the previous condition, add another:
Inside it:
5.1 Display warning message
5.2 Show warning symbol
5.3 Play warning sound
The complete section:
Step 6: Detect "Student sitting in the bus"
Inside the second else, add another condition:
Inside it, add:
6.1 Display safe message
6.2 Display a safe symbol
From Quarky:
Your section becomes:
Step 7: Add a Small Delay
In the final else section, add:
This prevents the program from running unnecessarily fast when no trained class is detected.
Complete Block Structure
Your final program should follow this structure:
AI Image Classifier
Open Image Classifier
- Open PictoBlox.
- Go to AI / ML Extensions.
- Open Image Classifier.
- Create a new Image Classification project.
Create the First Class – Student Near Bus Door
- Click Add Class.
- Rename the class as Student near bus door.
- Click Upload to add training images.
- Add around 20–30 images showing students standing or moving near the bus door.
- Use different angles, lighting conditions, and backgrounds.
- Make sure the images clearly represent this situation.
Create the Second Class – Student Head Out of Bus Window
- Add another class.
- Rename it Student Head out of the bus window.
- Upload around 20–30 images.
- Use images showing a student's head outside the bus window.
- Include different students, camera angles, and bus environments.
Create the Third Class – Student Sitting in the Bus
- Add another class.
- Rename it Student sitting in the bus.
- Upload around 20–30 images.
- Use images showing students properly seated inside the bus.
- Include different seating positions and backgrounds.
Train the AI Model
- Check that all three classes contain sufficient images.
- Click Train.
- Wait until the training is completed.
- Observe the Accuracy vs Epochs graph.
- If the accuracy is not satisfactory, add more varied images and click Train Again.
Test the Model
- After training is completed, go to the Testing section.
- Click Upload or Webcam.
- Provide a new image that was not used during training.
- The AI model will classify the image into one of the trained classes:
- Student near bus door
- Student Head out of the bus window
- Student sitting in the bus
- Test several different images to check the model's performance.
Connect the Model to the Project
The trained model can be connected to the PictoBlox project to create a Smart School Bus Safety Monitor.
Applications
School Bus Safety Monitoring – Helps identify unsafe student behaviour inside and around school buses.
Driver/Attendant Assistance – Can help bus staff notice situations such as students near the door or leaning out of windows.
Student Safety Awareness – Can be used to teach students safe behaviour while travelling by bus.
School Safety Systems – The AI model can be integrated into a school transportation safety system.
Real-Time Monitoring – A webcam can be used to analyze student behaviour while the bus is stationary or during controlled demonstrations.
AI Learning Project – Helps students learn about image classification, computer vision, AI model training, and real-world problem solving.
Safety Alert System – The detected unsafe categories could be connected to an alert mechanism in a future version of the project.
Conclusion
The AI School Bus Safety Monitor successfully uses an Image Classifier to identify different student safety situations inside and around a school bus. By training the model with images of students near the bus door, sitting inside the bus, and putting their head out of the window, the system can recognize potentially unsafe behavior. This project helps students understand how AI image classification can be used to improve school bus safety and promote responsible behavior among students.