Convolutional neural network using openCV - c++

I wonder if there is a way of building a convolutional neural network with openCV. Basically I have already trained the cifarnet cnn using the python API of Tensorflow but now I want to run the inference without tensorflow by using C++. The only open-source lib that I can use is opencv. Do you know if I can do that with opencv instead of creating the network manually?

Try to look at deep learning module from opencv_contrib. Some sample with evaluating model trained in TensorFlow in dnn/samples/tf_inception.cpp. Also some hints about making snapshot in issue: https://github.com/opencv/opencv_contrib/issues/1029#issuecomment-290070240.

Related

difference between using torchscript and libtorch C++ api

I'm looking at torchscript found here and libtorch found here. torchscript allows us to convert a python model into a module that can be loaded into C++ application while libtorch allows us to train and test a model in C++.
How are they different in terms of speed? Why would I use libtorch over torchscript or vice versa?

Yolov4 onnxruntime C++

I need to deploy a yolov4 inference model and I want to use onnxruntime with tensorRT backend. I don't know how to post process yolov4 detection result in C++. I have a sample written in python but I can not find C++ sample.
https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/yolov4
Is there a sample to know how to process yolov4 onnx result ?
Thanks
we have built something similar. For now we have only yolov3 with onnxruntime in C++ but we are testing yolov4 and will be avaiable in our next release. If you want have a look here https://github.com/ai4prod/ai4prod.

Yolo: PyTorch vs. Darknet

I have recently found Yolo implementations in PyTorch (e.g. https://github.com/ultralytics/yolov3). What I would like to know if this is really the same (in terms of model accuracy, speed and so on) like the one with Darknet backbone?
I am asking because it is waaaaaay easier with PyTorch (as I am struggling with installing Darknet on windows).
Kind regards,
Can
Follow these step to install darknet framework on window10.
I recommend to clone darknet from AlexeyAB repository since it works great on windows10 and a lot of community support.(https://github.com/AlexeyAB/darknet).
And now it has a python wrapper so you could implement it on python.
Clone darknet repositoriey.
install vcpkg.(https://github.com/microsoft/vcpkg)
Install visual studio 2017.
Install CUDA and CUDNN.
Add CUDNN into system environment. Variable name = 'CUDNN' , variable value =
'installed path'.
Add 'CUDA_TOOLKIT_ROOT_DIR' into system environment. Variable name = 'CUDNN',
variable value = 'installed path\NVIDIA GPU Computing Toolkit\CUDA\v10.2.
build with powershell command '.\build.ps1' in darknet directory.
Hope you find this help :).
YOLO (You Only Look Once) is a one shot detector method to detect object in a certain image. It can work with Darknet, Pytorch, Tensorflow, Keras etc. frameworks. YOLO and darknet complements together pretty well as it has a robust support for CUDA & CUDNN. Use whichever framework you want !!

Create Haar Cascade in OpenCV 3 without using the OpenCV applications

I need to train my own Haar Cascade classifier using OpenCV 3.X writing my own code without using OpenCV application (opencv_createsamples, opencv_haartraining), but I'm not able to find any reference neither in the OpenCV documentation or in some tutorial.
Everything say "use opencv applications", even in the official documentation.
Where I can find at least some base classes reference?

Serial Communication in OpenCV

I am building an application involving identification of color of object and then sorting it with the help of a robotic hand manipulator. The code for Color Identification is ready in OpenCV, what I do not know is how to transfer this data to my Arduino UNO board connected by USB. I have made this kind of application previously in MATLAB, but have no idea how to do it in OpenCV. Do we have any way to send data over Serial port in OpenCV?
Have you considered using OpenFrameworks? I personally haven't played around with OpenCV but I have played around with serial communications to arduinos on OF. OF also includes the OpenCV library so you can link your work with it.
Prerequisites :Install opencv with python bindings.I usually work on Mac Os.Its pretty easy installing opencv with python bindings on mac using macports.I have no idea about windows and linux but there is no shortage of tutorials to do so.Just google.
And about python,don't worry,You can learn a lot of python in 2 days.Google python classes are definitely a good start.
Check this out for different python opencv methods.And this is a good site for starting opencv with python