CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Cropping fails in Alexnet sample model

Open saonim opened this issue 10 years ago • 6 comments

Switching lines:

width=224
height=224

to 227 crashes the program

I am using Build SHA1: 2f9a48c71dc0a6097498cb7e90ac3b151ab536dd

saonim avatar Mar 14 '16 22:03 saonim

I successfully changed the width/height of my model without issue with the crop. Some context would help to understand what is going wrong. Did you change anything else in your model configuration (please attach your model configuration files) ? As with any crash report, do you have a call stack ? What is "the program", CNTK.exe ?

rold2007 avatar Mar 14 '16 22:03 rold2007

yes, CNTK.config is the program.

Config file:

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=256
    learningRatesPerMB=0.01*20:0.003*12:0.001*28:0.0003
    momentumPerMB=0.9
    maxEpochs=10
    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=227
        height=227
        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=0
        # Crop scale ratio. Examples: cropRatio=0.9, cropRatio=0.7:0.9. Default: 1.
        cropRatio=0.88671875
        # 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$/add_top5_layer.mel ]

Test=[ action=test modelPath=$ModelDir$/AlexNet.Top5 # Set minibatch size for testing. minibatchSize=128

 NDLNetworkBuilder=[
    networkDescription=$ConfigDir$/AlexNet.ndl
]

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

]

Command used to run: cntk configFile=AlexNet.cntk configName=AlexNet

Error:

Redirecting stderr to file ./Output/AlexNet_Train_AddTop5Eval_Test.log ./alexnet_1GPU.sh: line 1: 21367 Segmentation fault cntk configFile=AlexNet.cntk configName=AlexNet

saonim avatar Mar 14 '16 23:03 saonim

Have you modified the AlexNet.ndl file ? You need to update the image sizes there too, and I think you will need to update the parameters for DNNImageReLULayer too.

rold2007 avatar Mar 15 '16 21:03 rold2007

David is right - you also need to update NDL file. When you change your input size, the network structure changes as well, for example, first fully connected layer (h1) dimensions have to be recomputed.

Alexey-Kamenev avatar Mar 15 '16 21:03 Alexey-Kamenev

Are you still having this issue after updating NDL files?

Alexey-Kamenev avatar Mar 17 '16 16:03 Alexey-Kamenev

no feedback, so assuming this has been resolved

wolfma61 avatar Mar 22 '16 21:03 wolfma61