MCPcopy Create free account
hub / github.com/ARM-software/armnn / AssignColourToLabel

Function AssignColourToLabel

samples/ObjectDetection/src/Main.cpp:65–89  ·  view source on GitHub ↗

* Assigns a color to each label in the label set */

Source from the content-addressed store, hash-verified

63 * Assigns a color to each label in the label set
64 */
65std::vector<std::tuple<std::string, common::BBoxColor>> AssignColourToLabel(const std::string& pathToLabelFile)
66{
67 std::ifstream in(pathToLabelFile);
68 std::vector<std::tuple<std::string, common::BBoxColor>> labels;
69
70 std::string str;
71 std::default_random_engine generator;
72 std::uniform_int_distribution<int> distribution(0,255);
73
74 while (std::getline(in, str))
75 {
76 if(!str.empty())
77 {
78 common::BBoxColor c{
79 .colorCode = std::make_tuple(distribution(generator),
80 distribution(generator),
81 distribution(generator))
82 };
83 auto bboxInfo = std::make_tuple (str, c);
84
85 labels.emplace_back(bboxInfo);
86 }
87 }
88 return labels;
89}
90
91std::tuple<std::unique_ptr<common::IFrameReader<cv::Mat>>,
92 std::unique_ptr<common::IFrameOutput<cv::Mat>>>

Callers 1

mainFunction · 0.85

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected