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).
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
The Tensorflow suppport the python3.5~3.7, so we install the python3.7, the python3.7 link:Python Download ,
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:
pip3 install -i https://mirrors.aliyun.com/pypi/simple tensorflow pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow |
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.
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 .
pi@raspberrypi:~$ sudo apt install pyhton3-opencv |
pi@raspberrypi:~$ pip3 install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37-cp37m-linux_armv7l.whl |
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.