| 365 | }; |
| 366 | |
| 367 | static void AddCommandLineOptions(cxxopts::Options& options, |
| 368 | CommandLineOptions& cLineOptions, std::vector<std::string>& required) |
| 369 | { |
| 370 | const std::vector<std::string> defaultComputes = { "CpuAcc", "CpuRef" }; |
| 371 | |
| 372 | const std::string backendsMessage = "Which device to run layers on by default. Possible choices: " |
| 373 | + armnn::BackendRegistryInstance().GetBackendIdsAsString(); |
| 374 | |
| 375 | options |
| 376 | .allow_unrecognised_options() |
| 377 | .add_options() |
| 378 | ("m,model-dir", "Path to directory containing model files (.prototxt/.tflite)", |
| 379 | cxxopts::value<std::string>(cLineOptions.m_ModelDir)) |
| 380 | ("c,compute", backendsMessage.c_str(), |
| 381 | cxxopts::value<std::vector<std::string>>(cLineOptions.m_ComputeDevices)->default_value("CpuRef")) |
| 382 | ("b,dynamic-backends-path", |
| 383 | "Path where to load any available dynamic backend from. " |
| 384 | "If left empty (the default), dynamic backends will not be used.", |
| 385 | cxxopts::value(cLineOptions.m_DynamicBackendsPath)) |
| 386 | ("l,labels", |
| 387 | "Text file containing one image filename - correct label pair per line, " |
| 388 | "used to test the accuracy of the network.", cxxopts::value<std::string>(cLineOptions.m_Labels)) |
| 389 | ("v,visualize-optimized-model", |
| 390 | "Produce a dot file useful for visualizing the graph post optimization." |
| 391 | "The file will have the same name as the model with the .dot extention.", |
| 392 | cxxopts::value<bool>(cLineOptions.m_VisualizePostOptimizationModel)->default_value("false")) |
| 393 | ("fp16-turbo-mode", |
| 394 | "If this option is enabled FP32 layers, weights and biases will be converted " |
| 395 | "to FP16 where the backend supports it.", |
| 396 | cxxopts::value<bool>(cLineOptions.m_EnableFp16TurboMode)->default_value("false")) |
| 397 | ("bf16-turbo-mode", |
| 398 | "If this option is enabled FP32 layers, weights and biases will be converted " |
| 399 | "to BF16 where the backend supports it.", |
| 400 | cxxopts::value<bool>(cLineOptions.m_EnableBf16TurboMode)->default_value("false")); |
| 401 | |
| 402 | required.emplace_back("model-dir"); |
| 403 | } |
| 404 | |
| 405 | InferenceModel(const Params& params, |
| 406 | bool enableProfiling, |