# Note: This sample uses the deprecated NdlNetworkBuilder.
# An updated version using BrainScript is coming soon.
# Please find updated samples on Github, https://github.com/Microsoft/CNTK/tree/master/Examples /...
#
RootDir = "."
ConfigDir = "$RootDir$"
DataDir = "$RootDir$"
OutputDir = "$RootDir$/Output"
ModelDir = "$OutputDir$/Models"
ndlMacros="$ConfigDir$/Macros.ndl"
precision="float"
deviceId="Auto"
command=Train:AddTop5Eval:Test
parallelTrain="false"
stderr="$OutputDir$/AlexNet"
traceLevel=1
numMBsToShowResult=500
Train=[
action="train"
modelPath="$ModelDir$/AlexNet"
NDLNetworkBuilder=[
networkDescription="$ConfigDir$/AlexNet.ndl"
]
SGD=[
epochSize=0
minibatchSize=128
learningRatesPerMB=0.01*20:0.003*12:0.001*28:0.0003
momentumPerMB=0.9
maxEpochs=90
gradUpdateType=None
L2RegWeight=0.0005
dropoutRate=0*5:0.5
ParallelTrain=[
parallelizationMethod="DataParallelSGD"
distributedMBReading="true"
parallelizationStartEpoch=1
DataParallelSGD=[
gradientBits=32
]
]
numMBsToShowResult=100
]
reader=[
readerType="ImageReader"
# Map file which maps images to labels using the following format:
# <full path to image><tab><numerical label (0-based class id)>
# Example:
# C:\Data\ImageNet\2012\train\n01440764\n01440764_10026.JPEG<tab>0
file="$ConfigDir$/train_map.txt"
# Randomize images before every epoch. Possible values: None, Auto. Default: Auto.
randomize="Auto"
features=[
# Below are the required parameters.
width=224
height=224
channels=3
# Below are the optional parameters.
# Possible values: Center, Random. Default: Center
cropType="Random"
# Horizontal random flip, will be enabled by default if cropType=Random
#hflip="true"
# Crop scale ratio. Examples: cropRatio=0.9, cropRatio=0.7:0.9. Default: 1.
cropRatio=0.875
# Crop scale ratio jitter type.
# Possible values: None, UniRatio, UniLength, UniArea. Default: UniRatio
jitterType="UniRatio"
# Interpolation to use when scaling image to width x height size.
# Possible values: nearest, linear, cubic, lanczos. Default: linear.
interpolations="Linear"
# Stores mean values for each pixel in OpenCV matrix XML format.
meanFile="$ConfigDir$/ImageNet1K_mean.xml"
]
labels=[
labelDim=1000
]
]
]
AddTop5Eval=[
action="edit"
CurModel="$ModelDir$/AlexNet"
NewModel="$ModelDir$/AlexNet.Top5"
editPath="$ConfigDir$/AddTop5Layer.mel"
]
Test=[
action="test"
modelPath="$ModelDir$/AlexNet.Top5"
# Set minibatch size for testing.
minibatchSize=128
reader=[
readerType="ImageReader"
file="$ConfigDir$/val_map.txt"
randomize="None"
features=[
width=224
height=224
channels=3
cropType="Center"
meanFile="$ConfigDir$/ImageNet1K_mean.xml"
]
labels=[
labelDim=1000
]
]
]