forked from microsoft/CNTK
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexey Kamenev
committed
Jun 14, 2016
1 parent
c5a6f11
commit 75dbb2c
Showing
8 changed files
with
185 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# Parameters can be overwritten on the command line | ||
# for example: cntk configFile=myConfigFile RootDir=../.. | ||
# For running from Visual Studio add | ||
# currentDirectory=$(SolutionDir)/<path to corresponding data folder> | ||
RootDir = ".." | ||
|
||
ConfigDir = "$RootDir$/Config" | ||
DataDir = "$RootDir$/Data" | ||
OutputDir = "$RootDir$/Output" | ||
ModelDir = "$OutputDir$/Models" | ||
|
||
deviceId = 0 | ||
imageLayout = "cudnn" | ||
# Override the above as follows when running on CPU: | ||
# deviceId = -1 | ||
# Note: Compared to GPU, this runs very slow. | ||
|
||
command = train:test | ||
|
||
precision = "float" | ||
modelPath = "$ModelDir$/04_DeConv" | ||
ndlMacros = "$ConfigDir$/Macros.ndl" | ||
|
||
# uncomment the following line to write logs to a file | ||
# stderr = "$OutputDir$/04_DeConv_out" | ||
traceLevel=1 | ||
numMBsToShowResult=500 | ||
|
||
prefetch=true | ||
|
||
# If set to true, always initialize the network on CPU, making initialization consistent across CPU and GPU targets (for testing). | ||
initOnCPUOnly=true | ||
|
||
####################################### | ||
# TRAINING CONFIG # | ||
####################################### | ||
|
||
train = [ | ||
action = "train" | ||
|
||
NDLNetworkBuilder = [ | ||
networkDescription = "$ConfigDir$/04_DeConv.ndl" | ||
] | ||
|
||
SGD = [ | ||
epochSize = 60000 | ||
minibatchSize = 32 | ||
learningRatesPerMB = 1*5:0.03 | ||
momentumPerMB = 0*10:0.7 | ||
maxEpochs = 15 | ||
] | ||
|
||
# Note: this reader crashes if randomization is turned on. | ||
reader = [ | ||
readerType = "UCIFastReader" | ||
# To get the data (Train-28x28.txt) please run `python mnist_convert.py` | ||
# from the 'AdditionalFiles' folder. See REAMDE.md for details. | ||
file = "$DataDir$/Train-28x28.txt" | ||
|
||
features = [ | ||
dim = 784 | ||
start = 1 | ||
] | ||
|
||
labels = [ | ||
dim = 1 | ||
start = 0 | ||
labelDim = 10 | ||
labelMappingFile = "$DataDir$/labelsmap.txt" | ||
] | ||
] | ||
] | ||
|
||
####################################### | ||
# TEST CONFIG # | ||
####################################### | ||
|
||
test = [ | ||
action = test | ||
minibatchSize = 16 | ||
|
||
NDLNetworkBuilder = [ | ||
networkDescription = "$ConfigDir$/04_DeConv.ndl" | ||
] | ||
|
||
reader = [ | ||
readerType = "UCIFastReader" | ||
file = "$DataDir$/Test-28x28.txt" | ||
|
||
features = [ | ||
dim = 784 | ||
start = 1 | ||
] | ||
|
||
labels = [ | ||
dim = 1 | ||
start = 0 | ||
labelDim = 10 | ||
labelMappingFile = "$DataDir$/labelsmap.txt" | ||
] | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# macros to include | ||
load = ndlMnistMacros | ||
|
||
# the actual NDL that defines the network | ||
run = DNN | ||
|
||
ndlMnistMacros = [ | ||
imageW = 28 | ||
imageH = 28 | ||
imageC = 1 | ||
labelDim = 10 | ||
|
||
features = ImageInput(imageW, imageH, imageC, imageLayout=$imageLayout$) | ||
featScale = Constant(0.00390625) | ||
featScaled = Scale(featScale, features) | ||
labels = InputValue(labelDim) | ||
] | ||
|
||
DNN=[ | ||
# conv1 | ||
kW1 = 5 | ||
kH1 = 5 | ||
cMap1 = 16 | ||
hStride1 = 2 | ||
vStride1 = 2 | ||
wScale1 = 10 | ||
bValue1 = 1 | ||
# weight[cMap1, kW1 * kH1 * inputChannels] | ||
# Conv2DReLULayer is defined in Macros.ndl | ||
conv1 = Conv2DReLULayer(featScaled, cMap1, 25, kW1, kH1, hStride1, vStride1, wScale1, bValue1) | ||
|
||
# pool1 | ||
pool1W = 2 | ||
pool1H = 2 | ||
pool1hStride = 2 | ||
pool1vStride = 2 | ||
# MaxPooling is a standard NDL node. | ||
pool1 = MaxPooling(conv1, pool1W, pool1H, pool1hStride, pool1vStride, imageLayout=$imageLayout$) | ||
|
||
#unpool1 | ||
unpool1 = MaxNDUnpooling(pool1, conv1, pool1W, pool1H, pool1hStride, pool1vStride) | ||
|
||
# deconv1 | ||
lpad1 = 2 | ||
upad1 = 1 | ||
# weight[cMap2, kW2 * kH2 * cMap1] | ||
# DeconvReLULayer is defined in Macros.ndl | ||
deconv1 = DeconvReLULayer(unpool1, kW1, kH1, imageC, 25, cMap1, hStride1, vStride1, lpad1, upad1, wScale1, bValue1) | ||
|
||
mse = SquareError(featScaled, deconv1) | ||
#err = ErrorPrediction(labels, ol) | ||
|
||
# Special Nodes | ||
FeatureNodes = (features) | ||
#LabelNodes = (labels) | ||
CriterionNodes = (mse) | ||
#EvalNodes = (err) | ||
OutputNodes = (deconv1) | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters