darts.pipelines.sequential_v2
¶
Sequential implementation of the v2 pipelines.
PlanetPipeline
dataclass
¶
PlanetPipeline(
model_files: list[pathlib.Path] = None,
default_dirs: darts_utils.paths.DefaultPaths = (
lambda: darts_utils.paths.DefaultPaths()
)(),
output_data_dir: pathlib.Path | None = None,
arcticdem_dir: pathlib.Path | None = None,
tcvis_dir: pathlib.Path | None = None,
device: typing.Literal["cuda", "cpu", "auto"]
| int
| None = None,
ee_project: str | None = None,
ee_use_highvolume: bool = True,
tpi_outer_radius: int = 100,
tpi_inner_radius: int = 0,
patch_size: int = 1024,
overlap: int = 256,
batch_size: int = 8,
reflection: int = 0,
binarization_threshold: float = 0.5,
mask_erosion_size: int = 10,
edge_erosion_size: int | None = None,
min_object_size: int = 32,
quality_level: int
| typing.Literal[
"high_quality", "low_quality", "none"
] = 1,
export_bands: list[str] = (
lambda: [
"probabilities",
"binarized",
"polygonized",
"extent",
"thumbnail",
]
)(),
write_model_outputs: bool = False,
overwrite: bool = False,
offline: bool = False,
debug_data: bool = False,
orthotiles_dir: pathlib.Path | None = None,
scenes_dir: pathlib.Path | None = None,
image_ids: list = None,
)
Bases: darts.pipelines.sequential_v2._BasePipeline
Pipeline for processing PlanetScope data.
Processes PlanetScope imagery (both orthotiles and scenes) for RTS segmentation. Supports both offline and online processing modes.
Data Structure
Expects PlanetScope data organized as:
- Orthotiles: orthotiles_dir/tile_id/scene_id/
- Scenes: scenes_dir/scene_id/
Parameters:
-
orthotiles_dir(pathlib.Path | None, default:None) –Directory containing PlanetScope orthotiles. If None, uses default path from DARTS paths. Defaults to None.
-
scenes_dir(pathlib.Path | None, default:None) –Directory containing PlanetScope scenes. If None, uses default path from DARTS paths. Defaults to None.
-
image_ids(list | None, default:None) –List of image/scene IDs to process. If None, processes all images found in orthotiles_dir and scenes_dir. Defaults to None.
-
model_files(pathlib.Path | list[pathlib.Path] | None, default:None) –Path(s) to model file(s) for segmentation. Single Path implies
write_model_outputs=False. If None, searches default model directory for all .pt files. Defaults to None. -
output_data_dir(pathlib.Path | None, default:None) –Output directory for results. If None, uses
{default_out}/planet. Defaults to None. -
arcticdem_dir(pathlib.Path | None, default:None) –Directory for ArcticDEM datacube. Will be created/downloaded if needed. If None, uses default path. Defaults to None.
-
tcvis_dir(pathlib.Path | None, default:None) –Directory for TCVis data. If None, uses default path. Defaults to None.
-
device(typing.Literal['cuda', 'cpu', 'auto'] | int | None, default:None) –Computation device. "cuda" uses GPU 0, int specifies GPU index, "auto" selects free GPU. Defaults to None.
-
ee_project(str | None, default:None) –Earth Engine project ID. May be omitted if defined in persistent credentials. Defaults to None.
-
ee_use_highvolume(bool, default:True) –Whether to use EE high-volume server. Defaults to True.
-
tpi_outer_radius(int, default:100) –Outer radius (m) for TPI calculation. Defaults to 100.
-
tpi_inner_radius(int, default:0) –Inner radius (m) for TPI calculation. Defaults to 0.
-
patch_size(int, default:1024) –Patch size for inference. Defaults to 1024.
-
overlap(int, default:256) –Overlap between patches. Defaults to 256.
-
batch_size(int, default:8) –Batch size for inference. Defaults to 8.
-
reflection(int, default:0) –Reflection padding for inference. Defaults to 0.
-
binarization_threshold(float, default:0.5) –Threshold for binarizing probabilities. Defaults to 0.5.
-
mask_erosion_size(int, default:10) –Disk size for mask erosion and inner edge cropping. Defaults to 10.
-
edge_erosion_size(int | None, default:None) –Size for outer edge cropping. If None, uses
mask_erosion_size. Defaults to None. -
min_object_size(int, default:32) –Minimum object size (pixels) to keep. Defaults to 32.
-
quality_level(int | typing.Literal['high_quality', 'low_quality', 'none'], default:1) –Quality filtering level. 0="none", 1="low_quality", 2="high_quality". Defaults to 1.
-
export_bands(list[str], default:(lambda: ['probabilities', 'binarized', 'polygonized', 'extent', 'thumbnail'])()) –Bands to export. Can include "probabilities", "binarized", "polygonized", "extent", "thumbnail", "optical", "dem", "tcvis", "metadata", or specific band names. Defaults to ["probabilities", "binarized", "polygonized", "extent", "thumbnail"].
-
write_model_outputs(bool, default:False) –Save individual model outputs (not just ensemble). Defaults to False.
-
overwrite(bool, default:False) –Overwrite existing output files. Defaults to False.
-
offline(bool, default:False) –Skip downloading missing data. Defaults to False.
-
debug_data(bool, default:False) –Write intermediate debugging data. Defaults to False.
default_dirs
class-attribute
instance-attribute
¶
default_dirs: darts_utils.paths.DefaultPaths = dataclasses.field(
default_factory=lambda: darts_utils.paths.DefaultPaths()
)
device
class-attribute
instance-attribute
¶
export_bands
class-attribute
instance-attribute
¶
export_bands: list[str] = dataclasses.field(
default_factory=lambda: [
"probabilities",
"binarized",
"polygonized",
"extent",
"thumbnail",
]
)
quality_level
class-attribute
instance-attribute
¶
__post_init__
¶
Source code in darts/src/darts/pipelines/sequential_v2.py
cli
staticmethod
¶
cli(
*,
pipeline: darts.pipelines.sequential_v2.PlanetPipeline,
)
Run the sequential pipeline for PlanetScope data.
Parameters:
-
pipeline(darts.pipelines.sequential_v2.PlanetPipeline) –Configured PlanetPipeline instance.
cli_prepare_data
staticmethod
¶
cli_prepare_data(
*,
pipeline: darts.pipelines.sequential_v2.PlanetPipeline,
aux: bool = False,
)
Download all necessary data for offline processing.
Parameters:
-
pipeline(darts.pipelines.sequential_v2.PlanetPipeline) –Configured PlanetPipeline instance.
-
aux(bool, default:False) –If True, downloads auxiliary data (ArcticDEM, TCVis). Defaults to False.
Source code in darts/src/darts/pipelines/sequential_v2.py
prepare_data
¶
Download and prepare data for offline processing.
Validates configuration, determines data requirements from models, and downloads requested data (optical imagery and/or auxiliary data).
Parameters:
-
optical(bool, default:False) –If True, downloads optical imagery. Defaults to False.
-
aux(bool, default:False) –If True, downloads auxiliary data (ArcticDEM, TCVis) as needed. Defaults to False.
Raises:
-
KeyboardInterrupt–If user interrupts execution.
-
SystemExit–If the process is terminated.
-
SystemError–If a system error occurs.
Source code in darts/src/darts/pipelines/sequential_v2.py
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 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
run
¶
Run the complete segmentation pipeline.
Executes the full pipeline including: 1. Configuration validation and dumping 2. Loading ensemble models 3. Creating/loading auxiliary datacubes 4. Processing each tile: - Loading optical data - Loading auxiliary data (ArcticDEM, TCVis) as needed - Preprocessing - Segmentation - Postprocessing - Exporting results 5. Saving results and timing information
Results are saved to the output directory with timestamped configuration, results parquet file, and timing information.
Raises:
-
KeyboardInterrupt–If user interrupts execution.
Source code in darts/src/darts/pipelines/sequential_v2.py
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | |
Sentinel2Pipeline
dataclass
¶
Sentinel2Pipeline(
model_files: list[pathlib.Path] = None,
default_dirs: darts_utils.paths.DefaultPaths = (
lambda: darts_utils.paths.DefaultPaths()
)(),
output_data_dir: pathlib.Path | None = None,
arcticdem_dir: pathlib.Path | None = None,
tcvis_dir: pathlib.Path | None = None,
device: typing.Literal["cuda", "cpu", "auto"]
| int
| None = None,
ee_project: str | None = None,
ee_use_highvolume: bool = True,
tpi_outer_radius: int = 100,
tpi_inner_radius: int = 0,
patch_size: int = 1024,
overlap: int = 256,
batch_size: int = 8,
reflection: int = 0,
binarization_threshold: float = 0.5,
mask_erosion_size: int = 10,
edge_erosion_size: int | None = None,
min_object_size: int = 32,
quality_level: int
| typing.Literal[
"high_quality", "low_quality", "none"
] = 1,
export_bands: list[str] = (
lambda: [
"probabilities",
"binarized",
"polygonized",
"extent",
"thumbnail",
]
)(),
write_model_outputs: bool = False,
overwrite: bool = False,
offline: bool = False,
debug_data: bool = False,
scene_ids: list[str] | None = None,
scene_id_file: pathlib.Path | None = None,
tile_ids: list[str] | None = None,
aoi_file: pathlib.Path | None = None,
start_date: str | None = None,
end_date: str | None = None,
max_cloud_cover: int | None = 10,
max_snow_cover: int | None = 10,
months: list[int] | None = None,
years: list[int] | None = None,
prep_data_scene_id_file: pathlib.Path | None = None,
sentinel2_grid_dir: pathlib.Path | None = None,
raw_data_store: pathlib.Path | None = None,
no_raw_data_store: bool = False,
raw_data_source: typing.Literal["gee", "cdse"] = "cdse",
)
Bases: darts.pipelines.sequential_v2._BasePipeline
Pipeline for processing Sentinel-2 data.
Processes Sentinel-2 Surface Reflectance (SR) imagery from either CDSE or Google Earth Engine. Supports multiple scene selection methods and flexible filtering options.
Source Selection
The data source is specified via the raw_data_source parameter:
- "cdse": Copernicus Data Space Ecosystem (CDSE)
- "gee": Google Earth Engine (GEE)
Both sources require accounts and proper credential setup on the system.
Scene Selection
Scenes can be selected using one of four mutually exclusive methods (priority order):
scene_ids: Direct list of Sentinel-2 scene IDsscene_id_file: JSON file containing scene IDstile_ids: List of Sentinel-2 tile IDs (e.g., "33UVP") with optional filtersaoi_file: Shapefile defining area of interest with optional filters
Offline Processing
Use cli_prepare_data to download data for offline use.
The prep_data_scene_id_file stores scene IDs from queries for offline reuse.
Parameters:
-
scene_ids(list[str] | None, default:None) –Direct list of Sentinel-2 scene IDs to process. Defaults to None.
-
scene_id_file(pathlib.Path | None, default:None) –JSON file containing scene IDs to process. Defaults to None.
-
tile_ids(list[str] | None, default:None) –List of Sentinel-2 tile IDs (requires filtering params). Defaults to None.
-
aoi_file(pathlib.Path | None, default:None) –Shapefile with area of interest (requires filtering params). Defaults to None.
-
start_date(str | None, default:None) –Start date for filtering (YYYY-MM-DD format). Defaults to None.
-
end_date(str | None, default:None) –End date for filtering (YYYY-MM-DD format). Defaults to None.
-
max_cloud_cover(int | None, default:10) –Maximum cloud cover percentage (0-100). Defaults to 10.
-
max_snow_cover(int | None, default:10) –Maximum snow cover percentage (0-100). Defaults to 10.
-
months(list[int] | None, default:None) –Filter by months (1-12). Defaults to None.
-
years(list[int] | None, default:None) –Filter by years. Defaults to None.
-
prep_data_scene_id_file(pathlib.Path | None, default:None) –File to store/load scene IDs for offline processing. Written during
prepare_data, read during offlinerun. Defaults to None. -
sentinel2_grid_dir(pathlib.Path | None, default:None) –Directory for Sentinel-2 grid shapefiles. Used only in
prepare_datawithtile_ids. If None, uses default path. Defaults to None. -
raw_data_store(pathlib.Path | None, default:None) –Directory for storing raw Sentinel-2 data locally. If None, uses default path based on
raw_data_source. Defaults to None. -
no_raw_data_store(bool, default:False) –If True, processes data in-memory without local storage. Overrides
raw_data_store. Defaults to False. -
raw_data_source(typing.Literal['gee', 'cdse'], default:'cdse') –Data source to use. Defaults to "cdse".
-
model_files(pathlib.Path | list[pathlib.Path] | None, default:None) –Path(s) to model file(s) for segmentation. Single Path implies
write_model_outputs=False. If None, searches default model directory for all .pt files. Defaults to None. -
output_data_dir(pathlib.Path | None, default:None) –Output directory for results. If None, uses
{default_out}/sentinel2-{raw_data_source}. Defaults to None. -
arcticdem_dir(pathlib.Path | None, default:None) –Directory for ArcticDEM datacube. Will be created/downloaded if needed. If None, uses default path. Defaults to None.
-
tcvis_dir(pathlib.Path | None, default:None) –Directory for TCVis data. If None, uses default path. Defaults to None.
-
device(typing.Literal['cuda', 'cpu', 'auto'] | int | None, default:None) –Computation device. "cuda" uses GPU 0, int specifies GPU index, "auto" selects free GPU. Defaults to None.
-
ee_project(str | None, default:None) –Earth Engine project ID. May be omitted if defined in persistent credentials. Defaults to None.
-
ee_use_highvolume(bool, default:True) –Whether to use EE high-volume server. Defaults to True.
-
tpi_outer_radius(int, default:100) –Outer radius (m) for TPI calculation. Defaults to 100.
-
tpi_inner_radius(int, default:0) –Inner radius (m) for TPI calculation. Defaults to 0.
-
patch_size(int, default:1024) –Patch size for inference. Defaults to 1024.
-
overlap(int, default:256) –Overlap between patches. Defaults to 256.
-
batch_size(int, default:8) –Batch size for inference. Defaults to 8.
-
reflection(int, default:0) –Reflection padding for inference. Defaults to 0.
-
binarization_threshold(float, default:0.5) –Threshold for binarizing probabilities. Defaults to 0.5.
-
mask_erosion_size(int, default:10) –Disk size for mask erosion and inner edge cropping. Defaults to 10.
-
edge_erosion_size(int | None, default:None) –Size for outer edge cropping. If None, uses
mask_erosion_size. Defaults to None. -
min_object_size(int, default:32) –Minimum object size (pixels) to keep. Defaults to 32.
-
quality_level(int | typing.Literal['high_quality', 'low_quality', 'none'], default:1) –Quality filtering level. 0="none", 1="low_quality", 2="high_quality". Defaults to 1.
-
export_bands(list[str], default:(lambda: ['probabilities', 'binarized', 'polygonized', 'extent', 'thumbnail'])()) –Bands to export. Can include "probabilities", "binarized", "polygonized", "extent", "thumbnail", "optical", "dem", "tcvis", "metadata", or specific band names. Defaults to ["probabilities", "binarized", "polygonized", "extent", "thumbnail"].
-
write_model_outputs(bool, default:False) –Save individual model outputs (not just ensemble). Defaults to False.
-
overwrite(bool, default:False) –Overwrite existing output files. Defaults to False.
-
offline(bool, default:False) –Skip downloading missing data. Requires pre-downloaded data. Defaults to False.
-
debug_data(bool, default:False) –Write intermediate debugging data to output directory. Defaults to False.
default_dirs
class-attribute
instance-attribute
¶
default_dirs: darts_utils.paths.DefaultPaths = dataclasses.field(
default_factory=lambda: darts_utils.paths.DefaultPaths()
)
device
class-attribute
instance-attribute
¶
export_bands
class-attribute
instance-attribute
¶
export_bands: list[str] = dataclasses.field(
default_factory=lambda: [
"probabilities",
"binarized",
"polygonized",
"extent",
"thumbnail",
]
)
prep_data_scene_id_file
class-attribute
instance-attribute
¶
quality_level
class-attribute
instance-attribute
¶
raw_data_source
class-attribute
instance-attribute
¶
sentinel2_grid_dir
class-attribute
instance-attribute
¶
__post_init__
¶
Source code in darts/src/darts/pipelines/sequential_v2.py
cli
staticmethod
¶
cli(
*,
pipeline: darts.pipelines.sequential_v2.Sentinel2Pipeline,
)
Run the sequential pipeline for Sentinel-2 data.
Parameters:
-
pipeline(darts.pipelines.sequential_v2.Sentinel2Pipeline) –Configured Sentinel2Pipeline instance.
Source code in darts/src/darts/pipelines/sequential_v2.py
cli_prepare_data
staticmethod
¶
cli_prepare_data(
*,
pipeline: darts.pipelines.sequential_v2.Sentinel2Pipeline,
optical: bool = False,
aux: bool = False,
)
Download all necessary data for offline processing.
Queries the data source (CDSE or GEE) for scene IDs and downloads optical and/or auxiliary data.
Stores scene IDs in prep_data_scene_id_file if specified for later offline use.
Parameters:
-
pipeline(darts.pipelines.sequential_v2.Sentinel2Pipeline) –Configured Sentinel2Pipeline instance.
-
optical(bool, default:False) –If True, downloads optical (Sentinel-2) imagery. Defaults to False.
-
aux(bool, default:False) –If True, downloads auxiliary data (ArcticDEM, TCVis). Defaults to False.
Source code in darts/src/darts/pipelines/sequential_v2.py
prepare_data
¶
Download and prepare data for offline processing.
Validates configuration, determines data requirements from models, and downloads requested data (optical imagery and/or auxiliary data).
Parameters:
-
optical(bool, default:False) –If True, downloads optical imagery. Defaults to False.
-
aux(bool, default:False) –If True, downloads auxiliary data (ArcticDEM, TCVis) as needed. Defaults to False.
Raises:
-
KeyboardInterrupt–If user interrupts execution.
-
SystemExit–If the process is terminated.
-
SystemError–If a system error occurs.
Source code in darts/src/darts/pipelines/sequential_v2.py
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 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
run
¶
Run the complete segmentation pipeline.
Executes the full pipeline including: 1. Configuration validation and dumping 2. Loading ensemble models 3. Creating/loading auxiliary datacubes 4. Processing each tile: - Loading optical data - Loading auxiliary data (ArcticDEM, TCVis) as needed - Preprocessing - Segmentation - Postprocessing - Exporting results 5. Saving results and timing information
Results are saved to the output directory with timestamped configuration, results parquet file, and timing information.
Raises:
-
KeyboardInterrupt–If user interrupts execution.
Source code in darts/src/darts/pipelines/sequential_v2.py
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | |
_BasePipeline
dataclass
¶
_BasePipeline(
model_files: list[pathlib.Path] = None,
default_dirs: darts_utils.paths.DefaultPaths = (
lambda: darts_utils.paths.DefaultPaths()
)(),
output_data_dir: pathlib.Path | None = None,
arcticdem_dir: pathlib.Path | None = None,
tcvis_dir: pathlib.Path | None = None,
device: typing.Literal["cuda", "cpu", "auto"]
| int
| None = None,
ee_project: str | None = None,
ee_use_highvolume: bool = True,
tpi_outer_radius: int = 100,
tpi_inner_radius: int = 0,
patch_size: int = 1024,
overlap: int = 256,
batch_size: int = 8,
reflection: int = 0,
binarization_threshold: float = 0.5,
mask_erosion_size: int = 10,
edge_erosion_size: int | None = None,
min_object_size: int = 32,
quality_level: int
| typing.Literal[
"high_quality", "low_quality", "none"
] = 1,
export_bands: list[str] = (
lambda: [
"probabilities",
"binarized",
"polygonized",
"extent",
"thumbnail",
]
)(),
write_model_outputs: bool = False,
overwrite: bool = False,
offline: bool = False,
debug_data: bool = False,
)
Base class for all v2 pipelines.
This class provides the run and prepare_data methods which are the main entry points for all pipelines.
This class is meant to be subclassed by the specific pipelines (e.g., PlanetPipeline, Sentinel2Pipeline).
Subclasses must implement the following abstract methods:
- _arcticdem_resolution: Return the ArcticDEM resolution to use (2, 10, or 32 meters).
- _get_tile_id: Extract a tile identifier from a tilekey.
- _tileinfos: Return a list of (tilekey, output_path) tuples for all tiles to process.
- _load_tile: Load optical data for a given tilekey.
- _tile_aoi: Return a GeoDataFrame representing the area of interest for all tiles.
Optionally, subclasses can override _download_tile to implement data download functionality.
The subclass must also be a dataclass to fully inherit all parameters of this class.
Parameters:
-
model_files(list[pathlib.Path] | None, default:None) –List of model file paths to use for segmentation. If None, will search the default model directory for all .pt files. Defaults to None.
-
default_dirs(darts_utils.paths.DefaultPaths, default:(lambda: darts_utils.paths.DefaultPaths())()) –Default directory paths configuration. Defaults to DefaultPaths().
-
output_data_dir(pathlib.Path | None, default:None) –The output directory for results. If None, will use the default output directory based on DARTS paths. Defaults to None.
-
arcticdem_dir(pathlib.Path | None, default:None) –Directory containing ArcticDEM datacube and extent files. If None, will use the default directory based on DARTS paths and resolution. Defaults to None.
-
tcvis_dir(pathlib.Path | None, default:None) –Directory containing TCVis data. If None, will use the default TCVis directory. Defaults to None.
-
device(typing.Literal['cuda', 'cpu', 'auto'] | int | None, default:None) –Device for computation. "cuda" uses GPU 0, int specifies GPU index, "auto" selects free GPU, "cpu" uses CPU. Defaults to None (auto-selected).
-
ee_project(str | None, default:None) –Earth Engine project ID. May be omitted if defined in persistent credentials. Defaults to None.
-
ee_use_highvolume(bool, default:True) –Whether to use Earth Engine high-volume server. Defaults to True.
-
tpi_outer_radius(int, default:100) –Outer radius in meters for TPI (Topographic Position Index) calculation. Defaults to 100.
-
tpi_inner_radius(int, default:0) –Inner radius in meters for TPI calculation. Defaults to 0.
-
patch_size(int, default:1024) –Patch size for inference. Defaults to 1024.
-
overlap(int, default:256) –Overlap between patches during inference. Defaults to 256.
-
batch_size(int, default:8) –Batch size for inference. Defaults to 8.
-
reflection(int, default:0) –Reflection padding for inference. Defaults to 0.
-
binarization_threshold(float, default:0.5) –Threshold for binarizing probabilities. Defaults to 0.5.
-
mask_erosion_size(int, default:10) –Size of disk for mask erosion and inner edge cropping. Defaults to 10.
-
edge_erosion_size(int | None, default:None) –Size for outer edge cropping. If None, defaults to
mask_erosion_size. Defaults to None. -
min_object_size(int, default:32) –Minimum object size in pixels to keep. Defaults to 32.
-
quality_level(int | typing.Literal['high_quality', 'low_quality', 'none'], default:1) –Quality filtering level. Can be 0="none", 1="low_quality", 2="high_quality". Defaults to 1.
-
export_bands(list[str], default:(lambda: ['probabilities', 'binarized', 'polygonized', 'extent', 'thumbnail'])()) –Bands to export, e.g., "probabilities", "binarized", "polygonized", "extent", "thumbnail", "optical", "dem", "tcvis", "metadata", or specific band names. Defaults to ["probabilities", "binarized", "polygonized", "extent", "thumbnail"].
-
write_model_outputs(bool, default:False) –Whether to save individual model outputs (not just ensemble). Automatically set to False if only one model is used. Defaults to False.
-
overwrite(bool, default:False) –Whether to overwrite existing output files. Defaults to False.
-
offline(bool, default:False) –If True, will not attempt to download any missing data. Defaults to False.
-
debug_data(bool, default:False) –If True, writes intermediate data for debugging purposes. Defaults to False.
default_dirs
class-attribute
instance-attribute
¶
default_dirs: darts_utils.paths.DefaultPaths = dataclasses.field(
default_factory=lambda: darts_utils.paths.DefaultPaths()
)
device
class-attribute
instance-attribute
¶
export_bands
class-attribute
instance-attribute
¶
export_bands: list[str] = dataclasses.field(
default_factory=lambda: [
"probabilities",
"binarized",
"polygonized",
"extent",
"thumbnail",
]
)
quality_level
class-attribute
instance-attribute
¶
__post_init__
¶
Source code in darts/src/darts/pipelines/sequential_v2.py
prepare_data
¶
Download and prepare data for offline processing.
Validates configuration, determines data requirements from models, and downloads requested data (optical imagery and/or auxiliary data).
Parameters:
-
optical(bool, default:False) –If True, downloads optical imagery. Defaults to False.
-
aux(bool, default:False) –If True, downloads auxiliary data (ArcticDEM, TCVis) as needed. Defaults to False.
Raises:
-
KeyboardInterrupt–If user interrupts execution.
-
SystemExit–If the process is terminated.
-
SystemError–If a system error occurs.
Source code in darts/src/darts/pipelines/sequential_v2.py
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 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
run
¶
Run the complete segmentation pipeline.
Executes the full pipeline including: 1. Configuration validation and dumping 2. Loading ensemble models 3. Creating/loading auxiliary datacubes 4. Processing each tile: - Loading optical data - Loading auxiliary data (ArcticDEM, TCVis) as needed - Preprocessing - Segmentation - Postprocessing - Exporting results 5. Saving results and timing information
Results are saved to the output directory with timestamped configuration, results parquet file, and timing information.
Raises:
-
KeyboardInterrupt–If user interrupts execution.
Source code in darts/src/darts/pipelines/sequential_v2.py
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | |