This system comprises two serverless functions deployed on OpenFaaS, leveraging MinIO for object storage, Python for scripting, YOLO for object detection, and OpenCV for image processing.
This code is a minified version of my thesis. You can find my thesis on ResearchGate .
Function 1 serves as the primary entry point, responsible for initiating video ingestion, preprocessing frames, storing them in MinIO, and triggering object detection.
- Purpose: Function 1 facilitates real-time video analysis for use cases such as surveillance, anomaly detection, and automated monitoring.
- Workflow:
- Ingestion Initiation: Receives a JSON payload containing the video stream URL, target object for detection, and probability threshold.
- Stream Processing: Fetches the video stream, extracts and preprocesses frames, ensuring compatibility with downstream processing.
- Data Storage: Stores preprocessed frames in MinIO, ensuring accessibility and scalability for subsequent analysis.
- Action Invocation: Triggers Function 2 (Object Detection) to perform object detection on stored frames.
Function 2 specializes in detecting objects within images stored in MinIO, annotating them with bounding boxes for visualization and further analysis.
- Purpose: Function 2 provides robust object detection capabilities, essential for tasks like inventory management, security monitoring, and content moderation.
- Workflow:
- Data Retrieval: Retrieves images from the designated MinIO bucket, processing them based on provided criteria.
- Object Detection: Utilizes YOLO to detect objects within images, applying bounding boxes to highlight their presence.
- Annotation: Annotates detected objects within images, enhancing their interpretability and facilitating downstream processing.
- Data Persistence: Stores annotated images back in the MinIO bucket, ensuring the preservation of analysis results.
This section provides instructions for deploying the system, including setup, configuration, and invocation steps.
This advanced system comprises two serverless functions deployed on OpenFaaS, leveraging MinIO for object storage, Python for scripting, YOLO for object detection, and OpenCV for image processing.
To deploy the system, follow these steps:
-
Set Up MinIO and OpenFaaS:
- Ensure MinIO and OpenFaaS are running in Docker containers.
- Configure the connection between MinIO and OpenFaaS to enable seamless data transfer.
-
Build the Functions:
- Use the
faas-cli build
command to build the functions based on the provided YAML configuration file (function.yml
).faas-cli build -f function.yml
- Use the
-
Deploy the Functions:
- Deploy the built functions using the
faas-cli deploy
command.faas-cli deploy -f function.yml
- Deploy the built functions using the
-
Configure MinIO Credentials:
- Ensure that the MinIO access key and secret key are correctly configured within the function code or provided via environment variables.
-
Verify Deployment:
- Once deployed, verify the successful deployment of the functions and their availability for invocation.
- Ensure that the MinIO bucket specified in the function code exists and is accessible.
-
Invoke the Functions:
- Trigger Function 1 (Video Ingestion and Object Detection Trigger) by sending a JSON payload containing the necessary parameters (video stream URL[HTTP or RTSP], object to detect, probability threshold).
- Monitor the system logs to track the progress of video ingestion, object detection, and any potential errors or issues.
-
Enjoy fast Video Analysis in a Serverless Manner:
- Sit back, relax, and witness the magic of real-time video ingestion and object detection as the system processes incoming streams and identifies objects of interest with remarkable accuracy.
- Artifact Requirements: Ensure the availability of YOLO configuration files (
yolov3-tiny.weights
,yolov3-tiny.cfg
,coco.names
) in the designated paths relative to function containers. - Networking Considerations: Ensure proper network configuration to enable seamless communication between the MinIO server and function instances.
- Artifact Requirements: Ensure the availability of YOLO configuration files (
yolov3-tiny.weights
,yolov3-tiny.cfg
,coco.names
) in the designated paths relative to function containers. - Networking Considerations: Ensure proper network configuration to enable seamless communication between the MinIO server and function instances.