Welcome to the AI Vision-Based Person Detection and Head Orientation Classification project! This tool leverages deep learning and computer vision to detect people, identify communication devices in an image, and classify the direction in which a person is looking based on head orientation landmarks. This README provides an overview of the setup, methodology, and usage of this project.
- Introduction
- Technologies Used
- Setup and Installation
- Methodology
- How to Use
- Sample Results
- Future Improvements
The primary goal of this project is to analyze images, count the number of people, identify if any communication devices are present, and classify head orientation direction (left, right, up, down, or at-system) for individuals in the image.
This type of analysis can be useful in various scenarios, such as monitoring attentiveness, surveillance, and interactive systems that adapt based on user direction.
- Python 3.12 - Programming Language
- OpenCV - For image processing and visualization
- YOLOv8 - Pre-trained model for object detection
- MediaPipe - For human pose and facial landmark detection
- Math and JSON - For processing coordinates and formatting outputs
- Python 3.12: Install Python from Python's official website.
- Required Libraries: You can install the necessary packages using pip.
- Clone this repository to your local machine:
git clone https://github.com/akshaysatyam2/Test-Cheating-Detection.git
- Install the required libraries:
pip install opencv-python ultralytics mediapipe
-
Person Detection: YOLOv8 is used to detect objects in the image, particularly focusing on identifying people and specific communication devices (like laptops, remotes, cell phones).
-
Head Orientation Estimation:
- MediaPipe’s Pose model is applied to detect facial landmarks, such as the nose, eyes, and ears.
- These landmarks help in calculating distances to estimate head orientation in multiple directions.
- Based on the relative positions of these points, the code classifies whether the person is looking directly at the system, or towards the left, right, up, or down.
-
Result Compilation:
- The output includes the count of people, presence of a communication device, and head orientation direction for each detected person.
- Place the images to be processed in a designated folder (e.g.,
/content). - Run the
classify_image()function, providing the path to each image. - The code processes each image, displays annotated results, and outputs a JSON with the following information:
people_count: Number of people in the image.direction_looking: Direction of gaze (left, right, up, down, or at-system).communication_device_present: Boolean indicating if a communication device is present.
The sample output will look something like this:
{
"people_count": 1,
"direction-looking": "right",
"communication_device_present": true
}The displayed image will show annotated points on detected facial landmarks, aiding in visual confirmation of the calculated gaze direction.
There are various areas where the project can be enhanced:
- Extended Head Pose Estimation: Incorporate more detailed 3D head pose estimation for finer orientation details.
- Real-Time Processing: Adapt the code for real-time video input or camera feed.
- Device-Specific Classification: Extend communication device detection to a broader range of items, potentially with fine-grained classification.
- Model Training: Currently we are using base model of Yolo and Mediapipe's Pose model so we can finetune or use better models for our tasks.
Thank you for using this project! If you encounter any issues or have suggestions, please feel free to reach out.