# CNTK Configuration File for training a simple CIFAR-10 convnet. # During the hands-on tutorial, this will be fleshed out into a ResNet-20 model. command = TrainConvNet:Eval makeMode = false ; traceLevel = 0 ; deviceId = "auto" rootDir = "." ; dataDir = "$rootDir$" ; modelDir = "$rootDir$/Models" modelPath = "$modelDir$/cifar10.cmf" # Training action for a convolutional network TrainConvNet = { action = "train" BrainScriptNetworkBuilder = { imageShape = 32:32:3 labelDim = 10 model (features) = { featNorm = features - Constant (128) l1 = ConvolutionalLayer {32, (5:5), pad=true, activation=ReLU, init="gaussian", initValueScale=0.0043} (featNorm) p1 = MaxPoolingLayer {(3:3), stride=(2:2)} (l1) l2 = ConvolutionalLayer {32, (5:5), pad=true, activation=ReLU, init="gaussian", initValueScale=1.414} (p1) p2 = MaxPoolingLayer {(3:3), stride=(2:2)} (l2) l3 = ConvolutionalLayer {64, (5:5), pad=true, activation=ReLU, init="gaussian", initValueScale=1.414} (p2) p3 = MaxPoolingLayer {(3:3), stride=(2:2)} (l3) d1 = DenseLayer {64, activation=ReLU, init="gaussian", initValueScale=12} (p3) d1_d = Dropout (d1) ##### added z = LinearLayer {10, init = "gaussian", initValueScale = 1.5} (d1_d) ##### d1 -> d1_d }.z # inputs features = Input {imageShape} labels = Input {labelDim} # apply model to features z = model (features) # connect to system ce = CrossEntropyWithSoftmax (labels, z) errs = ClassificationError (labels, z) featureNodes = (features) labelNodes = (labels) criterionNodes = (ce) evaluationNodes = (errs) outputNodes = (z) } SGD = { epochSize = 50000 maxEpochs = 10 ; minibatchSize = 64 learningRatesPerSample = 0.00015625*7:0.000046875*10:0.000015625 momentumAsTimeConstant = 600*20:6400 L2RegWeight = 0.03 dropoutRate = 0*1:0.5 ##### added firstMBsToShowResult = 10 ; numMBsToShowResult = 100 } reader = { verbosity = 0 ; randomize = true deserializers = ({ type = "ImageDeserializer" ; module = "ImageReader" file = "$dataDir$/cifar-10-batches-py/train_map.txt" input = { features = { transforms = ( { type = "Crop" ; cropType = "random" ; cropRatio = 0.8 ; jitterType = "uniRatio" } : { type = "Scale" ; width = 32 ; height = 32 ; channels = 3 ; interpolations = "linear" } : { type = "Transpose" } )} labels = { labelDim = 10 } } }) } } # Eval action Eval = { action = "eval" minibatchSize = 16 evalNodeNames = errs reader = { verbosity = 0 ; randomize = true deserializers = ({ type = "ImageDeserializer" ; module = "ImageReader" file = "$dataDir$/cifar-10-batches-py/test_map.txt" input = { features = { transforms = ( { type = "Scale" ; width = 32 ; height = 32 ; channels = 3 ; interpolations = "linear" } : { type = "Transpose" } )} labels = { labelDim = 10 } } }) } }