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 image.tif --tile 256 --window 15 --levels 64 --out outputs

Usage API

import torch
from haralick_torch.io import read_tiff_as_tensor
from haralick_torch.tiling import process_in_tiles
from haralick_torch.utils import save_as_tif

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

img, ref = read_tiff_as_tensor("image.tif", device)
textures = process_in_tiles(img, tile_size=256, window_size=15, levels=32)

for name, tensor in textures.items():
    save_as_tif(tensor.numpy(), ref, f"{name}.tif")

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.0.0.tar.gz (5.4 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.0.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: haralick_torch-1.0.0.tar.gz
  • Upload date:
  • Size: 5.4 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.0.0.tar.gz
Algorithm Hash digest
SHA256 0b1d2819bc585692cfb9a38390a56ddc9676c4affa31d96e5c52b52e861e3f23
MD5 b9e4aec74c205255ff7afae27e92656e
BLAKE2b-256 7e9ff879a778a93b0fe35215f6fc6fce4c8766385204730df935c668e902cee0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: haralick_torch-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb2e67994919dce96cfe128f57268b60e2e4dbdb5e7fcbde29f68a4b4e4dc1e8
MD5 7c2580f6596fb2e3d5010d6beeb7e562
BLAKE2b-256 51dd74cf67aecea5508aa6badfda227e8203f2edab238c0a484e187ad377e6d4

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