README.md 8.6 KB
Newer Older
Eric.Lee2021's avatar
Eric.Lee2021 已提交
1 2
# classification    
物体识别分类   
Eric.Lee2021's avatar
Eric.Lee2021 已提交
3

Eric.Lee2021's avatar
Eric.Lee2021 已提交
4 5 6 7 8 9 10 11 12
## 项目介绍    
该项目对物体进行识别分类。  

## 项目配置   
* 作者开发环境:   
* Python 3.7   
* PyTorch >= 1.5.1   

## 数据集     
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
13
### 1、Stanford Dogs 数据集  
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
14 15 16

 ![image_dogs](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/dogs.png)   

Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
17
* 采用"Stanford Dogs Dataset"数据集官方地址:http://vision.stanford.edu/aditya86/ImageNetDogs/     
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
18
* 本文将该数据集的标注文件更改为xml格式,[数据集下载地址(百度网盘 Password: ks87 )](https://pan.baidu.com/s/1tT0wF4N2I9p5JDfCwtM1CQ)     
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
19 20
* 通过运行read_datasests.py,可以对数据的标注信息进行解析可视化。   
* 该数据集分为 120 类 。  
Eric.Lee2021's avatar
Eric.Lee2021 已提交
21

Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
22
### 2、静态手势识别数据集(handpose_x_gesture_v1)    
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
23

Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
24
 ![video_gesture](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/gesture.gif)   
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
25

Eric.Lee2021's avatar
Eric.Lee2021 已提交
26 27 28 29
* 数据集来源3部分,且网上数据占绝大多数,具体:
* 1)来源于网上数据并自制。
* 2)来源于自己相机采集并自制。
* 3)来源于 kinect_leap_dataset 数据集并自制,其官网地址为:https://lttm.dei.unipd.it/downloads/gesture/  
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
30 31 32 33 34 35 36 37 38
* 注:数据集如有侵权,请联系删除。
```
kinect_leap_dataset 数据集来源于以下paper项目组的贡献。  
[1] G. Marin, F. Dominio, P. Zanuttigh, "Hand gesture recognition with Leap Motion and Kinect devices", IEEE International Conference on Image Processing (ICIP), Paris, France, 2014  

[2] G. Marin, F. Dominio, P. Zanuttigh, "Hand Gesture Recognition with Jointly Calibrated Leap Motion and Depth Sensor", Multimedia Tools and Applications, 2015  
```

