BarraCUDA Boiz

From CDOT Wiki
Revision as of 03:11, 5 February 2017 by Addogra (talk | contribs) (Progress)
Jump to: navigation, search

BarraCUDA Boiz

Team Members

  1. Van Chau Bui
  2. Michael Michalski
  3. Agam Dogra


Progress

Assignment 1

EucideanDistance

Profiled the following project on github which finds the euclidean distance transformation on given chart formatted in a text file. The project can be found here: here

The following is a example of the program running with an example input and the output afterwards.

   Before:                                                          After:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0   0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0   0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 2 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0   0 0 0 1 0 0 0 1 0 0 0 0 1 1 2 3 2 1 1 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0   0 0 0 0 1 0 0 1 0 0 0 1 1 2 3 4 3 2 1 1 0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 0 0   0 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0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


At n = 1302:

Flat profile:

Each sample counts as 0.01 seconds.
no time accumulated

 %   cumulative   self              self     total
time   seconds   seconds    calls  Ts/call  Ts/call  name
 0.00      0.00     0.00      810     0.00     0.00  EuclideanDistanceTransform::loadNeighbors(int, int, int)
 0.00      0.00     0.00        1     0.00     0.00  _GLOBAL__sub_I__ZN26EuclideanDistanceTransformC2ERSt14basic_ifstreamIcSt11char_traitsIcEERSt14basic_ofstreamIcS2_ES7_
 0.00      0.00     0.00        1     0.00     0.00  EuclideanDistanceTransform::zeroFramed()
 0.00      0.00     0.00        1     0.00     0.00  EuclideanDistanceTransform::firstPassEuclideanDistance(std::basic_ofstream<char, std::char_traits<char> >&)
 0.00      0.00     0.00        1     0.00     0.00  EuclideanDistanceTransform::secondPassEuclideanDistance(std::basic_ofstream<char, std::char_traits<char> >&)
 0.00      0.00     0.00        1     0.00     0.00  EuclideanDistanceTransform::loadImage(std::basic_ifstream<char, std::char_traits<char> >&)


At n = 1000000:

Flat profile:

Each sample counts as 0.01 seconds.
 %   cumulative   self              self     total
time   seconds   seconds    calls  ms/call  ms/call  name
33.33      0.03     0.03        1    30.00    30.00  EuclideanDistanceTransform::loadImage(std::basic_ifstream<char, std::char_traits<char> >&)
22.22      0.05     0.02  1001696     0.00     0.00  EuclideanDistanceTransform::loadNeighbors(int, int, int)
22.22      0.07     0.02                             EuclideanDistanceTransform::EuclideanDistanceTransform(std::basic_ifstream<char, std::char_traits<char> >&, std::basic_ofstream<char, std::char_traits<char> >&, std::basic_ofstream<char, std::char_traits<char> >&)
11.11      0.08     0.01        1    10.00    20.00  EuclideanDistanceTransform::firstPassEuclideanDistance(std::basic_ofstream<char, std::char_traits<char> >&)
11.11      0.09     0.01        1    10.00    20.00  EuclideanDistanceTransform::secondPassEuclideanDistance(std::basic_ofstream<char, std::char_traits<char> >&)
 0.00      0.09     0.00        1     0.00     0.00  _GLOBAL__sub_I__ZN26EuclideanDistanceTransformC2ERSt14basic_ifstreamIcSt11char_traitsIcEERSt14basic_ofstreamIcS2_ES7_
 0.00      0.09     0.00        1     0.00     0.00  EuclideanDistanceTransform::zeroFramed()

At n = 10000000:

Flat profile:

Each sample counts as 0.01 seconds.
 %   cumulative   self              self     total
time   seconds   seconds    calls  ms/call  ms/call  name
35.14      0.26     0.26                             EuclideanDistanceTransform::EuclideanDistanceTransform(std::basic_ifstream<char, std::char_traits<char> >&, std::basic_ofstream<char, std::char_traits<char> >&, std::basic_ofstream<char, std::char_traits<char> >&)
27.03      0.46     0.20        1   200.00   255.00  EuclideanDistanceTransform::secondPassEuclideanDistance(std::basic_ofstream<char, std::char_traits<char> >&)
20.27      0.61     0.15        1   150.00   205.00  EuclideanDistanceTransform::firstPassEuclideanDistance(std::basic_ofstream<char, std::char_traits<char> >&)
14.86      0.72     0.11  9998998     0.00     0.00  EuclideanDistanceTransform::loadNeighbors(int, int, int)
 2.70      0.74     0.02        1    20.00    20.00  EuclideanDistanceTransform::loadImage(std::basic_ifstream<char, std::char_traits<char> >&)
 0.00      0.74     0.00        1     0.00     0.00  _GLOBAL__sub_I__ZN26EuclideanDistanceTransformC2ERSt14basic_ifstreamIcSt11char_traitsIcEERSt14basic_ofstreamIcS2_ES7_
 0.00      0.74     0.00        1     0.00     0.00  EuclideanDistanceTransform::zeroFramed()

