ParticleDetection.modelling.configs
Collection of helper functions to be used with CfgNode configuration objects for a Detectron2 network. Additionally, defines a ported version of a previously used R-CNN from an older implementation.
Author: Adrian Niemann (adrian.niemann@ovgu.de)
Date: 31.10.2022
- PORTED_AUGMENTATIONS = [detectron2.data.transforms.AugmentationList]
List of augmentations used during training of a rod detection network.
- get_epochs(cfg: detectron2.config.config.CfgNode, image_count: int) float[source]
Computes the achieved number of epochs with given settings and data.
- Parameters:
cfg (CfgNode) – Configuration of a network to be trained with Detectron2. Must contain at least the keys
SOLVER.IMS_PER_BATCHandSOLVER.MAX_ITER.image_count (int) – Number of images the network will be trained on.
- Returns:
float
- get_iters(cfg: detectron2.config.config.CfgNode, image_count: int, desired_epochs: int) int[source]
Computes the necessary iterations to achieve a given number of epochs.
- Parameters:
cfg (CfgNode) – Configuration of a network to be trained with Detectron2. Must contain at least the key
SOLVER.IMS_PER_BATCH.image_count (int) – Number of images the network will be trained on.
desired_epochs (int) – Number of epochs the network shall be trained using a dataset with
ìmage_countnumber of images.
- Returns:
int
- old_ported_config(dataset: DataSet | None = None, test_dataset: DataSet | None = None) detectron2.config.config.CfgNode[source]
Creates a configuration resembling one previously used with an older implementation of a R-CNN.
- run_test_config(dataset: DataSet) detectron2.config.config.CfgNode[source]
Creates a configuration with only few iterations for testing new code.
- write_configs(cfg: detectron2.config.config.CfgNode, directory: str, augmentations: List[detectron2.data.transforms.Augmentation] | None = None) None[source]
Write network configurations to a target directory.
Writes a
config.yamlfile from the configuration and possibly anaugmentations.pklfile.- Parameters:
cfg (CfgNode) – Configuration for a network handled with Detectron2.
directory (str) – Directory the configuration shall be written to.
augmentations (List[Augmentation]) – List of image augmentations that shall be saved alongside the network configuration. Default is
None.