augmentations
cut_mix ¶
1 2 3 4 5 6 7 |
|
Performs the cutmix operation of two image batches.
A random image patch from batch2
is taken and inserted into batch1.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
batch1 |
tf.Tensor
|
Batch of grid-shaped data of shape ( |
required |
batch2 |
tf.Tensor
|
Batch of grid-shaped data of shape ( |
required |
ignore_background |
bool
|
If true, pixels belonging to the backgroud are ignored. Only applicable for images where the background is represented as 0. Defaults to False. |
False
|
invert_mask |
bool
|
If true, the mask is inverted. 1->0 and 0->1. Defaults to False. |
False
|
mask |
Optional[tf.Tensor]
|
Binary mask that requires same shape as |
None
|
Returns:
Name | Type | Description |
---|---|---|
ground_truth_mask |
tf.Tensor
|
Actual mask that has been applied |
new_batch |
tf.Tensor
|
Batch with applied cutmix opperation |
Source code in DeepSaki/augmentations/grid_cutting.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
cut_out ¶
1 2 3 4 5 |
|
Performs the cutout operation of a batch of images.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
batch |
tf.Tensor
|
Batch of grid-shaped data of shape ( |
required |
invert_mask |
bool
|
If true, the mask is inverted. 1->0 and 0->1. Defaults to False. |
False
|
mask |
Optional[tf.Tensor]
|
Binary mask that requires same shape as |
None
|
Returns:
Name | Type | Description |
---|---|---|
mask |
tf.Tensor
|
Actual mask that has been applied |
new_batch |
tf.Tensor
|
Batch with applied cutout opperation |
Source code in DeepSaki/augmentations/grid_cutting.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|