Comments (5)
Python's API (match) is actually calling the C++ implementation. So that must be something wrong in your code.
printf("ret=%.10lf\n",ret);
You dont need l
to print a double when using printf
. See a duplicate here: #140 (comment)
from opencv_zoo.
printf("ret=%.10f\n",ret); is not working! result is same as %.10lf
tried std::cout <<std::fixed << std::setprecision(10) << ret << std::endl; not working!
I also tested use Go, result is also wrong
from opencv_zoo.
Actually, I first tested with Go code and found that the comparison results were incorrect. That's why I used C++ code to test it. However, I found that the results were inconsistent with Python's results. The code is very simple, which confuses me.
from opencv_zoo.
- cv::Mat feature1=getFaceFeature(faceDetector,faceRecognizer,image1);
- cv::Mat feature2=getFaceFeature(faceDetector,faceRecognizer,image2);
+ cv::Mat feature1=getFaceFeature(faceDetector,faceRecognizer,image1).clone();
+ cv::Mat feature1=getFaceFeature(faceDetector,faceRecognizer,image1).clone();
Classic C++ misuse.
- Your
feature
is extracted in a function, so it is a local variable. - When you call
getFaceFeature
the first time, feature is extracted and then returned, resulting in a shallow copy tofeature1
. In my changes above,.clone()
makes it a deep copy. - When you call
getFaceFeature
the second time, local variablefeature
is reused to save memory, and it is overwritten by the features of image2. This changes the values infeature1
as well due to shallow copy. - So you get
feature1
andfeature2
, both have exact same values, resulting in very high cosine score (because they are the same one!).
from opencv_zoo.
Thank you very much, the correct value was returned after using the clone() method. I will continue testing in the future, thx!
I check the source code of get feature, outputarray of mat type just give a shallow copy ,so mat need to clone if use it later.
from opencv_zoo.
Related Issues (20)
- Can I run the onnx model as a batch process? HOT 2
- objThreshold parameter not used in yolox HOT 1
- 请问为什么没有提供rpn的量化版本,是不支持siam网络量化嘛? HOT 6
- AttributeError: module 'cv2' has no attribute 'TrackerVit_Params' HOT 9
- K-best BB VitTracker (feature/Question) HOT 3
- VitTracker weights (question) HOT 10
- Mediapipe pose estimation performance HOT 5
- Refreshing template in Vit (Question) HOT 4
- Dynamic Input Shape? HOT 2
- Lack of charsets in models\text_recognition_crnn HOT 8
- `quantize-ort.py` doesn't reproduce the quantized models in the repos HOT 3
- Is it possible to parallelize face detection process using the face_detection_yunet model in C++? HOT 6
- How to process output of face detection network when batch of images is used as network input? HOT 7
- SFace: Quantized model is slower HOT 1
- 为什么输入的两张相同的图片经过处理以后维度会不一样 HOT 10
- 求助求助,随便选两个图片对比的相似度都很高。 HOT 3
- Add Java demos (Last update on 2024-04-07) HOT 4
- I can't run the yunet_2023mar in OpenCV4.9.0 HOT 2
- Face Anti-Spoofing opencv HOT 1
- 总是报错 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencv_zoo.