CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Composition of ImageReader deserializers for multiple image input nodes not implemented

Open LowerySJ opened this issue 10 years ago • 4 comments

Hello, CNTK community.

I am trying to use multiple ImageReader deserializers to read in several images into distinct input nodes of a NN, as described here.

In particular I am trying to follow the format specified

reader = [
    randomize = true|false
    verbosity = 0|1|2
    deserializers = (
        [<deserializerConfiguration1>]:
        [<deserializerConfiguration2>]:
        [<deserializerConfigurationN>]
    )
]
[
    module = "<readerModuleName>"   
    type = "<deserializerType>"     # The type of the deserializer
    input = [
        # Replace 'InputNameN' by the name of the corresponding input node in the network.
        InputName1 = [<inputConfiguration>]
        InputName2 = [<inputConfiguration>]
        ...
    ]
]

I have encountered three problems.

  1. I am not able to name inputs anything other than "feature" and "labels" for ImageReader. Trying to do this with a single ImageReader produces this error in the output file
[CALL STACK]
    > Microsoft::MSR::CNTK::DataReader::  GetMinibatch
    - Microsoft::MSR::CNTK::DataReaderHelpers::GetMinibatchIntoNetwork<float>  
    - Microsoft::MSR::CNTK::SGD<float>::  TrainOneEpoch
    - Microsoft::MSR::CNTK::SGD<float>::  TrainOrAdaptModel
    - Microsoft::MSR::CNTK::SGD<float>::  Train
    - DoTrain<Microsoft::MSR::CNTK::ConfigParameters,float>  
    - DoCommands<float>  
    - wmainOldCNTKConfig
    - wmain1
    - wmain
    - __tmainCRTStartup
    - BaseThreadInitThunk
    - RtlUserThreadStart

EXCEPTION occurred: Could not map input 'features1' to the reader. Reader outputs only ["features", "labels"].

Note that being able to use distinct input names is necessary for inputting multiple images.

Problem 2. Putting two ImageReader deserializers together as in the file below consistently causes CNTK to crash.

01_ConvBS4.txt Shared.bs.txt

Problem 3. The ImageReader deserializer requires a labelsDim input. I and other users may not always want to input more label nodes...

In any case, I will look into resolving this on my own. Thanks for any help and please let me know if there is any more info I can provide.

Regards

LowerySJ avatar Jul 19 '16 16:07 LowerySJ

Hi LowerySJ,

Sorry, I was on vacation. I will have a look at this asap.

eldakms avatar Aug 02 '16 13:08 eldakms

Eldakms, thanks for your help. By now, I've branched and modified a version of ImageReader for my needs -- I'm almost done with my custom reader.

For the help of anyone else using this, problems 1 and 3 can be fixed by modifying ImageDeserializer.cpp. I never got the compositing feature to work (problem 2), but it's pretty easy to modify ImageDeserializer.cpp so ImageReader takes in multiple images and no compositing is needed. Note: I was using a build of CNTK from late June when I first wrote this post, so maybe compositing does work now.

I will provide the outline of my final sol'n in a week or so for anyone who might be following.

Regards

LowerySJ avatar Aug 02 '16 16:08 LowerySJ

Hi LowerySJ,

Could you please try eldak/imageComposition branch? The bug should be fixed there. Thanks!

eldakms avatar Aug 02 '16 16:08 eldakms

The fix/unit test has been merged to master. Closing for now. If you still bump into any issues, feel free to reopen.

eldakms avatar Aug 04 '16 16:08 eldakms