{"action":"created","issue":{"url":"https://api.github.com/repos/opencv/opencv/issues/10382","repository_url":"https://api.github.com/repos/opencv/opencv","labels_url":"https://api.github.com/repos/opencv/opencv/issues/10382/labels{/name}","comments_url":"https://api.github.com/repos/opencv/opencv/issues/10382/comments","events_url":"https://api.github.com/repos/opencv/opencv/issues/10382/events","html_url":"https://github.com/opencv/opencv/issues/10382","id":284049001,"number":10382,"title":"DNN scale_layer issue","user":{"login":"BAILOOL","id":11172777,"avatar_url":"https://avatars3.githubusercontent.com/u/11172777?v=4","gravatar_id":"","url":"https://api.github.com/users/BAILOOL","html_url":"https://github.com/BAILOOL","followers_url":"https://api.github.com/users/BAILOOL/followers","following_url":"https://api.github.com/users/BAILOOL/following{/other_user}","gists_url":"https://api.github.com/users/BAILOOL/gists{/gist_id}","starred_url":"https://api.github.com/users/BAILOOL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BAILOOL/subscriptions","organizations_url":"https://api.github.com/users/BAILOOL/orgs","repos_url":"https://api.github.com/users/BAILOOL/repos","events_url":"https://api.github.com/users/BAILOOL/events{/privacy}","received_events_url":"https://api.github.com/users/BAILOOL/received_events","type":"User","site_admin":false},"labels":[{"id":635087908,"url":"https://api.github.com/repos/opencv/opencv/labels/category:%20dnn","name":"category: dnn","color":"ededed","default":false},{"id":241023000,"url":"https://api.github.com/repos/opencv/opencv/labels/feature","name":"feature","color":"84b6eb","default":false},{"id":242286875,"url":"https://api.github.com/repos/opencv/opencv/labels/good%20first%20issue","name":"good first issue","color":"7057ff","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-12-22T01:24:31Z","updated_at":"2018-01-01T09:56:41Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nIf you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses.\r\nIf you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).\r\n\r\nThis is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.\r\n-->\r\n\r\n##### System information (version)\r\n<!-- Example\r\n- OpenCV => 3.3.1-dev\r\n- Operating System / Platform => Ubuntu 16.04\r\n- Compiler => gcc 5.4.0\r\n-->\r\n\r\n- OpenCV => 3.3.1-dev\r\n- Operating System / Platform => Ubuntu 16.04\r\n- Compiler => gcc 5.4.0\r\n\r\n##### Detailed description\r\n\r\nWhen using Caffe [implementation of Squeeze-and-Excitation](https://github.com/shicai/SENet-Caffe) getting the following issue:\r\n```\r\nOpenCV Error: Assertion failed (blobs.size() == 1 + hasBias) in forward, file opencv/modules/dnn/src/layers/scale_layer.cpp, line 51\r\n```\r\nSeems like Scale layer with no bias in dnn module has an issue. Scale layer for batch normalization (with bias) works well though. I believe this is the layer that causes the problem:\r\n```\r\nlayer {\r\n  name: \"scale2_1\"\r\n  type: \"Scale\"\r\n  bottom: \"conv2_1/x3\"\r\n  bottom: \"fc2_1/exc\"\r\n  top: \"scale2_1\"\r\n  scale_param {\r\n    axis: 0\r\n    bias_term: false\r\n  }\r\n}\r\n```\r\n\r\n##### Steps to reproduce\r\n1. Download prototxt and caffemodel from [this repo](https://github.com/shicai/SENet-Caffe).\r\n2. Set relevant paths to model from Step 1 in [opencv/samples/dnn/caffe_googlenet.cpp](https://github.com/opencv/opencv/blob/master/samples/dnn/caffe_googlenet.cpp).\r\n3. Change image input to 225x225x3 in caffe_googlenet.cpp like this:\r\n```\r\nMat inputBlob = blobFromImage(img, 1.0f, Size(225, 225), Scalar(104, 117, 123), false);  \r\n```"},"comment":{"url":"https://api.github.com/repos/opencv/opencv/issues/comments/354645534","html_url":"https://github.com/opencv/opencv/issues/10382#issuecomment-354645534","issue_url":"https://api.github.com/repos/opencv/opencv/issues/10382","id":354645534,"user":{"login":"victor-ludorum","id":33842504,"avatar_url":"https://avatars3.githubusercontent.com/u/33842504?v=4","gravatar_id":"","url":"https://api.github.com/users/victor-ludorum","html_url":"https://github.com/victor-ludorum","followers_url":"https://api.github.com/users/victor-ludorum/followers","following_url":"https://api.github.com/users/victor-ludorum/following{/other_user}","gists_url":"https://api.github.com/users/victor-ludorum/gists{/gist_id}","starred_url":"https://api.github.com/users/victor-ludorum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/victor-ludorum/subscriptions","organizations_url":"https://api.github.com/users/victor-ludorum/orgs","repos_url":"https://api.github.com/users/victor-ludorum/repos","events_url":"https://api.github.com/users/victor-ludorum/events{/privacy}","received_events_url":"https://api.github.com/users/victor-ludorum/received_events","type":"User","site_admin":false},"created_at":"2018-01-01T09:56:41Z","updated_at":"2018-01-01T09:56:41Z","author_association":"CONTRIBUTOR","body":"Thanks @dkurt  for your response !! As you have suggested that OpenCV's scale layer is working with single input , Is this line \r\n`    ScaleLayerImpl(const LayerParams& params)`\r\nDo I have to do modification with this line in [link](https://github.com/opencv/opencv/blob/master/modules/dnn/src/layers/scale_layer.cpp#L25) so that it may work with 2 inputs . \r\n\r\n> Following Caffe's documentation add tests with simple models (2 input layers and a single scale layer).\r\n>\r\n I have also not understood this line . Can you please elaborate it more ..  I have understood what should be done but I need your guidance to do this ..  I need little bit more info . "}}
{"actor":{"display_login":"victor-ludorum"}}