segrails.client¶
Segrails pipeline orchestrator.
Classes¶
Orchestrate the full Segrails inference pipeline. |
Module Contents¶
- class segrails.client.SegrailsClient(config: altametris.segrails.config.SegrailsConfig | None = None, credentials: altametris.azure_sdk.authentication.credentials.Credentials | None = None, device: str = 'cpu')¶
Orchestrate the full Segrails inference pipeline.
- Steps:
WeightStep — resolve model weights from Azure Blob or local cache.
RasterStep — generate a PNG raster from the input point cloud.
InferenceStep — run UNet inference to produce a binary mask.
PostprocessStep — detect rail tracks and crossings from the mask.
The model is loaded on the first call to
predict()and cached for subsequent calls.- Parameters:
config – SegrailsConfig instance. When None, built from
SegrailsConfig().credentials – Pre-built
Credentialsinstance fromaltametris.azure_sdk. When None, created withauth_mode="default"(az login/ SP env vars).device – PyTorch device string. Defaults to
"cpu".
Example
>>> client = SegrailsClient(config=config, credentials=creds) >>> result = client.predict(Path("cloud.las"), center=(790490.0, 6878297.0)) >>> result = client.predict( ... {"path": "https://altametris.xyz/dev/u3d/data/proj/ept.json", ... "headers": {"Bearer": "mytoken"}}, ... center=(790490.0, 6878297.0), ... ) >>> print(result.predictions.n_tracks)
- config¶
- _device = 'cpu'¶
- _weight_step¶
- _raster_step¶
- _postprocess_step¶
- _inference_step: altametris.segrails.pipeline.inference.InferenceStep | None = None¶
- _model_dir: pathlib.Path | None = None¶
- _tracker¶
- predict(point_cloud: altametris.segrails.pipeline.raster.PointCloudSource, center: tuple[float, float], pipeline_name: str | None = None, env: str | None = None) altametris.segrails.result.SegrailsResult¶
Run the full pipeline on a single point cloud tile.
- Parameters:
point_cloud –
Point cloud source. Either:
str | Path— local LAS/LAZ file path.dict— remote EPT filespec with keys:"path"(required): EPT endpoint URL."headers"(optional): dict of HTTP headers. The"Bearer"key is forwarded as the EPT token.
center – Geographic centre of the raster tile as
(X, Y)in the same coordinate reference system as the point cloud.pipeline_name – Optional identifier of the calling pipeline.
env – Optional environment override for this call.
- Returns:
SegrailsResult with
status="success"and populatedpredictions, orstatus="failure"with aSegrailsErrordescribing which step failed and why.