-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
calib3d: some tests fails using clang on Raspberry Pi 3 #11056
Copy link
Copy link
Closed
Description
System information (version)
- OpenCV => master ( c729fbd )
- Operating System / Platform => Debian (Raspbian) 9.3 / Raspberry Pi 3
- Compiler => GCC 4.9.2 / Clang 3.7.0
Detailed description
- The following tests fails from
opencv_test_calib3d
[==========] 89 tests from 46 test cases ran. (472539 ms total)
[ PASSED ] 86 tests.
[ FAILED ] 3 tests, listed below:
[ FAILED ] Calib3d_SolveP3P.accuracy
[ FAILED ] Calib3d_SolvePnPRansac.accuracy
[ FAILED ] Calib3d_SolvePnP.accuracy
3 FAILED TESTS
- On the other hand, when building with GCC, this doesn't happen
[==========] 89 tests from 46 test cases ran. (410682 ms total)
[ PASSED ] 89 tests.
- I reported similar behavior ( Calib3d_SolvePnP.accuracy is too unstable based on random seed #9187 ) but this was based on unstable
srand, so it's independent for this case. - This time, same code, same data, same platform, but different compiler.
- Since we have a reference from gcc, I traced back where the data differs and trace backed to here in ap3p.cpp
complex<double> complex2 = 2 * q4 / sqrt_2m;
- I added some
printfand found weird behvior of complex
GCC(expected behavior) |Clang (weird behavior)
=========================|=========================
q4 :-0.00130684 |q4 :-0.00130684
2 * q4 :(-0.00261369,0) |2 * q4 :(-0.00261369,0)
sqrt_2m :(0.00617747,0) |sqrt_2m :(0.00617747,0)
complex2:(-0.4231,0) |complex2:(-0.00261369,0)
- It seems division of
complex<double>has something wrong. - From this part, the data was different, and concluded as a massive number of failure.
- Just to make sure, I wrote a small code to check the behaviour.
- Even for the simplest following code, the result differs between the compiler
#include <iostream>
#include <cmath>
#include <complex>
int main(int argc, char**argv)
{
std::complex<double> a(-0.00261369, 0);
std::complex<double> b(0.00617747, 0);
std::complex<double> c = a / b;
std::cout << "a" << a << std::endl;
std::cout << "b" << b << std::endl;
std::cout << "c" << c << std::endl;
return 0;
}
=========GCC=========
a(-0.00261369,0)
b(0.00617747,0)
c(-0.4231,0)
=========Clang=======
a(-0.00261369,0)
b(0.00617747,0)
c(-0.00261369,0)
=====GCC Version=====
g++ (Raspbian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=====Clang Version===
Raspbian clang version 3.7.0-4~bpo8+1 (tags/RELEASE_370/final) (based on LLVM 3.7.0)
Target: arm-unknown-linux-gnueabihf
Thread model: posix
- I also tried on wandbox but this issue did not reproduce. I didn't use any suspicious clang, I installed clang using
apt - I added a workaround using
ifdefin this code, and avoided the issue. - I'll send PR later.
Steps to reproduce
- run
opencv_test_calib3don Raspbian on Raspberry Pi 3, using clang
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels