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-0.1.2.tar.gz (6.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-0.1.2-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: haralick_torch-0.1.2.tar.gz
  • Upload date:
  • Size: 6.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-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f73ffd41017c8052093b15d93309e70a78396882f79d6fa20d1678e6cf8dd9c9
MD5 8df5eb2f1655b06da5f233a2144d2718
BLAKE2b-256 6d3ee429c1e985be8be44af41bb06d51403bdb04045420794133233e161ca99e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: haralick_torch-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.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-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 48dd49b9e32ef36d56c067dbcc22c4e6caad4c14146c2468dcaf6b7f8c236f21
MD5 0dde7d06b0f115d4e379df911eaa358d
BLAKE2b-256 e1844cafadd2daa61c0360f853e8a37f522efff4b5e2b3cffd640cfdb042a256

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