Commit Graph

340 Commits

Author SHA1 Message Date
Yuantao Feng
bc0618b688
Merge pull request #25582 from fengyuentau:dnn/dump_pbtxt
Current net exporter `dump` and `dumpToFile` exports the network structure (and its params) to a .dot file which works with `graphviz`. This is hard to use and not friendly to new user. What's worse, the produced picture is not looking pretty.
dnn: better net exporter that works with netron #25582

This PR introduces new exporter `dumpToPbtxt` and uses this new exporter by default with environment variable `OPENCV_DNN_NETWORK_DUMP`. It mimics the string output of a onnx model but modified with dnn-specific changes, see below for an example.

![image](https://github.com/opencv/opencv/assets/17219438/0644bed1-da71-4019-8466-88390698e4df)

## Usage

Call `cv::dnn::Net::dumpToPbtxt`:

```cpp
TEST(DumpNet, dumpToPbtxt) {
    std::string path = "/path/to/model.onnx";
    auto net = readNet(path);

    Mat input(std::vector<int>{1, 3, 640, 480}, CV_32F);
    net.setInput(input);

    net.dumpToPbtxt("yunet.pbtxt");
}
```

Set `export OPENCV_DNN_NETWORK_DUMP=1`

```cpp
TEST(DumpNet, env) {
    std::string path = "/path/to/model.onnx";
    auto net = readNet(path);

    Mat input(std::vector<int>{1, 3, 640, 480}, CV_32F);
    net.setInput(input);

    net.forward();
}
```

---

Note:
- `pbtxt` is registered as one of the ONNX model suffix in netron. So you can see `module: ai.onnx` and such in the model.
- We can get the string output of an ONNX model with the following script

```python
import onnx
net = onnx.load("/path/to/model.onnx")
net_str = str(net)
file = open("/path/to/model.pbtxt", "w")
file.write(net_str)
file.close()
```

### 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
- [ ] 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-17 11:07:05 +03:00
Kumataro
c577b24406
Merge pull request #25445 from Kumataro:fix25403
apps: createsamples: fix comment to remove last backslash #25445

Close #25403

### 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-04-18 18:11:07 +03:00
Alexander Smorkalov
daa8f7dfc6 Partially back-port #25075 to 4.x 2024-03-05 12:15:39 +03:00
Yuriy Chernyshov
494d201fda Add missing <sstream> includes 2023-09-05 22:04:26 +03:00
Alexander Smorkalov
004801f1c5 Merge remote-tracking branch 'origin/3.4' into merge-3.4 2023-06-20 09:56:57 +03:00
Alexander Smorkalov
66f86e898c Fixed potential buffer overflow of user file name in create_samples_app 2023-06-02 10:33:24 +03:00
Fabrizio Di Vittorio
044a322519
Merge pull request #23594 from fdivitto:fdivitto-traincascade-patch
fix: traincascade, use C++ persistence API #23594

This pull allows to compile traincascade application with OpenCV 4.6. Changes uses new persistence C++ API in place of legacy one.
2023-05-23 09:19:27 +03:00
Vladimir Ponomarev
9931da772d
Merge pull request #23363 from vovka643:4.x_generate_charuco
Added charuco board generation to gen_pattern.py #23363

added charuco board generation in gen_pattern.py
moved aruco_dict_utils.cpp to samples from opencv_contrib (https://github.com/opencv/opencv_contrib/pull/3464)

### 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
2023-05-19 20:25:59 +03:00
unknown
2c4079fa4b remove unused var 2023-05-15 17:51:12 +02:00
Alexander Smorkalov
f7bee7883b
Merge pull request #23479 from vovka643:4.x_charuco_calib
Charuco board into interactive calibration
2023-05-05 11:25:36 +03:00
vovka643
f7e52076b6 Define charuco board parameters with command line 2023-05-05 10:08:21 +03:00
Sean McBride
47bea69322
Merge pull request #23055 from seanm:sprintf2
* Replaced most remaining sprintf with snprintf
* Deprecated encodeFormat and introduced new method that takes the buffer length
* Also increased buffer size at call sites to be a little bigger, in case int is 64 bit
2023-04-18 09:22:59 +03:00
Alexander Alekhin
18cbfa4a4f Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2023-01-23 00:11:12 +00:00
Christoph Rackwitz
a64b51dd94
Merge pull request #23108 from crackwitz:issue-23107
Usage of imread(): magic number 0, unchecked result

* docs: rewrite 0/1 to IMREAD_GRAYSCALE/IMREAD_COLOR in imread()

* samples, apps: rewrite 0/1 to IMREAD_GRAYSCALE/IMREAD_COLOR in imread()

* tests: rewrite 0/1 to IMREAD_GRAYSCALE/IMREAD_COLOR in imread()

* doc/py_tutorials: check imread() result
2023-01-09 09:55:31 +00:00
Alexander Panov
121034876d
Merge pull request #22986 from AleksandrPanov:move_contrib_charuco_to_main_objdetect
merge with https://github.com/opencv/opencv_contrib/pull/3394

move Charuco API from contrib to main repo:

- add CharucoDetector:
```
CharucoDetector::detectBoard(InputArray image, InputOutputArrayOfArrays markerCorners, InputOutputArray markerIds, 
                             OutputArray charucoCorners, OutputArray charucoIds) const // detect charucoCorners and/or markerCorners
CharucoDetector::detectDiamonds(InputArray image, InputOutputArrayOfArrays _markerCorners,
                                InputOutputArrayOfArrays _markerIds, OutputArrayOfArrays _diamondCorners,
                                OutputArray _diamondIds) const
```

- add `matchImagePoints()` for `CharucoBoard`
- remove contrib aruco dependencies from interactive-calibration tool
- move almost all aruco tests to objdetect

### 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
2022-12-28 17:28:59 +03:00
Alexander Panov
b4b35cff15
Merge pull request #22368 from AleksandrPanov:move_contrib_aruco_to_main_objdetect
Megre together with https://github.com/opencv/opencv_contrib/pull/3325

1. Move aruco_detector, aruco_board, aruco_dictionary, aruco_utils to objdetect
1.1 add virtual Board::draw(), virtual ~Board()
1.2 move `testCharucoCornersCollinear` to Board classes (and rename to `checkCharucoCornersCollinear`)
1.3 add wrappers to keep the old api working
3. Reduce inludes
4. Fix java tests (add objdetect import)
5. Refactoring

### 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

```
**WIP**
force_builders=linux,win64,docs,Linux x64 Debug,Custom
Xbuild_contrib:Docs=OFF

build_image:Custom=ubuntu:22.04
build_worker:Custom=linux-1
```
2022-12-16 12:28:47 +03:00
rogday
04e01e2b31 Add new params 2022-08-05 15:08:16 +03:00
Alexander Smorkalov
47a59d72c9 Merge pull request #22135 from rogday:force_reopen 2022-08-05 11:14:23 +00:00
Alexander Smorkalov
163770f99a Merge pull request #22146 from rogday:symcircles 2022-08-05 11:13:14 +00:00
Smirnov Egor
08696d92ea Add option to force reopen camera in interactive calibration tool 2022-07-26 15:43:40 +03:00
Smirnov Egor
2c2466fb25 Add symmetric circles board 2022-07-26 15:39:33 +03:00
rogday
33b1e76e48 fix save_frames parameter 2022-07-18 12:53:04 +03:00
rogday
b91f173680
Merge pull request #22147 from rogday:zoom_factor
Add zoom factor to interactive calibration tool

* add zoom factor

* address review comments
2022-06-30 23:31:52 +03:00
Alexander Alekhin
2a4926f417 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2022-06-26 14:22:24 +00:00
Sean McBride
35f1a90df7
Merge pull request #22149 from seanm:sprintf
Replaced sprintf with safer snprintf

* Straightforward replacement of sprintf with safer snprintf

* Trickier replacement of sprintf with safer snprintf

Some functions were changed to take another parameter: the size of the buffer, so that they can pass that size on to snprintf.
2022-06-25 06:48:22 +03:00
Christine Poerschke
db5b22e895
Merge pull request #22065 from cpoerschke:3.4-apps-visualisation-configurable-codec
* apps/opencv_visualisation: configurable video codec

* Update apps/visualisation/opencv_visualisation.cpp
2022-06-17 14:48:30 +03:00
Alexander Smorkalov
533bb035cf Save Frames option for interactive calibration tool
The option to save all frames that contribute to final calibration result.
Useful for dataset collection and further offline tuning.
2022-06-10 09:32:58 +03:00
Lukas-Alexander Weber
8ca394efaf
Merge pull request #22005 from lukasalexanderweber:delete_stitching_tool
Move stitching package and tool to a dedicated repository

* deleted moved files

* Update README.md
2022-05-26 22:30:24 +03:00
Alexander Alekhin
d9bf522b27 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2022-05-23 16:06:14 +00:00
Alexander Alekhin
89f8d4ae12 build: GCC12 warnings 2022-05-15 16:21:16 +00:00
Lukas-Alexander Weber
d37bcbdc92
Merge pull request #21420 from lukasalexanderweber:4.x
Introduce Cropping to OpenCV Stitching Tool

* Introduced Cropping

* integrate https://github.com/opencv/opencv/pull/21413/

* fixed failing subsetter tests

* updated stuff
2022-02-01 16:56:44 +00:00
Alexander Alekhin
c78a8dfd2d fix 4.x links 2021-12-22 13:24:30 +00:00
Lukas-Alexander Weber
fa5c7a9e75
Merge pull request #21020 from lukasalexanderweber:squash
Created Stitching Tool based on stitching_detailed.py
2021-11-08 11:54:06 +00:00
rogday
6801dd043d
Merge pull request #20494 from rogday:onnx_diagnostic_fix
fix ONNXImporter diagnostic mode layer registration issue

* fix layer registration, thread unsafe access and align the behavior of DNN_DIAGNOSTICS_RUN between onnx and tf importers

* move skipModelInput

* print all missing layers

* address TF issue
2021-08-20 14:43:47 +00:00
Smirnov Egor
dc5199feea skipping missing layers and layer failures 2021-06-25 11:26:37 +03:00
Alexander Alekhin
28f919d9d2 apps(model_diagnostics): fix invalid callback 2021-04-01 10:26:22 +00:00
Anastasia M
e08de1101d
Merge pull request #19693 from LupusSanctus:onnx_diagnostic
ONNX diagnostic tool

* Final

* Add forgotten Normalize layer to the set of supported types

* ONNX diagnostic tool corrections

* Fixed CI test warnings

* Added code minor corrections

Co-authored-by: Sergey Slashchinin <sergei.slashchinin@xperience.ai>
2021-03-29 16:38:28 +00:00
Alexander Alekhin
ce8027c6fb Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-11-17 21:56:26 +00:00
shioko
fe9a8ebea2
Fix typo 'Applicatioin' 2020-11-17 15:02:55 +00:00
Alexander Alekhin
0b4c101e8a Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-03-23 16:54:35 +00:00
Alexander Alekhin
6db9f00fd1 cmake(apps): support OPENCV_INSTALL_APPS_LIST
Usage:
- cmake -DOPENCV_INSTALL_APPS_LIST=opencv_version ...
2020-03-23 00:06:42 +00:00
Alexander Alekhin
ca23c0e630 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-03-17 13:23:33 +03:00
Alexander Alekhin
3d36f9044d opencv_version: dump threads information 2020-03-12 16:41:03 +03:00
Alexander Alekhin
96b26dc8f4 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2020-02-20 19:47:27 +03:00
atinfinity
f81fdd58da
Merge pull request #16445 from atinfinity:fixed-typo
* fixed typo

* add compatibility code to handle migration
2020-02-16 19:16:33 +03:00
Brian Wignall
f9c514b391 Fix spelling typos
backport commit 659ffaddb4
2019-12-27 12:46:53 +00:00
Brian Wignall
659ffaddb4 Fix spelling typos 2019-12-26 06:45:03 -05:00
luz.paz
57ccf14952 FIx misc. source and comment typos
Found via `codespell -q 3 -S ./3rdparty,./modules -L amin,ang,atleast,dof,endwhile,hist,uint`

backporting of commit: 32aba5e64b
2019-08-15 13:09:52 +03:00
luz.paz
32aba5e64b FIx misc. source and comment typos
Found via `codespell -q 3 -S ./3rdparty,./modules -L amin,ang,atleast,dof,endwhile,hist,uint`
2019-08-14 13:33:49 -04:00
Alexander Alekhin
166ecaeda8 Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2019-05-23 19:50:20 +03:00