Skip to main content

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
)

Release files for haralick-torch 1.1.0

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

Source distribution (sdist)

Source distribution for haralick-torch 1.1.0
File Size Uploaded
haralick_torch-1.1.0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for haralick-torch 1.1.0
File Interpreter ABI Platform
haralick_torch-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / haralick_torch-1.1.0.tar.gz

Download URL haralick_torch-1.1.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c5a4eb2c59c876348dbe83c8ffe8d18be20f77fe2b51d91b4d96e35300dc6816
BLAKE2b-256 checksum
How to use checksums
37fb54cd5b0f8a86fe36667b845bc3ddb47b7c0b9daa9eaee92ff544ee8fc744
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / haralick_torch-1.1.0-py3-none-any.whl

Download URL haralick_torch-1.1.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
787952dc5e5ad041fdda42bf29ceae66c0bea83c0abfcc04d81f17b6ee41d9b8
BLAKE2b-256 checksum
How to use checksums
7a651458c67c84d7551fc0c23cde5356442b47d21011f3b4982d7d1f41725caa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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