swh:1:snp:f50ab94432af916b5fb8b4ad831e8dddded77084
Raw File
Tip revision: 1c2bc5a7783570f55330bbfdeec43d94477f4d2d authored by Marko Radmilac on 28 April 2016, 17:21:13 UTC
Add support for new CU
Tip revision: 1c2bc5a
ImageConfigHelper.h
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
//

#pragma once

#include <string>
#include <vector>
#include "Config.h"
#include "Reader.h"

namespace Microsoft { namespace MSR { namespace CNTK {

// A helper class for image specific parameters.
// A simple wrapper around CNTK ConfigParameters.
class ImageConfigHelper
{
public:
    explicit ImageConfigHelper(const ConfigParameters& config);

    // Get all streams that are specified in the configuration.
    std::vector<StreamDescriptionPtr> GetStreams() const;

    // Get index of the feature stream.
    size_t GetFeatureStreamId() const;

    // Get index of the label stream.
    size_t GetLabelStreamId() const;

    // Get the map file path that describes mapping of images into their labels.
    std::string GetMapPath() const;

    ImageLayoutKind GetDataFormat() const
    {
        return m_dataFormat;
    }

    int GetCpuThreadCount() const
    {
        return m_cpuThreadCount;
    }

    bool ShouldRandomize() const
    {
        return m_randomize;
    }

    bool UseGrayscale() const
    {
        return m_grayscale;
    }
	
	bool IsMultiViewCrop() const
    {
        return m_multiViewCrop;
    }

private:
    ImageConfigHelper(const ImageConfigHelper&) = delete;
    ImageConfigHelper& operator=(const ImageConfigHelper&) = delete;

    std::string m_mapPath;
    std::vector<StreamDescriptionPtr> m_streams;
    ImageLayoutKind m_dataFormat;
    int m_cpuThreadCount;
    bool m_randomize;
    bool m_multiViewCrop;
    bool m_grayscale;
};

typedef std::shared_ptr<ImageConfigHelper> ImageConfigHelperPtr;
} } }
back to top