aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTeresa Charlin <teresa.charlinreyes@arm.com>2021-11-17 11:46:25 +0000
committerTeresa Charlin <teresa.charlinreyes@arm.com>2021-11-17 17:09:59 +0000
commit2b30f16d5393a0f59110af2d9e128aab430b13f0 (patch)
treefbf07bff5606d6e486710b4bdc9175881eefcd49 /tests
parentd998a1cfbcc7b4ed9922532ffe19c51283fcae68 (diff)
downloadarmnn-2b30f16d5393a0f59110af2d9e128aab430b13f0.tar.gz
IVGCVSW-6580 ModelAccuracyTool: change parameter "b,blacklist-path"
to comply with inclusive language guidelines. Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com> Change-Id: Iff3c9fd1107ddd97b1547f676e6aec06d7e2d28a
Diffstat (limited to 'tests')
-rw-r--r--tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp55
-rw-r--r--tests/ModelAccuracyTool-Armnn/README.md2
2 files changed, 31 insertions, 26 deletions
diff --git a/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp b/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp
index c08d88e053..49efbbf928 100644
--- a/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp
+++ b/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp
@@ -28,17 +28,17 @@ using namespace armnn::test;
* @param[in] imageDirectoryPath Path to directory containing validation images
* @param[in] begIndex Begin index of images to be loaded. Inclusive
* @param[in] endIndex End index of images to be loaded. Inclusive
- * @param[in] blacklistPath Path to blacklist file
+ * @param[in] excludelistPath Path to excludelist file
* @return A map mapping image file names to their corresponding ground-truth labels
*/
map<std::string, std::string> LoadValidationImageFilenamesAndLabels(const string& validationLabelPath,
const string& imageDirectoryPath,
size_t begIndex = 0,
size_t endIndex = 0,
- const string& blacklistPath = "");
+ const string& excludelistPath = "");
/** Load model output labels from file
- *
+ *
* @pre \p modelOutputLabelsPath exists and is a regular file
*
* @param[in] modelOutputLabelsPath path to model output labels file
@@ -63,7 +63,7 @@ int main(int argc, char* argv[])
std::string inputLayout;
std::vector<armnn::BackendId> computeDevice;
std::string validationRange;
- std::string blacklistPath;
+ std::string excludelistPath;
const std::string backendsMessage = "Which device to run layers on by default. Possible choices: "
+ armnn::BackendRegistryInstance().GetBackendIdsAsString();
@@ -106,10 +106,15 @@ int main(int argc, char* argv[])
"The index starts at 1 and the range is inclusive."
"By default the evaluation will be performed on all images.",
cxxopts::value<std::string>(validationRange)->default_value("1:0"))
- ("b,blacklist-path",
- "Path to a blacklist file where each line denotes the index of an image to be "
+ ("e,excludelist-path",
+ "Path to a excludelist file where each line denotes the index of an image to be "
"excluded from evaluation.",
- cxxopts::value<std::string>(blacklistPath)->default_value(""));
+ cxxopts::value<std::string>(excludelistPath)->default_value(""));
+ ARMNN_DEPRECATED_MSG_REMOVAL_DATE("This b,blacklist-path command is deprecated", "22.08")
+ ("b,blacklist-path",
+ "Path to a blacklist file where each line denotes the index of an image to be "
+ "excluded from evaluation. This command will be deprecated in favor of: --excludelist-path ",
+ cxxopts::value<std::string>(excludelistPath)->default_value(""));
auto result = options.parse(argc, argv);
@@ -243,17 +248,17 @@ int main(int argc, char* argv[])
return EXIT_FAILURE;
}
- // Validate blacklist file if it's specified
- if (!blacklistPath.empty() &&
- !(fs::exists(blacklistPath) && fs::is_regular_file(blacklistPath)))
+ // Validate excludelist file if it's specified
+ if (!excludelistPath.empty() &&
+ !(fs::exists(excludelistPath) && fs::is_regular_file(excludelistPath)))
{
- ARMNN_LOG(fatal) << "Invalid path to blacklist file at " << blacklistPath;
+ ARMNN_LOG(fatal) << "Invalid path to excludelist file at " << excludelistPath;
return EXIT_FAILURE;
}
fs::path pathToDataDir(dataDir);
const map<std::string, std::string> imageNameToLabel = LoadValidationImageFilenamesAndLabels(
- validationLabelPath, pathToDataDir.string(), imageBegIndex, imageEndIndex, blacklistPath);
+ validationLabelPath, pathToDataDir.string(), imageBegIndex, imageEndIndex, excludelistPath);
armnnUtils::ModelAccuracyChecker checker(imageNameToLabel, modelOutputLabels);
if (ValidateDirectory(dataDir))
@@ -407,7 +412,7 @@ map<std::string, std::string> LoadValidationImageFilenamesAndLabels(const string
const string& imageDirectoryPath,
size_t begIndex,
size_t endIndex,
- const string& blacklistPath)
+ const string& excludelistPath)
{
// Populate imageFilenames with names of all .JPEG, .PNG images
std::vector<std::string> imageFilenames;
@@ -445,15 +450,15 @@ map<std::string, std::string> LoadValidationImageFilenamesAndLabels(const string
throw armnn::Exception("Invalid image index range");
}
- // Load blacklist if there is one
- std::vector<unsigned int> blacklist;
- if (!blacklistPath.empty())
+ // Load excludelist if there is one
+ std::vector<unsigned int> excludelist;
+ if (!excludelistPath.empty())
{
- std::ifstream blacklistFile(blacklistPath);
+ std::ifstream excludelistFile(excludelistPath);
unsigned int index;
- while (blacklistFile >> index)
+ while (excludelistFile >> index)
{
- blacklist.push_back(index);
+ excludelist.push_back(index);
}
}
@@ -462,25 +467,25 @@ map<std::string, std::string> LoadValidationImageFilenamesAndLabels(const string
map<std::string, std::string> imageNameToLabel;
ifstream infile(validationLabelPath);
size_t imageIndex = begIndex;
- size_t blacklistIndexCount = 0;
+ size_t excludelistIndexCount = 0;
while (std::getline(infile, classification))
{
if (imageIndex > endIndex)
{
break;
}
- // If current imageIndex is included in blacklist, skip the current image
- if (blacklistIndexCount < blacklist.size() && imageIndex == blacklist[blacklistIndexCount])
+ // If current imageIndex is included in excludelist, skip the current image
+ if (excludelistIndexCount < excludelist.size() && imageIndex == excludelist[excludelistIndexCount])
{
++imageIndex;
- ++blacklistIndexCount;
+ ++excludelistIndexCount;
continue;
}
imageNameToLabel.insert(std::pair<std::string, std::string>(imageFilenames[imageIndex - 1], classification));
++imageIndex;
}
- std::cout << blacklistIndexCount << " images blacklisted" << std::endl;
- std::cout << imageIndex - begIndex - blacklistIndexCount << " images to be loaded" << std::endl;
+ std::cout << excludelistIndexCount << " images in excludelist" << std::endl;
+ std::cout << imageIndex - begIndex - excludelistIndexCount << " images to be loaded" << std::endl;
return imageNameToLabel;
}
diff --git a/tests/ModelAccuracyTool-Armnn/README.md b/tests/ModelAccuracyTool-Armnn/README.md
index 6383f33096..74a4c28f02 100644
--- a/tests/ModelAccuracyTool-Armnn/README.md
+++ b/tests/ModelAccuracyTool-Armnn/README.md
@@ -24,7 +24,7 @@ To build ModelAccuracyTool, pass the following options to Cmake:
| -l | --data-layout ] | Data layout. Supported value: NHWC, NCHW. Default: NHWC
| -c | --compute | Which device to run layers on by default. Possible choices: CpuRef, CpuAcc, GpuAcc. Default: CpuAcc, CpuRef |
| -r | --validation-range | The range of the images to be evaluated. Specified in the form <begin index>:<end index>. The index starts at 1 and the range is inclusive. By default the evaluation will be performed on all images. |
-| -b | --blacklist-path | Path to a blacklist file where each line denotes the index of an image to be excluded from evaluation. |
+| -e | --excludelist-path | Path to a excludelist file where each line denotes the index of an image to be excluded from evaluation. |
Example usage: <br>
<code>./ModelAccuracyTool -m /path/to/model/model.armnn -f tflite -i input -o output -d /path/to/test/directory/ -p /path/to/model-output-labels -v /path/to/file/val.txt -c CpuRef -r 1:100</code> \ No newline at end of file