commit
2c98becba4
@ -0,0 +1,15 @@
|
||||
*.DS_Store
|
||||
build/
|
||||
*.user
|
||||
.vscode
|
||||
.idea
|
||||
.project
|
||||
.cproject
|
||||
.pydevproject
|
||||
Makefile
|
||||
.test_env/
|
||||
third_party/
|
||||
*~
|
||||
bazel-*
|
||||
|
||||
!build/*.deb
|
||||
@ -1,24 +1,23 @@
|
||||
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
|
||||
sha: c25201a00e6b0514370501050cf2a8538ac12270
|
||||
sha: v1.0.1
|
||||
hooks:
|
||||
- id: remove-crlf
|
||||
files: (?!.*third_party)^.*$ | (?!.*book)^.*$
|
||||
- repo: https://github.com/reyoung/mirrors-yapf.git
|
||||
sha: v0.13.2
|
||||
hooks:
|
||||
- id: yapf
|
||||
files: (.*\.(py|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
sha: 4ef03c4223ad322c7adaa6c6c0efb26b57df3b71
|
||||
sha: 5bf6c09bfa1297d3692cadd621ef95f1284e33c0
|
||||
hooks:
|
||||
- id: check-added-large-files
|
||||
- id: check-merge-conflict
|
||||
- id: check-symlinks
|
||||
- id: detect-private-key
|
||||
files: (?!.*third_party)^.*$ | (?!.*book)^.*$
|
||||
- id: end-of-file-fixer
|
||||
# TODO(yuyang): trailing whitespace has some bugs on markdown
|
||||
# files now, please not add it to pre-commit hook now
|
||||
# - id: trailing-whitespace
|
||||
#
|
||||
# TODO(yuyang): debug-statements not fit for Paddle, because
|
||||
# not all of our python code is runnable. Some are used for
|
||||
# documenation
|
||||
# - id: debug-statements
|
||||
- repo: https://github.com/PaddlePaddle/clang-format-pre-commit-hook.git
|
||||
sha: 28c0ea8a67a3e2dbbf4822ef44e85b63a0080a29
|
||||
hooks:
|
||||
- id: clang-formater
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
./doc/howto/dev/contribute_to_paddle_en.md
|
||||
@ -0,0 +1,63 @@
|
||||
# A image for building paddle binaries
|
||||
# Use cuda devel base image for both cpu and gpu environment
|
||||
FROM nvidia/cuda:8.0-cudnn5-devel-ubuntu14.04
|
||||
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
|
||||
|
||||
ARG UBUNTU_MIRROR
|
||||
RUN /bin/bash -c 'if [[ -n ${UBUNTU_MIRROR} ]]; then sed -i 's#http://archive.ubuntu.com/ubuntu#${UBUNTU_MIRROR}#g' /etc/apt/sources.list; fi'
|
||||
|
||||
# ENV variables
|
||||
ARG WITH_GPU
|
||||
ARG WITH_AVX
|
||||
ARG WITH_DOC
|
||||
ARG WITH_STYLE_CHECK
|
||||
|
||||
ENV WOBOQ OFF
|
||||
ENV WITH_GPU=${WITH_GPU:-OFF}
|
||||
ENV WITH_AVX=${WITH_AVX:-ON}
|
||||
ENV WITH_DOC=${WITH_DOC:-OFF}
|
||||
ENV WITH_STYLE_CHECK=${WITH_STYLE_CHECK:-OFF}
|
||||
|
||||
ENV HOME /root
|
||||
# Add bash enhancements
|
||||
COPY ./paddle/scripts/docker/root/ /root/
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y git python-pip python-dev openssh-server bison && \
|
||||
apt-get install -y wget unzip tar xz-utils bzip2 gzip coreutils && \
|
||||
apt-get install -y curl sed grep graphviz libjpeg-dev zlib1g-dev && \
|
||||
apt-get install -y python-numpy python-matplotlib gcc g++ gfortran && \
|
||||
apt-get install -y automake locales clang-format-3.8 swig doxygen && \
|
||||
apt-get clean -y
|
||||
|
||||
# git credential to skip password typing
|
||||
RUN git config --global credential.helper store
|
||||
|
||||
# Fix locales to en_US.UTF-8
|
||||
RUN localedef -i en_US -f UTF-8 en_US.UTF-8
|
||||
|
||||
# FIXME: due to temporary ipykernel dependency issue, specify ipykernel jupyter
|
||||
# version util jupyter fixes this issue.
|
||||
RUN pip install --upgrade pip && \
|
||||
pip install -U 'protobuf==3.1.0' && \
|
||||
pip install -U wheel pillow BeautifulSoup && \
|
||||
pip install -U docopt PyYAML sphinx && \
|
||||
pip install -U sphinx-rtd-theme==0.1.9 recommonmark && \
|
||||
pip install pre-commit 'requests==2.9.2' 'ipython==5.3.0' && \
|
||||
pip install 'ipykernel==4.6.0' 'jupyter==1.0.0'
|
||||
|
||||
RUN curl -sSL https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz | tar -xz && \
|
||||
cd cmake-3.4.1 && ./bootstrap && make -j `nproc` && make install && \
|
||||
cd .. && rm -rf cmake-3.4.1
|
||||
|
||||
VOLUME ["/woboq_out"]
|
||||
|
||||
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
|
||||
RUN mkdir /var/run/sshd
|
||||
RUN echo 'root:root' | chpasswd
|
||||
RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
|
||||
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
|
||||
EXPOSE 22
|
||||
|
||||
# development image default do build work
|
||||
CMD ["bash", "/paddle/paddle/scripts/docker/build.sh"]
|
||||
@ -0,0 +1,9 @@
|
||||
paddle/image/logs
|
||||
paddle/image/*.pyc
|
||||
paddle/image/train.list
|
||||
paddle/rnn/logs
|
||||
paddle/rnn/*.pyc
|
||||
paddle/rnn/imdb.pkl
|
||||
caffe/image/logs
|
||||
tensorflow/image/logs
|
||||
tensorflow/rnn/logs
|
||||
@ -0,0 +1,168 @@
|
||||
# Benchmark
|
||||
|
||||
Machine:
|
||||
|
||||
- CPU: 12-core Intel(R) Xeon(R) CPU E5-2620 v2 @2.10GHz
|
||||
- GPU: Tesla K40m
|
||||
- cuDNN: v5.1
|
||||
- system: Docker 1.12.1, all platforms are tested in docker environment.
|
||||
|
||||
Platforms:
|
||||
|
||||
- PaddlePaddle: paddledev/paddle:gpu-devel-v0.9.0a0
|
||||
- Tensorflow: gcr.io/tensorflow/tensorflow:0.11.0rc0-gpu
|
||||
- Caffe: kaixhin/cuda-caffe
|
||||
|
||||
Several convolutional neural networks and recurrent neural networks are used to test.
|
||||
|
||||
## Image
|
||||
|
||||
### Benchmark Model
|
||||
|
||||
AlexNet, GoogleNet and a small network used in Caffe.
|
||||
|
||||
- [AlexNet](https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet): but the group size is one.
|
||||
|
||||
- [GoogleNet](https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet): but remove loss1 and loss2 when testing benchmark.
|
||||
|
||||
- [SmallNet](https://github.com/BVLC/caffe/blob/master/examples/cifar10/cifar10\_quick\_train\_test.prototxt)
|
||||
|
||||
|
||||
### Single-GPU
|
||||
|
||||
- AlexNet: input - 3 * 227 * 227, Time: ms/batch
|
||||
|
||||
| BatchSize | 64 | 128 | 256 | 512 |
|
||||
|--------------|-----| -----| ------| -----|
|
||||
| PaddlePaddle | 195 | 334 | 602 | 1629 |
|
||||
| TensorFlow | 223 | 364 | 645 | 1235 |
|
||||
| Caffe | 324 | 627 | 1232 | 2513 |
|
||||
|
||||
**Notation**
|
||||
|
||||
All platforms use cuDNN-v5.1. We see that caffe is slower in this experiment, because its workspace limit size of cuDNN-conv interface is 8 * 1024 * 1024, which is smaller in PaddlePaddle and TensorFlow. Note that Caffe will be faster if increasing the workspace limit size.
|
||||
|
||||
- GoogletNet: input - 3 * 224 * 224, Time: ms/batch
|
||||
|
||||
|
||||
| BatchSize | 64 | 128 | 256 |
|
||||
|--------------|-------| -------| --------|
|
||||
| PaddlePaddle | 613 | 1149 | 2348 |
|
||||
| TensorFlow | 644 | 1176 | 2219 |
|
||||
| Caffe | 694 | 1364 | out of memory |
|
||||
|
||||
- SmallNet: input - 3 * 32 * 32, Time ms/batch
|
||||
|
||||
| BatchSize | 64 | 128 | 256 | 512 |
|
||||
|--------------|--------| -------- | --------|---------|
|
||||
| PaddlePaddle | 10.463 | 18.184 | 33.113 | 63.039 |
|
||||
| TensorFlow | 9 | 15 | 28 | 59 |
|
||||
| Caffe | 9.373 | 16.6606 | 31.4797 | 59.719 |
|
||||
|
||||
**Notation**
|
||||
|
||||
All the single-GPU experiments in caffe use `caffe time` to calculate elapsed time, which does not include parameter updating time. However, both PaddlePaddle and TensorFlow experiments contain the parameter updating time. As compared with the total time, this part is relatively little on single machine, we can ignore it.
|
||||
|
||||
In Tensorflow, they implement algorithm searching method instead of using the algorithm searching interface in cuDNN.
|
||||
|
||||
### Multi-GPU: 4 GPUs
|
||||
|
||||
- AlexNet, ms / batch
|
||||
|
||||
| total-BatchSize | 128 * 4 | 256 * 4 |
|
||||
|------------------|----------| -----------|
|
||||
| PaddlePaddle | 347 | 622 |
|
||||
| TensorFlow | 377 | 675 |
|
||||
| Caffe | 1229 | 2435 |
|
||||
|
||||
For example, if `total-BatchSize = 128 * 4`, the speedup ratio is calculated by
|
||||
|
||||
```
|
||||
time_at_1gpu_batch_128 * 4 / time_at_4gpu_total_batch_512
|
||||
= (334 * 4)/347
|
||||
= 3.85
|
||||
```
|
||||
|
||||
<img src="figs/alexnet-4gpu.png" width="420">
|
||||
|
||||
|
||||
- GoogleNet, ms / batch
|
||||
|
||||
| total-BatchSize | 128 * 4 | 256 * 4 |
|
||||
|-------------------|--------------| ----------- |
|
||||
| PaddlePaddle | 1178 | 2367 |
|
||||
| TensorFlow | 1210 | 2292 |
|
||||
| Caffe | 2007 | out of memory |
|
||||
|
||||
<img src="figs/googlenet-4gpu.png" width="420">
|
||||
|
||||
|
||||
## RNN
|
||||
We use lstm network for text classfication to test benchmark.
|
||||
|
||||
### Dataset
|
||||
- [IMDB](http://www.iro.umontreal.ca/~lisa/deep/data/imdb.pkl)
|
||||
- Sequence length is 100. In fact, PaddlePaddle supports training with variable-length sequence, but TensorFlow needs to pad. Thus, we also pad sequence length to 100 in PaddlePaddle in order to compare.
|
||||
- Dictionary size=30000
|
||||
- Peephole connection is used in `lstmemory` by default in PaddlePaddle. It is also configured in TensorFlow.
|
||||
|
||||
### Single-GPU
|
||||
|
||||
#### LSTM in Text Classification
|
||||
|
||||
Testing `2 lstm layer + fc` network with different hidden size and batch size.
|
||||
|
||||
- Batch size = 64, ms / batch
|
||||
|
||||
| hidden_size | 256 | 512 | 1280 |
|
||||
|--------------|-------| -------| --------|
|
||||
| PaddlePaddle | 83 | 184 | 641 |
|
||||
| TensorFlow | 175 | 280 | 818 |
|
||||
|
||||
- Batch size = 128, ms / batch
|
||||
|
||||
| hidden_size | 256 | 512 | 1280 |
|
||||
|--------------|------- | -------| --------|
|
||||
| PaddlePaddle | 110 | 261 | 1007 |
|
||||
| TensorFlow | 181 | 361 | 1237 |
|
||||
|
||||
|
||||
- Batch size = 256, ms / batch
|
||||
|
||||
| hidden_size | 256 | 512 | 1280 |
|
||||
|--------------|-------| -------| --------|
|
||||
| PaddlePaddle | 170 | 414 | 1655 |
|
||||
| TensorFlow | 238 | 536 | 1905 |
|
||||
|
||||
<img src="figs/rnn_lstm_cls.png" width="600">
|
||||
|
||||
#### Seq2Seq
|
||||
|
||||
The benchmark of sequence-to-sequence network will be added later.
|
||||
|
||||
|
||||
### Multi GPU: 4 GPUs
|
||||
|
||||
#### LSTM in Text Classification
|
||||
|
||||
- hidden_size = 256, ms / batch
|
||||
|
||||
| batch_size | 256 | 512 |
|
||||
|--------------| -------| --------|
|
||||
| PaddlePaddle | 90 | 118 |
|
||||
| TensorFlow | 226 | 118 |
|
||||
|
||||
|
||||
- hidden_size = 512, ms / batch
|
||||
|
||||
| batch_size | 256 | 512 |
|
||||
|--------------| -------| --------|
|
||||
| PaddlePaddle | 189 | 268 |
|
||||
| TensorFlow | 297 | 383 |
|
||||
|
||||
|
||||
<img src="figs/rnn_lstm_4gpus.png" width="420">
|
||||
|
||||
#### Seq2Seq
|
||||
|
||||
The benchmark of sequence-to-sequence network will be added later.
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,30 @@
|
||||
set -e
|
||||
|
||||
function test() {
|
||||
cfg=$1
|
||||
batch=$2
|
||||
prefix=$3
|
||||
sed -i "/input: \"data\"/{n;s/^input_dim.*/input_dim: $batch/g}" $cfg
|
||||
sed -i "/input: \"label\"/{n;s/^input_dim.*/input_dim: $batch/g}" $cfg
|
||||
caffe time --model=$cfg --iterations=50 --gpu 0 > logs/$prefix-1gpu-batch${batch}.log 2>&1
|
||||
}
|
||||
|
||||
if [ ! -d "logs" ]; then
|
||||
mkdir logs
|
||||
fi
|
||||
|
||||
# alexnet
|
||||
test alexnet.prototxt 64 alexnet
|
||||
test alexnet.prototxt 128 alexnet
|
||||
test alexnet.prototxt 256 alexnet
|
||||
test alexnet.prototxt 512 alexnet
|
||||
|
||||
# googlenet
|
||||
test googlenet.prototxt 64 googlenet
|
||||
test googlenet.prototxt 128 googlenet
|
||||
|
||||
# small net
|
||||
test smallnet_mnist_cifar.prototxt 64 smallnet
|
||||
test smallnet_mnist_cifar.prototxt 128 smallnet
|
||||
test smallnet_mnist_cifar.prototxt 256 smallnet
|
||||
test smallnet_mnist_cifar.prototxt 512 smallnet
|
||||
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
function test() {
|
||||
cfg=$1
|
||||
batch=$2
|
||||
prefix=$3
|
||||
batch_per_gpu=`expr ${batch} / 4`
|
||||
sed -i "/input: \"data\"/{n;s/^input_dim.*/input_dim: ${batch_per_gpu}/g}" $cfg
|
||||
sed -i "/input: \"label\"/{n;s/^input_dim.*/input_dim: ${batch_per_gpu}/g}" $cfg
|
||||
sed -i "1c\net : \"${cfg}\"" solver.prototxt
|
||||
caffe train --solver=solver.prototxt -gpu 0,1,2,3 > logs/${prefix}-4gpu-batch${batch}.log 2>&1
|
||||
}
|
||||
|
||||
if [ ! -d "logs" ]; then
|
||||
mkdir logs
|
||||
fi
|
||||
|
||||
# alexnet
|
||||
test alexnet.prototxt 512 alexnet
|
||||
test alexnet.prototxt 1024 alexnet
|
||||
|
||||
# googlnet
|
||||
test googlenet.prototxt 512 googlenet
|
||||
@ -0,0 +1,198 @@
|
||||
name: "mnist/cifar"
|
||||
input: "data"
|
||||
input_dim: 128
|
||||
input_dim: 3
|
||||
input_dim: 32
|
||||
input_dim: 32
|
||||
input: "label"
|
||||
input_dim: 128
|
||||
input_dim: 1
|
||||
input_dim: 1
|
||||
input_dim: 1
|
||||
layer {
|
||||
name: "conv1"
|
||||
type: "Convolution"
|
||||
bottom: "data"
|
||||
top: "conv1"
|
||||
param {
|
||||
lr_mult: 1
|
||||
}
|
||||
param {
|
||||
lr_mult: 2
|
||||
}
|
||||
convolution_param {
|
||||
num_output: 32
|
||||
pad: 2
|
||||
kernel_size: 5
|
||||
stride: 1
|
||||
weight_filler {
|
||||
type: "gaussian"
|
||||
std: 0.0001
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "pool1"
|
||||
type: "Pooling"
|
||||
bottom: "conv1"
|
||||
top: "pool1"
|
||||
pooling_param {
|
||||
pool: MAX
|
||||
kernel_size: 3
|
||||
stride: 2
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "relu1"
|
||||
type: "ReLU"
|
||||
bottom: "pool1"
|
||||
top: "pool1"
|
||||
}
|
||||
layer {
|
||||
name: "conv2"
|
||||
type: "Convolution"
|
||||
bottom: "pool1"
|
||||
top: "conv2"
|
||||
param {
|
||||
lr_mult: 1
|
||||
}
|
||||
param {
|
||||
lr_mult: 2
|
||||
}
|
||||
convolution_param {
|
||||
num_output: 32
|
||||
pad: 2
|
||||
kernel_size: 5
|
||||
stride: 1
|
||||
weight_filler {
|
||||
type: "gaussian"
|
||||
std: 0.01
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "relu2"
|
||||
type: "ReLU"
|
||||
bottom: "conv2"
|
||||
top: "conv2"
|
||||
}
|
||||
layer {
|
||||
name: "pool2"
|
||||
type: "Pooling"
|
||||
bottom: "conv2"
|
||||
top: "pool2"
|
||||
pooling_param {
|
||||
pool: AVE
|
||||
kernel_size: 3
|
||||
stride: 2
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "conv3"
|
||||
type: "Convolution"
|
||||
bottom: "pool2"
|
||||
top: "conv3"
|
||||
param {
|
||||
lr_mult: 1
|
||||
}
|
||||
param {
|
||||
lr_mult: 2
|
||||
}
|
||||
convolution_param {
|
||||
num_output: 64
|
||||
pad: 2
|
||||
kernel_size: 5
|
||||
stride: 1
|
||||
weight_filler {
|
||||
type: "gaussian"
|
||||
std: 0.01
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "relu3"
|
||||
type: "ReLU"
|
||||
bottom: "conv3"
|
||||
top: "conv3"
|
||||
}
|
||||
layer {
|
||||
name: "pool3"
|
||||
type: "Pooling"
|
||||
bottom: "conv3"
|
||||
top: "pool3"
|
||||
pooling_param {
|
||||
pool: AVE
|
||||
kernel_size: 3
|
||||
stride: 2
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "ip1"
|
||||
type: "InnerProduct"
|
||||
bottom: "pool3"
|
||||
top: "ip1"
|
||||
param {
|
||||
lr_mult: 1
|
||||
}
|
||||
param {
|
||||
lr_mult: 2
|
||||
}
|
||||
inner_product_param {
|
||||
num_output: 64
|
||||
weight_filler {
|
||||
type: "gaussian"
|
||||
std: 0.1
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "ip2"
|
||||
type: "InnerProduct"
|
||||
bottom: "ip1"
|
||||
top: "ip2"
|
||||
param {
|
||||
lr_mult: 1
|
||||
}
|
||||
param {
|
||||
lr_mult: 2
|
||||
}
|
||||
inner_product_param {
|
||||
num_output: 10
|
||||
weight_filler {
|
||||
type: "gaussian"
|
||||
std: 0.1
|
||||
}
|
||||
bias_filler {
|
||||
type: "constant"
|
||||
}
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "accuracy"
|
||||
type: "Accuracy"
|
||||
bottom: "ip2"
|
||||
bottom: "label"
|
||||
top: "accuracy"
|
||||
include {
|
||||
phase: TEST
|
||||
}
|
||||
}
|
||||
layer {
|
||||
name: "loss"
|
||||
type: "SoftmaxWithLoss"
|
||||
bottom: "ip2"
|
||||
bottom: "label"
|
||||
top: "loss"
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
net: "alexnet.prototxt"
|
||||
base_lr: 0.01
|
||||
lr_policy: "fixed"
|
||||
display: 20
|
||||
max_iter: 200
|
||||
momentum: 0.9
|
||||
weight_decay: 0.0005
|
||||
snapshot: 10000
|
||||
snapshot_prefix: "models/caffe_alexnet_train"
|
||||
solver_mode: GPU
|
||||
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 115 KiB |
@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from paddle.trainer_config_helpers import *
|
||||
|
||||
height = 227
|
||||
width = 227
|
||||
num_class = 1000
|
||||
batch_size = get_config_arg('batch_size', int, 128)
|
||||
|
||||
args = {'height': height, 'width': width, 'color': True, 'num_class': num_class}
|
||||
define_py_data_sources2(
|
||||
"train.list", None, module="provider", obj="process", args=args)
|
||||
|
||||
settings(
|
||||
batch_size=batch_size,
|
||||
learning_rate=0.01 / batch_size,
|
||||
learning_method=MomentumOptimizer(0.9),
|
||||
regularization=L2Regularization(0.0005 * batch_size))
|
||||
|
||||
# conv1
|
||||
net = data_layer('data', size=height * width * 3)
|
||||
net = img_conv_layer(
|
||||
input=net,
|
||||
filter_size=11,
|
||||
num_channels=3,
|
||||
num_filters=96,
|
||||
stride=4,
|
||||
padding=1)
|
||||
net = img_cmrnorm_layer(input=net, size=5, scale=0.0001, power=0.75)
|
||||
net = img_pool_layer(input=net, pool_size=3, stride=2)
|
||||
|
||||
# conv2
|
||||
net = img_conv_layer(
|
||||
input=net, filter_size=5, num_filters=256, stride=1, padding=2, groups=1)
|
||||
net = img_cmrnorm_layer(input=net, size=5, scale=0.0001, power=0.75)
|
||||
net = img_pool_layer(input=net, pool_size=3, stride=2)
|
||||
|
||||
# conv3
|
||||
net = img_conv_layer(
|
||||
input=net, filter_size=3, num_filters=384, stride=1, padding=1)
|
||||
# conv4
|
||||
net = img_conv_layer(
|
||||
input=net, filter_size=3, num_filters=384, stride=1, padding=1, groups=1)
|
||||
|
||||
# conv5
|
||||
net = img_conv_layer(
|
||||
input=net, filter_size=3, num_filters=256, stride=1, padding=1, groups=1)
|
||||
net = img_pool_layer(input=net, pool_size=3, stride=2)
|
||||
|
||||
net = fc_layer(
|
||||
input=net,
|
||||
size=4096,
|
||||
act=ReluActivation(),
|
||||
layer_attr=ExtraAttr(drop_rate=0.5))
|
||||
net = fc_layer(
|
||||
input=net,
|
||||
size=4096,
|
||||
act=ReluActivation(),
|
||||
layer_attr=ExtraAttr(drop_rate=0.5))
|
||||
net = fc_layer(input=net, size=1000, act=SoftmaxActivation())
|
||||
|
||||
lab = data_layer('label', num_class)
|
||||
loss = cross_entropy(input=net, label=lab)
|
||||
outputs(loss)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue