You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Locating objects: Based on the objectness score (onerow.at<float>(4)).
Classifying objects: Based on the class confidence scores (onerow.at<float>(5) through onerow.at<float>(10)).
By multiplying the objectness score and the class confidence score, you get a combined measure (finalConf) that represents the likelihood of a specific class being present in the bounding box.
Example:
Center X = 0.5 (50% of image width).
Center Y = 0.5 (50% of image height).
Width = 0.2 (20% of image width).
Height = 0.4 (40% of image height).
Objectness Score = 0.9 (90% confidence that there is an object in this box).
Class Scores:
Class 0: 0.1
Class 1: 0.7
Class 2: 0.2
Class 3: 0.05
Class 4: 0.03
Class 5: 0.02
If the highest class confidence score is 0.7 (for Class 1):
finalConf = 0.9 * 0.7 = 0.63.
This final confidence is compared to the threshold to decide whether to keep this detection.
for (auto& detection : detections)
{
for (int i = 0; i < detection.rows; i++)
{
cv::Mat onerow = detection.row(i);
cv::Mat scores = onerow.colRange(5, onerow.cols);
cv::minMaxLoc(scores, 0, &maxscore, 0, &classIdPoint);
finalConf = onerow.at(4) * maxscore;
}w.at(3) * resize_3840_bgr.rows);
int left = centerX - width / 2;
int top = centerY - height / 2;
}
In YOLO, the decision-making process involves:
By multiplying the objectness score and the class confidence score, you get a combined measure (finalConf) that represents the likelihood of a specific class being present in the bounding box.
Example:
For a row with the following values:
[0.5, 0.5, 0.2, 0.4, 0.9, 0.1, 0.7, 0.2, 0.05, 0.03, 0.02]
If the highest class confidence score is 0.7 (for Class 1):
This final confidence is compared to the threshold to decide whether to keep this detection.
//python
maxcore = scores[class_id]
finalConf = detection[4] * maxcore
#if maxcore > CONF_THRESH:
if finalConf > CONF_THRESH:
center_x = int(detection[0] * im_w)
center_y = int(detection[1] * im_h)
width = int(detection[2] * im_w)
height = int(detection[3] * im_h)
left = int(center_x - width / 2)
top = int(center_y - height / 2)
class_ids.append(int(class_id))
#confidences.append(float(maxcore))
confidences.append(float(finalConf))
boxes.append([left, top, width, height])
The text was updated successfully, but these errors were encountered: