Annotations are collected from Gaze information from TOBI glass2 link for dataset
This guide will help you run the Python script designed for extracting frames from a video and visualizing bounding boxes on those frames. The bounding box where given in the seperate folder for each frame which was obtained from the Gaze information observed form TobiGlass2
- Python installed on your machine.
- OpenCV library installed. You can install it using
pip install opencv-python-headless. - A video file from which you want to extract frames.
- A text file containing bounding box coordinates.
- Place your video file and bounding box text file in an accessible directory.
- Open the script using a text editor or an IDE of your choice.
- Modify the script paths (video path, bounding box path, etc.) to match your file locations.
- Open a terminal or command prompt.
- Navigate to the directory containing the script.
- Run the script by typing
python saveFramefrvideo.py, replacingsaveFramefrvideo.pywith the name of your script file. - The script will create directories for extracted frames and visualized frames, and it will process the video and bounding box data accordingly.
After running the script, you will find two new directories containing the extracted frames and the visualized frames. The visualized frames will include bounding boxes drawn over the objects of interest as specified in your bounding box file.
This document provides instructions on how to use the script designed for converting bounding box annotations into the YOLOv8 format. This is particularly useful for preparing datasets for object detection models.
The script reads images and their corresponding bounding box annotations, converts these bounding boxes to the YOLOv8 format (normalized x_center, y_center, width, and height), and then saves each image and its new annotation in designated directories.
- Ensure all prerequisites are met: Python, OpenCV, and your dataset are ready.
- Adjust the script paths for images, bounding boxes, YOLOv8 formatted images, and annotation directories to your specific directory structure.
- Open a terminal or command prompt.
- Navigate to the directory containing the conversion script.
- Execute the script by typing
python conversiondata_yolov8.py, whereconversiondata_yolov8.pyis the name of your Python script. change the path of dataset directories in your script - The script will process each image and its annotation, saving the results in the specified YOLOv8 format directories.
Upon completion, the script outputs two main types of files in separate directories:
- Images: Copies of the original images, potentially with visualized bounding boxes if specified.
- Annotations: Text files in YOLOv8 format corresponding to each image, containing normalized bounding box coordinates and class identifiers.
This conversion is essential for training object detection models using the YOLOv8 algorithm, facilitating a standardized approach to dataset preparation.