Calculate confidance in openCV EigenFaceRecognizer - c++

I am trying openCV EigenFaceRecognizer example given here.
I have successfully recognized the face and predictedLabel is correct. But I wish to know how much confidant the program is about the prediction. I have tried this but values seems like garbage(like 1547139552). Can anyone please help in calculating the confidence level.

Related

Neural Net gradient calculation with Batch Normalization C++

I was trying to change my activation function of my neural net from sigmoid to RELU (or more specifically SELU). Since I got a lot of exploding gradients with that change, I tried to use the batch normalization. I calculated the gradients of my error function w.r.t the learning parameters \beta and \gamma, but it seems that they are a bit different from the ones I saw in several (sadly only Python) examples.
Here, for example, the code example on the bottom of the page says dbeta = np.sum(dout, axis=0) and I wonder what exactly this dout is.
My derivatives look like this:
Derivation of error function w.r.t \beta
What am I doing wrong in this derivation?
Thank you a lot for your help.
I try to add batchnorm2d layer in a small CNN testet on MNIST with Libtorch C++ code with or without GPU use
Here
https://github.com/ollewelin/libtorch-GPU-CNN-test-MNIST-with-Batchnorm
And the precision increase a little then.
Search for
”bn1”
Or
”bn2”
In this code you find.
Installation at Ubuntu with GPU and Libtorch + OpenCV for C++ here:
https://github.com/ollewelin/torchlib-opencv-gpu

In Qt how to create GUI for user to input nxn matrix?

I am learning Qt please do not assume I know a lot I appreciate if you could help me with this.
I am working on an application for solving a linear system of equations. For that, I want to take input from user two matrices A(nxn) and B(nx1) solve them and then display the matrix x(nx1).
I get the part of solving them, but in Qt I am finding it difficult to make the window that takes the input of matrices and shows the output.
How should I do that? Someone please help me with this.
Goto into Examples (Ctrl+1 in QtCreator) and look for spreadsheet.
Then configure and run that small project. A spreadsheet it's (albeit a bit overkill) a simple and efficient way to input (and output) matrices of any size and shape. Just apply your requirements about number of cols, rows and value constraints as you see fit.

c++ OCR Extracting digitsfrom an Image

I have been trying to solve this issue for days. Here is an image.
I want to get digits from this image.
I tried background subtraction and partition image in segments so as to compare templates. But result is
111117
Along with this i tried Tesseract API and it even refused to give me any output. At one point i got "GALLONS" as a output. Any help is highly appreciated. Thanks

Perspective transform (warp) of an image

I'm stuck trying to get perspective transformation to work.
I want to draw an image so it fits 4 given points. It's something like you have in Photoshop and it's used to change the perspective of image (see image below).
I have an image in byte array and I'm not using any additional libraries.
Everything I've found so far was either for OpenCV or didn't do what I wanted.
I have found some open-source program PhotoDemon and it does exactly what I want, and there is a code for that. I was trying to get it to work for many hours but it gives me completly weird results (second line on the image below).
Could someone provide me with some code or step-by-step math of what and how to do or even just a pseudo-code. I'm a little bit sick of it. It seems easy but I need some help.

Real time Object detection: where to learn?

I am working with opencv these days and I am capable of doing 99% of stuff explained in opencv official tutorials. And I managed to do motion tracking manually with background substraction, where some users claimed as impossible.
However, right now I am working with object detection, where I need to track the hand and want to find whether the hand is moved to left or right. Can this be done by following steps? (used in motion detection)
Get camera 2 instances of camera video (real time)
blur it to reduce noise
theresold it to find hand (or leave it if blur is enough)
find the absolute deference between 2 images
Get PSR
find pixel position of motion
However, it seems like it is not 100% same as motion detection, because I read some stuff about Kalman Filter, Block-matching, etc which I did not use in motion detection. However, I found this tutorial
http://homepages.cae.wisc.edu/~ece734/project/s06/lintangwuReport.pdf
But, I really need your advice. Is there any tutorial which teach me how to do this? I am interested in learning core theory with opencv explanation (c++).
Since I am not good at maths( I am working on it - I didnt go to the university , they found me and invited me to join the final year for free because of my programming skills, so I missed math) , full of math stuff will not work.
Please help. Thank you.