MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / ValidationOutputAccessor

Method ValidationOutputAccessor

utils/GraphUtils.cpp:405–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405ValidationOutputAccessor::ValidationOutputAccessor(const std::string &image_list,
406 std::ostream &output_stream,
407 unsigned int start,
408 unsigned int end)
409 : _results(), _output_stream(output_stream), _offset(0), _positive_samples_top1(0), _positive_samples_top5(0)
410{
411 ARM_COMPUTE_EXIT_ON_MSG(start > end, "Invalid validation range!");
412
413 std::ifstream ifs;
414 try
415 {
416 ifs.exceptions(std::ifstream::badbit);
417 ifs.open(image_list, std::ios::in | std::ios::binary);
418
419 // Parse image correctly classified labels
420 unsigned int counter = 0;
421 for (std::string line; !std::getline(ifs, line).fail() && counter <= end; ++counter)
422 {
423 // Add label if within range
424 if (counter >= start)
425 {
426 std::stringstream linestream(line);
427 std::string image_name;
428 int result;
429
430 linestream >> image_name >> result;
431 _results.emplace_back(result);
432 }
433 }
434 }
435 catch (const std::ifstream::failure &e)
436 {
437 ARM_COMPUTE_ERROR_VAR("Accessing %s: %s", image_list.c_str(), e.what());
438 }
439}
440
441void ValidationOutputAccessor::reset()
442{

Callers

nothing calls this directly

Calls 2

openMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected