Ortho segmentor
ortho_segmentor
¶
Functions¶
assemble_tiled_predictions(raster_input_file, pred_files, class_savefile, num_classes, counts_savefile=None, downweight_edge_frac=0.25, nodataval=NULL_TEXTURE_INT_VALUE, count_dtype=np.uint8, max_overlapping_tiles=4)
¶
Take tiled predictions on disk and aggregate them into a raster
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pred_files |
list[PATH_TYPE]
|
List of filenames where predictions are written |
required |
class_savefile |
PATH_TYPE
|
Where to save the merged raster. |
required |
counts_savefile |
Union[PATH_TYPE, NoneType]
|
Where to save the counts for the merged predictions raster. A tempfile will be created and then deleted if not specified. Defaults to None. |
None
|
downweight_edge_frac |
float
|
Downweight this fraction of predictions at the edge of each tile using a linear ramp. Defaults to 0.25. |
0.25
|
nodataval |
Union[int, None]
|
(typing.Union[int, None]): Value for unassigned pixels. If None, will be set to len(class_names), the first unused class. Defaults to 255 |
NULL_TEXTURE_INT_VALUE
|
count_dtype |
type
|
What type to use for aggregation. Float uses more space but is more accurate. Defaults to np.uint8 |
uint8
|
max_overlapping_tiles |
int
|
The max number of prediction tiles that may overlap at a given point. This is used to upper bound the valud in the count matrix, because we use scaled np.uint8 values rather than floats for efficiency. Setting a lower value enables slightly more accuracy in the aggregation process, but too low can lead to overflow. Defaults to 4 |
4
|
Source code in geograypher/predictors/ortho_segmentor.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 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 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 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 |
|
parse_windows_from_files(files, sep=':', return_in_extent_coords=True)
¶
Return the boxes and extent from a list of filenames
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files |
list[Path]
|
List of filenames |
required |
sep |
str
|
Seperator between elements |
':'
|
return_in_extent_coords |
bool
|
Return in the coordinate frame of the extent |
True
|
Returns:
Type | Description |
---|---|
tuple[list[Window], Window]
|
tuple[list[Window], Window]: List of windows for each file and extent |