{"action":"created","issue":{"url":"https://api.github.com/repos/Itseez/opencv/issues/6693","repository_url":"https://api.github.com/repos/Itseez/opencv","labels_url":"https://api.github.com/repos/Itseez/opencv/issues/6693/labels{/name}","comments_url":"https://api.github.com/repos/Itseez/opencv/issues/6693/comments","events_url":"https://api.github.com/repos/Itseez/opencv/issues/6693/events","html_url":"https://github.com/Itseez/opencv/issues/6693","id":160873659,"number":6693,"title":"Different results of CascadeClasifier on CPU and GPU","user":{"login":"putintsev-rv","id":19994376,"avatar_url":"https://avatars.githubusercontent.com/u/19994376?v=3","gravatar_id":"","url":"https://api.github.com/users/putintsev-rv","html_url":"https://github.com/putintsev-rv","followers_url":"https://api.github.com/users/putintsev-rv/followers","following_url":"https://api.github.com/users/putintsev-rv/following{/other_user}","gists_url":"https://api.github.com/users/putintsev-rv/gists{/gist_id}","starred_url":"https://api.github.com/users/putintsev-rv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/putintsev-rv/subscriptions","organizations_url":"https://api.github.com/users/putintsev-rv/orgs","repos_url":"https://api.github.com/users/putintsev-rv/repos","events_url":"https://api.github.com/users/putintsev-rv/events{/privacy}","received_events_url":"https://api.github.com/users/putintsev-rv/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Itseez/opencv/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/Itseez/opencv/labels/category:%20gpu%20(cuda)","name":"category: gpu (cuda)","color":"ededed"},{"url":"https://api.github.com/repos/Itseez/opencv/labels/category:%20objdetect","name":"category: objdetect","color":"ededed"},{"url":"https://api.github.com/repos/Itseez/opencv/labels/priority:%20low","name":"priority: low","color":"AA9739"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-06-17T12:05:27Z","updated_at":"2016-06-29T12:08:09Z","closed_at":null,"body":"### My system\r\n- OpenCV version: 3.1\r\n- Host OS: Linux (Ubuntu 14.04)\r\n- Video card: GTX-950\r\n- Video driver: v.352.93\r\n\r\n### In which part of the OpenCV library you got the issue?\r\n- objdetect, cudaobjdetect\r\n- cv::CascadeClassifier, cv::cuda::CascadeClassifier\r\n\r\n### Expected behaviour\r\nI built the latest OpenCV version with cuda support from master branch. After that I tried to use CPU cv::CascadeClassifier and GPU cv::cuda::CascadeClassifier, but faced with a strange result. I use same xml from opencv/data/haarcascades_cuda/haarcascade_fullbody.xml for both CPU and GPU version of CascadeClassifier. CPU Classifier with this xml shows much more objects than GPU classifier.\r\n\r\nAnother strange thing, that when I set ScaleFactor to 2, speed of CPU version boosted up to 4 times, but GPU version becomes just slightly faster.\r\n\r\n### Additional description\r\n[OpencvQA](http://answers.opencv.org/question/96452/different-results-of-cascadeclasifier-on-cpu-and-gpu/)\r\n[Video demo: example.ogv.zip](https://github.com/Itseez/opencv/files/320887/example.ogv.zip)\r\n[Video demo with same parameters values: example_v2.ogv.zip](https://github.com/Itseez/opencv/files/322422/example_v2.ogv.zip)\r\n\r\n### Code example to reproduce the issue\r\n[Bitbucket: main.cpp](https://bitbucket.org/barbatum/cascadeqa/raw/571cdafc1b230cb5ec5d2c7b6b766895549d2d1e/CascadeQA/main.cpp)\r\n[Bitbucket: qmake project + deps build bash script](https://bitbucket.org/barbatum/cascadeqa)\r\n"},"comment":{"url":"https://api.github.com/repos/Itseez/opencv/issues/comments/229337125","html_url":"https://github.com/Itseez/opencv/issues/6693#issuecomment-229337125","issue_url":"https://api.github.com/repos/Itseez/opencv/issues/6693","id":229337125,"user":{"login":"StevenPuttemans","id":4621239,"avatar_url":"https://avatars.githubusercontent.com/u/4621239?v=3","gravatar_id":"","url":"https://api.github.com/users/StevenPuttemans","html_url":"https://github.com/StevenPuttemans","followers_url":"https://api.github.com/users/StevenPuttemans/followers","following_url":"https://api.github.com/users/StevenPuttemans/following{/other_user}","gists_url":"https://api.github.com/users/StevenPuttemans/gists{/gist_id}","starred_url":"https://api.github.com/users/StevenPuttemans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StevenPuttemans/subscriptions","organizations_url":"https://api.github.com/users/StevenPuttemans/orgs","repos_url":"https://api.github.com/users/StevenPuttemans/repos","events_url":"https://api.github.com/users/StevenPuttemans/events{/privacy}","received_events_url":"https://api.github.com/users/StevenPuttemans/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T12:08:09Z","updated_at":"2016-06-29T12:08:09Z","body":"To prove my previous point, let me quickly grab some part of the OpenCV 3 Blueprints book chapters I wrote. In the image below you can see a comparison of GPU versus multicore CPU processing on object detection using OpenCV.\r\n\r\nIf you take OpenCV 3 without any optimization on CPU, and compare it to GPU you have the following results\r\n\r\n![screenshot from 2016-06-29 14 02 30](https://cloud.githubusercontent.com/assets/4621239/16451257/3803ac40-3e02-11e6-968f-400324682d7b.png)\r\n\r\nWe can see that GPU is performing way faster then CPU, certainly when going for larger resolutions and considering the pushing back and forward bottleneck.\r\n\r\nHowever, this is a setup with NO optimizations. Looking at an optimized setup on the CPU (and most recent systems have most of these): IPP (free compact set provided by OpenCV), TBB, SSE2, SSE3, SSE4 (SSE instructions selected automatically by the CMAKE script for my system), pthread (for using parallel for loop structures)\r\n\r\n![screenshot from 2016-06-29 14 02 43](https://cloud.githubusercontent.com/assets/4621239/16451313/7e4a6ef0-3e02-11e6-9ca0-c46f74bfc787.png)\r\n\r\nNow all of a sudden my multicore CPU is beating the GPU. The problem becomes even larger when considering you need to process images that are to large to go to GPU memory in a single part. This is shown here:\r\n\r\n![screenshot from 2016-06-29 14 06 17](https://cloud.githubusercontent.com/assets/4621239/16451337/adb7177e-3e02-11e6-8138-cdc6afe66716.png)\r\n\r\nMy GPU only has 1GP of dedicated memory and cannot process a 8000x4000 pixel image at a single run, and thus needs to split and continue with double bottlenecks. Here CPU beats the GPU even harder.\r\n\r\nSo I guess my conclusion in the book still stands\r\n\r\n> As you can see, there is still a difference of the GPU interface taking about four times as long as the CPU interface, and thus in this case, it would be a very bad decision to select a GPU solution for the project, rather than a multicore CPU solution\r\n\r\n"}}
{"actor":{"display_login":"StevenPuttemans"}}