Skip to main content

OBIA

PyPI PyPI Downloads Docker Pulls Tests Docs Contributors License

Object-based image analysis tools for geospatial rasters.

OBIA groups raster pixels into spatial objects, calculates object-level features, and supports downstream segment classification. The main output is a GeoDataFrame or GeoPackage of segment polygons with feature columns, optional point-cloud metrics, and predicted classes.

Current scope:

  • GeoTIFF loading with Rasterio metadata preserved
  • SLIC and quickshift segmentation
  • segment-level spectral and texture features
  • optional point-cloud features joined to the same segment objects
  • point-to-segment labelling utilities
  • random forest and MLP segment classification
  • tiled SLIC utilities for large rasters
  • experimental RetinaNet-based detection modules

Install

From PyPI

pip install obia

Point-cloud support

Point-cloud workflows need PDAL. Install PDAL with conda-forge first, then install OBIA with pip inside that environment:

conda create -n obia-pointcloud -c conda-forge python=3.11 pdal python-pdal
conda activate obia-pointcloud
pip install obia

Docker

Build the image from the repository root:

docker build -t obia .

Release images are published to Docker Hub as iosefa/obia:

docker pull iosefa/obia:latest

The image includes OBIA, PDAL, the PDAL Python bindings, and pyforestscan.

Developer install

git clone https://github.com/iosefa/obia.git
cd obia
conda env create -f environment.yml
conda activate obia

The development environment installs the package in editable mode with documentation and optional workflow dependencies.

Basic Segmentation

from obia.handlers.geotif import open_geotiff
from obia.segmentation.segment import segment

image = open_geotiff("/path/to/image.tif")

objects = segment(
    image,
    segmentation_bands=[0, 1, 2],
    statistics_bands=[0, 1, 2, 3],
    method="slic",
    n_segments=3000,
    compactness=10,
)

segments = objects.segments
segments.to_file("segments.gpkg", driver="GPKG")

Point-Cloud Features

from obia.pointcloud import add_pointcloud_features

segments = add_pointcloud_features(
    segments,
    pointcloud="/path/to/points.laz",
    metrics=["height", "intensity", "density"],
)

Point-cloud features are appended as pc_* columns, so the enriched segment table can be labelled and classified with the raster-derived features.

Segment Classification

import geopandas as gpd

from obia.classification.classify import classify
from obia.utils.utils import label_segments

labelled_points = gpd.read_file("/path/to/labelled_points.gpkg")
training_segments, mixed_segments = label_segments(
    segments,
    labelled_points,
)

result = classify(
    segments,
    training_segments,
    method="rf",
    n_estimators=300,
    random_state=42,
)

result.classified.to_file("classified_segments.gpkg", driver="GPKG")

Documentation

Published documentation is available at https://obia.sefa.ai.

Preview the docs locally:

mkdocs serve

Open http://127.0.0.1:8000. If the port is already in use:

mkdocs serve -a 127.0.0.1:8001

Documentation source lives in docs/.

License

MIT (LICENSE)

Metadata

Release files for obia 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for obia 0.1.4
File Size Uploaded Provenance Actions
obia-0.1.4.tar.gz 35.1 kB With provenance Details for obia-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for obia 0.1.4
File Interpreter ABI Platform Actions
obia-0.1.4-py3-none-any.whl Python 3 none any Details for obia-0.1.4-py3-none-any.whl

Total release size: 73.8 kB

Release files / obia-0.1.4.tar.gz

Download URL obia-0.1.4.tar.gz
Size 35.1 kB
Tags Source
SHA-256 checksum
How to use checksums
304fba5bfa224306442161ac2260106e87ca6c20c5f291272e2f29aec666dd54
BLAKE2b-256 checksum
How to use checksums
adf75cfc3d6d9244b2ae27b4e0d02a56ce68ffbeeb3d2d64e6667d62ddcb9d2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / obia-0.1.4-py3-none-any.whl

Download URL obia-0.1.4-py3-none-any.whl
Size 38.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e327891e3a4ff04c94d835dce8a587a499f27427eb8dfd84edf9d8bce772942a
BLAKE2b-256 checksum
How to use checksums
fc4ae88fe4430abcd0dc6bc2aa7f3fa2c934e42fbd71ce206152ee607f6cb99c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for obia 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for obia-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page