elektronn3.data.transforms.random_blurring module¶
- class elektronn3.data.transforms.random_blurring.FunctionCallsCounter[source]¶
Bases:
object
- counter = 0¶
- class elektronn3.data.transforms.random_blurring.ScalarScheduler(value, max_value=None, growth_type=None, interval=None, steps_per_report=None)[source]¶
Bases:
object
A scheduler for a scalar value within an iterative process according to either linear or exponential growth. The user specifies the initial value, the maximum one, growth type and the number of steps within which the scalar value has to be gradually scaled. At each iteration the user has to explicitly call step() to update and modify the scalar value If the user doesn’t specify the maximum value or the interval, the scalar value works as a constant.
- exp_update()[source]¶
Performs an update of the scheduled value according to the exponential growth
- Return type:
None
- elektronn3.data.transforms.random_blurring.apply_random_blurring(inp_sample, probability, threshold, lower_lim_region_size, upper_lim_region_size, verbose=False, save_path=None, num_steps_save=None)[source]¶
Takes an input sample and applies random blurring. At the beginning the function generates a random number within the range [0,1) and compares it with the probability value passed by the user. If the random number exceeds the probability value the function terminates and returns the controls to the caller. Otherwise, the function generates random regions within a raw data sample volume until the total accumulated region volume exceeds that value specified by means of the threshold parameter. The threshold denotes the percentage of input sample volume that has to be filled in by regions. Regions have different spatial shape which is randomly generated within the ranges specified by the user. Moreover, the volume within a region is blurred by a Gaussian filter.
- Parameters:
(C (inp_sample - input sample with the format) –
D –
H –
W) –
algorithm (probability - probability of applying the random blurring) –
to (threshold - controls the level of random blurring with respect) – the input sample volume
axis (upper_lim_region_size - max values of region size along each) –
axis –
screen (verbose - mode that controls text information on the) –
(blurred) (num_steps_save - number of steps between writing modified) – input sample in the “h5” format
(blurred) – raw data input sample in the “h5” format
- Return type:
None
- elektronn3.data.transforms.random_blurring.check_random_data_blurring_config(patch_shape, probability, threshold, lower_lim_region_size, upper_lim_region_size, verbose=False, save_path=None, num_steps_save=None)[source]¶
Checks random data blurring parameters and ensures that all parameters won’t cause problems during apply_random_blurring function calls. The function raises exceptions if a conflict is detected. Use this function before a training procedure to be sure the config fulfills the requirements posed by the apply_random_blurring function
- Parameters:
samples (patch_shape - shape of input) –
algorithm (probability - probability of applying the random blurring) –
to (threshold - controls the level of data random blurring with respect) – input sample volume
axis (upper_lim_region_size - max values of regions size along each) –
axis –
screen (verbose - mode that controls text information on the) –
(blurred) (num_steps_save - number of steps between writing a modified) – raw data input sample in the “h5” format
(blurred) – raw data input sample in the “h5” format
- Return type:
None