Giter Club home page Giter Club logo

gestop's Introduction

Gestop : Customizable Gesture Control of Computer Systems

This is the implementation of the approach described in the paper:

Sriram Krishna and Nishant Sinha. Gestop: Customizable Gesture Control of Computer Systems 8th ACM IKDD CODS and 26th COMAD. 2021. 405-409.

Built on top of mediapipe, this project aims to be a tool to interact with a computer through hand gestures. Out of the box, using this tool, it is possible to:

  1. Use your hand to act as a replacement for the mouse.
  2. Perform hand gestures to control system parameters like screen brightness, volume etc.

In addition, it is possible to extend and customize the functionality of the application in numerous ways:

  1. Remap existing hand gestures to different functions in order to better suit your needs.
  2. Create custom functionality through the use of either python functions or shell scripts.
  3. Collect data and create your own custom gestures to use with existing gestures.

Demo (Click on the image to see the full video)

Demo video link

Installation

Installation using pip inside a virtual environment is highly recommended. To do so:

python -m venv env
source env/bin/activate
pip install gestop

In addition to the Python dependencies, OpenCV and xdotool are also required by Gestop.

Usage

Server

To start the Gestop server:

python -m gestop.receiver

Client

The client, or the keypoint generator, can be setup either through MediaPipe's C++ API, or through its Python API. The Python API is simpler to setup and is recommended.

MediaPipe Python API

python -m gestop.keypoint_gen.hand_tracking
MediaPipe C++ API
  1. Download mediapipe and set it up. MediaPipe >=0.8.0 is NOT supported and should no be used. Make sure the provided hand tracking example is working to verify if all dependencies are installed.
  2. Clone this repo in the top level directory of mediapipe. Install all of Gestop's dependencies.
  3. Run the instructions below to build and then execute the code.

Note: Run build instructions in the mediapipe/ directory, not inside this directory.

GPU (Linux only)
bazel build -c opt --verbose_failures --copt -DMESA_EGL_NO_X11_HEADERS --copt -DEGL_NO_X11 gestop:hand_tracking_gpu

GLOG_logtostderr=1 bazel-bin/gestop/hand_tracking_gpu --calculator_graph_config_file=gestop/gestop/keypoint_gen/hand_tracking_desktop_live.pbtxt
CPU
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 gestop:hand_tracking_cpu

GLOG_logtostderr=1 bazel-bin/gestop/hand_tracking_cpu --calculator_graph_config_file=gestop/keypoint_gen/hand_tracking_desktop_live.pbtxt

Overview

The hand keypoints are detected using google's MediaPipe. These keypoints are then fed into receiver.py . The tool recognizes two kinds of gestures:

  1. Static Gestures : Gestures whose meaning can be inferred from a single image itself.
  2. Dynamic Gestures : Gestures which can only be understood through a sequence of images i.e. a video.

Static gestures, by default, are mapped to all functionality relevant to the mouse, such as left mouse click, scroll etc. Combined with mouse tracking, this allows one to replace the mouse entirely. The mouse is tracked simply by moving the hand, where the tip of the index finger reflects the position of the cursor. The gestures related to the mouse actions are detailed below. To train the neural network to recognize static gestures, a dataset was created manually for the available gestures.

For more complicated gestures involving the movement of the hand, dynamic gestures can be used. By default, it consists of various other actions to interface with the system, such as modifying screen brightness, switching workspaces, taking screenshots etc. The data for these dynamic gestures comes from SHREC2017 dataset. Dynamic gestures are detected by holding down the Ctrl key, which freezes the cursor, performing the gesture, and then releasing the key.

The project consists of a few distinct pieces which are:

  • MediaPipe - Accessed through either the Python API or the C++ API, MediaPipe tracks the hand, generates the keypoints and transmits them.
  • Gesture Receiver - See receiver.py, responsible for handling the stream and utilizing the following modules.
  • Mouse Tracker - See mouse_tracker.py, responsible for moving the cursor using the position of the index finger.
  • Gesture Recognizer - See recognizer.py, takes in the keypoints from the mediapipe executable, and converts them into a high level description of the state of the hand, i.e. a gesture name.
  • Gesture Executor - See executor.py, uses the gesture name from the previous module, and executes an action.

Notes

  • For best performance, perform dynamic gestures with right hand only, as all data from SHREC is right hand only.
  • For dynamic gestures to work properly, you may need to change the keycodes being used in executor.py. Use the given find_keycode.py script to find the keycodes of the keys used to change screen brightness and volumee. Finally, system shortcuts may need to be remapped so that the shortcuts work even with the Ctrl key held down. For example, in addition to the usual default behaviour of <Prnt_Screen> taking a screenshot, you may need to add <Ctrl+Prnt_Screen> as a shortcut as well.

Useful Information

Joints of the hand

HandCommander

Video recorded with VokoScreenNG

gestop's People

Contributors

dependabot[bot] avatar ekshaks avatar sriramsk1999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gestop's Issues

Fake project

the dyanmic net can not be run at all:

   return F.linear(input, self.weight, self.bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (1x49 and 36x128)

this porject actually doens't work.!!!!!

Dynamic Gestures recognized failed

hi thanks your project, your project give me so much help. but when I test dynamic gesture, for example Swipe Right and Swipe left ,
when I holding down the Ctrl key ,it return the result as follow
image
I can not understand why return the answer like static gesture

Issues with receiver step

Hi. This is great work and I was trying to replicate the same for further use. However, after installing all the dependencies from 'requirements.txt', when I try to execute the server step: 'python3 -m gestop.receiver' , the operation stalls in Loading StaticNet and Dynamic Net and doesn't go any further. Is there an additional dependency I am missing? Some help would be awsome! Thanks in advance

Architecture Comparison

Hey! The program works well for me with a slight latency though. I went through the forwarded paper hoping to get some insights on possible comparative studies/comparisons with known architectures but unfortunately could not find any. Can you please tell if you did relative comparisons with any baseline?

Thanks in advance!

Best,
PM

Protobuf error parsing

Hi,

Thank you for sharing your great work. That is very impressive work.
I tried to run your project in my local PC and follow the steps you given in readme.
That works fine until I tried to adding some new static gesture by run static_data_collection.py and it gave me an error said that "Error parsing message". (And previoulsy of course I run gesture_receiver.py)
error_parsing
I think the proto library cannot parse the proto file.
I used protobuf==3.14.0.

Could you help to solve this issue ? Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.