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.0.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.0.0-py3-none-any.whl (46.9 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sgrf-3.0.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.0.0.tar.gz
Algorithm Hash digest
SHA256 33734717dd5fc09367fa6dbc37cefbc3651c5c893e919740a17ee653c09d794f
MD5 e660135944ebe730a34fafb87a3a353e
BLAKE2b-256 3216d9788fb263c7e24f6624e97a42f3382094c532088e5499b6c3955a84fe6e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sgrf-3.0.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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c28f6cd8f6f422f78e9bd816d1c822674b64aab74440490e6dd02172aaad001d
MD5 e21ec8d4e03fd13c10a8613468615812
BLAKE2b-256 5431d73e7a70c0ab1e12421eac43a479bf30788874f0401c8aa15efd3fe58906

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