@@ -170,6 +170,8 @@ We must import and initialize PaddlePaddle (enable/disable GPU, set the number o
```python
importsys
importpaddle.v2aspaddle
fromvggimportvgg_bn_drop
fromresnetimportresnet_cifar10
# PaddlePaddle init
paddle.init(use_gpu=False,trainer_count=1)
...
...
@@ -243,7 +245,9 @@ First, we use a VGG network. Since the image size and amount of CIFAR10 are rela
The above VGG network extracts high-level features and maps them to a vector of the same size as the categories. Softmax function or classifier is then used for calculating the probability of the image belonging to each category.
```python
out = fc_layer(input=net, size=class_num, act=SoftmaxActivation())
out = paddle.layer.fc(input=net,
size=classdim,
act=paddle.activation.Softmax())
```
4. Define Loss Function and Outputs
...
...
@@ -261,7 +265,7 @@ First, we use a VGG network. Since the image size and amount of CIFAR10 are rela
The first, third and fourth steps of a ResNet are the same as a VGG. The second one is the main module.
```python
net=resnet_cifar10(data,depth=32)
net=resnet_cifar10(image,depth=56)
```
Here are some basic functions used in `resnet_cifar10`:
@@ -212,6 +212,8 @@ We must import and initialize PaddlePaddle (enable/disable GPU, set the number o
```python
import sys
import paddle.v2 as paddle
from vgg import vgg_bn_drop
from resnet import resnet_cifar10
# PaddlePaddle init
paddle.init(use_gpu=False, trainer_count=1)
...
...
@@ -285,7 +287,9 @@ First, we use a VGG network. Since the image size and amount of CIFAR10 are rela
The above VGG network extracts high-level features and maps them to a vector of the same size as the categories. Softmax function or classifier is then used for calculating the probability of the image belonging to each category.
```python
out = fc_layer(input=net, size=class_num, act=SoftmaxActivation())
out = paddle.layer.fc(input=net,
size=classdim,
act=paddle.activation.Softmax())
```
4. Define Loss Function and Outputs
...
...
@@ -303,7 +307,7 @@ First, we use a VGG network. Since the image size and amount of CIFAR10 are rela
The first, third and fourth steps of a ResNet are the same as a VGG. The second one is the main module.
```python
net = resnet_cifar10(data, depth=32)
net = resnet_cifar10(image, depth=56)
```
Here are some basic functions used in `resnet_cifar10`:
@@ -83,11 +83,6 @@ We use the [MovieLens ml-1m](http://files.grouplens.org/datasets/movielens/ml-1m
`paddle.v2.datasets` package encapsulates multiple public datasets, including `cifar`, `imdb`, `mnist`, `moivelens` and `wmt14`, etc. There's no need for us to manually download and preprocess `MovieLens` dataset.
```python
# Run this block to show dataset's documentation
help(paddle.v2.dataset.movielens)
```
The raw `MoiveLens` contains movie ratings, relevant features from both movies and users.
@@ -125,11 +125,6 @@ We use the [MovieLens ml-1m](http://files.grouplens.org/datasets/movielens/ml-1m
`paddle.v2.datasets` package encapsulates multiple public datasets, including `cifar`, `imdb`, `mnist`, `moivelens` and `wmt14`, etc. There's no need for us to manually download and preprocess `MovieLens` dataset.
```python
# Run this block to show dataset's documentation
help(paddle.v2.dataset.movielens)
```
The raw `MoiveLens` contains movie ratings, relevant features from both movies and users.