Ask Your Question

wureka's profile - activity

2017-07-02 19:21:56 -0600 received badge  Editor (source)
2017-07-02 19:19:55 -0600 asked a question Why vGPU (Tesla K80) on Google cloud slower than GTX940M on T460P

I am not sure if this question is suitable in this forum. If not, please let me know. I will move it to other forums.

I have a question about the vGPU (Tesla K80) on the VM of Google cloud.

My laptop is Lenovo T460P equiped with below spec:

  • CPU: intel i7-6700HQ
  • RAM: 16GB
  • GPU: nVIDIA GTX 940M (CUDA Cores: 348)
  • OS: Windiws 10 Pro 64bit
  • OpenCV: ver3.2.0 with CUDA 8.0 support (I downloaded from http://jamesbowley.co.uk/downloads/)

The VM I created in Google Cloud contains the below spec:

  • CPU: vCPU x 2
  • RAM: 4GB
  • HDD: 25GB
  • GPU: vGPU (Tesla K80) x 1 (CUDA Cores 4992)
  • OS: Ubuntu 16.04 LTS 64bit
  • CUDA Driver: I follow the install procedure from this link: https://cloud.google.com/compute/docs...
  • OpenCV: ver 3.2.0 (compile parameters:
    • cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_CUDA=ON -D WITH_CUBLAS=ON -D WITH_TBB=ON -D CUDA_GENERATION=Auto -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_NVCUVID=1 -D WITH_CUFFT=ON -D WITH_EIGEN=ON -D WITH_IPP=ON )

I use opencv to train LBP cascade with 160 positive images and 800 negative images. I use the same positive and negative samples on both above environments Below is the parameters of opencv_createsamples and opencv_traincascade:

opencv_createsamples -info data/positive_images/positives.txt -vec data/positive_images/positives.vec -w 32 -h 32

opencv_traincascade -data classifier -vec data/positive_images/positives.vec -bg data/negative_images/negatives.txt -mode BASIC -featureType LBP -numPos 160 -numNeg 800 -minHitRate 0.998 -maxFalseAlarmRate 0.05 -w 32 -h 32 -numStages 10

However, I found that my laptop took 5 minutes around to finish the training. and the vm of Google cloud took over 20 minutes and was still in TRAINING 8-stage.

opencv_traincascade on Google cloud vm with Tesla K80

nvidia-smi on Google cloud vm

What's the matter with the vm of Google cloud ? I thought that the vm of Google cloud should have computed faster than that of my laptop because the vm has a Tesla K80. But it actually is far slow than my laptop.

Did I miss something or do something wrong on the vm of Google cloud ?

Thanks for help.

2017-06-26 00:43:49 -0600 received badge  Enthusiast
2017-06-22 02:48:58 -0600 asked a question my trained cascade.xml makes the call detectMultiScale(...) hangs

Hi, My environment:

  • Ubuntu Linux 17.04 Desktop 64bit
  • OpenCV 3.2.0

I have two cascades.

One is downloaded from internet -->cars3.xml

The other is trained by myself -->my trained cascade.xml

The tested picture is here currentFrame02.jpg

My opencv_traincascade command is as below:

opencv_traincascade -data classifier -vec data/positive_images/positives.vec -bg data/negative_images/negatives.txt -numStages 20 -w 100 -h 100 -mode BASIC -numPos 182 -numNeg 166 -featureType LBP

My code is as below:

#include <stdio.h>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>

using namespace cv;
using namespace std;
int main() {
    Mat image;
    image = imread("/home/user/opencv_workspace/test_images/currentFrame02.jpg", CV_LOAD_IMAGE_COLOR);
    namedWindow("window1", 1);
    imshow("window1", image);
    waitKey(0);
    CascadeClassifier vehicle_cascade;
    //vehicle_cascade.load("/home/user/opencv_workspace/classifier/cars3.xml");
    vehicle_cascade.load("/home/user/opencv_workspace/classifier/cascade.xml");
    std::vector<Rect> vehicles;
    vehicle_cascade.detectMultiScale(image, vehicles); // hangs here when using cascade.xml
    cout << "find " << vehicles.size() << " vehicles"<< endl;
    for(int i = 0; i < vehicles.size(); i++) {
        Point center(vehicles[i].x + vehicles[i].width*0.5, vehicles[i].y + vehicles[i].height * 0.5);
        ellipse(image, center, Size(vehicles[i].width*0.5, vehicles[i].height* 0.5), 0, 0, 360, Scalar(255, 0, 255), 4, 8, 0);
    }
    imshow("Detected Vehicle", image);
    waitKey(0);
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

If I use the downloaded cars3.xml, the code can detect something and display the result.

However, if I use my trained cascade.xml, the code freezes at line

vehicle_cascade.detectMultiScale(image, vehicles);

Does anybody help me to solve the problem ? Many thanks

2017-06-21 08:48:54 -0600 asked a question javacv 1.3.2 run haar CascadeClassifier.detectMultiScale() hangs

It's so weird that when I post my problem and submit it, it make this forum appear

Internal System Error

So I post my problem to javacv 1.3.2 run haar CascadeClassifier.detectMultiScale() hangs

Please help me to solve my problem Thanks