CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

The error is different for the same input

Open bulatGH opened this issue 10 years ago • 22 comments

I get different error for the same input. What kind of explanation could it be?

bulatGH avatar May 10 '16 18:05 bulatGH

Could you clarify--you run the same experiment twice, and get different outputs? Could you paste into this thread the relevant sections of the two log outputs?

(I am about to merge a change that removes a non-reproducibility caused by atomicAdd(). If your output only varies slightly, this may be the cause.)

frankseide avatar May 10 '16 18:05 frankseide

I have a text file with two same lines for input. I also generated a network to classify data from such input files. But, when I run classification, I get different classification: -2.089206 4.216597 -0.821852 2.788121

The numbers stay the same even if I run the experiment next time with the same input, so we cannot explain it by some random initialization or other unpredictable things.

bulatGH avatar May 10 '16 18:05 bulatGH

This should not happen indeed. I can only imagine that some training configuration leaked in, such as Dropout still enabled, although all those kinds of nodes are aware of training vs. testing.

It's a little difficult to work with Dropbox. Could you just paste your network and reader configs here?

frankseide avatar May 10 '16 18:05 frankseide

How do you test?

Could you also confirm the version you are using?

frankseide avatar May 10 '16 19:05 frankseide

(BTW the fix for non-atomic-add is now in master, but I don't think it will solve your issue.)

frankseide avatar May 10 '16 20:05 frankseide

Network.zip Here is my network, could you please run it to check if you also get different numbers for the same network, if there is a problem on my side. In general, I found out that testing results depend on the minibatchSize, so maybe there is some connection to the gpu usage.

I am using your binaries 1.1 which were released several weeks ago.

bulatGH avatar May 10 '16 20:05 bulatGH

I will take a look, but just to make sure we are using the same setup: how did you get the outputs? Was it through API (EvalDll) or write command in CNTK?

Alexey-Kamenev avatar May 10 '16 21:05 Alexey-Kamenev

I used write command in CNTK

bulatGH avatar May 10 '16 21:05 bulatGH

In your write command, do you have

NDLNetworkBuilder = [
..
]

? If so, remove it and try again.

Alexey-Kamenev avatar May 10 '16 21:05 Alexey-Kamenev

No, I do not use this command. Here is the test file

BP_test_3Planar.txt

I have already changed the input image size, but do not take this into account, it was as in training file.

bulatGH avatar May 10 '16 21:05 bulatGH

It looks like the test file is from a different network as it has different dimensions in the reader section (625) vs train (441). But even after I updated the file, I could not run it using the latest version from master, I'm getting this error:

EXCEPTION occurred: Node 'features3' (InputValue operation): TensorView: Shape bounds [0,882) exceed bounds of underlying storage object [0,441)

BTW, I've noticed that in your NDL you are using this:

   FeatureNodes = (features1)

Shouldn't it rather be:

   FeatureNodes = (features1, features2, features3)

?

Alexey-Kamenev avatar May 10 '16 22:05 Alexey-Kamenev

Yes, that is true that I already changed the test file. Sorry. It should be:

    features1 = [
        dim = 441
        start = 1
    ]

    features2 = [
        dim = 441
        start = 442
    ]

    features3 = [
        dim = 441
        start = 883
    ]

Regarding FeatureNodes, should it affect the classification error? Nevertheless, thank you for this information, I will modify the FeatureNodes field

bulatGH avatar May 10 '16 22:05 bulatGH

Ok, so I was able to repro your issue by using our binary release bits. It looks like we have fixed the error reporting since then. Any chance you can try our latest master bits? And yes, please either tag Input nodes with tag="feature" or include them in the FeatureNode list.

Alexey-Kamenev avatar May 10 '16 23:05 Alexey-Kamenev

Thank you, I will try this. When I try to add features2, features3 to FeatureNodes I got an error:

NotifyFunctionValuesMBSizeModified: features2 InputValue operation had its row dimension 441 changed by the reader to 21.

Is it possible to use several 2D matrices for FeatureNodes?

bulatGH avatar May 10 '16 23:05 bulatGH

Hmm, something is not right here: it looks like the reader is not reading all the features for some reason, It should be possible to have more than one ImageInput nodes, there should really be no difference. Let me check that tomorrow though.

Alexey-Kamenev avatar May 11 '16 04:05 Alexey-Kamenev

A reasonable question would be if FeatureNodes = (features1) means that features2 and features3 will contain only zeros?

As the last measure, we can use Reshape function. In general, I think that Reshape may be a workaround for a lot of tricky cases like this.

bulatGH avatar May 11 '16 04:05 bulatGH

Yes, from what I see in the code, if a node is not tagged or included into special nodes, it will be ignored.

Alexey-Kamenev avatar May 11 '16 17:05 Alexey-Kamenev

And how to make FeatureNodes accepting several ImageInputs? It looks like Reshape does not help much.

bulatGH avatar May 11 '16 17:05 bulatGH

Ok, I think I found a so-called "crutch" to avoid this issue.

features1 = ImageInput(63, imageH, 1, imageLayout=$imageLayout$)
feature1_Im = RowSlice(0, imageH, features1)
feature2_Im = RowSlice(imageH, imageH, features1)
feature3_Im = RowSlice(42, imageH, features1)
    ........
    FeatureNodes = (features1)

bulatGH avatar May 11 '16 18:05 bulatGH