mlpack 3.4.2
load.hpp
Go to the documentation of this file.
1
14#ifndef MLPACK_CORE_DATA_LOAD_HPP
15#define MLPACK_CORE_DATA_LOAD_HPP
16
17#include <mlpack/prereqs.hpp>
19#include <string>
20
21#include "format.hpp"
22#include "dataset_mapper.hpp"
23#include "image_info.hpp"
24
25namespace mlpack {
26namespace data {
27
65template<typename eT>
66bool Load(const std::string& filename,
67 arma::Mat<eT>& matrix,
68 const bool fatal = false,
69 const bool transpose = true,
70 const arma::file_type inputLoadType = arma::auto_detect);
71
101template<typename eT>
102bool Load(const std::string& filename,
103 arma::SpMat<eT>& matrix,
104 const bool fatal = false,
105 const bool transpose = true);
106
114extern template bool Load<int>(const std::string&,
115 arma::Mat<int>&,
116 const bool,
117 const bool,
118 const arma::file_type);
119
120// size_t and uword should be one of these three typedefs.
121extern template bool Load<unsigned int>(const std::string&,
122 arma::Mat<unsigned int>&,
123 const bool,
124 const bool,
125 const arma::file_type);
126
127extern template bool Load<unsigned long>(const std::string&,
128 arma::Mat<unsigned long>&,
129 const bool,
130 const bool,
131 const arma::file_type);
132
133extern template bool Load<unsigned long long>(const std::string&,
134 arma::Mat<unsigned long long>&,
135 const bool,
136 const bool,
137 const arma::file_type);
138
139extern template bool Load<float>(const std::string&,
140 arma::Mat<float>&,
141 const bool,
142 const bool,
143 const arma::file_type);
144
145extern template bool Load<double>(const std::string&,
146 arma::Mat<double>&,
147 const bool,
148 const bool,
149 const arma::file_type);
150
151extern template bool Load<int>(const std::string&,
152 arma::Mat<int>&,
153 const bool,
154 const bool,
155 const arma::file_type);
156
157extern template bool Load<unsigned int>(const std::string&,
158 arma::SpMat<unsigned int>&,
159 const bool,
160 const bool);
161
162extern template bool Load<unsigned long>(const std::string&,
163 arma::SpMat<unsigned long>&,
164 const bool,
165 const bool);
166
167extern template bool Load<unsigned long long>(const std::string&,
168 arma::SpMat<unsigned long long>&,
169 const bool,
170 const bool);
171
172extern template bool Load<float>(const std::string&,
173 arma::SpMat<float>&,
174 const bool,
175 const bool);
176
177extern template bool Load<double>(const std::string&,
178 arma::SpMat<double>&,
179 const bool,
180 const bool);
181
213template<typename eT>
214bool Load(const std::string& filename,
215 arma::Col<eT>& vec,
216 const bool fatal = false);
217
245template<typename eT>
246bool Load(const std::string& filename,
247 arma::Row<eT>& rowvec,
248 const bool fatal = false);
249
282template<typename eT, typename PolicyType>
283bool Load(const std::string& filename,
284 arma::Mat<eT>& matrix,
286 const bool fatal = false,
287 const bool transpose = true);
288
296extern template bool Load<int, IncrementPolicy>(
297 const std::string&,
298 arma::Mat<int>&,
300 const bool,
301 const bool);
302
303extern template bool Load<arma::u32, IncrementPolicy>(
304 const std::string&,
305 arma::Mat<arma::u32>&,
307 const bool,
308 const bool);
309
310extern template bool Load<arma::u64, IncrementPolicy>(
311 const std::string&,
312 arma::Mat<arma::u64>&,
314 const bool,
315 const bool);
316
317extern template bool Load<float, IncrementPolicy>(
318 const std::string&,
319 arma::Mat<float>&,
321 const bool,
322 const bool);
323
324extern template bool Load<double, IncrementPolicy>(
325 const std::string&,
326 arma::Mat<double>&,
328 const bool,
329 const bool);
330
360template<typename T>
361bool Load(const std::string& filename,
362 const std::string& name,
363 T& t,
364 const bool fatal = false,
366
380template<typename eT>
381bool Load(const std::string& filename,
382 arma::Mat<eT>& matrix,
383 ImageInfo& info,
384 const bool fatal = false);
385
395template<typename eT>
396bool Load(const std::vector<std::string>& files,
397 arma::Mat<eT>& matrix,
398 ImageInfo& info,
399 const bool fatal = false);
400
401// Implementation found in load_image.cpp.
402bool LoadImage(const std::string& filename,
403 arma::Mat<unsigned char>& matrix,
404 ImageInfo& info,
405 const bool fatal = false);
406
407} // namespace data
408} // namespace mlpack
409
410// Include implementation of model-loading Load() overload.
411#include "load_model_impl.hpp"
412// Include implementation of Load() for vectors.
413#include "load_vec_impl.hpp"
414// Include implementation of Load() for images.
415#include "load_image_impl.hpp"
416
417#endif
Auxiliary information for a dataset, including mappings to/from strings (or other types) and the data...
Implements meta-data of images required by data::Load and data::Save for loading and saving images in...
Definition: image_info.hpp:37
bool LoadImage(const std::string &filename, arma::Mat< unsigned char > &matrix, ImageInfo &info, const bool fatal=false)
format
Define the formats we can read through boost::serialization.
Definition: format.hpp:21
bool Load(const std::string &filename, arma::Mat< eT > &matrix, const bool fatal=false, const bool transpose=true, const arma::file_type inputLoadType=arma::auto_detect)
Loads a matrix from file, guessing the filetype from the extension.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.