Commit Graph

34189 Commits

Author SHA1 Message Date
CNOCycle
7713c84465
Merge pull request #25297 from CNOCycle:tflite/transpose
Support Transpose op in TFlite #25297

**Merge with extra**: https://github.com/opencv/opencv_extra/pull/1168

The purpose of this PR is to introduce support for the Transpose op in TFlite format and to add a shape comparison between the output tensors and the references. In some occasional cases, the shape of the output tensor is `[1,4,1,1]`, while the shape of the reference tensor is `[1,4]`. Consequently, the norm check incorrectly reports that the test has passed, as the residual is zero.

Below is a Python script for generating testing data. The generated data can be integrated into the repo `opencv_extra`.

```python
import numpy as np
import tensorflow as tf

PREFIX_TFL = '/path/to/opencv_extra/testdata/dnn/tflite/'

def generator(input_tensor, model, saved_name):

    # convert keras model to .tflite format
    converter = tf.lite.TFLiteConverter.from_keras_model(model)
    #converter.optimizations = [tf.lite.Optimize.DEFAULT]
    converter.optimizations = [None]
    tflite_model = converter.convert()
    with open(f'{PREFIX_TFL}/{saved_name}.tflite', 'wb') as f:
        f.write(tflite_model)

    # save the input tensor to .npy
    if input_tensor.ndim == 4:
        opencv_tensor = np.transpose(input_tensor, (0,3,1,2))
    else:
        opencv_tensor = input_tensor
    opencv_tensor = np.copy(opencv_tensor, order='C').astype(np.float32)
    np.save(f'{PREFIX_TFL}/{saved_name}_inp.npy', opencv_tensor)

    # generate output tenosr and save it to .npy
    mat_out = model(input_tensor).numpy()
    mat_out = np.copy(mat_out, order='C').astype(np.float32)
    if mat_out.ndim == 4:
        mat_out = np.transpose(mat_out, (0,3,1,2))
    interpreter = tf.lite.Interpreter(model_content=tflite_model)
    out_name = interpreter.get_output_details()[0]['name']
    np.save(f'{PREFIX_TFL}/{saved_name}_out_{out_name}.npy', mat_out)

def build_transpose():

    model_name = "keras_permute"
    mat_in = np.array([[[1,2,3], [4,5,6]]], dtype=np.float32)

    model = tf.keras.Sequential()
    model.add(tf.keras.Input(shape=(2,3)))
    model.add(tf.keras.layers.Permute((2,1)))
    model.summary()

    generator(mat_in, model, model_name)

if __name__ == '__main__':
    build_transpose()
```

### Pull Request Readiness Checklist

- [x] I agree to contribute to the project under Apache 2 License.
- [X] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [X] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [X] The feature is well documented and sample code can be built with the project CMake
2024-05-15 20:07:25 +03:00
Laurent Berger
76d9f7aaeb
Merge pull request #25591 from LaurentBerger:I25589
Remove dnn::layer::allocate in doc #25591

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work #25589 
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-05-15 17:08:52 +03:00
Alexander Smorkalov
68581e7b4a
Merge pull request #25592 from asmorkalov:as/gapi_disable_steaming_again
Disable more streaming test in G-API due to instability.
2024-05-15 16:41:13 +03:00
Alexander Smorkalov
c034c46e69 Disable more streaming test in G-API due to instability. 2024-05-15 15:41:23 +03:00
Alexander Smorkalov
4d4def2d36
Merge pull request #25590 from asmorkalov:as/restore_highgui_test
Restored and extended Highgui test logic for small windows.
2024-05-15 14:56:00 +03:00
Alexander Smorkalov
2e07ec1f87 Restored and extended Highgui test logic for small windows. 2024-05-15 12:47:22 +03:00
Kumataro
47a6ffb73c
Merge pull request #25561 from Kumataro:fix25560
highgui: wayland: expand image width if title bar cannot be shown

Close #25560

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-05-15 11:00:46 +03:00
alexlyulkov
03507e06b4
Merge pull request #25518 from alexlyulkov:al/fixed-gemm-openvino
Fixed OpenVINO gemm layer #25518

