Skip to content

Commit

Permalink
added Image Jenkins tests to VS solution and did the same edits as la…
Browse files Browse the repository at this point in the history
…st commit to it
  • Loading branch information
frankseide committed Nov 27, 2015
1 parent d25e83c commit 4031c04
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 79 deletions.
27 changes: 27 additions & 0 deletions CNTK.sln
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,30 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SequenceTraining", "Sequenc
Tests\Speech\DNN\SequenceTraining\testcases.yml = Tests\Speech\DNN\SequenceTraining\testcases.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Image", "Image", "{8071EF60-30F7-4A77-81AA-ADCA0E18B1E3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{76F9323D-34A1-43A5-A594-C4798931FF21}"
ProjectSection(SolutionItems) = preProject
Tests\Image\Data\labelsmap.txt = Tests\Image\Data\labelsmap.txt
Tests\Image\Data\Test.txt = Tests\Image\Data\Test.txt
Tests\Image\Data\Train.txt = Tests\Image\Data\Train.txt
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "QuickE2E", "QuickE2E", "{2A884EB5-037C-481E-8170-BCDC8B3EDD93}"
ProjectSection(SolutionItems) = preProject
Tests\Image\QuickE2E\baseline.linux.debug.gpu.txt = Tests\Image\QuickE2E\baseline.linux.debug.gpu.txt
Tests\Image\QuickE2E\baseline.linux.release.gpu.txt = Tests\Image\QuickE2E\baseline.linux.release.gpu.txt
Tests\Image\QuickE2E\baseline.windows.debug.cpu.txt = Tests\Image\QuickE2E\baseline.windows.debug.cpu.txt
Tests\Image\QuickE2E\baseline.windows.debug.gpu.txt = Tests\Image\QuickE2E\baseline.windows.debug.gpu.txt
Tests\Image\QuickE2E\baseline.windows.release.cpu.txt = Tests\Image\QuickE2E\baseline.windows.release.cpu.txt
Tests\Image\QuickE2E\baseline.windows.release.gpu.txt = Tests\Image\QuickE2E\baseline.windows.release.gpu.txt
Tests\Image\QuickE2E\cntk.config = Tests\Image\QuickE2E\cntk.config
Tests\Image\QuickE2E\Convolution.ndl = Tests\Image\QuickE2E\Convolution.ndl
Tests\Image\QuickE2E\Macros.ndl = Tests\Image\QuickE2E\Macros.ndl
Tests\Image\QuickE2E\run-test = Tests\Image\QuickE2E\run-test
Tests\Image\QuickE2E\testcases.yml = Tests\Image\QuickE2E\testcases.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Mixed Platforms = Debug|Mixed Platforms
Expand Down Expand Up @@ -719,5 +743,8 @@ Global
{EB2BE26F-6BD4-4274-971F-86D080779DD1} = {DD043083-71A4-409A-AA91-F9C548DCF7EC}
{B97BDF88-F6B5-4F3A-BD8E-45F787D0C3C3} = {6F19321A-65E7-4829-B00C-3886CD6C6EDE}
{BB8B9FC5-C4B3-477F-80E2-665DC8E431BD} = {6994C86D-A672-4254-824A-51F4DFEB807F}
{8071EF60-30F7-4A77-81AA-ADCA0E18B1E3} = {D45DF403-6781-444E-B654-A96868C5BE68}
{76F9323D-34A1-43A5-A594-C4798931FF21} = {8071EF60-30F7-4A77-81AA-ADCA0E18B1E3}
{2A884EB5-037C-481E-8170-BCDC8B3EDD93} = {8071EF60-30F7-4A77-81AA-ADCA0E18B1E3}
EndGlobalSection
EndGlobal
15 changes: 7 additions & 8 deletions Tests/Image/QuickE2E/Convolution.ndl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
load=ndlMnistMacros
run=DNN
load = ndlMnistMacros
run = DNN

ndlMnistMacros = [
ImageW = 28
ImageH = 28
LabelDim = 10

features = ImageInput(ImageW, ImageH, 1, tag = feature)
features = ImageInput(ImageW, ImageH, 1, tag=feature)
featScale = Const(0.00390625)
featScaled = Scale(featScale, features)
labels = Input(LabelDim, tag = label)
labels = Input(LabelDim, tag=label)
]

DNN=[
Expand Down Expand Up @@ -52,8 +52,7 @@ DNN=[
h1 = DNNSigmoidLayer(512, h1Dim, pool2, 1)
ol = DNNLayer(h1Dim, labelDim, h1, 1)

CE = CrossEntropyWithSoftmax(labels, ol, tag = Criteria)
Err = ErrorPrediction(labels, ol, tag = Eval)
OutputNodes = ol
ce = CrossEntropyWithSoftmax(labels, ol, tag=criterion)
err = ErrorPrediction(labels, ol, tag=eval)
outputNodes = ol
]

38 changes: 17 additions & 21 deletions Tests/Image/QuickE2E/Macros.ndl
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
DNNSigmoidLayer(inDim, outDim, x, parmScale)
{
W = Parameter(outDim, inDim, init = Uniform, initValueScale = parmScale)
b = Parameter(outDim, init = Uniform, initValueScale = parmScale)
DNNSigmoidLayer(inDim, outDim, x, parmScale) = [
W = Parameter(outDim, inDim, init=uniform, initValueScale=parmScale)
b = Parameter(outDim, 1, init=uniform, initValueScale=parmScale)
t = Times(W, x)
z = Plus(t, b)
y = Sigmoid(z)
}
]

DNNLayer(inDim, outDim, x, parmScale)
{
W = Parameter(outDim, inDim, init = Uniform, initValueScale = parmScale)
b = Parameter(outDim, init = Uniform, initValueScale = parmScale)
DNNLayer(inDim, outDim, x, parmScale) = [
W = Parameter(outDim, inDim, init=uniform, initValueScale=parmScale)
b = Parameter(outDim, 1, init=uniform, initValueScale=parmScale)
t = Times(W, x)
z = Plus(t, b)
}
]

ConvReLULayer(inp, outMap, inWCount, kW, kH, hStride, vStride, wScale, bValue)
{
convW = Parameter(outMap, inWCount, init = Uniform, initValueScale = wScale)
conv = Convolution(convW, inp, kW, kH, outMap, hStride, vStride, zeroPadding = false)
convB = Parameter(outMap, 1, init = fixedValue, value = bValue)
ConvReLULayer(inp, outMap, inWCount, kW, kH, hStride, vStride, wScale, bValue) = [
convW = Parameter(outMap, inWCount, init=uniform, initValueScale=wScale)
conv = Convolution(convW, inp, kW, kH, outMap, hStride, vStride, zeroPadding=false)
convB = Parameter(outMap, 1, init=fixedValue, value=bValue)
convPlusB = Plus(conv, convB);
act = RectifiedLinear(convPlusB);
}
]

BatchNorm(dim, x, scaleInit, biasInit)
{
BatchNorm(dim, x, scaleInit, biasInit) = [
m = Mean(x)
isd = InvStdDev(x)
norm = ColumnElementTimes(Minus(x, m), isd)
sc = Parameter(dim, 1, init=Uniform, initValueScale=scaleInit)
b = Parameter(dim, 1, init=Uniform, initValueScale=biasInit)
sc = Parameter(dim, 1, init=uniform, initValueScale=scaleInit)
b = Parameter(dim, 1, init=uniform, initValueScale=biasInit)
bn_norm = Plus(ColumnElementTimes(norm, sc), b)
}
]
95 changes: 48 additions & 47 deletions Tests/Image/QuickE2E/cntk.config
Original file line number Diff line number Diff line change
@@ -1,66 +1,67 @@
precision=float
command=Train:Test
deviceId=$DeviceId$
precision = "float"
command = train:test
deviceId = $DeviceId$

ndlMacros=$ConfigDir$/Macros.ndl
ndlMacros = "$ConfigDir$/Macros.ndl"

parallelTrain=false
NumCPUThreads=8
parallelTrain = false
numCPUThreads = 8

Train=[
action=train
modelPath=$RunDir$/models/cntk.dnn
deviceId=$DeviceId$
traceLevel=1
train = [
action = "train"
modelPath = "$RunDir$/models/cntk.dnn"
#deviceId = $DeviceId$
traceLevel = 1

NDLNetworkBuilder=[
networkDescription=$ConfigDir$/Convolution.ndl
]
NDLNetworkBuilder = [
networkDescription = "$ConfigDir$/Convolution.ndl"
]

SGD=[
epochSize=100
minibatchSize=10
learningRatesPerMB=0.05
momentumPerMB=0*10:0.7
maxEpochs=12
SGD = [
epochSize = 100
minibatchSize = 10
learningRatesPerMB = 0.05
momentumPerMB = 0*10:0.7
maxEpochs = 12
]

reader=[
readerType=UCIFastReader
file=$DataDir$/Train.txt
features=[
dim=784
start=1
reader = [
readerType = "UCIFastReader"
file = "$DataDir$/Train.txt"
features = [
dim = 784
start = 1
]
labels=[
dim=1
start=0
labelDim=10
labelMappingFile=$DataDir$/labelsmap.txt
labels = [
dim = 1
start = 0
labelDim = 10
labelMappingFile = "$DataDir$/labelsmap.txt"
]
]
]

Test=[
action=test
modelPath=$RunDir$/models/cntk.dnn
test = [
action = "test"
modelPath = "$RunDir$/models/cntk.dnn"

NDLNetworkBuilder=[
networkDescription=$ConfigDir$/Convolution.ndl
# TODO: there should be no need for a network builder upon testing
NDLNetworkBuilder = [
networkDescription = "$ConfigDir$/Convolution.ndl"
]

reader=[
readerType=UCIFastReader
file=$DataDir$/Test.txt
features=[
dim=784
start=1
reader = [
readerType = "UCIFastReader"
file = "$DataDir$/Test.txt"
features = [
dim = 784
start = 1
]
labels=[
dim=1
start=0
labelDim=10
labelMappingFile=$DataDir$/labelsmap.txt
labels = [
dim = 1
start = 0
labelDim = 10
labelMappingFile = "$DataDir$/labelsmap.txt"
]
]
]
5 changes: 3 additions & 2 deletions Tests/ParallelTraining/SimpleMultiGPU.config
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
deviceId = $DeviceId$
command = simpleMultiGPU
command = SimpleMultiGPU
precision = "float"

parallelTrain = true

simpleMultiGPU = [
# TODO: This name should be lowercase (cameCase), but that will break the reference filename in Jenkins on Linux
SimpleMultiGPU = [
action = "train"
modelPath = "$RunDir$/models/Simple.dnn"
#deviceId = $DeviceId$
Expand Down
2 changes: 1 addition & 1 deletion Tests/Speech/DNN/DiscriminativePreTraining/macros.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DNNLastLayer(hiddenDim, LabelDim, x) = [
#W = Parameter(LabelDim, hiddenDim, init=uniform, initValueScale=1, initOnCPUOnly=true, randomSeed=1);
#b = Parameter(LabelDim, 1, init=uniform, initValueScale=1, initOnCPUOnly=true, randomSeed=1);
W = Parameter(LabelDim, hiddenDim);
b = Parameter(LabelDim 1,);
b = Parameter(LabelDim, 1);
t = Times(W, x);
z = Plus(t, b);
]

0 comments on commit 4031c04

Please sign in to comment.