The test has race condition, which is addressed by the patch.
The race is next:
Master thread is calling execute (effectively blocked, waiting for
callback to be called)
"Async" thread picks up the callback
Call the callback
Then sets the variables in test
After call back is called, master thread is unblocked and may check
the variables (set in point 4 by the "async" thread) earlier then they
actually changed
Changes:
callback should be called as the last step (after flag variables are
set), as it effectively unblock the master thread
fixes#18974
[G-API]: kmeans() Standard Kernel Implementation
* cv::gapi::kmeans kernel implementation
- 4 overloads:
- standard GMat - for any dimensionality
- GMat without bestLabels initialization
- GArray<Point2f> - for 2D
- GArray<Point3f> - for 3D
- Accuracy tests:
- for every input - 2 tests
1) without initializing. In this case, no comparison with cv::kmeans is done as kmeans uses random auto-initialization
2) with initialization
- in both cases, only 1 attempt is done as after first attempt kmeans initializes bestLabels randomly
* Addressing comments
- bestLabels is returned to its original place among parameters
- checkVector and isPointsVector functions are merged into one, shared between core.hpp & imgproc.hpp by placing it into gmat.hpp (and implementation - to gmat.cpp)
- typos corrected
* addressing comments
- unified names in tests
- const added
- typos
* Addressing comments
- fixed the doc note
- ddepth -> expectedDepth, `< 0 ` -> `== -1`
* Fix unsupported cases of input Mat
- supported: multiple channels, reversed width
- added test cases for those
- added notes in docs
- refactored checkVector to return dimentionality along with quantity
* Addressing comments
- makes chackVector smaller and (maybe) clearer
* Addressing comments
* Addressing comments
- cv::checkVector -> cv::gapi::detail
* Addressing comments
- Changed checkVector: returns bool, quantity & dimensionality as references
* Addressing comments
- Polishing checkVector
- FIXME added
* Addressing discussion
- checkVector: added overload, separate two different functionalities
- depth assert - out of the function
* Addressing comments
- quantity -> amount, dimensionality -> dim
- Fix typos
* Addressing comments
- fix docs
- use 2 variable's definitions instead of one (for all non-trivial variables)
* TBB executor for GAPI
- the sole executor
- unit tests for it
- no usage in the GAPI at the momnet
* TBB executor for GAPI
- introduced new overload of execute to explicitly accept tbb::arena
argument
- added more basic tests
- moved arena creation code into tests
-
* TBB executor for GAPI
- fixed compie errors & warnings
* TBB executor for GAPI
- split all-in-one execute() function into logicaly independant parts
* TBB executor for GAPI
- used util::variant in in the tile_node
* TBB executor for GAPI
- moved copy_through_move to separate header
- rearranged details staff in proper namespaces
- moved all implementation into detail namespace
* TBB executor for GAPI
- fixed build error with TBB 4.4.
- fixed build warnings
* TBB executor for GAPI
- aligned strings width
- fixed spaces in expressions
- fixed english grammar
- minor improvements
* TBB executor for GAPI
- added more comments
- minor improvements
* TBB executor for GAPI
- changed ITT_ prefix for macroses to GAPI_ITT
* TBB executor for GAPI
- no more "unused" warning for GAPI_DbgAssert
- changed local assert macro to man onto GAPI_DbgAssert
* TBB executor for GAPI
- file renamings
- changed local assert macro to man onto GAPI_DbgAsse
* TBB executor for GAPI
- test file renamed
- add more comments
* TBB executor for GAPI
- minor clenups and cosmetic changes
* TBB executor for GAPI
- minor clenups and cosmetic changes
* TBB executor for GAPI
- changed spaces and curly braces alignment
* TBB executor for GAPI
- minor cleanups
* TBB executor for GAPI
- minor cleanups
Support XCFramework builds, Catalyst
* Early work on xcframework support
* Improve legibility
* Somehow this works
* Specify ABIs in a place where they won't get erased
If you pass in the C/CXX flags from the Python script, they won't be respected. By doing it in the actual toolchain, the options are respected and Catalyst successfully links.
* Clean up and push updates
* Actually use Catalyst ABI
Needed to specify EXE linker flags to get compiler tests to link to the Catalyst ABIs.
* Clean up
* Revert changes to common toolchain that don't matter
* Try some things
* Support Catalyst build in OSX scripts
* Remove unnecessary iOS reference to AssetsLibrary framework
* Getting closer
* Try some things, port to Python 3
* Some additional fixes
* Point Cmake Plist gen to osx directory for Catalyst targets
* Remove dynamic lib references for Catalyst, copy iOS instead of macos
* Add flag for building only specified archs, remove iOS catalyst refs
* Add build-xcframework.sh
* Update build-xcframework.sh
* Add presumptive Apple Silicon support
* Add arm64 iphonesimulator target
* Fix xcframework build
* Working on arm64 iOS simulator
* Support 2.7 (replace run with check_output)
* Correctly check output of uname_m against arch
* Clean up
* Use lipo for intermediate frameworks, add python script
Remove unneeded __init__.py
* Simplify python xcframework build script
* Add --only-64-bit flag
* Add --framework-name flag
* Document
* Commit to f-strings, improve console output
* Add i386 to iphonesimulator platform in xcframework generator
* Enable objc for non-Catalyst frameworks
* Fix xcframework builder for paths with spaces
* Use arch when specifying Catalyst build platform in build command
* Fix incorrect settings for framework_name argparse configuration
* Prefer underscores instead of hyphens in new flags
* Move Catalyst flags to where they'll actually get used
* Use --without=objc on Catalyst target for now
* Remove get_or_create_folder and simplify logic
* Remove unused import
* Tighten up help text
* Document
* Move common functions into cv_build_utils
* Improve documentation
* Remove old build script
* Add readme
* Check for required CMake and Xcode versions
* Clean up TODOs and re-enable `copy_samples()`
Remove TODO
Fixup
* Add missing print_function import
* Clarify CMake dependency documentation
* Revert python2 change in gen_objc
* Remove unnecessary builtins imports
* Remove trailing whitespace
* Avoid building Catalyst unless specified
This makes Catalyst support a non-breaking change, though defaults should be specified when a breaking change is possible.
* Prevent lipoing for the same archs on different platforms before build
* Rename build-xcframework.py to build_xcframework.py
* Check for duplicate archs more carefully
* Prevent sample copying error when directory already exists
This can happen when building multiple architectures for the same platform.
* Simplify code for checking for default archs
* Improve build_xcframework.py header text
* Correctly resolve Python script paths
* Parse only known args in ios/osx build_framework.py
* Pass through uncaptured args in build_xcframework to osx/ios build
* Fix typo
* Fix typo
* Fix unparameterized build path for intermediate frameworks
* Fix dyanmic info.plist path for catalyst
* Fix utf-8 Python 3 issue
* Add dynamic flag to osx script
* Rename platform to platforms, remove armv7s and i386
* Fix creation of dynamic framework on maccatalyst and macos
* Update platforms/apple/readme.md
* Add `macos_archs` flag and deprecate `archs` flag
* Allow specification of archs when generating xcframework from terminal
* Change xcframework platform argument names to match archs flag names
* Remove platforms as a concept and shadow archs flags from ios/osx .py
* Improve documentation
* Fix building of objc module on Catalyst, excluding Swift
* Clean up build folder logic a bit
* Fix framework_name flag
* Drop passthrough_args, use unknown_args instead
* minor: coding style changes
Co-authored-by: Chris Ballinger <cballinger@rightpoint.com>
Support for Pool1d layer for OpenCV and OpenCL targets
* Initial version of Pool1d support
* Fix variable naming
* Fix 1d pooling for OpenCL
* Change support logic, remove unnecessary variable, split the tests
* Remove other depricated variables
* Fix warning. Check tests
* Change support check logic
* Change support check logic, 2