All Projects → juliansprt → OpenCvSharpDNN

juliansprt / OpenCvSharpDNN

Licence: MIT license
Implementation of YoloV3 and Caffe in OpenCvSharp

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to OpenCvSharpDNN

OpenCvSharpDnnYolo
Yolo With OpenCvSharp Dnn
Stars: ✭ 25 (+25%)
Mutual labels:  dnn, opencvsharp, opencvsharp-dnn
YOLO-Streaming
Push-pull streaming and Web display of YOLO series
Stars: ✭ 56 (+180%)
Mutual labels:  dnn, yolov3
Caffe2-yolo-v3
A Caffe2 implementation of the YOLO v3 object detection algorithm
Stars: ✭ 32 (+60%)
Mutual labels:  caffe2, yolov3
rebar detect
CCFDF rebar detection
Stars: ✭ 14 (-30%)
Mutual labels:  yolov3
object-detection-yolo-opencv
Object Detection using Yolo V3 and OpenCV
Stars: ✭ 29 (+45%)
Mutual labels:  yolov3
Deep-Learning-with-GoogleColab
Deep Learning Applications (Darknet - YOLOv3, YOLOv4 | DeOldify - Image Colorization, Video Colorization | Face-Recognition) with Google Colaboratory - on the free Tesla K80/Tesla T4/Tesla P100 GPU - using Keras, Tensorflow and PyTorch.
Stars: ✭ 63 (+215%)
Mutual labels:  yolov3
myDL
Deep Learning
Stars: ✭ 18 (-10%)
Mutual labels:  dnn
copilot
Lane and obstacle detection for active assistance during driving. Uses windowed sweep for lane detection. Combination of object tracking and YOLO for obstacles. Determines lane change, relative velocity and time to collision
Stars: ✭ 95 (+375%)
Mutual labels:  yolov3
DLInfBench
CNN model inference benchmarks for some popular deep learning frameworks
Stars: ✭ 51 (+155%)
Mutual labels:  caffe2
YOLOX
YOLOX is a high-performance anchor-free YOLO, exceeding yolov3~v5 with MegEngine, ONNX, TensorRT, ncnn, and OpenVINO supported. Documentation: https://yolox.readthedocs.io/
Stars: ✭ 6,570 (+32750%)
Mutual labels:  yolov3
yolov3-pytorch
annotation and specification for yolov3
Stars: ✭ 48 (+140%)
Mutual labels:  yolov3
PowerShellModules
A collection of PowerShell modules
Stars: ✭ 24 (+20%)
Mutual labels:  dnn
keras-yolo3-facedetection
Real-time face detection model using YOLOv3 with Keras
Stars: ✭ 13 (-35%)
Mutual labels:  yolov3
imsearch
Framework to build your own reverse image search engine
Stars: ✭ 64 (+220%)
Mutual labels:  yolov3
Yolov3-TensorRT-py
Yolov3 on tensorflow2.0 and tensorrt7.0
Stars: ✭ 15 (-25%)
Mutual labels:  yolov3
AICamera new
Recompile the library with caffe2 in pytorch stable(1.0) and re-implement the AICamera example provided by caffe2 officially.
Stars: ✭ 33 (+65%)
Mutual labels:  caffe2
DNN.IFrame
DNN IFrame is a module used for embedding an internal/external URL on your DNN site.
Stars: ✭ 14 (-30%)
Mutual labels:  dnn
go-darknet
Go bindings for Darknet (YOLO v4 / v3)
Stars: ✭ 56 (+180%)
Mutual labels:  yolov3
lightDenseYOLO
A real-time object detection app based on lightDenseYOLO Our lightDenseYOLO is the combination of two components: lightDenseNet as the CNN feature extractor and YOLO v2 as the detection module
Stars: ✭ 20 (+0%)
Mutual labels:  yolov3
ROS-Object-Detection-2Dto3D-RealsenseD435
Use the Intel D435 real-sensing camera to realize object detection based on the Yolov3-5 framework under the Opencv DNN(old version)/TersorRT(now) by ROS-melodic.Real-time display of the Pointcloud in the camera coordinate system.
Stars: ✭ 45 (+125%)
Mutual labels:  dnn

OpenCvSharp DNN

Example of implementation of YoloV3 and Caffe in OpenCvSharp, in this example it is used pre-trained models to detect persons, faces and a estimation of the probability gender of the faces detected

Requirements

Usage

This is a implementation usage in YoloV3 and Caffe models

           //Directory contains the models and configuration files
           string dir = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "data");

           //Model of YoloV3
           string model = System.IO.Path.Combine(dir, "yolov3.weights");
           string cfg = System.IO.Path.Combine(dir, "yolov3.cfg");
           string labelsYolo = System.IO.Path.Combine(dir, "coco.names");


           //Model of face
           string modelFace = System.IO.Path.Combine(dir, "yolov3-wider_16000.weights");
           string cfgFace = System.IO.Path.Combine(dir, "yolov3-face.cfg");

           //Model of Gender classifaction
           string modelGenderCaffe = System.IO.Path.Combine(dir, "gender_net.caffemodel");
           string cfgGenderCaffe = System.IO.Path.Combine(dir, "deploy_gender.prototxt");

           //Image Path
           string testImage = System.IO.Path.Combine(dir, "friends.jpg");


           using (NetYoloV3 yoloV3 = new NetYoloV3())
           using (NetYoloV3 yoloV3Faces = new NetYoloV3())
           using (NetCaffeAgeGender caffeGender = new NetCaffeAgeGender())
           using (Bitmap bitmap = new Bitmap(testImage))
           using (Bitmap resultImage = new Bitmap(testImage))
           {

               //Initialize models
               yoloV3.Initialize(model, cfg, labelsYolo);
               yoloV3Faces.Initialize(modelFace, cfgFace, new string[] { "faces" });
               caffeGender.Initialize(modelGenderCaffe, cfgGenderCaffe, new string[] { "Male", "Female" });


               //Get result of YoloV3
               NetResult[] resultPersons = yoloV3.Detect(bitmap, labelsFilters: new string[] { "person" });


               //Get result of YoloV3 faces train
               NetResult[] resultFaces = yoloV3Faces.Detect(bitmap);

               using (Graphics canvas = Graphics.FromImage(resultImage))
               {
                   Font font = new Font(FontFamily.GenericSansSerif, 15);


                   foreach (NetResult item in resultFaces)
                   {
                       //Create a roi by each faces
                       using (Bitmap roi = (Bitmap)bitmap.Clone(item.Rectangle, bitmap.PixelFormat))
                       {
                           NetResult resultGender = caffeGender.Detect(roi).FirstOrDefault();

                           canvas.DrawString($"{resultGender.Label} {resultGender.Probability:0.0%}",
                               font,
                               new SolidBrush(Color.Green),
                               item.Rectangle.X - font.GetHeight(), item.Rectangle.Y - font.GetHeight());

                       }

                       canvas.DrawRectangle(new Pen(Color.Red, 2), item.Rectangle);
                   }

                   canvas.Save();
               }

               resultImage.Save(Path.Combine(dir, "result.jpg"));

           }

Pre-trained models

You can download the pre-trained models in these link:

Google Drive: https://drive.google.com/drive/folders/1oj9p04mPjbbCbq1qSK8ChMjOhMLMpk42

Results

For the next image:

Input image

This is the result: Input image

And this is the diagnostics the time of execution:

The model NetYoloV3 - Faces has taken 1609 milliseconds

The model NetCaffeGender has taken 45 milliseconds

License

Licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].