Skip to content

[WIP] Ceil, Floor, Log, Round, Sqrt layers added#16750

Closed
ashishkrshrivastava wants to merge 2 commits intoopencv:3.4from
ashishkrshrivastava:eltwise
Closed

[WIP] Ceil, Floor, Log, Round, Sqrt layers added#16750
ashishkrshrivastava wants to merge 2 commits intoopencv:3.4from
ashishkrshrivastava:eltwise

Conversation

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor

@ashishkrshrivastava ashishkrshrivastava commented Mar 6, 2020

resolves #16749

Merge with extra: opencv/opencv_extra#723

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 OpenCV (BSD) 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

This PR adds implementation of

  • Ceil Layer
  • Floor Layer
  • Round Layer
  • Log Layer
  • Sqrt Layer
  • Exp Layer
  • Not Layer
  • ReduceMin (only for constant because it is working on constants in fasterrcnn and maskrcnn )
  • NonZero (only for constant blob because it is working on constants in fasterrcnn and maskrcnn)
  • Equal
  • Greater
  • Less
  • And
  • Gather
  • TopK
force_builders=Custom,Custom Win,Custom Mac
build_image:Custom=ubuntu-openvino-2020.1.0:16.04
build_image:Custom Win=openvino-2020.1.0
build_image:Custom Mac=openvino-2020.1.0

Xtest_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=*

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

@alalek @dkurt I am not sure why it is failing here. these changes are working perfectly fine locally. Any idea how to tackle this?

@alalek
Copy link
Copy Markdown
Member

alalek commented Mar 7, 2020

std::round is C++ feature: https://en.cppreference.com/w/cpp/numeric/math/round
OpenCV 3.4 should use C++98 by default.

Failed builders have GCC 4.x.

@ashishkrshrivastava ashishkrshrivastava force-pushed the eltwise branch 2 times, most recently from 1a63847 to 2720dc2 Compare March 7, 2020 18:56
@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

@alalek thanks.

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

@alalek , is there any documentation where I can get to know about the configuration of builders like what version of gcc or C++ custom builder use ?
changes are only getting failed for custom builders.

@alalek
Copy link
Copy Markdown
Member

alalek commented Mar 10, 2020

version of gcc

Check "CMake" step => "stdio" log.

failed for custom builders

These builders are configured to build OpenCV with OpenVINO's Inference engine (Open Source version is here: https://github.com/opencv/dldt/releases/tag/2020.1).

General information about IE and how to build OpenCV with IE locally: https://github.com/opencv/opencv/wiki/Intel%27s-Deep-Learning-Inference-Engine-backend#build-opencv-from-source
This should work well if you using Ubuntu 16.04 / 18.04.

supportBackend

You should tune implementation details through .supportBackend() method. Simplest way is to disable support for both DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 and DNN_BACKEND_INFERENCE_ENGINE_NGRAPH backend. These implementations can be added later (if possible).


General information about CI options: https://github.com/opencv/opencv/wiki/CI-configuration

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

@alalek Thank you so much.

@dkurt
Copy link
Copy Markdown
Member

dkurt commented Mar 10, 2020

Please see the comment #16749 (comment). I think that adding so atomic operations is not a right way to enable object detection networks. They won't cover all the operations from the models and we need more fundamental solution. Can you specify origin frameworks for YOLOv3 and Faster R-CNN models in ONNX format?

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

@dkurt , all of object detection models are originated from keras2onnx. They are written in keras.

@alalek
Copy link
Copy Markdown
Member

alalek commented Mar 10, 2020

I think that adding so atomic operations is not a right way to enable object detection networks.

It can be useful, for example, for debugging purposes of graph transformations.

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

@dkurt

we need more fundamental solution.

I have added explanation in #16749 comment . Please share your view.

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

@alalek , necessary lines of code is already added to PR description to allow custom build then why it is not getting build. Am I missing something ?

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

@alalek , sorry opencv/opencv_extra#723 had merge conflict yesteday, I have resolved them. can you please let build on custom builders.

@asmorkalov
Copy link
Copy Markdown
Contributor

I re-triggered all builds, include custom one.

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

I re-triggered all builds, include custom one.

Thank you so much @asmorkalov . They all are build successfully.

@alalek alalek mentioned this pull request Mar 22, 2020
4 tasks
@dkurt
Copy link
Copy Markdown
Member

dkurt commented Mar 22, 2020

resolves #16749

Please specify if this PR enables one of the models mentioned in the issue

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

@dkurt Actually I created the issue requesting layer implementation, not model. But as you said that we must focus on models not operators or layers, making models work needs several fusion and layer implementation. It would take time. So if you want me to make model work, please let the PR open. I will complete that. Otherwise this PR can be merged for now since layer implementation is already there and I will work on models separately.

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

ashishkrshrivastava commented Apr 9, 2020

@alalek , I am adding a layer which needs changes in usr/local/include/opencv2/dnn/all_layers.hpp and using those changes more changes are required in modules/dnn/src/layers/pooling_layer.cpp but builder can only find changes in pooling_layer.cpp not in all_layers.hpp.

Am i missing something ?

I am sorry to ask this question here.

@alalek
Copy link
Copy Markdown
Member

alalek commented Apr 9, 2020

usr/local/include

out of source tree.

@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

ashishkrshrivastava commented Apr 9, 2020

out of source tree.

ohh.. need to add changes here /modules/dnn/include/opencv2/dnn/all_layers.hpp
Thankyou so much.

@ashishkrshrivastava ashishkrshrivastava marked this pull request as draft April 11, 2020 01:20
@ashishkrshrivastava ashishkrshrivastava changed the title Ceil, Floor, Log, Round, Sqrt layers added [WIP] Ceil, Floor, Log, Round, Sqrt layers added Apr 13, 2020
@ashishkrshrivastava ashishkrshrivastava force-pushed the eltwise branch 2 times, most recently from aa00911 to bf68c96 Compare April 17, 2020 08:57
@ashishkrshrivastava
Copy link
Copy Markdown
Contributor Author

I think these changes are not relevant anymore. Closing it for now. I would definitely work on it if find any issue regarding this in future.

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.

4 participants