CarveMix
CarveMix
CarveMix (holes_num:int=1, modifier:RegionModifier=None, ROI_class:int=-1, ROI_area:int=25, delta_ratio:float=None, random_position:bool=False, p:float=0.5)
Defines the amount of holes, the technique used to make them and the probability of apply the technique.
Type | Default | Details | |
---|---|---|---|
holes_num | int | 1 | The amount of holes to make. |
modifier | RegionModifier | None | The modifier that defines the traditional augments to apply to the selected regions. |
ROI_class | int | -1 | The class to be used to select the ROI. |
ROI_area | int | 25 | The minimum area to be selected as a ROI. |
delta_ratio | float | None | The ratio of pixels of the ROI that are going to be used. A ratio of 1 takes all the ROI pixels, a ratio < 1 crops the ROI and a ratio > 1 adds more pixels to the ROI. A None ratio takes a random value [0.9, 1.1) in each usage. |
random_position | bool | False | Whether the ROI should be added randomly in the image or in the same position it was extracted. |
p | float | 0.5 | The probability of applying this technique. |
The CarveMix
technique is a derivation of the CutMixRandom
technique with a HoleMakerRandom
technique.
However, CarveMix
behavior can not be achieved using there techniques together, because of the implementation of the CutMixRandom
technique, which takes a hole from the image that is been seen by the model instead of another image of the batch. CarveMix
needs to take another image of the batch to properly work.
This technique was defined and implemented here.
This technique has been generalized to be implemented in this library, in order to be usefull in multiple class segmentation too.
CarveMix.before_batch
CarveMix.before_batch ()
Applies the CutMix technique.