Skip to content

Commit

Permalink
[tools] [sit] Add feature to skip layers in SIT
Browse files Browse the repository at this point in the history
- Add a command line option to skip checking layers when comparing output with SIT.
  Currently only applies to NRMSE and RRMSE mode.
  • Loading branch information
zm6int committed Dec 2, 2024
1 parent 79493c2 commit 341fa30
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/plugins/intel_npu/tools/single-image-test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ DEFINE_string(
DEFINE_string(data_shape, "",
"Required for models with dynamic shapes. Set shape for input blobs. Only one shape can be set."
"In case of one input size: \"[1,3,224,224]\"");
DEFINE_string(skip_output_layers, "" , "Skip output layers from the network");

// for using input image mean and scale
static constexpr char mean_values_message[] =
Expand Down Expand Up @@ -247,6 +248,7 @@ void parseCommandLine(int argc, char* argv[]) {
std::cout << " Performance counters: " << FLAGS_pc << std::endl;
std::cout << " Mean_values [channel1,channel2,channel3] " << FLAGS_mean_values << std::endl;
std::cout << " Scale_values [channel1,channel2,channel3] " << FLAGS_scale_values << std::endl;
std::cout << " Skip output layers " << FLAGS_skip_output_layers << std::endl;
if (FLAGS_run_test) {
std::cout << " Reference files direcotry: "
<< (FLAGS_ref_dir.empty() ? "Current directory" : FLAGS_ref_dir) << std::endl;
Expand Down Expand Up @@ -1329,7 +1331,15 @@ bool testRRMSE(const TensorMap& outputs, const TensorMap& references, size_t bat
return false;
}

std::vector<std::string> skipped_layers;
skipped_layers = splitStringList(FLAGS_skip_output_layers, ';');

for (const auto& [tensorName, output] : outputs) {
if (std::find(skipped_layers.begin(), skipped_layers.end(), tensorName) != skipped_layers.end()) {
std::cout << "Skip RRMSE for layer: " << tensorName << std::endl;
continue;
}

auto referencesIterator = references.find(tensorName);
OPENVINO_ASSERT(referencesIterator != references.end());

Expand Down Expand Up @@ -1397,7 +1407,15 @@ bool testNRMSE(const TensorMap& outputs, const TensorMap& references, size_t bat
return false;
}

std::vector<std::string> skipped_layers;
skipped_layers = splitStringList(FLAGS_skip_output_layers, ';');

for (const auto& [tensorName, output] : outputs) {
if (std::find(skipped_layers.begin(), skipped_layers.end(), tensorName) != skipped_layers.end()) {
std::cout << "Skip NRMSE for layer: " << tensorName << std::endl;
continue;
}

auto referencesIterator = references.find(tensorName);
OPENVINO_ASSERT(referencesIterator != references.end());

Expand Down

0 comments on commit 341fa30

Please sign in to comment.