Aircraft Detection 1.0
|
#include "pipeline.h"
#include "hog_features_extraction.h"
#include "utils.h"
#include "template_matching.h"
#include "kmeans.h"
#include "eigenplanes.h"
#include "python_script.h"
#include "svm_training.h"
#include "straight_airplanes_extraction.h"
Functions | |
void | performKMeansBySize () |
Performs K-Means clustering on extracted templates based on their size and saves the clustered images. | |
void | performKMeansByIntensity () |
Performs K-Means clustering on images based on their intensity and saves the clustered images. | |
void | resizeImgsSingleCluster (const std::string &cluster_input_path, const std::filesystem::path &output_base_path, size_t cluster_index) |
Resizes images within a single cluster to the same dimensions and saves them. | |
void | resizeImagesAcrossClusters () |
Resizes images across multiple clusters to the same dimensions and saves them. | |
void | generateEigenplanes () |
Generates average planes (eigenplanes) for clustered images and saves them. | |
void | evaluatePerformance () |
Evaluates the performance of the SVM model. | |
void | createCompletionFile (const std::string &step) |
Creates a completion file for a specified step. | |
void | checkPreviousStep (const std::string ¤t_step) |
Checks if the previous step required for the current step has been executed. | |
void | parseArguments (int argc, char **argv, std::vector< std::string > &steps) |
Parses command-line arguments to extract the list of steps to be executed. | |
void | executeStep (const std::string &step) |
Executes the specified step if it is defined in the step functions map. | |
void | printHelp () |
Prints the help message for the Aircraft Detection Project. | |
Variables | |
const std::filesystem::path | stepStatePath = std::filesystem::path(SRC_DIR_PATH)/ "steps_completed" |
const std::unordered_map< std::string, std::string > | stepDependencies |
Defines the dependencies between steps. | |
std::unordered_map< std::string, std::function< void()> > | stepFunctions |
Maps step names to their corresponding functions. | |
void checkPreviousStep | ( | const std::string & | current_step | ) |
Checks if the previous step required for the current step has been executed.
This function verifies if the step that the current step depends on has been executed by checking for the existence of a corresponding ".done" file. If the previous step has not been executed, it throws a runtime error.
[in] | current_step | The name of the current step to be executed. |
std::runtime_error | If the previous step required for the current step has not been executed. |
void createCompletionFile | ( | const std::string & | step | ) |
Creates a completion file for a specified step.
This function creates a directory for step state files if it does not exist, and then creates an empty file named "<step>.done" to indicate the completion of the specified step.
[in] | step | The name of the step for which to create the completion file. |
void evaluatePerformance | ( | ) |
Evaluates the performance of the SVM model.
This function runs a Python script to evaluate the performance of the SVM model. The script calculates various performance metrics and displays the results.
void executeStep | ( | const std::string & | step | ) |
Executes the specified step if it is defined in the step functions map.
This function looks up the specified step in the map of step functions and executes the corresponding function if it is found. If the step is not found, it prints an error message and displays the help information.
[in] | step | The name of the step to be executed. |
void generateEigenplanes | ( | ) |
Generates average planes (eigenplanes) for clustered images and saves them.
This function reads images from resized cluster directories, computes the average plane for each cluster using PCA, and saves the resulting average planes into a specified directory.
The steps are as follows:
avg_airplanes
directory.SRC_DIR_PATH/resized_clusters
exists and contains the images that have been resized and clustered.void parseArguments | ( | int | argc, |
char ** | argv, | ||
std::vector< std::string > & | steps ) |
Parses command-line arguments to extract the list of steps to be executed.
This function reads command-line arguments and stores them in a vector of steps.
[in] | argc | The number of command-line arguments. |
[in] | argv | The array of command-line argument strings. |
[out] | steps | A vector of strings where the parsed steps will be stored. |
void performKMeansByIntensity | ( | ) |
Performs K-Means clustering on images based on their intensity and saves the clustered images.
This function reads images that have been previously clustered by size, performs K-Means clustering based on the intensity of the images, and saves the clustered images into corresponding directories.
The steps are as follows:
SRC_DIR_PATH/kmeans_by_size
exists and contains the images that have been previously clustered by size. void performKMeansBySize | ( | ) |
Performs K-Means clustering on extracted templates based on their size and saves the clustered images.
This function reads images from a specified directory, performs K-Means clustering based on the dimensions of the images, and saves the clustered images into corresponding directories.
The steps are as follows:
cv::Mat
.SRC_DIR_PATH/straight_airplanes
exists and contains the images to be clustered. void printHelp | ( | ) |
Prints the help message for the Aircraft Detection Project.
This function displays a detailed help message that includes usage instructions, descriptions of the various steps in the project, and available options.
void resizeImagesAcrossClusters | ( | ) |
Resizes images across multiple clusters to the same dimensions and saves them.
This function lists the directories of intensity-based clusters, resizes images within each cluster to the same dimensions, and saves the resized images into corresponding directories within a base output directory.
The steps are as follows:
SRC_DIR_PATH/kmeans_by_intensity
exists and contains the images clustered by intensity.void resizeImgsSingleCluster | ( | const std::string & | cluster_input_path, |
const std::filesystem::path & | output_base_path, | ||
size_t | cluster_index ) |
Resizes images within a single cluster to the same dimensions and saves them.
This function reads images from a specified input cluster directory, resizes them to the same dimensions based on the average dimensions of the images, and saves the resized images into a specified output directory.
[in] | cluster_input_path | The path to the input directory containing the cluster images. |
[in] | output_base_path | The base path to the output directory where resized images will be saved. |
[in] | cluster_index | The index of the current cluster, used to name the output directory. |
.png
format.const std::unordered_map<std::string, std::string> stepDependencies |
Defines the dependencies between steps.
This unordered map defines the dependencies between different steps in the process. Each entry maps a step to its required preceding step.
std::unordered_map<std::string, std::function<void()> > stepFunctions |
Maps step names to their corresponding functions.
This unordered map defines the relationship between step names and the functions that implement those steps. Each entry maps a step name to a function that performs the step and creates a completion file upon successful execution.
const std::filesystem::path stepStatePath = std::filesystem::path(SRC_DIR_PATH)/ "steps_completed" |