Skip to main content

The geospatial pooling modules for neural networks in PyTorch

Project description

Torch Geopooling - The geospatial pooling library for PyTorch

The Torch Geopooling library is an extension for PyTorch library that provide extra layers for building geospatial neural networks.

Here is an example of how you can use modules from Torch Geopooling library to train neural networks predicting geospatial features: example

Installation

The library is distributed as PyPI package, to install that package, execute the following command:

pip install torch_geopooling

You can use the torch_geopooling library for building neural networks with geospatial indexing. The interface of the provided modules is compatible with PyTorch library, including automatic gradient computation.

Documentation

The Torch Geopooling Documentation contains additional details on how to get started with this library as well a few examples of training neural networks that use geo-pooling modules.

Usage

The module provides adaptive and regular modules that implement decomposition of point coordinates in 2-dimensional space. Decomposition in this context implies separation of the space into rectangles (quads).

Adaptive modules are building the decomposition during the training, while for regular modules the decomposition should be computed beforehand. As a result, adaptive module builds sparse decomposition, while regular module builds dense (regular) decomposition.

Using adaptive decomposition module for EPSG:4326 coordinates:

import torch
from torch_geopooling.nn import AdaptiveQuadPool2d

# Create 5-feature vector for each node in a decomposition.
pool = AdaptiveQuadPool2d(5, (-180, -90, 360, 180), max_depth=12, capacity=10)
input = torch.DoubleTensor(1024, 2).uniform_(-90, 90)
output = pool(input)

Using regular decomposition module for arbitrary polygon:

import torch
from shapely import Polygon
from torch_geopooling.nn import QuadPool2d

# Polygon for regular decomposition should be within an exterior boundary.
poly = Polygon([(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)])
exterior = (-100.0, -100.0, 200.0, 200.0)
# Create 3-feature vector for each node in a decomposition.
pool = QuadPool2d(3, poly, exterior, max_depth=10)
input = torch.DoubleTensor(200, 2).uniform_(0.0, 10.0)
output = pool(input)

Using 2-dimensional embedding module for learning data on sphere:

import torch
from torch_geopooling.nn import Embedding2d

embedding = Embedding2d((16, 16, 2), padding=(3, 3), exterior=(-100, 100, 200.0, 200.0))
input = torch.DoubleTensor(1024, 2).normal_(5.0, 1.0)
output = embedding(input)

License

The Torch Geopooling is distributed under GPLv3 license. See the LICENSE file for full license text.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

torch_geopooling-1.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

torch_geopooling-1.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.9 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