Fixed OpenVINO gemm layer
The problem was that our layer didn't properly handle all the possible gemm options in OpenVINO mode
Fixes #25472

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-05-14 17:41:19 +03:00
Alexander Smorkalov
f4e5438401
Merge pull request #25566 from asmorkalov:as/moments_documentation
Synchornized cv::moments documentation with actual implementation.
2024-05-14 17:19:41 +03:00
Alexander Smorkalov
02ad8c284f
Merge pull request #25577 from FantasqueX:fix-zlib-ng-version-parse-1
Fix zlib-ng version parse
2024-05-14 17:16:26 +03:00
Alexander Smorkalov
58e007e183
Merge pull request #25583 from mshabunin:fix-emd-32bit
imgproc: fix allocation issue in EMD
2024-05-14 16:43:02 +03:00
Maksim Shabunin
1614b8df4e imgproc: fix allocation issue in EMD 2024-05-14 12:51:26 +03:00
Alexander Smorkalov
3c7e94b275
Merge pull request #25576 from mshabunin:fix-env-doc
doc: fix env change method in the environment reference
2024-05-13 15:24:03 +03:00
Letu Ren
023d805492 Fix zlib-ng version parse
Currently, zlib-ng version is 'zlib ver #define ZLIB_VERSION "1.3.0.zlib-ng"'. Because ocv_parse_header_version only accepts dot and numbers and doesn't accepts 1.3.0.zlib-ng. This patch changes ocv_parse_header_version to accept all characters between parentheses.
2024-05-13 19:32:00 +08:00
Kumataro
8dc9ff5624
Merge pull request #25551 from Kumataro:fix25550
highgui: wayland: fix to pass highgui test #25551

Close #25550

- optimize Mat to XRGB8888 conversion with OpenCV functions
  - extend to support CV_8S/16U/16S/32F/64F
  - extend to support 1/4 channels
- fix to update value timing
 - initilize slider_ value if value is not nullptr.
 - Update user-ptr value and call on_change() function if cv_wl_trackbar::draw() is not called.
- Update usage of WAYLAND/XDG macro to avoid reference undefined macro.
- Update documents

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-05-13 14:26:24 +03:00
Maksim Shabunin
78c9793d5b doc: fix env change method in the environment reference 2024-05-13 14:16:31 +03:00
Rostislav Vasilikhin
1d9a4120fa
Merge pull request #25565 from savuor:rv/hal_eq_hist
Merge pull request #25565 from savuor/rv/hal_eq_hist

HAL for equalizeHist() added #25565

fixes #25530

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-05-09 08:37:55 +03:00
Alexander Smorkalov
55eebe81c3 Synchornized cv::moments documentation with actual implementation. 2024-05-09 08:30:36 +03:00
Alexander Smorkalov
1f1ba7e402
Merge pull request #25563 from asmorkalov:as/HAL_min_max_idx
Transform offset to indeces for MatND in minMaxIdx HAL #25563

Address comments in https://github.com/opencv/opencv/pull/25553

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-05-08 18:57:02 +03:00
Rostislav Vasilikhin
5bd64e09a3
Merge pull request #25554 from savuor:rv/hal_lut
Merge pull request #25554 from savuor:rv/hal_lut

HAL for LUT added #25554

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-05-08 17:45:08 +03:00
Alexander Smorkalov
faa259ab34
Merge pull request #25553 from asmorkalov:as/HAL_min_max_idx
Fix HAL interface for hal_ni_minMaxIdx #25553

Fixes https://github.com/opencv/opencv/issues/25540

The original implementation call HAL with the same parameters independently from amount of channels. The patch uses HAL correctly for the case cn > 1.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-05-07 20:46:17 +03:00
Alexander Smorkalov
a9e489f149
Merge pull request #25558 from asmorkalov:as/moments_sanity
Tune sanity threshold in Moments performance test for Android aarch64
2024-05-07 19:38:06 +03:00
Alexander Smorkalov
392fd4edd1 Tune sanity threshold in Moments performance test for Android aarch64. 2024-05-07 18:24:43 +03:00
Alexander Smorkalov
ba65d2eb0d
Merge pull request #25549 from mshabunin:fix-cap-images-noise
videoio: decreased log level for failed backends in capture and writer open
2024-05-07 09:01:50 +03:00
Alexander Smorkalov
8bc90a4bff
Merge pull request #25484 from mshabunin:bounding-rect-alignment
imgproc: improved test for boundingRect
2024-05-07 08:58:07 +03:00
Maksim Shabunin
7127161426 videoio: decreased log level for failed backends in VideoCapture and VideoWriter open 2024-05-06 20:48:17 +03:00
Alexander Smorkalov
26a5730f0d
Merge pull request #25542 from mshabunin:fix-disable-diagram
doc: disable inheritance graphs
2024-05-06 11:08:18 +03:00
Alexander Smorkalov
a4486c0e20
Merge pull request #25541 from mshabunin:fix-numpy2x-test
python: adapt test to NumPy 2.x
2024-05-06 08:39:00 +03:00
Alexander Smorkalov
70d333d336
Merge pull request #25483 from asmorkalov:as/HAL_meanStdDev
HAL API for meanStdDev
2024-05-06 08:19:43 +03:00
Alexander Smorkalov
c43957cbec
Merge pull request #25538 from asmorkalov:as/resnet_optional
Made fcn-resnet50-12.onnx model optional.
2024-05-06 08:16:51 +03:00
Maksim Shabunin
4081a309bf doc: disabled inheritance graphs 2024-05-03 22:09:33 +03:00
Maksim Shabunin
a8df49f170 doc: fixed modern Javadoc issue 2024-05-03 22:09:19 +03:00
Maksim Shabunin
c4ce94232b imgproc: fixed alignment issue and improved test for boundingRect 2024-05-03 21:26:40 +03:00
Maksim Shabunin
af4531b378 python: adapt test to NumPy 2.x 2024-05-03 20:10:41 +03:00
Alexander Smorkalov
b94cb5bc68 HAL interface for meanStdDev. 2024-05-03 16:36:43 +03:00
Alexander Smorkalov
d8e18f4576 Made fcn-resnet50-12.onnx model optional. 2024-05-03 16:14:22 +03:00
Alexander Smorkalov
75f3f0fac8
Merge pull request #25526 from NlSEMONO:patch-1
Fixed a typo in text_detection.cpp
2024-05-03 14:44:31 +03:00
Alexander Smorkalov
ac9a858377
Merge pull request #25524 from alexlyulkov:al/openvino-layers
Added more OpenVINO layers to dnn
2024-05-03 13:16:56 +03:00
Alexander Smorkalov
6e5a53c37a
Merge pull request #25532 from asmorkalov:as/HAL_moments_bug
Fix moments integration to OpenCV HAL
2024-05-03 12:34:51 +03:00
Alexander Smorkalov
d9555dbdd1
Merge pull request #25535 from asmorkalov:as/convertfp16_imgcodecs
Got rid of deprecated convertFp16 in imgcodecs module.
2024-05-03 12:33:36 +03:00
Alexander Smorkalov
c539cfd31a
Merge pull request #25435 from WanliZhong:fcn2onnx
change fcn8s-heavy-pascal tests from caffe to onnx
2024-05-03 11:13:13 +03:00
Alexander Smorkalov
9fe5615f2f Got rid of deprecated convertFp16 in imgcodecs module. 2024-05-03 11:05:08 +03:00
Alexander Smorkalov
6bf758ecc4
Merge pull request #24782 from FantasqueX:4.x-zlib-ng
Add zlib-ng as an alternative zlib implementation
2024-05-03 10:55:25 +03:00
Alexander Smorkalov
02c3132f02 Fix moments integration to OpenCV HAL. 2024-05-03 08:40:43 +03:00
Alexander Smorkalov
7ea4364c63
Merge pull request #25528 from asmorkalov:as/python_hdr_parser_fix
Fixed SyntaxWarning: invalid escape sequence '\w' in header parser.
2024-05-03 08:01:14 +03:00
Rostislav Vasilikhin
bc95f27e56
Merge pull request #25509 from savuor:rv/hal_otsu
HAL added for Otsu threshold #25509

fixes #25393

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2024-05-02 20:50:08 +03:00
Alexander Smorkalov
5aaa570fef Fixed SyntaxWarning: invalid escape sequence '\w' in header parser. 2024-05-02 20:38:23 +03:00
Wanli
ed47cce1c5 change fcn8s-heavy-pascal tests from caffe to onnx 2024-05-03 00:15:09 +08:00
NlSEMONO
c999cb3c5e
Update text_detection.cpp 2024-05-02 11:38:18 -04:00
Alexander Smorkalov
ce642e994d
Merge pull request #25510 from Kumataro:fix25497
highgui: wayland: support imshow() without pre-calling namedWindow()
2024-05-02 14:41:14 +03:00