资源简介
手势识别源码,用的算法是CNN,实施识别,运行系统包括windows和ubuntu
代码片段和文件信息
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
“““
Created on Thu Apr 6 01:01:43 2017
@author: abhisheksingh
“““
from keras.models import Sequential
from keras.layers import Dense Dropout Activation Flatten
from keras.layers import Conv2D MaxPooling2D ZeroPadding2D
from keras.optimizers import SGDRMSpropadam
from keras.utils import np_utils
# We require this for Theano lib ONLY. Remove it for TensorFlow usage
from keras import backend as K
K.set_image_dim_ordering(‘th‘)
import numpy as np
#import matplotlib.pyplot as plt
import os
import theano
from PIL import Image
# SKLEARN
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
import json
import cv2
import matplotlib
#matplotlib.use(“TkAgg“)
from matplotlib import pyplot as plt
# input image dimensions
img_rows img_cols = 200 200
# number of channels
# For grayscale use 1 value and for color images use 3 (RGB channels)
img_channels = 1
# Batch_size to train
batch_size = 32
## Number of output classes (change it accordingly)
## eg: In my case I wanted to predict 4 types of gestures (Ok Peace Punch Stop)
## NOTE: If you change this then dont forget to change Labels accordingly
nb_classes = 5
# Number of epochs to train (change it accordingly)
nb_epoch = 15 #25
# Total number of convolutional filters to use
nb_filters = 32
# Max pooling
nb_pool = 2
# Size of convolution kernel
nb_conv = 3
#%%
# data
path = “./“
path1 = “./gestures“ #path of folder of images
## Path2 is the folder which is fed in to training model
path2 = ‘./imgfolder_b‘
WeightFileName = [“ori_4015imgs_weights.hdf5““bw_4015imgs_weights.hdf5““bw_2510imgs_weights.hdf5““./bw_weight.hdf5““./final_c_weights.hdf5““./semiVgg_1_weights.hdf5““/new_wt_dropout20.hdf5““./weights-CNN-gesture_skinmask.hdf5“]
# outputs
output = [“OK“ “NOTHING““PEACE“ “PUNCH“ “STOP“]
#output = [“PEACE“ “STOP“ “THUMBSDOWN“ “THUMBSUP“]
#%%
# This function can be used for converting colored img to Grayscale img
# while copying images from path1 to path2
def convertToGrayImg(path1 path2):
listing = os.listdir(path1)
for file in listing:
if file.startswith(‘.‘):
continue
img = Image.open(path1 +‘/‘ + file)
#img = img.resize((img_rowsimg_cols))
grayimg = img.convert(‘L‘)
grayimg.save(path2 + ‘/‘ + file “PNG“)
#%%
def modlistdir(path):
listing = os.listdir(path)
retlist = []
for name in listing:
#This check is to ignore any hidden files/folders
if name.startswith(‘.‘):
continue
retlist.append(name)
return retlist
# Load CNN model
def loadCNN(wf_index):
global get_output
model = Sequential()
model.add(Conv2D(nb_filters (nb_conv nb_conv)
padding=‘valid‘
input_shape=(img_channels img_rows img_cols)))
convout1 = Activation(‘relu‘)
model.add(convout1)
model.add(Conv2D(nb_filters (nb_con
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-10-10 04:54 CNNGestureRecognizer-master\
文件 43 2017-10-10 04:54 CNNGestureRecognizer-master\.gitattributes
文件 1045 2017-10-10 04:54 CNNGestureRecognizer-master\.gitignore
文件 1071 2017-10-10 04:54 CNNGestureRecognizer-master\LICENSE
文件 10839 2017-10-10 04:54 CNNGestureRecognizer-master\README.md
文件 12816 2017-10-10 04:54 CNNGestureRecognizer-master\gestureCNN.py
文件 186106 2017-10-10 04:54 CNNGestureRecognizer-master\img_4_la
文件 357669 2017-10-10 04:54 CNNGestureRecognizer-master\img_7_la
目录 0 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\
文件 2399 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok1.png
文件 2243 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok10.png
文件 2056 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok100.png
文件 2004 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok101.png
文件 2311 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok102.png
文件 2492 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok103.png
文件 2605 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok104.png
文件 2603 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok105.png
文件 2541 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok106.png
文件 2615 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok107.png
文件 2703 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok108.png
文件 2572 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok109.png
文件 2304 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok11.png
文件 2645 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok110.png
文件 2698 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok111.png
文件 2704 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok112.png
文件 2699 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok113.png
文件 2618 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok114.png
文件 2655 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok115.png
文件 2600 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok116.png
文件 2594 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok117.png
文件 2601 2017-10-10 04:54 CNNGestureRecognizer-master\imgfolder_b\iiiok118.png
............此处省略4003个文件信息
相关资源
- 手势识别源代码+说明文档绝对原创、
- 手势识别项目源码(vs2015)
- 2018电赛 手势识别for MSP430F5529 oled图形
- 手势控制小车运动,交互程序和效果
- VS2013+OpenCV2.4.10提取傅里叶描述子特征
- VS2013+OPENCV2.4.10 提取HOG特征使用SVM多分
- 手势识别代码上,下,左,右
- 手势识别代码
- UnityVR手势识别插件VR Infinite Gesture1.
- mnist数据集162914
- 手势识别论文
- 几个基于openCV开发的手势识别代码
- 手势识别源代码 + 说明文档
- 基于Opencv的手势识别147077
- 手势识别数据库已标记
- opencv实现两种手势识别
- APDS9930-C51程序.zip
- 静态手势识别
- 基于OpenCV的手势识别--手掌和拳头识别
- 手势识别传感器paj7620 arduino板使用代
- 手势识别图像数据,三种手势每种1
- 图像识别(13)——手势识别(1)—
- Unity 手势识别,很好用,目前项目在
- 基于HMM的动态手势识别
- 剪刀、石头、布游戏的手势识别
- KT1025A蓝牙音频+QN8027FM调频+PAJ7620手势
- 手势识别-石头剪刀布
评论
共有 条评论