CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

How to output node value?

Open bb2103 opened this issue 10 years ago • 8 comments

i got trained model. But i cannot found a way to output network node value(DeepID)? any ideas, the example of 2d is confused to me。

bb2103 avatar Feb 24 '16 01:02 bb2103

By default, “write” will write nodes that are tagged as “output” in the network.

You can select that different nodes get output by the outputNodeNames option. Could you try to add an option like this:

outputNodeNames = DeepID

Thanks,

Frank

From: bb2103 [mailto:[email protected]] Sent: Tuesday, February 23, 2016 17:49 To: Microsoft/CNTK [email protected] Subject: [CNTK] How to output node value? (#155)

i got trained model. But i cannot found a way to output network node value(DeepID)? any ideas, the example of 2d is confused to me。

— Reply to this email directly or view it on GitHubhttps://github.com/Microsoft/CNTK/issues/155.

frankseide avatar Feb 24 '16 16:02 frankseide

Sry, im mean how to call cntk to get output value. In 2d example, its only add one output stage, you can just run it to get output. I feel its hard to Understand. Its there any steps like 'Caffe.FORWARD()'

bb2103 avatar Feb 26 '16 22:02 bb2103

If you want to write values to a file, please use a “write” command. It is similar to the “test” command, but change action to “write” and add a parameter outputPath = “…” with your target pathname.

I added an example to Simple.cntk, but it may take until Monday to get merged. Here is a simplified version:

Simple_Demo_Output=[ action = "write"

# Parameter values for the reader
reader = [
    readerType = "UCIFastReader"
    file = "$DataDir$/SimpleDataTest.txt"
    randomize = "none"

    features = [
        dim = 2
        start = 0
    ]

    labels = [
        start = 2
        dim = 1
        labelDim = 2
        labelMappingFile = "$DataDir$/SimpleMapping.txt"
    ]
]

outputNodeNames = PosteriorProb : labels    # Select the nodes to print. If this is not given, the nodes tagged as "output" are printed instead.

outputPath = "$OutputDir$/SimpleOutput"     # Path to write to. ".NODENAME" will be appended.
#outputPath = "-"                           # As an alternative, this prints to stdout.

]

From: bb2103 [mailto:[email protected]] Sent: Friday, February 26, 2016 14:32 To: Microsoft/CNTK [email protected] Cc: Frank Seide [email protected] Subject: Re: [CNTK] How to output node value? (#155)

Sry, im mean how to call cntk to get output value. In 2d example, its only add one output stage, you can just run it to get output. I feel its hard to Understand. Its there any steps like 'Caffe.FORWARD()'

— Reply to this email directly or view it on GitHubhttps://github.com/Microsoft/CNTK/issues/155#issuecomment-189509617.

frankseide avatar Feb 27 '16 01:02 frankseide

3ks for ur patience. The last question, is the ndl network file is needed?

bb2103 avatar Feb 27 '16 02:02 bb2103

NDL allows you to define custom networks. For the most standard configurations, you can use the SimpleNetworkBuilder.

From: bb2103 [mailto:[email protected]] Sent: Friday, February 26, 2016 18:05 To: Microsoft/CNTK [email protected] Cc: Frank Seide [email protected] Subject: Re: [CNTK] How to output node value? (#155)

3ks for ur patience. The last question, is the ndl network file is needed?

— Reply to this email directly or view it on GitHubhttps://github.com/Microsoft/CNTK/issues/155#issuecomment-189555790.

frankseide avatar Feb 27 '16 06:02 frankseide

@frankseide

Hi, for the code " outputNodeNames = PosteriorProb : labels", is PosteriorProb defined in cntk file or ndl file? If I want to output some intermediate nodes like the nodes "A" between layers, how should I use the name in ndl file for outputNodeNames ?

Thank you!

pinzhang10 avatar Jul 13 '16 14:07 pinzhang10

You need to use the name in the model which may be different from the name in the ndl due to macros used. You can find the correct node name by checking the validation log or dumping the node names using the dumpnode command.

dongyu888 avatar Jul 13 '16 16:07 dongyu888

@dongyu888 Thank you so much for your quick reply. I got the node names by checking the validation log. Really appreciate your great help!

Pin

pinzhang10 avatar Jul 13 '16 20:07 pinzhang10