diff --git a/doc/tutorial/detection_dnn/tutorial-detection-dnn.dox b/doc/tutorial/detection_dnn/tutorial-detection-dnn.dox index 0ab2a417f1..c5897fb046 100644 --- a/doc/tutorial/detection_dnn/tutorial-detection-dnn.dox +++ b/doc/tutorial/detection_dnn/tutorial-detection-dnn.dox @@ -474,6 +474,10 @@ If you want to train your own YoloV7 model, please refer to the [official docume If your dataset is rather small (only hundreds of pictures), you may want to consider to base your training on `yolov7-tiny` network, as it tends to get better results. +\warning If you train your own model, be sure to use the same image size in the `python train.py`, +`python export.py` and `./tutorial-dnn-object-detection-live` commands. Otherwise, it can lead to either an error thrown +by OpenCV or the absence of detection by the ONNX model while the Pytorch model works perfectly using the `python detect.py` command. + \subsubsection dnn_supported_yolov8 Yolo v8 You can find the weights (`yolov8s.onnx`) in ONNX format diff --git a/doc/tutorial/misc/tutorial-synthetic-blenderproc.dox b/doc/tutorial/misc/tutorial-synthetic-blenderproc.dox index 91f04a807a..e6e576ce6a 100644 --- a/doc/tutorial/misc/tutorial-synthetic-blenderproc.dox +++ b/doc/tutorial/misc/tutorial-synthetic-blenderproc.dox @@ -715,6 +715,10 @@ We also download the pretrained yolo model, that we will finetune on our own dat (yolov7) ~/yolov7 $ wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-tiny.pt ``` +\warning While creating the yolov7 virtual environment, you may face the following error: +"requirements to build wheel did not run successfully". It can be solved by fixing the version of the Python of +the virtual environment: `conda create --name yolov7 pip python=3.10` + To fine-tune a YoloV7, we should create two new files: the network configuration and the hyperparameters. We will reuse the ones provided for the tiny model. ``` diff --git a/tutorial/detection/dnn/tutorial-dnn-object-detection-live.cpp b/tutorial/detection/dnn/tutorial-dnn-object-detection-live.cpp index 44f670a142..4f8fe47c1b 100644 --- a/tutorial/detection/dnn/tutorial-dnn-object-detection-live.cpp +++ b/tutorial/detection/dnn/tutorial-dnn-object-detection-live.cpp @@ -338,6 +338,11 @@ int main(int argc, const char *argv[]) cv::Mat frame; while (true) { capture >> frame; + if (frame.type() == CV_8UC4) { + // RGBa format is not supported by the class, converting to BGR format + cv::Mat cpy = frame; + cv::cvtColor(cpy, frame, cv::COLOR_RGBA2BGR); + } if (frame.empty()) break;