Lane and Object Detection
Using OpenCV and YOLOv7
|
YOLOv7 based object detector. More...
#include "ObjectDetector.hpp"
Public Member Functions | |
ObjectDetector () | |
Construct a new ObjectDetector object. | |
void | SetProperties (const std::string &p_yoloFolderPath, const Globals::ObjectDetectorTypes &p_objectDetectorTypes, const Globals::ObjectDetectorBackEnds &p_objectDetectorBackEnds, const Globals::ObjectDetectorBlobSizes &p_objectDetectorBlobSizes) |
Set the properties of the ObjectDetector object. | |
void | RunObjectDetector (const cv::Mat &p_frame) |
Run the object detector against p_frame. | |
ObjectDetectionInformation | GetInformation () |
Get the ObjectDetectionInformation struct. |
Private Attributes | |
cv::dnn::Net | m_net |
OpenCV object which allows the use of pre-trained neural networks. | |
ObjectDetectionInformation | m_objectDetectionInformation |
The ObjectDetectionInformation struct containing all object detection-related information. | |
std::vector< std::string > | m_unconnectedOutputLayerNames |
The names of layers with unconnected outputs. | |
int32_t | m_blobSize |
The spatial size for the output image used by the cv::dnn::blobFromImage function. | |
bool | m_skipObjectDetection |
Whether to skip object detection. |
YOLOv7 based object detector.
Definition at line 23 of file ObjectDetector.hpp.
|
explicit |
Construct a new ObjectDetector object.
Definition at line 18 of file ObjectDetector.cpp.
void LaneAndObjectDetection::ObjectDetector::SetProperties | ( | const std::string & | p_yoloFolderPath, |
const Globals::ObjectDetectorTypes & | p_objectDetectorTypes, | ||
const Globals::ObjectDetectorBackEnds & | p_objectDetectorBackEnds, | ||
const Globals::ObjectDetectorBlobSizes & | p_objectDetectorBlobSizes ) |
Set the properties of the ObjectDetector object.
p_yoloFolderPath | The folder containing the .cfg and .weights YOLO files. |
p_objectDetectorTypes | The type of object detector to use with an option to disable object detection. The tiny version is more performant at the cost of accuracy. |
p_objectDetectorBackEnds | The supported backends for the object detector to run on. In theory, GPU should be significantly more performant. For maximum performance CUDA should be used as the backend, however, this requires building OpenCV with CUDA which is not supported with this projects built-in installation script. |
p_objectDetectorBlobSizes | The supported blob sizes for the object detector to run with. The larger the blob size the more performant the detector at the cost of performance. |
Definition at line 23 of file ObjectDetector.cpp.
void LaneAndObjectDetection::ObjectDetector::RunObjectDetector | ( | const cv::Mat & | p_frame | ) |
Run the object detector against p_frame.
p_frame | The frame to run the object detector against. |
Definition at line 78 of file ObjectDetector.cpp.
ObjectDetectionInformation LaneAndObjectDetection::ObjectDetector::GetInformation | ( | ) |
Get the ObjectDetectionInformation struct.
Definition at line 140 of file ObjectDetector.cpp.
|
private |
OpenCV object which allows the use of pre-trained neural networks.
Definition at line 66 of file ObjectDetector.hpp.
|
private |
The ObjectDetectionInformation struct containing all object detection-related information.
Definition at line 71 of file ObjectDetector.hpp.
|
private |
The names of layers with unconnected outputs.
Definition at line 76 of file ObjectDetector.hpp.
|
private |
The spatial size for the output image used by the cv::dnn::blobFromImage function.
Definition at line 81 of file ObjectDetector.hpp.
|
private |
Whether to skip object detection.
Definition at line 86 of file ObjectDetector.hpp.