29 #ifndef IMAGE_DATA_READER_HPP 30 #define IMAGE_DATA_READER_HPP 42 using sample_t = std::pair<img_src_t, label_t>;
60 const int num_labels = 0);
65 void setup(
int num_io_threads,
118 void load_labels(std::vector<char>& preloaded_buffer);
139 #endif // IMAGE_DATA_READER_HPP image_data_reader & operator=(const image_data_reader &)
bool load_conduit_nodes_from_file(const std::unordered_set< int > &data_ids)
int m_num_labels
number of labels
void set_linearized_image_size()
size_t determine_num_of_samples(std::istream &istrm) const
Return the number of lines in the input stream.
int get_linearized_data_size() const override
Get the total number of channel values in a sample of image(s).
sample_list_t::sample_idx_t sample_idx_t
virtual void set_defaults()
void load_conduit_node_from_file(int data_id, conduit::Node &node)
const std::vector< El::Int > get_data_dims() const override
Get the dimensions of the data.
virtual int get_image_height() const
image_data_reader(bool shuffle=true)
std::vector< label_t > labels_t
void gen_list_of_samples()
typename std::add_pointer< T >::type observer_ptr
Creating an observer_ptr to complement the unique_ptr and shared_ptr.
void copy_members(const image_data_reader &rhs)
void do_preload_data_store() override
sample_list_t m_sample_list
sample_t get_sample(const size_t idx) const
int m_image_linearized_size
linearized image size
int m_image_height
image height
El::Matrix< DataType, El::Device::CPU > Mat
virtual int get_image_num_channels() const
virtual void set_input_params(const int width=0, const int height=0, const int num_ch=0, const int num_labels=0)
const sample_list_t & get_sample_list() const
Allow read-only access to the entire sample list.
std::string m_image_dir
where images are stored
void load_labels(std::vector< char > &preloaded_buffer)
Load the labels for samples.
int get_num_labels() const override
Return the number of labels (classes) in this dataset.
std::pair< img_src_t, label_t > sample_t
void setup(int num_io_threads, observer_ptr< thread_pool > io_thread_pool) override
void load_list_of_samples_from_archive(const std::string &sample_list_archive)
Load the sample list from a serialized archive from another rank.
void load_list_of_samples(const std::string filename)
Rely on pre-determined list of samples.
int get_linearized_label_size() const override
Get the linearized size (i.e. number of elements) in a label.
virtual int get_image_width() const
bool fetch_label(Mat &Y, int data_id, int mb_idx) override
int m_image_width
image width
int m_image_num_channels
number of image channels
void dump_sample_label_list(const std::string &dump_file_name)
void read_labels(std::istream &istrm)
Read the labels from an open input stream.
typename samples_t::size_type sample_idx_t
Type for the index into the sample list.