Comments (2)
This may be due to the long time it takes for the GPU to start up the first time. If the loop is executed 5 times, you will find that only the first execution takes longer. The code and test results are as follows:
#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/core/cuda.hpp"
//#include <cuda_runtime.h>
int main(int argc, char *argv[])
{
//Read Two Images
cv::Mat h_img1 = cv::imread("images/cameraman.tif");
cv::Mat h_img2 = cv::imread("images/circles.png");
cv::Mat h_result1;
// execute 5 times
for (int i = 0; i < 5; i++)
{
int64 work_begin = cv::getTickCount();
//Create Memory for storing Images on device
cv::cuda::GpuMat d_result1, d_img1, d_img2;
//Upload Images to device
d_img1.upload(h_img1);
d_img2.upload(h_img2);
cv::cuda::add(d_img1, d_img2, d_result1);
//Download Result back to host
d_result1.download(h_result1);
int64 delta = cv::getTickCount() - work_begin;
double freq = cv::getTickFrequency();
double work_fps = freq / delta;
std::cout << "Performance of Addition on Jetson TX1: " << std::endl;
std::cout << "Time: " << (1 / work_fps) << std::endl;
std::cout << "FPS: " << work_fps << std::endl;
}
cv::imshow("Image1 ", h_img1);
cv::imshow("Image2 ", h_img2);
cv::imshow("Result addition ", h_result1);
cv::imwrite("result_add.png", h_result1);
cv::waitKey();
return 0;
}
Performance of Addition on Jetson TX1:
Time: 0.789957
FPS: 1.26589
Performance of Addition on Jetson TX1:
Time: 0.00194754
FPS: 513.469
Performance of Addition on Jetson TX1:
Time: 0.00159426
FPS: 627.25
Performance of Addition on Jetson TX1:
Time: 0.00177029
FPS: 564.879
Performance of Addition on Jetson TX1:
Time: 0.0016342
FPS: 611.921
from hands-on-gpu-accelerated-computer-vision-with-opencv-and-cuda.
Thanks for the feedback.
With this closing the issue.
from hands-on-gpu-accelerated-computer-vision-with-opencv-and-cuda.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hands-on-gpu-accelerated-computer-vision-with-opencv-and-cuda.