Skip to main content

Static Gestures Recognition Framework

Project description

SGRF library development setup

Prerequisites

  • Python 3.11
  • PIP

Development

Installation

  1. Create/activate virtual environment
  2. Install required packages with pip install -r requirements.txt

Create new algorithm

To create a new algorithm, use algorithm creation script: ./scripts/generate_algorithm.py

Validate algorithms

To validate algorithms use scripts located in ./validation directory. Json files with validation results are located in ./validation/results directory

Usage

Import library

To use library in external project, use pip install sgrf.

Sample use cases

To predict gesture on selected image, run the code below. You can select desired algorithm by using values on ALGORITHM enum. Some algorithms require their own payload (e.g. hand coordinates or background image without hand). You can import specific payload from sgrf.algorithms.<alg>.<alg>_payload.

import cv2
from sgrf import classify
from sgrf.data.algorithm import ALGORITHM
from sgrf.models.image_payload import ImagePayload

image = cv2.imread("resources/image.jpg")
result = classify(algorithm=ALGORITHM.EID_SCHWENKER, payload=ImagePayload(image=image))

print(result)

To show image processed by the selected algorithm, run:

import cv2
from sgrf import process_image
from sgrf.data.algorithm import ALGORITHM
from sgrf.models.image_payload import ImagePayload

image = cv2.imread("resources/image.jpg")
processed_image = process_image(algorithm=ALGORITHM.EID_SCHWENKER, payload=ImagePayload(image=image))

cv2.imshow("Image", processed_image)
cv2.waitKey(0)
cv2.destroyAllWindows()

To learn your own algorithm's model (e.g. on other image base than ours), run:

import cv2
from sgrf import learn
from sgrf.data.algorithm import ALGORITHM
from sgrf.data.gesture import GESTURE
from sgrf.models.learning_data import LearningData

image = cv2.imread("resources/image.jpg")
acc, loss = learn(algorithm=ALGORITHM.EID_SCHWENKER, target_model_path="models",
                  learning_data=[LearningData(image_path="resources/image.jpg", label=GESTURE.FIVE)] * 10)

print(acc, loss)

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

sgrf-3.1.0.tar.gz (46.9 MB view details)

Uploaded Source

Built Distribution

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

sgrf-3.1.0-py3-none-any.whl (46.9 MB view details)

Uploaded Python 3

File details

Details for the file sgrf-3.1.0.tar.gz.

File metadata

  • Download URL: sgrf-3.1.0.tar.gz
  • Upload date:
  • Size: 46.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sgrf-3.1.0.tar.gz
Algorithm Hash digest
SHA256 f07e57a46f53d6815e0433d2f37d27d24dc8e3a16bcccc03925501bb26f0180d
MD5 781e72d7911eb49719b7c54ef1c6a78f
BLAKE2b-256 c7780cc63e5e6047030c395a512ffb22e92878360c9b50d64361f1d2f754cc2c

See more details on using hashes here.

File details

Details for the file sgrf-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: sgrf-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 46.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sgrf-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52f5f49312030fe855e33d0e1619ad9d520392d9de1454bc565eb79a28e93892
MD5 fe0aa33c98e5605b93bbc4b108cc6d39
BLAKE2b-256 6c747c2e5f66c00f359da588519893e92c120c2a41321b93404882fc2a9c5b63

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