Gesture Recognition
The gesture recognition is based on Google's tensorflow framework. We use tensorflow for model training. Windows-based PC, Python is used as the programming language, and opencv is used for image processing. SP7021 uses tensorflowlite (tensorflow for embed system).
Tensorflow System Requirement
Python3.5~Python3.7
pip 19.0 or higher.
Windows 7 or higher (64-bit)
Microsoft Visual C++ redistributable package for Visual Studio 2015, 2017 and 2019
Python install
The Tensorflow suppport the python3.5~3.7, so we install the python3.7, the python3.7 link:Python Download ,
Install Tensorflow by pip
Check whether the Python environment is configured:
python3 --version
pip3 --version
The version of pip is less than 19.0, you must upgrade pip
python3 -m pip install --upgrade pip
Tensorflow install
pip3 install --user --upgrade tensorflow
In China, you can use other mirror servers as acceleration pip install the package, for exmaple:
Install OpenCV
Opencv windows install package page: https://opencv.org/releases/, the download link: https://nchc.dl.sourceforge.net/project/opencvlibrary/4.3.0/opencv-4.3.0-vc14_vc15.exe
click the opencv-4.3.0-vc14_vc15.exe the file , you shoule select the install path . I select the install path is d:\temp, so the opencv install the d:\ temp\opencv.
Trian the model
The opencv set the environment variables script is the : setup_vars_opencv4.cmd
At first, you must execute the script for setup the opencv environment variables,
you can download the attachment file, for train the model,
the train.py set up the 5 types of the gestures ,”0”, “1”, “2“, “3“, “4”, 500 pictures of data collected in each type. Hand.h5 file (tensorflow model file) and hand.tflite(tensorflow lite) will be created in the current directory。you press the 'Space' key to start the train .
SP7021 install the Tensorflow-lite and python opencv
Install the python3-opencv
Install the tensorflow lite
Insert the USB camera and download the attachment and copy the model file trained by tensorflow. Put these two files together and execute test.py.