In this project, a real-time object detection system has been developed that consists of a Raspberry Pi and a webcam for performing object detection along with a backend and a frontend for storing and viewing the data. The backend has been built using Express
, Socket.io
and MongoDB Atlas
. The frontend has been built using React
and Tailwind CSS
.
The Raspberry Pi uses ssd_mobilenet_v1.tflite
for performing object detection on the video stream from the webcam. The results from the object detection is then sent to the backend through a HTTP POST request which then gets stored in mongoDB Atlas. The frontend displays all the events that the Raspberry Pi generated with details such as the objects detected in a frame of the video stream, the image, the probability of the class of the detected objects and so on.
Socket.IO
has been used for creating a bidirectional connnection between the backend and the frontend. When the backend recieves a new event from the Raspberry Pi, it updates the events displayed in the frontend in real-time.
- Raspberry Pi and webcam for capturing the video stream and sending the events to the backend.
- TensorFlow for loading and using
ssd_mobilenet_v1.tflite
model on the captured video stream. - Express for creating a REST API in the backend.
- MongoDB Atlas for storing the data in the cloud.
- Socket.IO for creating real-time bidirectional connection between backend and frontend.
- React for creating the frontend.
- Tailwindcss for styling the frontend.
- Clone the repository.
git clone https://github.com/Rahul-7323/Object-Detection-System-RPi.git
- Create a
.env
file in the root of thebackend
folder with the same format as that of.env.example
file and replace the dummy value ofMONGODB_URI
with an URL to a real MongoDB Atlas database. Optionally, change the value of thePORT
variable to some other port of you choice. - Similarily, create a
.env
file in the root of thefrontend
folder with the same format as that of.env.example
file and replace the values ofVITE_BACKEND_API_URL
andVITE_BACKEND_SOCKET_URL
variables if you have deployed the backend or changed the port numbers to something else in the backend. - Run the below commands in the terminal to start the backend.
cd backend yarn install yarn dev
- Run the below commands in the terminal to start the frontend.
cd frontend yarn install yarn dev
- Clone the repository.
git clone https://github.com/Rahul-7323/Object-Detection-System-RPi.git
- Replace the value of
url
variable in thedetect_webcam.py
file in theraspberry_pi
folder to the URL of the backend. - Run the below commands in the terminal of the Raspberry Pi to start the object detection process.
cd Object-Detection-System-RPi/raspberry_pi source setup.sh python3 detect_webcam.py --modeldir object_detection_model
For doubts related to usage of this project, watch the demo video.