Skip to main content

The actspotter is a library / tensorflow model for detecting activities. It allows to classify body activities in images or videos. The package is limited to videos and images with only one person by design.

The following classes are available:

  • none

  • pull_up_up

  • pull_up_down

  • pull_up_none

  • push_up_up

  • push_up_down

  • push_up_none

  • sit_up_up

  • sit_up_down

  • sit_up_none

The package is currently in early development.

Future plans

Tensorflow model deployment will be integrated soon. Currently this package allows to classify push-ups, sit-ups and pull-ups. In future version kicks and others body activities will follow.

It is also planned to provide a signal processing layer that allows to easily detect connected activites and count them.

Another application will be to integrate with keyboard drivers so that activities could be used for controlling video games (e.g. by kicks).

Installation

Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. The basic problem it addresses is one of dependencies and versions, and indirectly permissions.

With virtualenv, it’s possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.

Supported Python Versions

Python >= 3.6

Mac/Linux

pip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install actspotter

Windows

pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install actspotter

Example Usage

Requirement: cv2 (opencv) installed.

Classification of images:

import cv2
import tensorflow as tf
from actspotter import ImageClassifier, classify_image_input_dimension, class_names

def _resize(frame, dim=classify_image_input_dimension):
    frame = cv2.resize(frame, dim, interpolation=cv2.INTER_AREA)
    return frame

def _to_tf_array(frame, dim=classify_image_input_dimension):
    frame = _resize(frame, dim)
    frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
    frame = tf.convert_to_tensor(frame, dtype=tf.float32)
    return frame

images = [
    to_tf_array(cv2.imread("test.jpg")),
]

print(class_names)
print(image_classifier.classify_images(images))

Classification of a video:

import cv2
import tensorflow as tf
from actspotter import VideoClassifier, classify_image_input_dimension

def _resize(frame, dim=classify_image_input_dimension):
    return frame

def _to_tf_array(frame, dim=classify_image_input_dimension):
    frame = _resize(frame, dim)
    frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
    frame = tf.convert_to_tensor(frame, dtype=tf.float32)
    return frame

cap = cv2.VideoCapture(0)

video_classifier = VideoClassifier(buffer_size=4)
video_classifier.start()

while cap.isOpened():
    ret, frame = cap.read()

    if ret == True:
        video_classifier.add_image(to_tf_array(frame))
        state = video_classifier.get_last_classification()
        print(state)

        frame = resize(frame, dim=(600, 600))
        cv2.putText(frame, f"{state}", (10, 40), 0, 2, 255)

        cv2.imshow("Frame", frame)

        waitkey = cv2.waitKey(25) & 0xFF

        if waitkey == ord("q"):
            break

video_classifier.exit()
cap.release()
cv2.destroyAllWindows()

Metadata

Release files for actspotter 0.1.3

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

Source distribution (sdist)

Source distribution for actspotter 0.1.3
File Size Uploaded
actspotter-0.1.3.tar.gz 11.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for actspotter 0.1.3
File Interpreter ABI Platform
actspotter-0.1.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 23.7 MB

Release files / actspotter-0.1.3.tar.gz

Download URL actspotter-0.1.3.tar.gz
Size 11.8 MB
Tags Source
SHA-256 checksum
How to use checksums
5efda7bc882b515c520d691c550684911fb300f1183b442dd251d31a300ed2f0
BLAKE2b-256 checksum
How to use checksums
55238a70229047d4c4d3b386656a97c54e9da03c1d43fe38ce708090fd36ec78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release files / actspotter-0.1.3-py2.py3-none-any.whl

Download URL actspotter-0.1.3-py2.py3-none-any.whl
Size 11.9 MB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d4dcfdac16876af9dc27f8f4923ce365f41250cbd2063e9bcd821b4cd5f1d326
BLAKE2b-256 checksum
How to use checksums
c42a5fe66527d71df7b648ff79ab939f6db4d1ecddb375d20bc082d204a08b55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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