nicetoolbox.detectors.method_detectors.base_detector¶
A template class for Detectors.
Classes
Abstract class to setup and run existing computer vision research code, called method detectors. |
- class nicetoolbox.detectors.method_detectors.base_detector.BaseDetector(config, io, data, requires_out_folder=True)[source]¶
Abstract class to setup and run existing computer vision research code, called method detectors.
- components¶
A list of components associated with the method detector.
- Type:
list
- algorithm¶
The algorithm used for detecting the component.
- Type:
str
- out_folder¶
The output folder.
- Type:
str
- viz_folder¶
The visualization folder.
- Type:
str
- subjects_descr¶
The subjects description.
- Type:
str
- config_path¶
The path to the configuration file.
- Type:
str
- conda_path¶
The path to the conda installation.
- Type:
str
- framework¶
The name of the framework used for the method detector.
- Type:
str
- script_path¶
The path to the script used for the method detector.
- Type:
str
- venv¶
The type of virtual environment used for the method detector.
- Type:
str
- env_name¶
The name of the virtual environment used for the method detector.
- Type:
str
- venv_path¶
The path to the virtual environment used for the method detector.
- Type:
str
Sets up the input and output folders required for each method based on the provided configurations. Saves a copy of the configuration file for the method detector.
- Parameters:
- abstract property algorithm: str¶
Abstract property that returns the algorithm of the method detector.
This property should be implemented in the derived classes to specify the algorithm that the method detector is associated with.
- Returns:
A string representing the algorithm associated with the method detector
- Return type:
str
- Raises:
NotImplementedError – If the property is not set in the derived classes.
- abstract property components: list[str]¶
Abstract property that returns the components of the method detector.
This property should be implemented in the derived classes to specify the components that the method detector is associated with.
- Returns:
- A list of strings representing the components associated with the
method detector.
- Return type:
list
- Raises:
NotImplementedError – If the property is not set in the derived classes.
- abstract post_inference() None[source]¶
Post-processing after inference.
This method is called after the inference step and is used for any post-processing tasks that need to be performed.
- run_inference() None[source]¶
Runs the inference of the method detector in a separate terminal/cmd window using the specified virtual environment or conda environment. Captures the output and logs the success or failure of the inference.
- abstract visualization(data) None[source]¶
Abstract method to visualize the output of the method, preferably as a video.
This method is intended to generate a visual representation of the method detector’s output. The visualization should be saved in the self.viz_folder.
- Parameters:
data (any) – The data to be visualized. The type and content of this parameter depend on the specific implementation of the method detector.
- Returns:
- None. This method does not return any value. However, it should save the
visualization in the self.viz_folder.
- Raises:
NotImplementedError – If this method is not implemented in the derived classes.