data_factory
Convenience functions to create NG data configurations.
create_ng_data_configuration(data_type, axes, patch_size, batch_size, augmentations=None, normalization=None, channels=None, in_memory=None, num_workers=0, train_dataloader_params=None, val_dataloader_params=None, pred_dataloader_params=None, seed=None) #
Create a training NGDatasetConfig.
Note that num_workers is applied to all dataloaders unless explicitly overridden in the respective dataloader parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_type | (array, tiff, zarr, czi, custom) | Type of the data. | "array" |
axes | str | Axes of the data. | required |
patch_size | list of int | Size of the patches along the spatial dimensions. | required |
batch_size | int | Batch size. | required |
augmentations | list of transforms or None | List of transforms to apply. If | None |
normalization | dict | Normalization configuration dictionary. If None, defaults to mean_std normalization with automatically computed statistics. | None |
channels | Sequence of int | List of channels to use. If | None |
in_memory | bool | Whether to load all data into memory. This is only supported for 'array', 'tiff' and 'custom' data types. If | None |
num_workers | int | Number of workers for data loading. | 0 |
augmentations | list of transforms or None | List of transforms to apply. If | None |
train_dataloader_params | dict | Parameters for the training dataloader, see PyTorch notes, by default None. | None |
val_dataloader_params | dict | Parameters for the validation dataloader, see PyTorch notes, by default None. | None |
pred_dataloader_params | dict | Parameters for the test dataloader, see PyTorch notes, by default None. | None |
seed | int | Random seed for reproducibility. If | None |
Returns:
| Type | Description |
|---|---|
NGDataConfig | Next-Generation Data model with the specified parameters. |
Source code in src/careamics/config/ng_factories/data_factory.py
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 101 102 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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
list_spatial_augmentations(augmentations=None, seed=None) #
List the augmentations to apply.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
augmentations | list of transforms | List of transforms to apply, either both or one of XYFlipConfig and XYRandomRotate90Config. | None |
seed | int | Random seed for reproducibility. | None |
Returns:
| Type | Description |
|---|---|
list of transforms | List of transforms to apply. |
Raises:
| Type | Description |
|---|---|
ValueError | If the transforms are not XYFlipConfig or XYRandomRotate90Config. |
ValueError | If there are duplicate transforms. |