How to get source file from dataset

Hi,

i was trying to figure a way out to obtain the scource file from a Dataset. My idea was that the file might be saved in the metadata of the Dataset but it seems like the metadata is always null.

        File trainData = new File("D:\\Deeplearning4J\\face\\pics");
        FileSplit trainSplit = new FileSplit(trainData, NativeImageLoader.ALLOWED_FORMATS, randNumGen);
        PathMultiLabelGenerator labelMaker = new FaceLabelGen();
        ImageRecordReader trainRR = new ImageRecordReader(height, width, channels, labelMaker);
        trainRR.initialize(trainSplit);
        DataSetIterator trainIter = new RecordReaderDataSetIterator.Builder(trainRR, batchSize)
            .regression(1,2)
            .collectMetaData(true)
            .build();

        List<Serializable> metaDataList = trainIter.next().getExampleMetaData();

You have run into a bug here. I’ve created an issue to keep track of it: RecordReaderDataSetIterator doesn't apply collectMetaData Builder option · Issue #8776 · eclipse/deeplearning4j · GitHub

As a workaround you can set the flag after building the iterator:

RecordReaderDataSetIterator trainIter = new RecordReaderDataSetIterator.Builder(trainRR, batchSize)
            .regression(1,2)
            .collectMetaData(true)
            .build();
trainIter.setCollectMetaData(true);