Aircraft Detection 1.0
|
#include "svm_training.h"
#include "utils.h"
#include "hog_features_extraction.h"
#include "template_matching.h"
#include <random>
#include <filesystem>
#include <iostream>
#include <vector>
#include <opencv2/opencv.hpp>
Functions | |
void | classifyPointsByYoloBoxes (const std::vector< cv::Rect > &yolo_boxes, const std::vector< cv::Point > &max_corr_points, std::vector< cv::Point > &max_corr_points_inside_yolo, std::vector< cv::Point > &max_corr_points_outside_yolo) |
Classifies points based on whether they fall inside or outside of YOLO bounding boxes. | |
std::vector< cv::Rect > | selectROIsWithHighestIoU (const std::vector< std::pair< cv::Rect, std::vector< cv::Rect > > > &yoloBox_roi_pairs) |
Selects the Regions of Interest (ROIs) with the highest Intersection over Union (IoU) for each YOLO bounding box. | |
std::vector< std::pair< cv::Rect, std::vector< cv::Rect > > > | associateYoloBoxesWithRois (const std::vector< cv::Rect > &yolo_boxes, const std::vector< cv::Point > &max_corr_tp) |
Associates YOLO bounding boxes with Regions of Interest (ROIs) generated from points. | |
void | generateSvmTrainingData () |
Generates SVM training data by extracting HOG features and saving them to CSV files. | |
std::unordered_map< int, std::vector< cv::Point > > | groupPointsByYoloBox (const std::vector< cv::Rect > &yolo_boxes, const std::vector< cv::Point > &points) |
Groups points by the YOLO bounding box they fall into. | |
std::vector< std::pair< cv::Rect, std::vector< cv::Rect > > > associateYoloBoxesWithRois | ( | const std::vector< cv::Rect > & | yolo_boxes, |
const std::vector< cv::Point > & | max_corr_tp ) |
Associates YOLO bounding boxes with Regions of Interest (ROIs) generated from points.
This function associates each YOLO bounding box with a set of ROIs generated from points that fall within the bounding box. The ROIs are generated using predefined sizes calculated from clusters.
[in] | yolo_boxes | A vector of cv::Rect objects representing the YOLO bounding boxes. |
[in] | max_corr_tp | A vector of cv::Point objects representing the points to be associated with ROIs. |
void classifyPointsByYoloBoxes | ( | const std::vector< cv::Rect > & | yolo_boxes, |
const std::vector< cv::Point > & | max_corr_points, | ||
std::vector< cv::Point > & | max_corr_points_inside_yolo, | ||
std::vector< cv::Point > & | max_corr_points_outside_yolo ) |
Classifies points based on whether they fall inside or outside of YOLO bounding boxes.
This function iterates through a list of points and classifies each point as either inside or outside any of the provided YOLO bounding boxes. Points that fall inside any of the YOLO bounding boxes are added to the max_corr_points_inside_yolo
vector, while points that fall outside are added to the max_corr_points_outside_yolo
vector.
[in] | yolo_boxes | A vector of cv::Rect objects representing the YOLO bounding boxes. |
[in] | max_corr_points | A vector of cv::Point objects representing the points to be classified. |
[out] | max_corr_points_inside_yolo | A vector to store points that fall inside any YOLO bounding box. |
[out] | max_corr_points_outside_yolo | A vector to store points that fall outside all YOLO bounding boxes. |
void generateSvmTrainingData | ( | ) |
Generates SVM training data by extracting HOG features and saving them to CSV files.
This function processes a dataset of images and their corresponding YOLO labels to generate training data for an SVM. It performs template matching, classifies points based on their location relative to YOLO bounding boxes, extracts HOG features for true positives and false positives, and saves the features to CSV files.
The function performs the following steps:
std::unordered_map< int, std::vector< cv::Point > > groupPointsByYoloBox | ( | const std::vector< cv::Rect > & | yolo_boxes, |
const std::vector< cv::Point > & | points ) |
Groups points by the YOLO bounding box they fall into.
This function iterates through a list of points and groups them by the YOLO bounding box they fall into. Each YOLO bounding box is associated with a vector of points that are contained within it.
[in] | yolo_boxes | A vector of cv::Rect objects representing the YOLO bounding boxes. |
[in] | points | A vector of cv::Point objects representing the points to be grouped. |
cv::Point
objects that fall within that bounding box. std::vector< cv::Rect > selectROIsWithHighestIoU | ( | const std::vector< std::pair< cv::Rect, std::vector< cv::Rect > > > & | yoloBox_roi_pairs | ) |
Selects the Regions of Interest (ROIs) with the highest Intersection over Union (IoU) for each YOLO bounding box.
This function iterates over pairs of YOLO bounding boxes and associated ROIs, and selects the ROI with the highest IoU for each YOLO bounding box. The selected ROIs are returned in a vector.
[in] | yoloBox_roi_pairs | A vector of pairs, where each pair consists of a YOLO bounding box (cv::Rect) and a vector of associated ROIs (cv::Rect). |
cv::Rect
objects representing the ROIs with the highest IoU for each YOLO bounding box.