Skip to content

Commit 42d5dd5

Browse files
authored
Merge pull request #539 from will-am/inception_v4
Implement Inception-v4 for image classification
2 parents 17898b4 + 1caf5c6 commit 42d5dd5

File tree

6 files changed

+554
-10
lines changed

6 files changed

+554
-10
lines changed

README.cn.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,15 @@ PaddlePaddle提供了丰富的运算单元,帮助大家以模块化的方式
9898

9999
图像相比文字能够提供更加生动、容易理解及更具艺术感的信息,是人们转递与交换信息的重要来源。图像分类是根据图像的语义信息对不同类别图像进行区分,是计算机视觉中重要的基础问题,也是图像检测、图像分割、物体跟踪、行为分析等其他高层视觉任务的基础,在许多领域都有着广泛的应用。如:安防领域的人脸识别和智能视频分析等,交通领域的交通场景识别,互联网领域基于内容的图像检索和相册自动归类,医学领域的图像识别等。
100100

101-
在图像分类任务中,我们向大家介绍如何训练AlexNet、VGG、GoogLeNet、ResNet和Inception-Resnet-V2模型。同时提供了能够将Caffe或TensorFlow训练好的模型文件转换为PaddlePaddle模型文件的模型转换工具。
101+
在图像分类任务中,我们向大家介绍如何训练AlexNet、VGG、GoogLeNet、ResNet、Inception-v4和Inception-Resnet-V2模型。同时提供了能够将Caffe或TensorFlow训练好的模型文件转换为PaddlePaddle模型文件的模型转换工具。
102102

103103
- 11.1 [将Caffe模型文件转换为PaddlePaddle模型文件](https://github.com/PaddlePaddle/models/tree/develop/image_classification/caffe2paddle)
104104
- 11.2 [将TensorFlow模型文件转换为PaddlePaddle模型文件](https://github.com/PaddlePaddle/models/tree/develop/image_classification/tf2paddle)
105105
- 11.3 [AlexNet](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
106106
- 11.4 [VGG](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
107107
- 11.5 [Residual Network](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
108-
- 11.6 [Inception-Resnet-V2](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
108+
- 11.6 [Inception-v4](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
109+
- 11.7 [Inception-Resnet-V2](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
109110

110111
## 12. 目标检测
111112

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,14 @@ As an example for sequence-to-sequence learning, we take the machine translation
7272

7373
## 9. Image classification
7474

75-
For the example of image classification, we show you how to train AlexNet, VGG, GoogLeNet, ResNet and Inception-Resnet-V2 models in PaddlePaddle. It also provides model conversion tools that convert Caffe or TensorFlow trained model files into PaddlePaddle model files.
75+
For the example of image classification, we show you how to train AlexNet, VGG, GoogLeNet, ResNet, Inception-v4 and Inception-Resnet-V2 models in PaddlePaddle. It also provides model conversion tools that convert Caffe or TensorFlow trained model files into PaddlePaddle model files.
7676

7777
- 9.1 [convert Caffe model file to PaddlePaddle model file](https://github.com/PaddlePaddle/models/tree/develop/image_classification/caffe2paddle)
7878
- 9.2 [convert TensorFlow model file to PaddlePaddle model file](https://github.com/PaddlePaddle/models/tree/develop/image_classification/tf2paddle)
7979
- 9.3 [AlexNet](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
8080
- 9.4 [VGG](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
8181
- 9.5 [Residual Network](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
82-
- 9.6 [Inception-Resnet-V2](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
82+
- 9.6 [Inception-v4](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
83+
- 9.7 [Inception-Resnet-V2](https://github.com/PaddlePaddle/models/tree/develop/image_classification)
8384

8485
This tutorial is contributed by [PaddlePaddle](https://github.com/PaddlePaddle/Paddle) and licensed under the [Apache-2.0 license](LICENSE).

image_classification/README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
图像分类
22
=======================
33

4-
这里将介绍如何在PaddlePaddle下使用AlexNet、VGG、GoogLeNet、ResNet和Inception-ResNet-v2模型进行图像分类。图像分类问题的描述和这五种模型的介绍可以参考[PaddlePaddle book](https://github.com/PaddlePaddle/book/tree/develop/03.image_classification)
4+
这里将介绍如何在PaddlePaddle下使用AlexNet、VGG、GoogLeNet、ResNet、Inception-v4和Inception-ResNet-v2模型进行图像分类。图像分类问题的描述和这些模型的介绍可以参考[PaddlePaddle book](https://github.com/PaddlePaddle/book/tree/develop/03.image_classification)
55

66
## 训练模型
77

@@ -20,6 +20,7 @@ import vgg
2020
import resnet
2121
import alexnet
2222
import googlenet
23+
import inception_v4
2324
import inception_resnet_v2
2425

2526

@@ -45,7 +46,7 @@ lbl = paddle.layer.data(
4546

4647
### 获得所用模型
4748

48-
这里可以选择使用AlexNet、VGG、GoogLeNet、ResNet和Inception-ResNet-v2模型中的一个模型进行图像分类。通过调用相应的方法可以获得网络最后的Softmax层。
49+
这里可以选择使用AlexNet、VGG、GoogLeNet、ResNet、Inception-v4和Inception-ResNet-v2模型中的一个模型进行图像分类。通过调用相应的方法可以获得网络最后的Softmax层。
4950

5051
1. 使用AlexNet模型
5152

@@ -90,7 +91,16 @@ ResNet模型可以通过下面的代码获取:
9091
out = resnet.resnet_imagenet(image, class_dim=CLASS_DIM)
9192
```
9293

93-
5. 使用Inception-ResNet-v2模型
94+
5. 使用Inception-v4模型
95+
96+
Inception-v4模型可以通过下面的代码获取, 本例中使用的模型输入大小为`3 * 224 * 224` (原文献中使用的输入大小为`3 * 299 * 299`):
97+
98+
```python
99+
out = inception_v4.inception_v4(image, class_dim=CLASS_DIM)
100+
```
101+
102+
103+
6. 使用Inception-ResNet-v2模型
94104

95105
提供的Inception-ResNet-v2模型支持`3 * 331 * 331``3 * 299 * 299`两种大小的输入,同时可以自行设置dropout概率,可以通过如下的代码使用:
96106

@@ -188,7 +198,7 @@ def event_handler(event):
188198

189199
### 定义训练方法
190200

191-
对于AlexNet、VGG、ResNet和Inception-ResNet-v2,可以按下面的代码定义训练方法:
201+
对于AlexNet、VGG、ResNet、Inception-v4和Inception-ResNet-v2,可以按下面的代码定义训练方法:
192202

193203
```python
194204
# Create trainer

0 commit comments

Comments
 (0)