Aircraft Detection 1.0
Loading...
Searching...
No Matches
svm_training.h File Reference

Go to the source code of this file.

Functions

void generateSvmTrainingData ()
 Generates SVM training data by extracting HOG features and saving them to CSV files.
 

Function Documentation

◆ generateSvmTrainingData()

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:

  1. Lists directories for k-means clustering by size and calculates average dimensions for ROIs.
  2. Reads dataset image paths and YOLO label paths.
  3. Reads images in grayscale.
  4. Iterates through each image in the dataset: a. Performs template matching. b. Reads YOLO bounding boxes. c. Classifies points inside and outside YOLO boxes. d. Filters points outside YOLO boxes by minimum distance. e. Associates each YOLO box with ROIs extracted from points inside it. f. Selects ROIs with the highest Intersection over Union (IoU) for true positives. g. Extracts ROIs for false positives. h. Extracts HOG features for true positives and false positives. i. Stores the HOG features in vectors, reserving space to minimize reallocations.
  5. Saves the HOG features to CSV files for SVM training.
Note
The function assumes that the dataset images and YOLO label files are in the specified directory.
The function initializes a random number generator for choosing random ROI sizes to extract false positives.
See also
listDirectories
calculateAvgDims
globFiles
readImages
templateMatching
readYoloBoxes
classifyPointsByYoloBoxes
filterPointsByMinDistance
associateYoloBoxesWithRois
selectROIsWithHighestIoU
hog_features_extraction
writeHogFeaturesToCsv