aoi_grouping
AOI grouping step logic.
kelp.data_prep.aoi_grouping.AOIGroupingConfig
Bases: ConfigBase
AOI grouping configuration
Source code in kelp/data_prep/aoi_grouping.py
27 28 29 30 31 32 33 34 35 |
|
kelp.data_prep.aoi_grouping.ImageDataset
Bases: Dataset
A simple image dataset that loads images from a list of file paths.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fps |
List[Path]
|
The file paths. |
required |
transform |
Callable[[Any], Tensor]
|
Transform to apply to the input images. |
required |
Source code in kelp/data_prep/aoi_grouping.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
kelp.data_prep.aoi_grouping.calculate_similarity_groups
Calculate similarity groups.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset |
ImageDataset
|
An instance of ImageDataset class. |
required |
features |
ndarray
|
The embeddings for all images. |
required |
threshold |
float
|
The similarity threshold to use when comparing individual image pairs. |
0.95
|
Source code in kelp/data_prep/aoi_grouping.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
kelp.data_prep.aoi_grouping.explode_groups_if_needed
Explodes all groups if needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
groups |
List[List[str]]
|
The list of groups of similar images to explode. |
required |
Source code in kelp/data_prep/aoi_grouping.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
kelp.data_prep.aoi_grouping.find_similar_images
Finds similar images in specified data folder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_folder |
Path
|
The data folder with input images. |
required |
tile_ids |
List[str]
|
A list of Tile IDs for corresponding images. |
required |
threshold |
float
|
The similarity threshold to use when comparing individual image pairs. |
0.95
|
batch_size |
int
|
Batch size to use when generating embeddings. |
32
|
num_workers |
int
|
Number of worker processes to use when generating embeddings. |
6
|
Source code in kelp/data_prep/aoi_grouping.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
|
kelp.data_prep.aoi_grouping.generate_embeddings
Generates embeddings for images in specified data folder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_folder |
Path
|
A path to the data folder. |
required |
tile_ids |
List[str]
|
A list of Tile IDs for corresponding images. |
required |
batch_size |
int
|
Batch size to use when generating embeddings. |
32
|
num_workers |
int
|
Number of worker processes to use when generating embeddings |
6
|
Source code in kelp/data_prep/aoi_grouping.py
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 |
|
kelp.data_prep.aoi_grouping.group_aoi
Groups images in the specified DEM directory into similar AOIs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dem_dir |
Path
|
The path to the directory with DEM images. |
required |
metadata_fp |
Path
|
The path to the metadata CSV file. |
required |
output_dir |
Path
|
The path where to save the results. |
required |
batch_size |
int
|
Batch size to use when generating embeddings. |
32
|
num_workers |
int
|
Number of worker processes to use when generating embeddings. |
6
|
similarity_threshold |
float
|
The similarity threshold to use when comparing individual image pairs. |
0.95
|
Source code in kelp/data_prep/aoi_grouping.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
|
kelp.data_prep.aoi_grouping.group_duplicate_images
Groups duplicate (similar) images.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
groups |
List[List[str]]
|
A list of lists where inner items are similar images. |
required |
Source code in kelp/data_prep/aoi_grouping.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
kelp.data_prep.aoi_grouping.groups_to_dataframe
Creates a DataFrame with groups of similar images.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
groups |
List[List[str]]
|
A list of groups of similar images. |
required |
Source code in kelp/data_prep/aoi_grouping.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
|
kelp.data_prep.aoi_grouping.main
Main entrypoint for grouping similar tiles together into AOIs
Source code in kelp/data_prep/aoi_grouping.py
391 392 393 394 395 396 397 398 399 400 401 |
|
kelp.data_prep.aoi_grouping.parse_args
Parse command line arguments.
Returns: An instance of AOI Grouping Config.
Source code in kelp/data_prep/aoi_grouping.py
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 |
|
kelp.data_prep.aoi_grouping.save_json
Saves data to specified JSON file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp |
Path
|
The path to JSON file. |
required |
data |
Any
|
The content to save as JSON. |
required |
Source code in kelp/data_prep/aoi_grouping.py
312 313 314 315 316 317 318 319 320 321 322 323 |
|