Search code examples
cntk

How to retrieve sequence id's from minibatch?


From: https://github.com/Microsoft/CNTK/wiki/CNTKTextFormat-Reader

"Sequence id is a number. It can be omitted, in which case the line number will be used as the sequence id."

Assume that I have create a minibatch from a source like this:

Map file:

|labels 0 0 0 1 0 0 |features 3
|labels 0 0 0 0 0 1 |features 7
|labels 1 0 0 0 0 0 |features 1
|labels 1 0 0 0 0 0 |features 9
|labels 1 0 0 0 0 0 |features 4

Code:

from cntk import Trainer, StreamConfiguration, text_format_minibatch_source, learning_rate_schedule, UnitType

mb_source = text_format_minibatch_source('test_map2.txt', [
    StreamConfiguration('features', 1),
    StreamConfiguration('labels', 6)])

test_minibatch = mb_source.next_minibatch(5)

How can I retrieve the sequence id's from the minibatch?


Solution

  • This sequence id is an internal number and currently not exposed. Please use the suggestion from this thread.

    How to get to the original index from a minibatch?