Skip to main content

GPU-accelerated Haralick texture extraction for GeoTIFFs

Project description

haralick-torch

GPU-accelerated Haralick texture extraction for GeoTIFF images using PyTorch.

Installation

GDAL must be installed via precompiled wheels:

https://github.com/cgohlke/geospatial-wheels/releases

pip install GDAL-3.10.1-cp310-cp310-win_amd64.whl
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install haralick-torch

Usage CLI

haralick-torch --input image.tif --out-texture textures.tif --out-pca pca.tif --nir-idx 8 --window 7 --levels 128 --tile 64

Usage API

import torch
from haralick_torch.io import read_nir_as_tensor, write_haralick_geotiff
from haralick_torch.haralick import compute_haralick
from haralick_torch.tiling import process_in_tiles

DEVICE = "cuda" if torch.cuda.is_available() else "cpu"

# ---- INPUT
img = "image.tif"
out = "haralick.tif"
nir_band = 4

# ---- IO
nir, ref_ds = read_nir_as_tensor(img, nir_band, DEVICE)

# ---- HARALICK
textures = process_in_tiles(
    nir,
    compute_haralick,
    window=11,
    stride=1
)

# ---- SAVE
write_haralick_geotiff(
    out,
    textures,
    list(textures.keys()),
    ref_ds
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

haralick_torch-1.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

haralick_torch-1.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file haralick_torch-1.1.0.tar.gz.

File metadata

  • Download URL: haralick_torch-1.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for haralick_torch-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c5a4eb2c59c876348dbe83c8ffe8d18be20f77fe2b51d91b4d96e35300dc6816
MD5 cde275a95202c60a9ca8558d7870b7dc
BLAKE2b-256 37fb54cd5b0f8a86fe36667b845bc3ddb47b7c0b9daa9eaee92ff544ee8fc744

See more details on using hashes here.

File details

Details for the file haralick_torch-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: haralick_torch-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for haralick_torch-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 787952dc5e5ad041fdda42bf29ceae66c0bea83c0abfcc04d81f17b6ee41d9b8
MD5 a136a8897c3d0d69cdaa4f0e35914698
BLAKE2b-256 7a651458c67c84d7551fc0c23cde5356442b47d21011f3b4982d7d1f41725caa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page