* 数据下载  
Eric.Lee2021's avatar
Eric.Lee2021 已提交
39
  该项目数据集命名为:handpose_x_gesture_v1,[数据集下载地址(百度网盘 Password: 6urr )](https://pan.baidu.com/s/1Sd-Ad88Wzp0qjGH6Ngah0g)
Eric.Lee2021's avatar
Eric.Lee2021 已提交
40
  数据集共 2850 个样本,分为 14 类。  
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
41
* 手势定义   
Eric.Lee2021's avatar
Eric.Lee2021 已提交
42

Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
43 44 45
 ![one](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/one.jpg) :000-one
 ![five](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/five.jpg) :001-five
 ![fist](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/fist.jpg) :002-fist
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
46
 ![ok](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/ok.jpg) :003-ok   
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
47 48 49
 ![heartSingle](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/heartSingle.jpg) :004-heartSingle
 ![yearh](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/yearh.jpg) :005-yearh
 ![three](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/three.jpg) :006-three
Eric.Lee2021's avatar
Eric.Lee2021 已提交
50
 ![four](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/four.jpg) :007-four  
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
51 52 53
 ![six](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/six.jpg) :008-six
 ![Iloveyou](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/Iloveyou.jpg) :009-Iloveyou
 ![gun](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/gun.jpg) :010-gun
Eric.Lee2021's avatar
Eric.Lee2021 已提交
54
 ![thumbUp](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/thumbUp.jpg) :011-thumbUp  
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
55
 ![nine](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/nine.jpg) :012-nine
Eric.Lee2021's avatar
Eric.Lee2021 已提交
56
 ![pink](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/pink.jpg) :013-pink  
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
57

Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
58
* 注意事项   
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
59
  如果使用了该项目的14类静态手势数据集请指出引用来源,具体如下所示 :   
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
60
```
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
61 62 63 64 65 66 67

[1] G. Marin, F. Dominio, P. Zanuttigh, "Hand gesture recognition with Leap Motion and Kinect devices", IEEE International Conference on Image Processing (ICIP), Paris, France, 2014  

[2] G. Marin, F. Dominio, P. Zanuttigh, "Hand Gesture Recognition with Jointly Calibrated Leap Motion and Depth Sensor", Multimedia Tools and Applications, 2015  

[3] Eric.Lee , https://codechina.csdn.net/EricLee/classification  

Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
68
```
69 70 71
### 3、imagenet 数据集 (使用“ILSVRC2012_img_train”数据集将原图裁剪后的部分数据集)  
* 因为考虑到本身imagenet数据集很大所以进行了裁剪做了一个mini数据集,如有侵权请联系删除,[数据集下载地址(百度网盘 Password: 6cm9 )](https://pan.baidu.com/s/1C4csbZfj02wM9Y-I5OiPhw)  
* 具体分类看json信息即 [imagenet_msg.json](https://codechina.csdn.net/EricLee/classification/-/blob/master/imagenet/imagenet_msg.json) ,"chinese_name"为类别中文名字,"doc_name"为数据集对应的每一类文件夹名字,前面的数字为模型的类别号从 "0"~"999", 共 1000 类。
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
72
* 如果需要完整imagenet数据集,请从官网申请下载,官网地址:http://www.image-net.org/
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
73
```
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
74 75 76 77
ImageNet is an image database organized according to the WordNet hierarchy (currently only the nouns),     
in which each node of the hierarchy is depicted by hundreds and thousands of images.   
The project has been instrumental in advancing computer vision and deep learning research.   
The data is available for free to researchers for non-commercial use.  
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
78
```
79
### 4、Stanford_Cars 数据集(共196 类)
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
80 81
* [数据集下载地址(百度网盘 Password: txtu )](https://pan.baidu.com/s/1DR9ANGqFS6z90yzU6nlIoA)
* Stanford_Cars官网地址:http://ai.stanford.edu/~jkrause/cars/car_dataset.html
82 83

 ![stanford_cars](https://codechina.csdn.net/EricLee/classification/-/raw/master/samples/xyxy_21-45-281-133_02577.jpg)
84
* 该数据集出自以下论文:
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
85 86 87 88
```
 3D Object Representations for Fine-Grained Categorization
 Jonathan Krause, Michael Stark, Jia Deng, Li Fei-Fei
 4th IEEE Workshop on 3D Representation and Recognition, at ICCV 2013 (3dRR-13). Sydney, Australia. Dec. 8, 2013.
Eric.Lee2021's avatar
Eric.Lee2021 已提交
89
       
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
90 91
 Note that the dataset, as released, has 196 categories, one less than in the paper, as it has been cleaned up slightly since publication. Numbers should be more or less comparable, though.
```
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
92

Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
93 94 95 96 97
### 构建自己的数据集  
* 构建一个总的数据集目录,在目录内建立每一个具体类别的子目录,每一个子目录有且只有单独的一个类别。并且文件夹的命名为“数字-名称”,比如上图的“one静态手势”的文件夹命名为“000-one”。  
* 注意名称为英文命名,可以由自己定义,类别编号数字从0开始。  
* 另外在具体训练时,需要在训练脚本 train.py 中进行训练集文件夹路径和类别数的对应修改。  

Eric.Lee2021's avatar
Eric.Lee2021 已提交
98
## 预训练模型    
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
99
### 1、Stanford Dogs 预训练模型
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
100
* [预训练模型下载地址(百度网盘 Password: ks87 )](https://pan.baidu.com/s/1tT0wF4N2I9p5JDfCwtM1CQ)   
Eric.Lee2021's avatar
Eric.Lee2021 已提交
101

Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
102
### 2、静态手势识别预训练模型(handpose_x_gesture_v1)    
Eric.Lee2021's avatar
Eric.Lee2021 已提交
103
* [预训练模型下载地址(百度网盘 Password: igcf )](https://pan.baidu.com/s/1WeoYQ3bfTkpbzPbROm81Ew)   
Eric.Lee2021's avatar
Eric.Lee2021 已提交
104

105
### 3、imagenet 预训练模型
106
* [预训练模型下载地址(百度网盘 Password: ct31 )](https://pan.baidu.com/s/1uZsAHF6wK-LOR8j6TFABmQ)   
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
107
* 具体分类看json信息即"imagenet_msg.json",运行 [read_imagenet_msg.py](https://codechina.csdn.net/EricLee/classification/-/blob/master/imagenet/read_imagenet_msg.py) 读取。
108
* "chinese_name"为类别中文名字,"doc_name"为数据集对应的每一类文件夹名字,前面的数字为模型的类别号从 "0"~"999",共 1000 类 。
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
109

Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
110 111 112
### 4、Stanford_Cars 预训练模型
* [预训练模型下载地址(百度网盘 Password: 7bf7 )](https://pan.baidu.com/s/1JY_ia48e92am6JJ_p-kgQg)

Eric.Lee2021's avatar
Eric.Lee2021 已提交
113 114
## 项目使用方法  
### 模型训练  
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
115 116
   注意: train.py 中的 3个参数与具体分类任务数据集,息息相关,如下所示:
```
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
117 118 119 120
    #---------------------------------------------------------------------------------
    parser.add_argument('--train_path', type=str, default = './handpose_x_gesture_v1/',
        help = 'train_path') # 训练集路径
    parser.add_argument('--num_classes', type=int , default = 14,
121
        help = 'num_classes') #  分类类别个数,gesture 配置为 14 , Stanford Dogs 配置为 120 , imagenet 配置为 1000
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
122
    parser.add_argument('--have_label_file', type=bool, default = False,
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
123 124
        help = 'have_label_file') # 是否有配套的标注文件解析才能生成分类训练样本,gesture 配置为 False , Stanford Dogs 配置为 True
```
Eric.Lee2021's avatar
Eric.Lee2021 已提交
125 126 127 128 129 130
* 根目录下运行命令: python train.py       (注意脚本内相关参数配置 )   

### 模型推理  
* 根目录下运行命令: python inference.py        (注意脚本内相关参数配置 )   

### 注意事项    
Eric.Lee2021's avatar
update  
Eric.Lee2021 已提交
131 132 133 134 135
* 因为数据集的整张图会有大量背景、多只狗等干扰因素。本文采用的图像输入是"Stanford Dogs Dataset"数据集的目标边界框范围图像,这样也觉定了在模型推断预测环境下也是以目标物的边界框为范围的图像作为输入。   


## 联系方式 (Contact)  
* E-mails: 305141918@qq.com