ParticleDetection.modelling.detectron
Collection of custom Detectron2 objects to provide a customized training process with more sophisticated outputs.
Author: Adrian Niemann (adrian.niemann@ovgu.de)
Date: 31.10.2022
- class CompleteMapper(*args: Any, **kwargs: Any)[source]
Bases:
DatasetMapperProvides annotation data in training and testing context.
- class CustomTensorboardWriter(*args: Any, **kwargs: Any)[source]
Bases:
EventWriterWrite all scalars to a tensorboard file.
- class CustomTrainer(*args: Any, **kwargs: Any)[source]
Bases:
DefaultTrainer- augmentations: List[detectron2.data.transforms.Augmentation] = []
- classmethod build_evaluator(cfg: detectron2.config.config.CfgNode, dataset_name: str)[source]
Build a custom evaluator depending on the detection task.
- Parameters:
cfg (CfgNode) –
Detectron2 network configuration with allowed TASK field of:
"None"-> will be changed to"segm""segm"-> results in an evaluator for a segmentation task"keypoints"-> results in an evaluator for a keypoint detection taskdataset_name (str) – Name of a dataset that is registered in the Detectron2 framework, that is used as the
testdataset of the constructed evaluator.
- Returns:
DatasetEvaluators
- build_hooks()[source]
Build a list of hooks, including the
DefaultTrainerdefault hooks and a custom loss hook used during evaluation.
- class EvalLossHook(*args: Any, **kwargs: Any)[source]
Bases:
HookBaseHook to compute different losses in the training process of a network.
This is the copy of the loss hook used by Detectron2 for the training dataset. This hook is intended for evaluating the loss on the test dataset during the training process.