https://github.com/Microsoft/CNTK
Raw File
Tip revision: c4fb0e5b41012466b1189c831539c46c070dcb01 authored by Dong Yu on 02 January 2017, 01:12:32 UTC
Merge branch 'master' of https://github.com/Microsoft/CNTK into dongyu/htkreaderext
Tip revision: c4fb0e5
VGG_E_BN_ndl_deprecated.cntk
# 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$/VGG_E_BN"
traceLevel=1

Train=[
    action="train"
    modelPath="$ModelDir$/VGG_E_BN"

     NDLNetworkBuilder=[
        networkDescription="$ConfigDir$/VGG_E_BN.ndl"
    ]
    
    SGD=[
        epochSize=0
        minibatchSize=16
        learningRatesPerMB=0.01*20:0.003*12:0.001*28:0.0003
        momentumPerMB=0.9
        maxEpochs=70
        gradUpdateType="None"
        L2RegWeight=0.0005
        dropoutRate=0*5:0.5
        
        ParallelTrain=[
            parallelizationMethod="DataParallelSGD"
            distributedMBReading="true"
            parallelizationStartEpoch=1
            DataParallelSGD=[
                gradientBits=32
            ]
        ]
        
        numMBsToShowResult=10
    ]
    
    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="$DataDir$/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$/VGG_E_BN"
    NewModel="$ModelDir$/VGG_E_BN.Top5"
    editPath="$ConfigDir$/CreateEvalModel.mel"
]

Test=[
    action="test"
    modelPath=$ModelDir$/VGG_E_BN.Top5
    # Set minibatch size for testing.
    minibatchSize=16

    reader=[
        readerType="ImageReader"
        file="$DataDir$/val_map.txt"
        randomize="None"
        features=[
            width=224
            height=224
            channels=3
            cropType="Center"
            meanFile="$ConfigDir$/ImageNet1K_mean.xml"
        ]
        labels=[
            labelDim=1000
        ]
    ]    
]
back to top