Aircraft Detection 1.0
Loading...
Searching...
No Matches
python_script.cpp File Reference
#include "python_script.h"
#include <filesystem>
#include <iostream>

Functions

void configureAndRunPythonScript ()
 Configures the Python environment and runs a Python script to generate a precision-recall curve.
 

Function Documentation

◆ configureAndRunPythonScript()

void configureAndRunPythonScript ( )

Configures the Python environment and runs a Python script to generate a precision-recall curve.

This function initializes the Python interpreter, configures the environment to include paths from a specified virtual environment, and executes a Python script. The script reads positive and negative scores from files, calculates the precision and recall, computes the AUC, and plots the precision-recall curve.

The steps are as follows:

  1. Check if the virtual environment exists.
  2. Initialize the Python interpreter.
  3. Add the virtual environment paths to sys.path.
  4. Execute the Python script.
  5. Finalize the Python interpreter.

The Python script:

  1. Sets the source directory path from an environment variable.
  2. Reads positive and negative scores from .sco files.
  3. Loads the data into pandas DataFrames, adds labels, and combines them.
  4. Sorts the combined DataFrame by confidence scores.
  5. Calculates precision, recall, and AUC.
  6. Plots the precision-recall curve.
Note
This function assumes that the virtual environment path is defined by VENV_PATH and the source directory path by SRC_DIR_PATH.
See also
Py_Initialize
Py_Finalize
PySys_GetObject
PyList_Append
PyRun_SimpleString