• Stars
    star
    772
  • Rank 58,858 (Top 2 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 6 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Real-Time Spatio-Temporally Localized Activity Detection by Tracking Body Keypoints

ActionAI 🤸

Python 3.x Join the chat at https://gitter.im/action-ai/community stars forks license twitter

ActionAI is a python library for training machine learning models to classify human action. It is a generalization of our yoga smart personal trainer, which is included in this repo as an example.

Getting Started

These instructions will show how to prepare your image data, train a model, and deploy the model to classify human action from image samples. See deployment for notes on how to deploy the project on a live stream.

Installation

Docker installation is recommended:

Docker

The included Dockerfile builds for Jetson devices running Jetpack 4.6.1. To build, cd into the docker/ directory and run:

docker build -f jetson-deployment.dockerfile -t actionai:j4.6.1 .

You can also pull a prebuilt image hosted on Docker Hub.

docker pull smellslikeml/actionai:j4.6.1
docker run -itd --rm 
         --net=host 
         --privileged 
         --env=DISPLAY 
         --runtime=nvidia  # for GPU
         --env=QT_X11_NO_MITSHM=1   # for visualization
         -v /tmp/.X11-unix:/tmp/.X11-unix 
	 --device /dev/input/js0      # for PS3 controller
	 -v /run/udev/data:/run/udev/data
         -v /dev/bus/usb:/dev/bus/usb  # for depthai camera
         --device-cgroup-rule='c *:* rmw' 
         -v /path/to/ActionAI:/app/ 
         smellslikeml/actionai:j4.6.1-latest /bin/bash

Jetson Nano Installation

Alternatively, use a virtual environment to avoid any conflicts with your system's global configuration. You can install the required dependencies via pip:

We use the trt_pose repo to extract pose estimations. Please look to this repo to install the required dependencies. You will also need to download these zipped model assets and unzip the package into the models/ directory.

# Assuming your python path points to python 3.x 
$ pip install -r requirements.txt

Inference

We've provided a sample inference script, inference.py, that will read input from a webcam, mp4, or rstp stream, run inference on each frame, and print inference results.

If you are running on a Jetson Nano, you can try running the iva.py script, which will perform multi-person tracking and activity recognition like the demo gif above Getting Started. Make sure you have followed the Jetson Nano installation instructions above and simply run:

$ python iva.py 0

# or if you have a video file

$ python iva.py /path/to/file.mp4

If specified, this script will write a labeled video as out.mp4. This demo uses a sample model called lstm_spin_squat.h5 to classify spinning vs. squatting. Change the model and motion dictionary under the RUNSECONDARY flag to run your own classifier.

Teachable Machine

We've also included a script under the experimental folder, online_finetune.py, that supports labelling samples via a PS3 Controller on a Jetson Nano and training in real-time from a webcam stream. This will require these extra dependencies:

To test it, run:

# Using a webcam
$ python experimental/online_finetune.py /dev/video0  

# Using a video asset
$ python experimental/online_finetune.py /path/to/file.mp4  

This script will also write labelled data into a csv file stored in data/ directory and produce a video asset out.mp4.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE.md file for details

References

More Repositories

1

everybody_dance_faster

Motion transfer booth for a 1 hour everybody dance now video generation using EdgeTPU and Tensorflow 2.0
Python
43
star
2

droop_detection

Conserve water with image classification for plant droop detection deployed on the Arduino platform.
Jupyter Notebook
23
star
3

kindbot

Kindbot: an app, sensors, voice-control, and state-of-the-art computer vision to maximize yields
Python
21
star
4

BRAD

Convolutional Autoencoders for Anomaly Detection to Reduce Bandwidth in Streaming Video
Python
19
star
5

end-to-end-ml-workshop

End-to-End ML on Databricks Workshop materials
Python
16
star
6

cnn_eeg

EEG wearable device using CNN for seizure prediction
Jupyter Notebook
16
star
7

distributed-deep-learning-workshop

Python
13
star
8

shoot_your_shot

train a custom classifier to score dart throws, relate to throwing form through pose estimation
Jupyter Notebook
12
star
9

deepIDS

deep learning applied to Network Intrusion Detection with NSL-KDD data
Jupyter Notebook
12
star
10

dolla_llama

Never forget the resource that helps to close that sales call! Power a real-time speech-to-text agent with retrieval augmented generation based on webscraped customer use-cases.
Python
12
star
11

cellular_ARDrone_2

Put your drone on a longer leash executing programmed flight on a powered Pi zero. Perform YOLO object recognition connect over Hologram CLI
Python
9
star
12

photoscope

image search engine using elasticsearch and mobilenet image embeddings
CSS
8
star
13

awesome-data-redaction

resources for programmatically redacting personally identifiable information
Jupyter Notebook
8
star
14

EdgeTPU-resources

Knowledge gathering and useful resources for the Coral EdgeTPU dev board
7
star
15

ros_neuralrecon

ROS 1 wrapper for NeuralRecon - https://github.com/zju3dv/NeuralRecon
Python
5
star
16

hacking_notes

conceptual overview and code for various intro hacking references
Python
4
star
17

MotionTransfer_PersonSeg

Implementation of Motion Transfer using Person Segmentation
Jupyter Notebook
4
star
18

tfr-bert-demo

TF-Ranking + Bert demo using MovieLens dataset
Python
4
star
19

ble_keyfinder

Sniffing BLE, trilateralize beacon with Machine Learning to guess location, Alexa for VUI
Python
4
star
20

image-similarity-metric-learning

Training CNN model to generate image embeddings
Python
3
star
21

rate-distortion-optimization

Spark notebooks outlining video rate-distortion optimization using content info
Jupyter Notebook
3
star
22

simple_ML_baselines

collection of jupyter notebooks exploring Kaggle competition datasets to implement simple baseline models
Jupyter Notebook
2
star
23

keras-r-mlflow

Example of training a GLM model with Keras and MLflow in R
R
1
star
24

rl_thermo

Temperature regulation with any appliance using policy gradients
Python
1
star
25

e2e-ml-demo

Basic E2E ML Demo on Databricks
Python
1
star