JeVoisBase
1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
|
|
Object detection and recognition using OpenCV Deep Neural Networks (DNN) More...
Public Member Functions | |
__init__ (self) | |
Constructor. | |
postprocess (self, frame, outs) | |
Analyze and draw boxes, object names, and confidence scores. | |
process (self, inframe, outframe) | |
JeVois main processing function. | |
Public Attributes | |
confThreshold | |
nmsThreshold | |
inpWidth | |
inpHeight | |
scale | |
mean | |
rgb | |
classes | |
net | |
timer | |
model | |
outNames | |
Object detection and recognition using OpenCV Deep Neural Networks (DNN)
This module runs an object detection deep neural network using the OpenCV DNN library. Detection networks analyze a whole scene and produce a number of bounding boxes around detected objects, together with identity labels and confidence scores for each detected box.
This module supports detection networks implemented in TensorFlow, Caffe, Darknet, Torch, etc as supported by the OpenCV DNN module.
Included with the standard JeVois distribution are:
See the module's constructor (init) code and select a value for model to switch network. Object categories are as follows:
Sometimes it will make mistakes! The performance of yolov3-tiny is about 33.1% correct (mean average precision) on the COCO test set. The OpenCV Face Detector is quite fast and robust!
This module is adapted from the sample OpenCV code: https://github.com/opencv/opencv/blob/master/samples/dnn/object_detection.py
More pre-trained models are available on github in opencv_extra
Definition at line 61 of file PyDetectionDNN.py.
PyDetectionDNN.PyDetectionDNN.__init__ | ( | self | ) |
Constructor.
Definition at line 64 of file PyDetectionDNN.py.
PyDetectionDNN.PyDetectionDNN.postprocess | ( | self, | |
frame, | |||
outs | |||
) |
Analyze and draw boxes, object names, and confidence scores.
Definition at line 134 of file PyDetectionDNN.py.
References Darknet.classes, Yolo.classes, PyPostClassify.PyPostClassify.classes, PyPostDAMOyolo.PyPostDAMOyolo.classes, PyPostYolo.PyPostYolo.classes, PyPostYOLOv8seg.PyPostYOLOv8seg.classes, PyClassificationDNN.PyClassificationDNN.classes, PyDetectionDNN.PyDetectionDNN.classes, PyEmotion.PyEmotion.classes, PyClassificationDNN.PyClassificationDNN.confThreshold, PyDetectionDNN.PyDetectionDNN.confThreshold, Darknet.net, Yolo.net, ObjectRecognition< NetType >.net, ObjectRecognition< tiny_dnn::sequential >.net, PyNetKSNN.PyNetKSNN.net, PyNetOpenCV.PyNetOpenCV.net, PyClassificationDNN.PyClassificationDNN.net, PyDetectionDNN.PyDetectionDNN.net, PyEmotion.PyEmotion.net, PyDetectionDNN.PyDetectionDNN.nmsThreshold, and PyDetectionDNN.PyDetectionDNN.outNames.
Referenced by PyDetectionDNN.PyDetectionDNN.process(), PyPostDAMOyolo.PyPostDAMOyolo.process(), and PyPostYOLOv8seg.PyPostYOLOv8seg.process().
PyDetectionDNN.PyDetectionDNN.process | ( | self, | |
inframe, | |||
outframe | |||
) |
JeVois main processing function.
Definition at line 252 of file PyDetectionDNN.py.
References PyClassificationDNN.PyClassificationDNN.inpHeight, PyDetectionDNN.PyDetectionDNN.inpHeight, PyEmotion.PyEmotion.inpHeight, PyClassificationDNN.PyClassificationDNN.inpWidth, PyDetectionDNN.PyDetectionDNN.inpWidth, PyEmotion.PyEmotion.inpWidth, mobilenet_v1.MobileNetV1.mean, mobilenet_v2.MobileNetV2.mean, quantize-inc.Dataset.mean, transform.Normalize.mean, PyPreBlob.PyPreBlob.mean, PyClassificationDNN.PyClassificationDNN.mean, PyDetectionDNN.PyDetectionDNN.mean, PyEmotion.PyEmotion.mean, TensorFlow.model, mobilenet_v1.MobileNetV1.model, mobilenet_v2.MobileNetV2.model, lpd_yunet.LPD_YuNet.model, mp_palmdet.MPPalmDet.model, PyNetKSNN.PyNetKSNN.model, PyNetOpenCV.PyNetOpenCV.model, PyNetORT.PyNetORT.model, PyNetURetinex.PyNetURetinex.model, PyClassificationDNN.PyClassificationDNN.model, PyCoralClassify.PyCoralClassify.model, PyCoralDetect.PyCoralDetect.model, PyCoralSegment.PyCoralSegment.model, PyDetectionDNN.PyDetectionDNN.model, PyEmotion.PyEmotion.model, PyLicensePlate.PyLicensePlate.model, Darknet.net, Yolo.net, ObjectRecognition< tiny_dnn::sequential >.net, ObjectRecognition< NetType >.net, PyNetKSNN.PyNetKSNN.net, PyNetOpenCV.PyNetOpenCV.net, PyClassificationDNN.PyClassificationDNN.net, PyDetectionDNN.PyDetectionDNN.net, PyEmotion.PyEmotion.net, PyDetectionDNN.PyDetectionDNN.outNames, DetectionDNN.postprocess(), PyDetectionDNN.PyDetectionDNN.postprocess(), PyPostYOLOv8seg.PyPostYOLOv8seg.postprocess(), PyPostDAMOyolo.PyPostDAMOyolo.postprocess(), PyClassificationDNN.PyClassificationDNN.rgb, PyCoralClassify.PyCoralClassify.rgb, PyCoralDetect.PyCoralDetect.rgb, PyCoralSegment.PyCoralSegment.rgb, PyDetectionDNN.PyDetectionDNN.rgb, PyEmotion.PyEmotion.rgb, PyPreBlob.PyPreBlob.scale, PyClassificationDNN.PyClassificationDNN.scale, PyDetectionDNN.PyDetectionDNN.scale, PyEmotion.PyEmotion.scale, AprilTag.AprilTag.timer, FirstPython.FirstPython.timer, PyClassificationDNN.PyClassificationDNN.timer, PyCoralClassify.PyCoralClassify.timer, PyCoralDetect.PyCoralDetect.timer, PyCoralSegment.PyCoralSegment.timer, PyDetectionDNN.PyDetectionDNN.timer, PyDMTX.PyDMTX.timer, PyEmotion.PyEmotion.timer, PyFaceMesh.PyFaceMesh.timer, PyHandDetector.PyHandDetector.timer, PyLicensePlate.PyLicensePlate.timer, PyObjectron.PyObjectron.timer, PyPoseDetector.PyPoseDetector.timer, PySceneText.PySceneText.timer, PySelfie.PySelfie.timer, PythonObject6D.PythonObject6D.timer, PythonOpenCV.PythonOpenCV.timer, PythonParallel.PythonParallel.timer, PythonSandbox.PythonSandbox.timer, and PythonTest.PythonTest.timer.
PyDetectionDNN.PyDetectionDNN.classes |
Definition at line 84 of file PyDetectionDNN.py.
Referenced by PyPostClassify.PyPostClassify.freeze(), PyPostDAMOyolo.PyPostDAMOyolo.freeze(), PyPostYolo.PyPostYolo.freeze(), PyPostYOLOv8seg.PyPostYOLOv8seg.freeze(), PyDetectionDNN.PyDetectionDNN.postprocess(), and PyClassificationDNN.PyClassificationDNN.process().
PyDetectionDNN.PyDetectionDNN.confThreshold |
Definition at line 65 of file PyDetectionDNN.py.
Referenced by PyDetectionDNN.PyDetectionDNN.postprocess(), and PyClassificationDNN.PyClassificationDNN.process().
PyDetectionDNN.PyDetectionDNN.inpHeight |
Definition at line 68 of file PyDetectionDNN.py.
Referenced by PyClassificationDNN.PyClassificationDNN.process(), and PyDetectionDNN.PyDetectionDNN.process().
PyDetectionDNN.PyDetectionDNN.inpWidth |
Definition at line 67 of file PyDetectionDNN.py.
Referenced by PyClassificationDNN.PyClassificationDNN.process(), and PyDetectionDNN.PyDetectionDNN.process().
PyDetectionDNN.PyDetectionDNN.mean |
Definition at line 70 of file PyDetectionDNN.py.
Referenced by transform.Normalize.__call__(), quantize-inc.Dataset.__getitem__(), mobilenet_v1.MobileNetV1._preprocess(), mobilenet_v2.MobileNetV2._preprocess(), PyPreBlob.PyPreBlob.process(), PyClassificationDNN.PyClassificationDNN.process(), and PyDetectionDNN.PyDetectionDNN.process().
PyDetectionDNN.PyDetectionDNN.model |
Definition at line 129 of file PyDetectionDNN.py.
Referenced by lpd_yunet.LPD_YuNet.__init__(), PyNetKSNN.PyNetKSNN.freeze(), PyNetOpenCV.PyNetOpenCV.freeze(), PyNetORT.PyNetORT.freeze(), PyNetURetinex.PyNetURetinex.freeze(), mobilenet_v1.MobileNetV1.infer(), mobilenet_v2.MobileNetV2.infer(), lpd_yunet.LPD_YuNet.infer(), mp_palmdet.MPPalmDet.infer(), PyNetKSNN.PyNetKSNN.load(), PyNetOpenCV.PyNetOpenCV.load(), PyNetORT.PyNetORT.load(), PyNetURetinex.PyNetURetinex.load(), PyClassificationDNN.PyClassificationDNN.process(), PyCoralClassify.PyCoralClassify.process(), PyCoralDetect.PyCoralDetect.process(), PyCoralSegment.PyCoralSegment.process(), PyDetectionDNN.PyDetectionDNN.process(), PyCoralClassify.PyCoralClassify.processGUI(), PyCoralDetect.PyCoralDetect.processGUI(), PyCoralSegment.PyCoralSegment.processGUI(), PyLicensePlate.PyLicensePlate.processGUI(), mobilenet_v1.MobileNetV1.setBackend(), mobilenet_v2.MobileNetV2.setBackend(), lpd_yunet.LPD_YuNet.setBackend(), mp_palmdet.MPPalmDet.setBackend(), mobilenet_v1.MobileNetV1.setTarget(), mobilenet_v2.MobileNetV2.setTarget(), lpd_yunet.LPD_YuNet.setTarget(), and mp_palmdet.MPPalmDet.setTarget().
PyDetectionDNN.PyDetectionDNN.net |
Definition at line 125 of file PyDetectionDNN.py.
Referenced by PyNetKSNN.PyNetKSNN.load(), PyNetOpenCV.PyNetOpenCV.load(), PyDetectionDNN.PyDetectionDNN.postprocess(), PyNetKSNN.PyNetKSNN.process(), PyNetOpenCV.PyNetOpenCV.process(), PyClassificationDNN.PyClassificationDNN.process(), and PyDetectionDNN.PyDetectionDNN.process().
PyDetectionDNN.PyDetectionDNN.nmsThreshold |
Definition at line 66 of file PyDetectionDNN.py.
Referenced by PyDetectionDNN.PyDetectionDNN.postprocess().
PyDetectionDNN.PyDetectionDNN.outNames |
Definition at line 130 of file PyDetectionDNN.py.
Referenced by PyDetectionDNN.PyDetectionDNN.postprocess(), and PyDetectionDNN.PyDetectionDNN.process().
PyDetectionDNN.PyDetectionDNN.rgb |
Definition at line 71 of file PyDetectionDNN.py.
Referenced by PyClassificationDNN.PyClassificationDNN.process(), PyCoralClassify.PyCoralClassify.process(), PyCoralDetect.PyCoralDetect.process(), PyCoralSegment.PyCoralSegment.process(), PyDetectionDNN.PyDetectionDNN.process(), PyCoralClassify.PyCoralClassify.processGUI(), PyCoralDetect.PyCoralDetect.processGUI(), and PyCoralSegment.PyCoralSegment.processGUI().
PyDetectionDNN.PyDetectionDNN.scale |
Definition at line 69 of file PyDetectionDNN.py.
Referenced by PyPreBlob.PyPreBlob.process(), PyClassificationDNN.PyClassificationDNN.process(), and PyDetectionDNN.PyDetectionDNN.process().
PyDetectionDNN.PyDetectionDNN.timer |
Definition at line 128 of file PyDetectionDNN.py.
Referenced by FirstPython.FirstPython.process(), PyClassificationDNN.PyClassificationDNN.process(), PyCoralClassify.PyCoralClassify.process(), PyCoralDetect.PyCoralDetect.process(), PyCoralSegment.PyCoralSegment.process(), PyDetectionDNN.PyDetectionDNN.process(), PyDMTX.PyDMTX.process(), PythonObject6D.PythonObject6D.process(), PythonOpenCV.PythonOpenCV.process(), PythonParallel.PythonParallel.process(), PythonSandbox.PythonSandbox.process(), AprilTag.AprilTag.processGUI(), PyCoralClassify.PyCoralClassify.processGUI(), PyCoralDetect.PyCoralDetect.processGUI(), PyCoralSegment.PyCoralSegment.processGUI(), PyFaceMesh.PyFaceMesh.processGUI(), PyHandDetector.PyHandDetector.processGUI(), PyLicensePlate.PyLicensePlate.processGUI(), PyObjectron.PyObjectron.processGUI(), PyPoseDetector.PyPoseDetector.processGUI(), PySceneText.PySceneText.processGUI(), PySelfie.PySelfie.processGUI(), PythonOpenCV.PythonOpenCV.processGUI(), PythonSandbox.PythonSandbox.processGUI(), PythonTest.PythonTest.processGUI(), FirstPython.FirstPython.processNoUSB(), PythonObject6D.PythonObject6D.processNoUSB(), and PythonSandbox.PythonSandbox.processNoUSB().