CNN实现手势识别(1)--准备leveldb数据,并得到均值文件

手势数据集为美国手势语言数据库

http://empslocal.ex.ac.uk/people/staff/np331/index.php?section=FingerSpellingDataset,

共24个字母手势类别不包括j和z。

在data文件夹中新建一个finger文件夹,存放配置文件和脚本文件,在finger文件夹下新建train和val文件夹,分别存放训练数据和验证数据。其中训练数据供10800张(每个字母手势450张,450*24=10800),验证数据共1170张(50*23+20,其实s手势验证数据只有20张)。

准备train.txt和val.txt,如下图所示

CNN实现手势识别(1)--准备leveldb数据,并得到均值文件_第1张图片 CNN实现手势识别(1)--准备leveldb数据,并得到均值文件_第2张图片

在finger文件夹下新建一个leveldb.bat,用于生成leveldb数据库,代入如下

set EXAMPLE=D:/360Downloads/NVIDIA/CaffeDev/caffe-windows/examples/finger
set DATA=D:/360Downloads/NVIDIA/CaffeDev/caffe-windows/data/finger
set TOOLS=D:/360Downloads/NVIDIA/CaffeDev/caffe-windows/Build/x64/Debug
set TRAIN_DATA_ROOT=D:/360Downloads/NVIDIA/CaffeDev/caffe-windows/data/finger/train/ 
set VAL_DATA_ROOT=D:/360Downloads/NVIDIA/CaffeDev/caffe-windows/data/finger/val/ 
  
set backend=leveldb  
set resize_width=128  
set resize_height=128  
  
set GLOG_logtostderr=1  
  
echo "Creating train leveldb..."  
  
"%TOOLS%/convert_imageset.exe" -backend=%backend% -resize_width=%resize_width% -resize_height=%resize_height% %TRAIN_DATA_ROOT% %DATA%/train.txt %EXAMPLE%/finger_train_leveldb  

echo "Creating test leveldb..."  
"%TOOLS%/convert_imageset.exe" -backend=%backend% -resize_width=%resize_width% -resize_height=%resize_height% %VAL_DATA_ROOT% %DATA%/val.txt %EXAMPLE%/finger_val_leveldb  
  
echo "Done."  
  
pause
运行结果如下所示

I1209 12:23:42.095513  7560 convert_imageset.cpp:87] A total of 1170 images.
I1209 12:23:42.115514  7560 db_leveldb.cpp:18] Opened leveldb D:/360Downloads/NVIDIA/CaffeDev/caffe-windows/examples/finger/f
inger_val_leveldb
I1209 12:23:49.044910  7560 convert_imageset.cpp:145] Processed 1000 files.
I1209 12:23:50.425989  7560 convert_imageset.cpp:151] Processed 1170 files.

计算训练数据的均值,得到均值文件,在finger文件夹下新建一个leveldb_mean.bat,

set GLOG_logtostderr=1
D:\360Downloads\NVIDIA\CaffeDev\caffe-windows\Build\x64\Debug\compute_image_mean.exe --backend=leveldb D:\360Downloads\NVIDIA\CaffeDev\caffe-windows\examples\finger\finger_train_leveldb D:\360Downloads\NVIDIA\CaffeDev\caffe-windows\data\finger\finger_mean.binaryproto
pause
运行结果如下

CNN实现手势识别(1)--准备leveldb数据,并得到均值文件_第3张图片



你可能感兴趣的:(深度学习,手势识别)