add java wrappers to dnn module#8998
add java wrappers to dnn module#8998opencv-pushbot merged 1 commit intoopencv:masterfrom abratchik:DNN.java.wrappers.fix
Conversation
| @@ -0,0 +1,30 @@ | |||
| function(download_google_inception5 dst_dir status_var) | |||
There was a problem hiding this comment.
No need to download these files, because they are not external to OpenCV.
- space_shuttle.jpg : opencv sources
- tensorflow_inception_graph.pb: opencv_extra testdata directory, check for
$ENV{OPENCV_TEST_DATA_PATH}
There was a problem hiding this comment.
Hi, Alex, thank you, this helps. Need your advice though: $ENV{OPENCV_TEST_DATA_PATH} - is this cmake variable or environment? I did not find it in CMakeVars.txt. The closest match was OPENCV_TEST_DATA_INSTALL_PATH=share/OpenCV/testdata. As far as I can see it is used currently only by text module.
The other question - do I have to copy space_shuttle to one of the build/ subfolders during cmake? Which one I need to use?
There was a problem hiding this comment.
Hi, @abratchik ! OPENCV_TEST_DATA_PATH and OPENCV_DNN_TEST_DATA_PATH both works only as environment variables.
There was a problem hiding this comment.
Hi, Dmitry, thank you. This makes sense. I checked on my Mac, OPENCV_TEST_DATA_PATH points at contrib_extra/testdata i.e. part of contrib_extra repository. I'm not sure if it was set automatically or I did it manually, don't remember. This is fine but here are few questions:
- I'd like to use space_shuttle.jpg, which is in the opencv/dnn/tutorials/images. If I copy it there it means I'm duplicating the file from opencv to opencv_extra, which is not good. On the other hand, when I'm running unit test in java, I need to find this file somehow. If it is somewhere under build/ it is easy because this is current directory for java autotests. I can also use OPENCV_TEST_DATA_PATH but this is less attractive because this variable may be not defined - do I have to skip test in this case?
- OPENCV_DNN_TEST_DATA_PATH is empty on my Mac. If I want my tests to be included in auto-builds, I need to know where this var is pointing to on auto-build environments.
Sorry if my questions are a bit unclear. Please give me more detailed guidance where I need to place the test files for dnn module. I'm fine with either approach but having them in the tree under /build folder seems to be more convenient for java autotests. I also found build/share/OpenCV/testdata, could place it there. Please advise which way is the right one.
There was a problem hiding this comment.
OPENCV_TEST_DATA_PATH is specified manually before OpenCV test launch.
this variable may be not defined - do I have to skip test in this case?
OpenCV C++ tests fail in this case. They are "skipped" in case of external data only.
Unfortunately we don't have Java tests that uses OPENCV_TEST_DATA_PATH (in C++ tests test data is managed by "opencv_ts" module - via cvtest::findDataFile() call).
OPENCV_DNN_TEST_DATA_PATH points to additional optional data (large files with DNN models).
They can be downloaded by this script into separate directory ("OPENCV_DNN_TEST_DATA_PATH/dnn", size is 2.1Gb).
There was a problem hiding this comment.
Thank you Alex. So would that be safe to assume that OPENCV_DNN_TEST_DATA_PATH is set on the auto-build environments?
Last question - is it possible to move space_shuttle to testdata/dnn? I mean since there is a general rule to store test data there then I guess no point to have any test images in the main repository?
There was a problem hiding this comment.
OPENCV_TEST_DATA_PATH - it must be set
OPENCV_DNN_TEST_DATA_PATH - optional, especially in case of embedded device.
is it possible to move space_shuttle to testdata/dnn
Yes, you can copy this file to opencv_extra.
There was a problem hiding this comment.
Great, just added, please kindly check and merge. I'll be waiting for your merge to complete the dnn wrappers pull request.
|
Hi, @alalek , with your latest patch java wrappers are generated successfully but it seems like CV__DNN_EXPERIMENTAL_ is also creating issues for python wrappers: |
|
Order of includes is important, please add this line into |
modules/python/src2/hdr_parser.py
Outdated
| @@ -1,4 +1,4 @@ | |||
| #!/usr/bin/env python | |||
| ##!/usr/bin/env python | |||
There was a problem hiding this comment.
|
BTW, I have moved my fixes here: #9050 |
|
@abratchik Current failures are related to non-ASCII symbols in source code comments. I'm investigating workaround for this problem. |
|
non-ASCII messages are related to #8895 and currently they don't cause build failure. |
|
@alalek it seems like the issue with python3 wrappers. What is strange: I have both python2 and python 3 enabled on my Mac, all builds up well without any issue. I even did make clean/make just to ensure no leftovers from previous builds. One warning pops out on python3 like this: But the end all builds and compiles successfully on my machine but not on autobuild servers. I also rebased on the latest master build (e5aa213) so all your fixes should be there already. Please kindly help me as I'm out of ideas how to fix it. Seems to be some old error as if it would be before your fixes but I cannot reproduce it locally. |
I have the same problem - can't reproduce current failures on my machine locally. Will take a look on build containers. |
|
@abratchik Please apply this patch |
|
ok, trying ... |
| File currentRelativePath = new File(System.getenv("OPENCV_DNN_TEST_DATA_PATH")); | ||
| modelFileName = new File(currentRelativePath, "dnn/tensorflow_inception_graph.pb").toString(); | ||
|
|
||
| File f = new File(currentRelativePath, "dnn/space_shuttle.jpg"); |
There was a problem hiding this comment.
opencv_extra testdata files are located under
OPENCV_TEST_DATA_PATH
env variable instead of
OPENCV_DNN_TEST_DATA_PATH
There was a problem hiding this comment.
@alalek now tensorflow_inception_graph.pb is also missing whereas it was previously there for OPENCV_DNN_TEST_DATA_PATH :)
There was a problem hiding this comment.
There are two environment variables:
- for general OpenCV testdata from opencv_extra:
OPENCV_TEST_DATA_PATH - optional large DNN models:
OPENCV_DNN_TEST_DATA_PATH
You should use both.
|
@alalek Alex, there is also one warning on the Mac environment, not sure what that means. Please also let me know the right location of tensorflow_inception_graph.pb and space_shutte.jpg. The first one seems to be found in the OPENCV_DNN_TEST_DATA_PATH/dnn folder but the last one is not there. Should I try to search the model in OPENCV_DNN_TEST_DATA_PATH/dnn and the jpg in OPENCV_TEST_DATA_PATH/dnn? |
|
For Mac build try to suppress warning here: -ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-const-variable)
+ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-const-variable -Wundef) |
|
@alalek done, the compilation warning seems to be addressed. Now the only remaining issue is placement of test files ) |
|
There are two environment variables:
You should use both. |
|
@alalek thank you Alex, it seems like worked this time around. Sorry it took a bit long for me to figure out since it is first time I'm writing the test case )) |
|
@alalek this is ready for merge, no more commits ) |
|
👍 |
1 similar comment
|
👍 |
This pullrequest changes
Added java wrappers to dnn module.
Added autotests based on Google Inception 5 model graph. The autotest depends on OPENCV_DNN_TEST_DATA_PATH and OPENCV_TEST_DATA_PATH environment variables pointing at correct folders where the following files should exist:
If the OPENCV_DNN_TEST_DATA_PATH is not set the test will be disabled. If OPENCV_TEST_DATA_PATH is not set it will fail. If both env vars are set but one of the files or both are missing the test will fail.