Skip to content

TanH darknet and test#19474

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
aryanshomray:darknet_tanh
Feb 17, 2021
Merged

TanH darknet and test#19474
opencv-pushbot merged 1 commit intoopencv:3.4from
aryanshomray:darknet_tanh

Conversation

@aryanshomray
Copy link
Copy Markdown
Contributor

@aryanshomray aryanshomray commented Feb 7, 2021

Merge with extra: opencv/opencv_extra#847

This PR resolves the issue #19393 and the test data is added in opencv_extra through PR #opencv/opencv_extra/pull/847

Pull Request Readiness Checklist

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

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to 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
opencv_extra=tanh_darlnet_testdata

force_builders=Custom,Custom Win,Custom Mac
build_image:Custom=ubuntu-openvino-2021.2.0:20.04
build_image:Custom Win=openvino-2021.2.0
build_image:Custom Mac=openvino-2021.2.0

test_modules:Custom=dnn,python2,python3,java
test_modules:Custom Win=dnn,python2,python3,java
test_modules:Custom Mac=dnn,python2,python3,java

buildworker:Custom=linux-1
# disabled due high memory usage: test_opencl:Custom=ON
test_opencl:Custom=OFF
test_bigdata:Custom=1
test_filter:Custom=*

@aryanshomray
Copy link
Copy Markdown
Contributor Author

The tests are failing because the test data is not present in opencv_extra during testing. Is there any way to do that?

@dkurt
Copy link
Copy Markdown
Member

dkurt commented Feb 7, 2021

Hi! Thanks for contributing! Please choose 3.4 branch as a target one (we will port to master after that)

@aryanshomray aryanshomray changed the base branch from master to 3.4 February 7, 2021 16:23
@dkurt
Copy link
Copy Markdown
Member

dkurt commented Feb 7, 2021

Please remove the branch locally (or rename) and just create a new branch from 3.4 but with the same name darknet_tanh

@alalek
Copy link
Copy Markdown
Member

alalek commented Feb 7, 2021

This patch should go into 3.4 branch first.
We will merge changes from 3.4 into master regularly (weekly/bi-weekly).

Please:

  • change "base" branch of this PR: master => 3.4 (use "Edit" button near PR title)
  • rebase your commits from master onto 3.4 branch. For example:
    git rebase -i --onto upstream/3.4 upstream/master
    (check list of your commits, save and quit (Esc + "wq" + Enter)
    where upstream is configured by following this GitHub guide and fetched (git fetch upstream).
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace".

P.S. The same steps are required for corresponding PR from opencv_extra.

@asmorkalov
Copy link
Copy Markdown
Contributor

@aryanshomray Friendly reminder. Please pay attention that the patch breaks dnn module tests on CI.

@aryanshomray
Copy link
Copy Markdown
Contributor Author

aryanshomray commented Feb 15, 2021

Hi,
I have tested the package in my local environment, and the tests were passed and after going through the details of the failed test to find about the issue.
The issue is primarily due to the lack of training data in the opencv_extra repo, which has been patched in this PR.
The error message is the same for each failed test.

Error Message
unknown file
C++ exception with description "OpenCV(3.4.13-dev) /home/opencv-cn/slave/workspace/precommit/ubuntu-20.04-arm64/opencv/modules/ts/src/ts.cpp:1062: error: (-2:Unspecified error) OpenCV tests: Can't find required data file: dnn/darknet/tanh_in.npy in function 'findData'
" thrown in the test body.
Stacktrace
unknown file
C++ exception with description "OpenCV(3.4.13-dev) /home/opencv-cn/slave/workspace/precommit/ubuntu-20.04-arm64/opencv/modules/ts/src/ts.cpp:1062: error: (-2:Unspecified error) OpenCV tests: Can't find required data file: dnn/darknet/tanh_in.npy in function 'findData'
" thrown in the test body.

I am not able to understand the reason for this error since it should be able to access the patch data.

@dkurt
Copy link
Copy Markdown
Member

dkurt commented Feb 15, 2021

@aryanshomray, an error is

[ RUN      ] Test_Darknet_layers.tanh/0, where GetParam() = OCV/CPU
unknown file: Failure
C++ exception with description "OpenCV(3.4.13-dev) /build/precommit_linux64/3.4/opencv/modules/dnn/test/npy_blob.cpp:83: error: (-215:Assertion failed) getType(header) == "<f4" in function 'blobFromNPY'
" thrown in the test body.

Most likely, .npy has float64 data type - should be float32

@asmorkalov
Copy link
Copy Markdown
Contributor

@aryanshomray Thanks for the contribution! The test passes now. Please squash the commits here and in extra repo to have clean git history.

Copy link
Copy Markdown
Contributor

@l-bat l-bat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

Copy link
Copy Markdown
Member

@dkurt dkurt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


TEST_P(Test_Darknet_layers, tanh)
{
testDarknetLayer("tanh");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aryanshomray
Could you please update test data to have non-trivial different values in testdata/dnn/darknet/tanh_out.npy file?
Current all 8 values are equal to 1.


BTW, GitHub shows "Empty file." in opencv_extra PR, but it is not correct (GitHub bug)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I have made the changes in the data. All 1 values might be because of large input numbers that I had taken for the test.

@opencv-pushbot opencv-pushbot merged commit 8d21c84 into opencv:3.4 Feb 17, 2021
@alalek alalek mentioned this pull request Feb 21, 2021
@alalek alalek mentioned this pull request Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants