|
|
@@ -28,6 +28,9 @@ void YoloFeatureManager::loadModel(const std::string & modelPath, const std::str
|
|
|
|
|
|
void YoloFeatureManager::loadClassNames(const std::string & file)
|
|
|
{
|
|
|
+ //先清空
|
|
|
+ classNames.clear();
|
|
|
+
|
|
|
std::ifstream ifs(file);
|
|
|
std::string line;
|
|
|
while (std::getline(ifs, line))
|
|
|
@@ -109,7 +112,7 @@ std::vector<float> YoloFeatureManager::extractFeatures(const std::string& imageP
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-std::vector<float> YoloFeatureManager::Detection(const std::string& imagePath)
|
|
|
+void YoloFeatureManager::Detection(const std::string& imagePath)
|
|
|
{
|
|
|
cv::Mat image = cv::imread(imagePath);
|
|
|
if (image.empty())
|
|
|
@@ -203,7 +206,7 @@ void YoloFeatureManager::drawDetection(cv::Mat& img, const std::vector<cv::Rect>
|
|
|
// 生成随机颜色(每个类别一种颜色)
|
|
|
std::vector<cv::Scalar> colors;
|
|
|
srand(time(0));
|
|
|
- for (int i = 0; i < classNames.size(); i++) {
|
|
|
+ for (std::size_t i = 0; i < classNames.size(); i++) {
|
|
|
int r = rand() % 256;
|
|
|
int g = rand() % 256;
|
|
|
int b = rand() % 256;
|