SeamCarving

Seam carving (or liquid re-scaling) is an algorithm for content-aware image resizing. It functions by establishing a number of seams (paths of least importance) in an image and automatically removes seams to reduce image size or inserts seams to extend it. The profiled project can be found on Github using this link: here

Here is an example of a test case:

I shrunk the image by 1000 pixels. 
Before:
TestImage.jpg 
After:
1000output.png


On shrinking by 100 pixels.

Flat profile:

Each sample counts as 0.01 seconds.
 %   cumulative   self              self     total           
time   seconds   seconds    calls  ms/call  ms/call  name    
36.84      5.87     5.87 2549733700     0.00     0.00  unsigned char& cv::Mat::at<unsigned char>(int, int)
24.50      9.77     3.90      100    39.02    71.54  computeSeam(cv::_InputArray const&, std::vector<int, std::allocator<int> >&)
11.31     11.57     1.80      100    18.01    46.39  void carveSeam<unsigned char>(cv::Mat&, std::vector<int, std::allocator<int> >&)
 7.76     12.81     1.24 558300205     0.00     0.00  int& cv::Mat::at<int>(int, int)
 6.28     13.81     1.00      100    10.01    37.36  detectEdge(cv::_InputArray const&, cv::_OutputArray const&)
 3.58     14.38     0.57 186060000     0.00     0.00  cvRound(double)
 2.89     14.84     0.46 186060000     0.00     0.00  unsigned char cv::saturate_cast<unsigned char>(double)
 2.64     15.26     0.42 186060000     0.00     0.00  unsigned char cv::saturate_cast<unsigned char>(int)
 2.14     15.60     0.34                             cv::Size_<int>::Size_(int, int)
 1.70     15.87     0.27 186060000     0.00     0.00  std::vector<int, std::allocator<int> >::operator[](unsigned long)
 0.44     15.94     0.07                             frame_dummy
 0.00     15.94     0.00     1003     0.00     0.00  cv::Mat::release()


On shrinking by 500 pixels.

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 37.44     30.05    30.05 11103057554     0.00     0.00  unsigned char& cv::Mat::at<unsigned char>(int, int)
 24.22     49.49    19.44      500    38.88    71.23  computeSeam(cv::_InputArray const&, std::vector<int, std::allocator<int> >&)
 12.09     59.19     9.71      500    19.41    48.18  void carveSeam<unsigned char>(cv::Mat&, std::vector<int, std::allocator<int> >&)
  7.57     65.27     6.07      500    12.15    37.01  detectEdge(cv::_InputArray const&, cv::_OutputArray const&)
  7.17     71.02     5.75 2431501402     0.00     0.00  int& cv::Mat::at<int>(int, int)
  2.94     73.38     2.36 810300000     0.00     0.00  cvRound(double)
  2.46     75.36     1.98 810300000     0.00     0.00  unsigned char cv::saturate_cast<unsigned char>(double)
  2.23     77.15     1.79                             cv::Size_<int>::Size_(int, int)
  1.89     78.66     1.52 810300000     0.00     0.00  unsigned char cv::saturate_cast<unsigned char>(int)
  1.55     79.90     1.24 810300000     0.00     0.00  std::vector<int, std::allocator<int> >::operator[](unsigned long)
  0.36     80.19     0.29                             frame_dummy
  0.12     80.29     0.10      500     0.20     0.20  std::vector<int, std::allocator<int> >::resize(unsigned long, int)
  0.00     80.29     0.00     5003     0.00     0.00  cv::Mat::release()

On shrinking by 1000 pixels.

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 38.13     40.06    40.06 18093467576     0.00     0.00  unsigned char& cv::Mat::at<unsigned char>(int, int)
 24.02     65.30    25.23     1000    25.23    47.05  computeSeam(cv::_InputArray const&, std::vector<int, std::allocator<int> >&)
 11.98     77.88    12.59     1000    12.59    32.07  void carveSeam<unsigned char>(cv::Mat&, std::vector<int, std::allocator<int> >&)
  7.63     85.90     8.01 3963002390     0.00     0.00  int& cv::Mat::at<int>(int, int)
  6.77     93.01     7.11     1000     7.11    23.07  detectEdge(cv::_InputArray const&, cv::_OutputArray const&)
  2.56     95.70     2.69 1320600000     0.00     0.00  cvRound(double)
  2.55     98.38     2.68                             cv::Size_<int>::Size_(int, int)
  2.25    100.75     2.37 1320600000     0.00     0.00  unsigned char cv::saturate_cast<unsigned char>(double)
  2.02    102.88     2.13 1320600000     0.00     0.00  unsigned char cv::saturate_cast<unsigned char>(int)
  1.87    104.84     1.96 1320600000     0.00     0.00  std::vector<int, std::allocator<int> >::operator[](unsigned long)
  0.23    105.08     0.24                             frame_dummy
  0.04    105.12     0.04     1000     0.04     0.04  std::vector<int, std::allocator<int> >::resize(unsigned long, int)