EmguCV-Caffe-Image-Classifier

This code translated from C++(OpenCv) to C#(EmguCV), and it allows to classify 80 images.(https://docs.opencv.org/3.4.0/d5/de7/tutorial_dnn_googlenet.html)

image

  1. Firstly, download GoogLeNet model files: bvlc_googlenet.prototxt and bvlc_googlenet.caffemodel

  2. Also you need file with names of ILSVRC2012 classes: synset_words.txt.

Put these files into working directory of this program. Also, you should know that this is not a fully translation of OpenCV code. Some functions can be changed.

Explanation

1) Add .prototxt and .caffemodel files to program

1
EgEmgu.CV.Dnn.Importer caffe = Emgu.CV.Dnn.Importer.CreateCaffeImporter("Text.prototxt", "Model.caffemodel");

2) Create net

1
Emgu.CV.Dnn.Net net = new Emgu.CV.Dnn.Net()

3) Pass the blob

1
2
Mat blob = Emgu.CV.Dnn.DnnInvoke.BlobFromImage(resim_Mat, 0.78, size, scalar, true);
net.SetInput(blob, "data");

This section is under construction.

Dependencies

Resources

https://github.com/opencv/opencv/tree/master/samples/dnn
https://docs.opencv.org/3.4.0/d5/de7/tutorial_dnn_googlenet.html