deepdisc.astrodet.detectron
Classes
This Hook saves the model during training |
|
Validation loss code adopted from https://gist.github.com/ortegatron/c0dad15e49c2b74de8bb09a5615d9f6b |
|
A hook which executes a torch builtin LR scheduler and summarizes the LR. |
|
Code from Deshwal on Stack Overflow |
|
Given a probability and a custom function, return a GenericWrapperTransform object whose apply_image |
|
Given a probability and a custom function, return a GenericWrapperTransform object whose apply_image |
|
Select and Apply "K" augmentations in "RANDOM" order with "Every" __call__ method invoke |
|
Functions
|
Plots different normalizations of your image using the stretch, Q parameters. |
|
Wrap Transform into Augmentation. |
Module Contents
- plot_stretch_Q(dataset_dicts, astro_metadata, num=0, stretches=[0.01, 0.1, 0.5, 1], Qs=[1, 10, 5, 100], ceil_percentile=99.5)[source]
Plots different normalizations of your image using the stretch, Q parameters.
- Parameters:
dataset_dicts (dict) – detectron dataset dictionary
num (int) – Dataset number/index to use
stretches (array) – List of stretch params you want to permutate through to find optimal image normalization. Default is [0.01, 0.1, 0.5, 1]
Qs (array) – List of Q params you want to permutate through to find optimal image normalization. Default is [1, 10, 5, 100]
from (Code adapted) – https://pmelchior.github.io/scarlet/tutorials/display.html
- Returns:
fig
- Return type:
Figure object
- class SaveHook(save_period)[source]
Bases:
detectron2.engine.HookBaseThis Hook saves the model during training
- Parameters:
save_period (int) – How many iterations to run before a checkpoint is saved
- class LossEvalHook(eval_period, model, data_loader)[source]
Bases:
detectron2.engine.HookBaseValidation loss code adopted from https://gist.github.com/ortegatron/c0dad15e49c2b74de8bb09a5615d9f6b
- Parameters:
eval_period (int) – How many iterations to run before validation loss is calculated
model (torch.NN.module) – The model being trained
data_loader (detectron2 DataLoader) – The dataloader that loads in the evaluation dataset
- class CustomLRScheduler(optimizer=None, scheduler=None)[source]
Bases:
detectron2.engine.HookBaseA hook which executes a torch builtin LR scheduler and summarizes the LR. It is executed after every iteration.
- Parameters:
optimizer (torch optimizer) – the training optimizer
scheduler (torch scheduler) – The learning rate scheduler
- class GenericWrapperTransform(custom_function)[source]
Bases:
fvcore.transforms.transform.TransformCode from Deshwal on Stack Overflow Generic wrapper for any transform (for color transform only. You can give functionality to apply_coods, apply_segmentation too)
- class CustomAug(custom_function, prob=1.0)[source]
Bases:
detectron2.data.transforms.AugmentationGiven a probability and a custom function, return a GenericWrapperTransform object whose apply_image will be called to perform augmentation
- class ShapeAug(custom_function, prob=1.0)[source]
Bases:
detectron2.data.transforms.AugmentationGiven a probability and a custom function, return a GenericWrapperTransform object whose apply_image will be called to perform augmentation
- class KRandomAugmentationList(augs, k: int = -1, cropaug=None)[source]
Bases:
detectron2.data.transforms.AugmentationSelect and Apply “K” augmentations in “RANDOM” order with “Every” __call__ method invoke
- _setup_augs(augs, k: int)[source]
Setup the argument list. Generates the list of argument to use from the given list :param augs: list of [Augmentation or Transform]) :param k: Number of augment to use from the given list in range [1,len_augs]. :param If False: :param use all. If it is -1: :param generate K randomly between [1: :param len_augs]: