AI School Bus Safety Monitor

by angasailakshmi in Living > Kids

2 Views, 0 Favorites, 0 Comments

AI School Bus Safety Monitor

AI School Bus Safety Monitor.png
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

  1. Pictoblox Software: Download PictoBlox | Windows, MacOS, Linux, Chromebook, Android & iOS
  2. Laptop/PC
  3. Inbuilt or External Camera Setup
  4. Speaker or Headphones

Step by Step Block Code Guide

Screenshot 2026-10-01 121719.png

This code uses the PictoBlox Image Classifier to detect three situations:

  1. Student near bus door
  2. Student head out of the bus window
  3. Student sitting in the bus

Step 1: Start the Camera

From Video Sensing, add:

when green flag clicked
turn [on] video on stage with [0] transparency

This turns on the webcam and displays the camera feed.

Step 2: Create the Continuous Detection Loop

From Control, add:

forever

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:

analyse image from [web camera]

Place this inside the forever loop.

So far:

when green flag clicked
turn [on] video on stage with [0] transparency

forever
analyse image from [web camera]

Step 4: Detect "Student near bus door"

From Control, add an if then else block.

Use the AI block:

is identified class [Student near bus door] ?

Complete it as:

if <is identified class [Student near bus door] ?> then

Inside this condition, add:

4.1 Display warning

From Looks:

say [Unsafe Near Door]

4.2 Display warning on Quarky LED matrix

From Quarky:

display matrix as [warning symbol]

4.3 Play warning sound

From Sound:

play tone of note [B7] with duration [Eighth]

So this section becomes:

if <is identified class [Student near bus door] ?> then
say [Unsafe Near Door]
display matrix as [warning symbol]
play tone of note [B7] with duration [Eighth]

Step 5: Detect "Student Head out of the bus window"

Inside the else section of the previous condition, add another:

if <is identified class [Student Head out of the bus window] ?> then

Inside it:

5.1 Display warning message

say [Unsafe Head out of the bus window]

5.2 Show warning symbol

display matrix as [warning symbol]

5.3 Play warning sound

play tone of note [B7] with duration [Eighth]

The complete section:

else
if <is identified class [Student Head out of the bus window] ?> then
say [Unsafe Head out of the bus window]
display matrix as [warning symbol]
play tone of note [B7] with duration [Eighth]

Step 6: Detect "Student sitting in the bus"

Inside the second else, add another condition:

if <is identified class [Student sitting in the bus] ?> then

Inside it, add:

6.1 Display safe message

say [Safe Student sitting]

6.2 Display a safe symbol

From Quarky:

display matrix as [green/safe symbol]

Your section becomes:

else
if <is identified class [Student sitting in the bus] ?> then
say [Safe Student sitting]
display matrix as [safe symbol]

Step 7: Add a Small Delay

In the final else section, add:

wait [1] seconds

This prevents the program from running unnecessarily fast when no trained class is detected.

Complete Block Structure

Your final program should follow this structure:

when green flag clicked

turn on video on stage with 0 transparency

forever
analyse image from web camera

if <is identified class [Student near bus door] ?> then
say [Unsafe Near Door]
display matrix as [warning symbol]
play tone of note [B7] with duration [Eighth]

else
if <is identified class [Student Head out of the bus window] ?> then
say [Unsafe Head out of the bus window]
display matrix as [warning symbol]
play tone of note [B7] with duration [Eighth]

else
if <is identified class [Student sitting in the bus] ?> then
say [Safe Student sitting]
display matrix as [safe symbol]

else
wait [1] seconds


AI Image Classifier

Screenshot 2026-10-01 122021.png
Screenshot 2026-10-01 122240.png
Screenshot 2026-10-01 122131.png
ML.png
Screenshot 2026-10-01 122250.png

Open Image Classifier

  1. Open PictoBlox.
  2. Go to AI / ML Extensions.
  3. Open Image Classifier.
  4. Create a new Image Classification project.

Create the First Class – Student Near Bus Door

  1. Click Add Class.
  2. Rename the class as Student near bus door.
  3. Click Upload to add training images.
  4. Add around 20–30 images showing students standing or moving near the bus door.
  5. Use different angles, lighting conditions, and backgrounds.
  6. Make sure the images clearly represent this situation.

Create the Second Class – Student Head Out of Bus Window

  1. Add another class.
  2. Rename it Student Head out of the bus window.
  3. Upload around 20–30 images.
  4. Use images showing a student's head outside the bus window.
  5. Include different students, camera angles, and bus environments.

Create the Third Class – Student Sitting in the Bus

  1. Add another class.
  2. Rename it Student sitting in the bus.
  3. Upload around 20–30 images.
  4. Use images showing students properly seated inside the bus.
  5. Include different seating positions and backgrounds.

Train the AI Model

  1. Check that all three classes contain sufficient images.
  2. Click Train.
  3. Wait until the training is completed.
  4. Observe the Accuracy vs Epochs graph.
  5. If the accuracy is not satisfactory, add more varied images and click Train Again.


Test the Model

Screenshot 2026-10-01 122207.png
  1. After training is completed, go to the Testing section.
  2. Click Upload or Webcam.
  3. Provide a new image that was not used during training.
  4. The AI model will classify the image into one of the trained classes:
  5. Student near bus door
  6. Student Head out of the bus window
  7. Student sitting in the bus
  8. 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

AI School Bus Safety Monitor


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.