mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Fixed code snippets in Yolo tutorial.
This commit is contained in:
@@ -232,7 +232,6 @@ module this is also quite easy to achieve. Below we will outline the sample impl
|
||||
|
||||
@snippet samples/dnn/object_detection.cpp preprocess_params
|
||||
@snippet samples/dnn/object_detection.cpp preprocess_call
|
||||
@snippet samples/dnn/object_detection.cpp preprocess_call_func
|
||||
|
||||
- Inference:
|
||||
|
||||
@@ -248,4 +247,4 @@ that NMS step is not included into onnx graph. Sample uses OpenCV function for i
|
||||
|
||||
- Draw predicted boxes
|
||||
|
||||
@snippet samples/dnn/object_detection.cpp draw_boxes
|
||||
@snippet samples/dnn/object_detection.cpp draw_boxes
|
||||
|
||||
@@ -294,9 +294,11 @@ int main(int argc, char** argv)
|
||||
if (asyncNumReq) {
|
||||
futureOutputs.push(net.forwardAsync());
|
||||
} else {
|
||||
//![forward]
|
||||
vector<Mat> outs;
|
||||
net.forward(outs, net.getUnconnectedOutLayersNames());
|
||||
predictionsQueue.push(outs);
|
||||
//![forward]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,6 +660,7 @@ void postprocess(Mat& frame, const vector<Mat>& outs, Net& net, int backend, vec
|
||||
|
||||
void drawPred(vector<int>& classIds, vector<float>& confidences, vector<Rect>& boxes, Mat& frame, FontFace& sans, int stdSize, int stdWeight, int stdImgSize, int stdThickness)
|
||||
{
|
||||
//![draw_boxes]
|
||||
int imgWidth = max(frame.rows, frame.cols);
|
||||
int size = (stdSize*imgWidth)/stdImgSize;
|
||||
int weight = (stdWeight*imgWidth)/stdImgSize;
|
||||
@@ -687,6 +690,7 @@ void drawPred(vector<int>& classIds, vector<float>& confidences, vector<Rect>& b
|
||||
Point(left + labelSize.width, top), boxColor, FILLED);
|
||||
putText(frame, label, Point(left, top-size/4), getTextColor(boxColor), sans, size, weight);
|
||||
}
|
||||
//![draw_boxes]
|
||||
}
|
||||
|
||||
void callback(int pos, void*)
|
||||
|
||||
Reference in New Issue
Block a user