Skip to main content

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

Metadata

Release files for rihog 1.0.2

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

Source distribution (sdist)

Source distribution for rihog 1.0.2
File Size Uploaded
rihog-1.0.2.tar.gz 1.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for rihog 1.0.2
File Interpreter ABI Platform
rihog-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 1.4 MB

Release files / rihog-1.0.2.tar.gz

Download URL rihog-1.0.2.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
703e8b83297e0da527e8dd59af1e088edd3f7be1eb73778eac3bc7b1b84a4150
BLAKE2b-256 checksum
How to use checksums
f3d92ab968c3bafe1e161ae44b7f96d4f8fec1ceccf1a7f3eeb2074ecd79d8c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / rihog-1.0.2-py3-none-any.whl

Download URL rihog-1.0.2-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ef0f5ed48046bfb3c73ef1f249425808c22a5bedde7bd8a457274fec96f0c03
BLAKE2b-256 checksum
How to use checksums
15023ac7df34d5f0a3e849673a8eeb101476d1380ef99ae9d09bbc7e5105bd9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

1.0.2 This release

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