本文整理汇总了C++中ImageLoader::start方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageLoader::start方法的具体用法?C++ ImageLoader::start怎么用?C++ ImageLoader::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageLoader
的用法示例。
在下文中一共展示了ImageLoader::start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
extern void* start(int img_size, int inner_size, bool center, bool flip,
bool rgb, bool multiview, int minibatch_size,
char *filename, int macro_start,
uint num_data, uint num_labels, bool macro,
DeviceParams* params) {
static_assert(sizeof(int) == 4, "int is not 4 bytes");
try {
int nchannels = (rgb == true) ? 3 : 1;
int item_max_size = nchannels*inner_size*inner_size;
// These objects will get freed in the destructor of ImageLoader.
Device* device;
#if HASGPU
if (params->_type == CPU) {
device = new Cpu(params);
} else {
device = new Gpu(params);
}
#else
assert(params->_type == CPU);
device = new Cpu(params);
#endif
Reader* reader;
if (macro == true) {
reader = new MacrobatchReader(filename, macro_start,
num_data, minibatch_size);
} else {
reader = new ImageFileReader(filename, num_data,
minibatch_size, img_size);
}
Decoder* decoder = new ImageDecoder(inner_size, flip);
ImageLoader* loader = new ImageLoader(minibatch_size, item_max_size,
num_labels, device,
reader, decoder);
int result = loader->start();
if (result != 0) {
printf("Could not start data loader. Error %d", result);
delete loader;
exit(-1);
}
return (void *) loader;
} catch(...) {
return 0;
}
}