Generates appropriate input accessor according to the specified graph parameters * * @param[in] graph_parameters Graph parameters * @param[in] preprocessor (Optional) Preproccessor object * @param[in] bgr (Optional) Fill the first plane with blue channel (default = true) * * @return An appropriate tensor accessor */
| 502 | * @return An appropriate tensor accessor |
| 503 | */ |
| 504 | inline std::unique_ptr<graph::ITensorAccessor> |
| 505 | get_input_accessor(const arm_compute::utils::CommonGraphParams &graph_parameters, |
| 506 | std::unique_ptr<IPreprocessor> preprocessor = nullptr, |
| 507 | bool bgr = true) |
| 508 | { |
| 509 | if (!graph_parameters.validation_file.empty()) |
| 510 | { |
| 511 | return std::make_unique<ValidationInputAccessor>( |
| 512 | graph_parameters.validation_file, graph_parameters.validation_path, std::move(preprocessor), bgr, |
| 513 | graph_parameters.validation_range_start, graph_parameters.validation_range_end); |
| 514 | } |
| 515 | else |
| 516 | { |
| 517 | const std::string &image_file = graph_parameters.image; |
| 518 | const std::string &image_file_lower = lower_string(image_file); |
| 519 | if (arm_compute::utility::endswith(image_file_lower, ".npy")) |
| 520 | { |
| 521 | return std::make_unique<NumPyBinLoader>(image_file, graph_parameters.data_layout); |
| 522 | } |
| 523 | else if (arm_compute::utility::endswith(image_file_lower, ".jpeg") || |
| 524 | arm_compute::utility::endswith(image_file_lower, ".jpg") || |
| 525 | arm_compute::utility::endswith(image_file_lower, ".ppm")) |
| 526 | { |
| 527 | return std::make_unique<ImageAccessor>(image_file, bgr, std::move(preprocessor)); |
| 528 | } |
| 529 | else |
| 530 | { |
| 531 | return std::make_unique<DummyAccessor>(); |
| 532 | } |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | /** Generates appropriate output accessor according to the specified graph parameters |
| 537 | * |
no test coverage detected