Skip to main content

Vectorized PyTorch implementation of Rotation Invariant Histogram of Oriented Gradients.

Project description

rihog

Vectorized PyTorch implementation of M. Cheon et al., Rotation Invariant Histogram of Oriented Gradients, International Journal of Fuzzy Logic and Intelligent Systems, vol. 11, no. 4, December 2011.

Install

pip install rihog

Usage

import rihog
import torch

img_b: torch.Tensor  # shape: (b 1 h w)

# class-based interface
rihog_fextr = rihog.RIHOG(...)
img_rihog_b = rihog_fextr(img_b)  # shape: (b wc nc*bc)
# wc: window count, nc: neighborhood count, bc: bin count

# functional interface
img_rihog_b = rihog.rihog(img_b, ...)  # shape: (b wc nc*bc)

Benchmark

Comparison of RIHOG1 and RIHOG3 against HOG and SIFT on the Original Brodatz Texture database. All algorithms are evaluated on the cosine distance-weighted k-NN accuracy computed from the average feature of each image, across three sizes of the feature vector (dimension). Following the evaluation procedure from the paper, 12 rotated versions are generated for each image (30° steps from 0° to 330°) and split into training set (first N rotations) and testing set (remaining rotations).

All benchmarks are run on the following hardware:

  • CPU: i9-11900KF @ 3.50GHz
  • RAM: 64GB @ 2400Mhz CL 17
  • GPU: RTX 3090 24GiB

Following is a run time comparison of the vectorized implementation on CPU and CUDA against the naive (non-vectorized) implementation across three hyper-parameter spaces: number of neighborhoods computed for each pixel (nbhd_steps parameter), batch size and image size.

License

MIT

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

rihog-1.0.2.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

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

rihog-1.0.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file rihog-1.0.2.tar.gz.

File metadata

  • Download URL: rihog-1.0.2.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for rihog-1.0.2.tar.gz
Algorithm Hash digest
SHA256 703e8b83297e0da527e8dd59af1e088edd3f7be1eb73778eac3bc7b1b84a4150
MD5 ea4c954c8b5d178fdb9459a99cd8e85f
BLAKE2b-256 f3d92ab968c3bafe1e161ae44b7f96d4f8fec1ceccf1a7f3eeb2074ecd79d8c0

See more details on using hashes here.

File details

Details for the file rihog-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: rihog-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for rihog-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5ef0f5ed48046bfb3c73ef1f249425808c22a5bedde7bd8a457274fec96f0c03
MD5 e98a684c217e88aad85e84b11f1c63e5
BLAKE2b-256 15023ac7df34d5f0a3e849673a8eeb101476d1380ef99ae9d09bbc7e5105bd9b

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