torch_geopooling-1.1.1-cp312-cp312-macosx_11_0_arm64.whl (227.1 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

torch_geopooling-1.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

torch_geopooling-1.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.9 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

torch_geopooling-1.1.1-cp311-cp311-macosx_11_0_arm64.whl (228.5 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

torch_geopooling-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

torch_geopooling-1.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

torch_geopooling-1.1.1-cp310-cp310-macosx_11_0_arm64.whl (226.9 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

torch_geopooling-1.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

torch_geopooling-1.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

torch_geopooling-1.1.1-cp39-cp39-macosx_11_0_arm64.whl (227.1 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

File details

Details for the file torch_geopooling-1.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 19d80ae094f45923f4f215df9cfeb4126a18a89c292d8f286ab9d618888085c0
MD5 42a6a4d43483c246d18cff9da54e5ac5
BLAKE2b-256 bc763699c61bfc218e148f3a1d917d3598d8a0558883bf85898d122aeba84c10

See more details on using hashes here.

File details

Details for the file torch_geopooling-1.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0947bc2600865a8635a218ef414dbccd3d3826d30ac157c7058a3b688b8595f4
MD5 c5844bfb4da9570ed75bb93de5466128
BLAKE2b-256 f36b85e68196cfeac2db6f80fc1bef53ac8e195cf2b377f4b540251c76511b74

See more details on using hashes here.

File details

Details for the file torch_geopooling-1.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d5f595d5d85496653de6dcb5a583f4d32a75ad2c3fee5083c7740fb6f08f6f88
MD5 c43fbf701ea5028e097e605d49c0d7fd
BLAKE2b-256 119389827d2a1314e8997894b3e49a6e54df78c03bdebdb2f44067b9abfc57a6

See more details on using hashes here.

File details

Details for the file torch_geopooling-1.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a3a44eae0890088d52562d6e1160198061addec43052b6e825d3c659e405438e
MD5 edbf05729e3403b942ffc270ec8d8817
BLAKE2b-256 b820ee6def0376a37d900fc0c94080e248ddcedc9e1c803036b47c4633eb95b1

See more details on using hashes here.

File details

Details for the file torch_geopooling-1.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 44f4b4a4714d2a1e830bfa3448806edc072e1d0f253656076ed4a66a1bebf191
MD5 ef59fcb95ec5ecdf210f5263f1e24901
BLAKE2b-256 72c0d09043d8ab7184459a8b241590f54b0bdd19bfa9ede03d8b4ceec9c3ca4a

See more details on using hashes here.

File details

Details for the file torch_geopooling-1.1.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 226772cc6681c978b15f44de79e10f16d608b6c4a4fa8454ab0683753f8b8297
MD5 e9173dbe6878f2cf14893882eee6298f
BLAKE2b-256 6c098f3c6336f8feb125bb78b35cdb2caebe687ec9ea557b59597af84f1f528d

See more details on using hashes here.

File details

Details for the file torch_geopooling-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2a3fd208aa9f7250ce8f9d0737434b2683ea0519ea97b29f1a41a4ef89db9c49
MD5 177a6f2ef20b39e297d648d248ee382a
BLAKE2b-256 7fe2d74305ed7c9117d757a080ed5076af9d261b54f67be64d9c89023665487d

See more details on using hashes here.

File details

Details for the file torch_geopooling-1.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 96605acbd3e9a4f117ca493356caa5803492b66cdf90d4cdb3ca69d922149cc3
MD5 f7f61ad2058c5b42bbbc004e378f1586
BLAKE2b-256 bf9d960a20a91bf365fe438abe1e83ad85b5e7d12a2aeb3c8816eb8173661dea

See more details on using hashes here.

File details

Details for the file torch_geopooling-1.1.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 feef0ca4ce9689176ffe19e03d0980f26e91a8db7fde87bb814bacd9e8efbeca
MD5 cd685cb157357c61a28214f06db63216
BLAKE2b-256 93c7b89edd95d89bfe140da339d58d24d2cf4b8506030424d6befd3a5b262280

See more details on using hashes here.

File details

Details for the file torch_geopooling-1.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1fa7097f22969448677be7d476a960fdf647b4fd763e083ff39fe3353ed983b
MD5 e37def1f59d37f3b1a951a508e188f3f
BLAKE2b-256 76cf9f861f1140d526e368cb1d79fb912d9d76ced4be9ade50d2e9c6554a8890

See more details on using hashes here.

File details

Details for the file torch_geopooling-1.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4fa702a96f46847c144b1ea1b5dcecaa3c7a0de0fd7052e57a939137f898a005
MD5 0f84e039fdf15a0c6743542e947f85f5
BLAKE2b-256 b286c1899f4d8952b91ee12555d6d1042a73b35c171c0761f91915d8a18e24e2

See more details on using hashes here.

File details

Details for the file torch_geopooling-1.1.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for torch_geopooling-1.1.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce04083acd6c841d06034de750db27a74aa8e345db5ed12b1d624201c86a242a
MD5 e35227c4ffaed101bc38446b896c25fc
BLAKE2b-256 579f404013dd14978eb62b98c591037d68d9e41226c9352cd077b6b7f99df379

See more details on using hashes here.

Supported by

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