Skip to content

Commit f5ac565

Browse files
Unify SIT file name deduction from a network path
The --network option is used to establish file names of inference results that SIT produces. Depending on whether an absolute or a relative path is given, the file name deduced would be different. For example, conside 'foo.xml' to be the network name: * C:\path\foo.xml would result in '_foo' file name * foo.xml would result in 'foo' file name This inconsistency causes unexpected failures when both absolute and relative paths are combined within a "single" SIT-based workflow.
1 parent 4922c49 commit f5ac565

File tree

1 file changed

+7
-17
lines changed
  • src/plugins/intel_npu/tools/single-image-test

1 file changed

+7
-17
lines changed

src/plugins/intel_npu/tools/single-image-test/main.cpp

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -826,14 +826,14 @@ bool hasLoadableExt(const std::string& network_path) {
826826
});
827827
}
828828

829-
std::string cleanName(std::string&& name) {
829+
std::string cleanName(std::string name) {
830830
std::replace_if(
831831
name.begin(), name.end(),
832832
[](unsigned char c) {
833833
return !std::isalnum(c);
834834
},
835835
'_');
836-
return std::move(name);
836+
return name;
837837
}
838838

839839
ov::Tensor loadImages(const ov::element::Type& precision, const ov::Shape& shape, const ov::Layout& layout,
@@ -2934,21 +2934,11 @@ static int runSingleImageTest() {
29342934

29352935
std::string netFileName;
29362936
{
2937-
auto startPos = FLAGS_network.rfind('/');
2938-
if (startPos == std::string::npos) {
2939-
startPos = FLAGS_network.rfind('\\');
2940-
if (startPos == std::string::npos) {
2941-
startPos = 0;
2942-
}
2943-
}
2944-
2945-
auto endPos = FLAGS_network.rfind('.');
2946-
if (endPos == std::string::npos) {
2947-
endPos = FLAGS_network.size();
2948-
}
2949-
2950-
OPENVINO_ASSERT(endPos > startPos);
2951-
netFileName = cleanName(FLAGS_network.substr(startPos, endPos - startPos));
2937+
std::filesystem::path networkPath(FLAGS_network);
2938+
OPENVINO_ASSERT(std::filesystem::exists(networkPath) && networkPath.has_filename(),
2939+
"Network path does not exist or is invalid: ",
2940+
FLAGS_network);
2941+
netFileName = cleanName(networkPath.stem().string());
29522942
}
29532943

29542944
for (size_t numberOfTestCase = 0; numberOfTestCase < inputFilesPerCase.size(); ++numberOfTestCase) {

0 commit comments

Comments
 (0)