#include <armnnUtils/Filesystem.hpp>
#include <cxxopts/cxxopts.hpp>
#include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 196 of file ImageCSVFileGenerator.cpp.
198 CommandLineProcessor cmdline;
199 if (!cmdline.ProcessCommandLine(argc, argv))
204 const std::string fileFormat(
".raw");
206 const std::string rawDirectory(cmdline.GetInputDirectory());
207 const std::string outputPath(cmdline.GetOutputFileName());
208 const std::string bindingId(cmdline.GetInputBindingId());
210 std::vector<fs::path> rawFiles;
211 for (
auto& entry : fs::directory_iterator(rawDirectory))
213 if (entry.path().extension().c_str() == fileFormat)
215 rawFiles.push_back(entry.path());
219 if (!rawFiles.empty())
221 unsigned int pass = 0;
222 std::ofstream refinementData;
223 refinementData.open(outputPath, std::ofstream::out);
224 if (refinementData.is_open())
226 for (
auto const& raw : rawFiles)
228 refinementData << pass <<
", " << bindingId <<
", " << raw.c_str() <<
"\n";
231 std::cerr <<
"Failed to write to output file: " << outputPath << std::endl;
236 refinementData.close();
240 std::cerr <<
"Failed to open output file: " << outputPath << std::endl;
246 std::cerr <<
"No matching files with the \".raw\" extension found in the directory: " 247 << rawDirectory << std::endl;