added stuff for evaluation
This commit is contained in:
@@ -13,7 +13,10 @@ import de.unidue.nes.gpu.events.ApplicationFinishedEvent;
|
||||
import de.unidue.nes.gpu.events.GpuEventBus;
|
||||
import de.unidue.nes.gpu.initialization.Initializer;
|
||||
import de.unidue.nes.gpu.tasks.Task;
|
||||
import de.unidue.nes.gpu.tasks.taskdefinitions.ColoringTask;
|
||||
import de.unidue.nes.gpu.tasks.taskdefinitions.ResizingTask;
|
||||
import de.unidue.nes.gpu.tasks.taskdefinitions.ThresholdingTask;
|
||||
import de.unidue.nes.gpu.tasks.taskdefinitions.UploadDownloadTask;
|
||||
|
||||
/**
|
||||
* Class containing the main method of this project.
|
||||
@@ -75,7 +78,7 @@ public class GpuTestSystem {
|
||||
|
||||
private List<Task> getTasks() {
|
||||
|
||||
return Arrays.asList(new ThresholdingTask());
|
||||
return Arrays.asList(new UploadDownloadTask(), new ThresholdingTask(), new ColoringTask(), new ResizingTask());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package de.unidue.nes.gpu.events;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.common.eventbus.DeadEvent;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
/**
|
||||
* @author Roch P., Shahbaz Nejad B.
|
||||
*/
|
||||
public class EventHandler {
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(EventHandler.class);
|
||||
|
||||
public EventHandler() {
|
||||
GpuEventBus.INSTANCE.register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onApplicationStartup(ApplicationStartupEvent event) {
|
||||
LOG.info("The following tasks will be tested:");
|
||||
event.getTasks().forEach(t -> LOG.info(t.getClass().getSimpleName()));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onApplicationFinished(ApplicationFinishedEvent event) {
|
||||
LOG.info("All tasks are finished");
|
||||
// TODO: save results, maybe export as csv
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onTaskResult(TaskResultEvent event) {
|
||||
LOG.debug(() -> "Task finished: " + event.getDescription());
|
||||
// TODO: save result
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onDeadEvent(DeadEvent deadEvent) {
|
||||
LOG.error("Dead events should not happen");
|
||||
LOG.error(() -> "Following event class was not subscribed: " + deadEvent.getEvent().getClass());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package de.unidue.nes.gpu.events;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author Roch P., Shahbaz Nejad B.
|
||||
*/
|
||||
public class TaskResultEvent {
|
||||
|
||||
private long executionTime;
|
||||
|
||||
private TimeUnit unit;
|
||||
|
||||
private String description;
|
||||
|
||||
private int executionRuns;
|
||||
|
||||
public TaskResultEvent(long executionTime, String description, int executionRuns) {
|
||||
this(executionTime, TimeUnit.MILLISECONDS, description, executionRuns);
|
||||
}
|
||||
|
||||
public TaskResultEvent(long executionTime, TimeUnit unit, String description, int executionRuns) {
|
||||
this.executionTime = executionTime;
|
||||
this.unit = unit;
|
||||
this.description = description;
|
||||
this.executionRuns = executionRuns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the executionTime
|
||||
*/
|
||||
public long getExecutionTime() {
|
||||
return this.executionTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unit
|
||||
*/
|
||||
public TimeUnit getUnit() {
|
||||
return this.unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the executionRuns
|
||||
*/
|
||||
public int getExecutionRuns() {
|
||||
return this.executionRuns;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
|
||||
import de.unidue.nes.gpu.events.EventHandler;
|
||||
|
||||
/**
|
||||
* class which is used to initialize everything
|
||||
*
|
||||
@@ -32,6 +34,10 @@ public class Initializer {
|
||||
LOG.warn("no cuda enabled device was found");
|
||||
throw new InitializationException("no cuda enabled device was found");
|
||||
}
|
||||
|
||||
LOG.info("creating EventHandler");
|
||||
new EventHandler();
|
||||
|
||||
testInitialization();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class CPUColoring {
|
||||
|
||||
long time = TimingService.measureTime(() -> Imgproc.cvtColor(image, gray, Imgproc.COLOR_BGR2GRAY), 1000);
|
||||
|
||||
LOG.info(() -> "Grayscaling took " + time + "ms");
|
||||
LOG.info(() -> "Grayscaling the image of size " + image.size() + " took " + time + "ms");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,14 +26,15 @@ public class GPUColoring {
|
||||
public void grayScale(Mat image) {
|
||||
LOG.debug(() -> "grayscaling an image of size " + image.size().toString());
|
||||
|
||||
org.bytedeco.opencv.opencv_core.Mat javacvMat = new org.bytedeco.opencv.opencv_core.Mat();
|
||||
this.converter.convert(image, javacvMat);
|
||||
long time;
|
||||
try (GpuMat gpuImg = new GpuMat(); GpuMat grayImg = new GpuMat()) {
|
||||
try (GpuMat gpuImg = new GpuMat();
|
||||
GpuMat grayImg = new GpuMat();
|
||||
org.bytedeco.opencv.opencv_core.Mat javacvMat = new org.bytedeco.opencv.opencv_core.Mat()) {
|
||||
this.converter.convert(image, javacvMat);
|
||||
gpuImg.upload(javacvMat);
|
||||
time = TimingService.measureTime(() -> opencv_cudaimgproc.cvtColor(gpuImg, grayImg, opencv_imgproc.COLOR_BGR2GRAY), 1000);
|
||||
}
|
||||
LOG.info(() -> "grayscaling took " + time + "ms");
|
||||
LOG.info(() -> "Grayscaling the image of size " + image.size() + " took " + time + "ms");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,26 +26,28 @@ public class GPUResizing {
|
||||
public void resize(Mat img, Size size) {
|
||||
LOG.debug(() -> "resizing image from size " + img.size() + " to size " + size);
|
||||
org.bytedeco.opencv.opencv_core.Mat javacvMat = this.converter.convert2Javacv(img);
|
||||
GpuMat gpuImg = new GpuMat();
|
||||
LOG.trace("uploading mat");
|
||||
gpuImg.upload(javacvMat);
|
||||
LOG.trace("uploading done");
|
||||
GpuMat dst = new GpuMat();
|
||||
org.bytedeco.opencv.opencv_core.Size javacvSize = new org.bytedeco.opencv.opencv_core.Size((int) size.width, (int) size.height);
|
||||
try (GpuMat gpuImg = new GpuMat();
|
||||
GpuMat dst = new GpuMat();
|
||||
org.bytedeco.opencv.opencv_core.Size javacvSize = new org.bytedeco.opencv.opencv_core.Size((int) size.width, (int) size.height)) {
|
||||
|
||||
LOG.trace("resizing now");
|
||||
long time = TimingService.measureTime(() -> opencv_cudawarping.resize(gpuImg, dst, javacvSize), 1000);
|
||||
LOG.trace("resizing done");
|
||||
LOG.trace("uploading mat");
|
||||
gpuImg.upload(javacvMat);
|
||||
LOG.trace("uploading done");
|
||||
|
||||
// org.bytedeco.opencv.opencv_core.Mat res = new org.bytedeco.opencv.opencv_core.Mat();
|
||||
// dst.download(res);
|
||||
// Mat result = this.converter.convert2Opencv(res);
|
||||
// HighGui.imshow(result.size().toString(), result);
|
||||
// HighGui.waitKey();
|
||||
LOG.trace("resizing now");
|
||||
long time = TimingService.measureTime(() -> opencv_cudawarping.resize(gpuImg, dst, javacvSize), 1000);
|
||||
LOG.trace("resizing done");
|
||||
|
||||
// long time = TimingService.measureTime(() -> Imgproc.resize(img, dst, size), 1000);
|
||||
// org.bytedeco.opencv.opencv_core.Mat res = new org.bytedeco.opencv.opencv_core.Mat();
|
||||
// dst.download(res);
|
||||
// Mat result = this.converter.convert2Opencv(res);
|
||||
// HighGui.imshow(result.size().toString(), result);
|
||||
// HighGui.waitKey();
|
||||
//
|
||||
// long time = TimingService.measureTime(() -> Imgproc.resize(img, dst, size), 1000);
|
||||
|
||||
LOG.info(() -> "resizing image from size " + img.size() + " to size " + size + " took " + time + "ms.");
|
||||
LOG.info(() -> "resizing image from size " + img.size() + " to size " + size + " took " + time + "ms.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,16 +24,19 @@ public class GPUThresholding {
|
||||
}
|
||||
|
||||
public void threshold(Mat mat) {
|
||||
GpuMat src = new GpuMat();
|
||||
org.bytedeco.opencv.opencv_core.Mat javacvMat = new org.bytedeco.opencv.opencv_core.Mat();
|
||||
this.converter.convert(mat, javacvMat);
|
||||
src.upload(javacvMat);
|
||||
GpuMat dst = new GpuMat();
|
||||
try (GpuMat src = new GpuMat(); org.bytedeco.opencv.opencv_core.Mat javacvMat = new org.bytedeco.opencv.opencv_core.Mat(); GpuMat dst = new GpuMat();) {
|
||||
|
||||
long time = TimingService.measureTime(() -> opencv_cudaarithm.threshold(src, dst, 128, 255, opencv_imgproc.THRESH_BINARY), 1000);
|
||||
this.converter.convert(mat, javacvMat);
|
||||
src.upload(javacvMat);
|
||||
|
||||
LOG.info(() -> "thresholding image from size " + mat.size() + " took " + time + "ms.");
|
||||
long time = TimingService.measureTime(() -> opencv_cudaarithm.threshold(src, dst, 128, 255, opencv_imgproc.THRESH_BINARY), 1000);
|
||||
|
||||
LOG.info(() -> "thresholding image from size " + mat.size() + " took " + time + "ms.");
|
||||
|
||||
// dst.download(javacvMat);
|
||||
// opencv_highgui.imshow("GPU result", javacvMat);
|
||||
// opencv_highgui.waitKey();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package de.unidue.nes.gpu.tasks.taskdefinitions;
|
||||
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.imgcodecs.Imgcodecs;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
|
||||
import de.unidue.nes.gpu.tasks.Task;
|
||||
import de.unidue.nes.gpu.tasks.cputasks.CPUColoring;
|
||||
@@ -25,18 +23,20 @@ public class ColoringTask implements Task {
|
||||
|
||||
@Override
|
||||
public void runTask() {
|
||||
Mat image = Imgcodecs.imread("src/main/resources/theSimpsons.jpg");
|
||||
Mat theImage = new Mat();
|
||||
image.copyTo(theImage);
|
||||
this.cpuTask.grayScale(theImage);
|
||||
image.copyTo(theImage);
|
||||
this.gpuTask.grayScale(theImage);
|
||||
Mat[] images = new Mat[] { Imgcodecs.imread("src/main/resources/skyscraper_small.jpg"),
|
||||
Imgcodecs.imread("src/main/resources/skyscraper_medium_small.jpg"), Imgcodecs.imread("src/main/resources/skyscraper_medium.jpg"),
|
||||
Imgcodecs.imread("src/main/resources/skyscraper_medium_large.jpg"), Imgcodecs.imread("src/main/resources/skyscraper_large.jpg") };
|
||||
|
||||
Imgproc.resize(image, image, new Size(), 10, 10);
|
||||
image.copyTo(theImage);
|
||||
this.cpuTask.grayScale(theImage);
|
||||
image.copyTo(theImage);
|
||||
this.gpuTask.grayScale(theImage);
|
||||
for (Mat img : images) {
|
||||
Mat m = new Mat();
|
||||
img.copyTo(m);
|
||||
this.cpuTask.grayScale(m);
|
||||
}
|
||||
for (Mat img : images) {
|
||||
Mat m = new Mat();
|
||||
img.copyTo(m);
|
||||
this.gpuTask.grayScale(img);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package de.unidue.nes.gpu.tasks.taskdefinitions;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.imgcodecs.Imgcodecs;
|
||||
@@ -24,22 +26,26 @@ public class ResizingTask implements Task {
|
||||
|
||||
@Override
|
||||
public void runTask() {
|
||||
Mat[] images = new Mat[] { Imgcodecs.imread("src/main/resources/skyscraper_small.jpg"), Imgcodecs.imread("src/main/resources/skyscraper_medium.jpg"),
|
||||
Imgcodecs.imread("src/main/resources/skyscraper_large.jpg") };
|
||||
Size[] sizes = new Size[] { images[0].size(), images[1].size(), images[2].size() };
|
||||
this.cpuTask.resize(images[0], sizes[1]);
|
||||
this.cpuTask.resize(images[0], sizes[2]);
|
||||
this.cpuTask.resize(images[1], sizes[0]);
|
||||
this.cpuTask.resize(images[1], sizes[2]);
|
||||
this.cpuTask.resize(images[2], sizes[0]);
|
||||
this.cpuTask.resize(images[2], sizes[1]);
|
||||
Mat[] images = new Mat[] { Imgcodecs.imread("src/main/resources/skyscraper_small.jpg"),
|
||||
Imgcodecs.imread("src/main/resources/skyscraper_medium_small.jpg"), Imgcodecs.imread("src/main/resources/skyscraper_medium.jpg"),
|
||||
Imgcodecs.imread("src/main/resources/skyscraper_medium_large.jpg"), Imgcodecs.imread("src/main/resources/skyscraper_large.jpg") };
|
||||
Size[] sizes = Arrays.stream(images).map(Mat::size).toArray(Size[]::new);
|
||||
|
||||
this.gpuTask.resize(images[0], sizes[1]);
|
||||
this.gpuTask.resize(images[0], sizes[2]);
|
||||
this.gpuTask.resize(images[1], sizes[0]);
|
||||
this.gpuTask.resize(images[1], sizes[2]);
|
||||
this.gpuTask.resize(images[2], sizes[0]);
|
||||
this.gpuTask.resize(images[2], sizes[1]);
|
||||
for (int i = 0; i < images.length; i++) {
|
||||
for (int j = 0; j < images.length; j++) {
|
||||
if (i != j) {
|
||||
this.cpuTask.resize(images[i], sizes[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < images.length; i++) {
|
||||
for (int j = 0; j < images.length; j++) {
|
||||
if (i != j) {
|
||||
this.gpuTask.resize(images[i], sizes[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,8 +25,9 @@ public class ThresholdingTask implements Task {
|
||||
@Override
|
||||
public void runTask() {
|
||||
// load images to threshold
|
||||
Mat[] images = new Mat[] { Imgcodecs.imread("src/main/resources/skyscraper_small.jpg"), Imgcodecs.imread("src/main/resources/skyscraper_medium.jpg"),
|
||||
Imgcodecs.imread("src/main/resources/skyscraper_large.jpg") };
|
||||
Mat[] images = new Mat[] { Imgcodecs.imread("src/main/resources/skyscraper_small.jpg"),
|
||||
Imgcodecs.imread("src/main/resources/skyscraper_medium_small.jpg"), Imgcodecs.imread("src/main/resources/skyscraper_medium.jpg"),
|
||||
Imgcodecs.imread("src/main/resources/skyscraper_medium_large.jpg"), Imgcodecs.imread("src/main/resources/skyscraper_large.jpg") };
|
||||
// convert to grayscale
|
||||
for (Mat img : images) {
|
||||
Imgproc.cvtColor(img, img, Imgproc.COLOR_BGR2GRAY);
|
||||
@@ -35,10 +36,14 @@ public class ThresholdingTask implements Task {
|
||||
this.cpuTask.threshold(images[0]);
|
||||
this.cpuTask.threshold(images[1]);
|
||||
this.cpuTask.threshold(images[2]);
|
||||
this.cpuTask.threshold(images[3]);
|
||||
this.cpuTask.threshold(images[4]);
|
||||
|
||||
this.gpuTask.threshold(images[0]);
|
||||
this.gpuTask.threshold(images[1]);
|
||||
this.gpuTask.threshold(images[2]);
|
||||
this.gpuTask.threshold(images[3]);
|
||||
this.gpuTask.threshold(images[4]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+62
-25
@@ -1,57 +1,94 @@
|
||||
package de.unidue.nes.gpu.tasks.taskdefinitions;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bytedeco.opencv.global.opencv_imgcodecs;
|
||||
import org.bytedeco.opencv.global.opencv_imgproc;
|
||||
import org.bytedeco.opencv.opencv_core.GpuMat;
|
||||
import org.bytedeco.opencv.opencv_core.Mat;
|
||||
import org.bytedeco.opencv.opencv_core.Size;
|
||||
import org.opencv.core.CvType;
|
||||
|
||||
import de.unidue.nes.gpu.events.GpuEventBus;
|
||||
import de.unidue.nes.gpu.events.TaskResultEvent;
|
||||
import de.unidue.nes.gpu.tasks.Task;
|
||||
import de.unidue.nes.gpu.utils.TimingService;
|
||||
|
||||
/**
|
||||
* @author Roch P., Shahbaz Nejad B.
|
||||
*/
|
||||
public class UploadDownloadTask implements Task {
|
||||
|
||||
private static final String MS = "ms.";
|
||||
|
||||
private static final String MAT_OF_SIZE = " Mat of size ";
|
||||
|
||||
private static final String TOOK = " took ";
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger(UploadDownloadTask.class);
|
||||
|
||||
private static final int UPLOAD_DOWNLOAD_RUNS = 50;
|
||||
private static final int ITERATIONS = 100;
|
||||
|
||||
@Override
|
||||
public void runTask() {
|
||||
|
||||
org.bytedeco.opencv.opencv_core.Mat smallMat = org.bytedeco.opencv.opencv_core.Mat.eye(3, 3, CvType.CV_8U).asMat();
|
||||
public void runTask() {// TODO: maybe use skyscraper images all along the tests
|
||||
|
||||
org.bytedeco.opencv.opencv_core.Mat smallImage = opencv_imgcodecs.imread("src/main/resources/car.jpg");
|
||||
|
||||
org.bytedeco.opencv.opencv_core.Mat mediumSmallImage = new org.bytedeco.opencv.opencv_core.Mat();
|
||||
opencv_imgproc.resize(smallImage, mediumSmallImage, new Size((int) (smallImage.cols() * 2.5), (int) (smallImage.rows() * 2.5)));
|
||||
|
||||
org.bytedeco.opencv.opencv_core.Mat mediumImage = new org.bytedeco.opencv.opencv_core.Mat();
|
||||
opencv_imgproc.resize(smallImage, mediumImage, new Size(smallImage.cols() * 5, smallImage.rows() * 5));
|
||||
|
||||
org.bytedeco.opencv.opencv_core.Mat mediumBigImage = new org.bytedeco.opencv.opencv_core.Mat();
|
||||
opencv_imgproc.resize(smallImage, mediumBigImage, new Size((int) (smallImage.cols() * 7.5), (int) (smallImage.rows() * 7.5)));
|
||||
|
||||
org.bytedeco.opencv.opencv_core.Mat bigImage = new org.bytedeco.opencv.opencv_core.Mat();
|
||||
opencv_imgproc.resize(smallImage, bigImage, new Size(smallImage.cols() * 10, smallImage.rows() * 10));
|
||||
try (GpuMat smallGpuMat = new GpuMat(); GpuMat smallGpuImage = new GpuMat(); GpuMat bigGpuImage = new GpuMat()) {
|
||||
|
||||
long time1 = System.currentTimeMillis();
|
||||
for (int i = 0; i < UPLOAD_DOWNLOAD_RUNS; i++) {
|
||||
smallGpuMat.upload(smallMat);
|
||||
smallGpuMat.download(smallMat);
|
||||
}
|
||||
long time2 = System.currentTimeMillis();
|
||||
for (int i = 0; i < UPLOAD_DOWNLOAD_RUNS; i++) {
|
||||
smallGpuImage.upload(smallImage);
|
||||
smallGpuImage.download(smallImage);
|
||||
}
|
||||
long time3 = System.currentTimeMillis();
|
||||
for (int i = 0; i < UPLOAD_DOWNLOAD_RUNS; i++) {
|
||||
bigGpuImage.upload(bigImage);
|
||||
bigGpuImage.download(bigImage);
|
||||
}
|
||||
long time4 = System.currentTimeMillis();
|
||||
// LOG.debug(() -> "small image size: " + getSizeOfMat(smallImage));
|
||||
// LOG.debug(() -> "medium image size: " + getSizeOfMat(mediumImage));
|
||||
// LOG.debug(() -> "big image size: " + getSizeOfMat(bigImage));
|
||||
|
||||
LOG.info(() -> "Small mat upload + download: " + (time2 - time1) + "ms");
|
||||
LOG.info(() -> "Small image upload + download: " + (time3 - time2) + "ms");
|
||||
LOG.info(() -> "Big image upload + download: " + (time4 - time3) + "ms");
|
||||
List<Mat> matList = Arrays.asList(smallImage, mediumSmallImage, mediumImage, mediumBigImage, bigImage);
|
||||
|
||||
matList.forEach(this::testUpload);
|
||||
matList.forEach(this::testDownload);
|
||||
matList.forEach(this::testUploadAndDownload);
|
||||
|
||||
}
|
||||
|
||||
private void testUpload(Mat m) {
|
||||
try (GpuMat gpuMat = new GpuMat()) {
|
||||
long time = TimingService.measureTime(() -> gpuMat.upload(m), ITERATIONS);
|
||||
LOG.info(() -> "uploading" + MAT_OF_SIZE + getSizeOfMat(m) + TOOK + time + MS);
|
||||
GpuEventBus.INSTANCE.post(new TaskResultEvent(time, "uploading Mat of size " + getSizeOfMat(m), ITERATIONS));
|
||||
}
|
||||
}
|
||||
|
||||
private void testDownload(Mat m) {
|
||||
try (GpuMat gpuMat = new GpuMat(); Mat res = new Mat()) {
|
||||
gpuMat.upload(m);
|
||||
long time = TimingService.measureTime(() -> gpuMat.download(res), ITERATIONS);
|
||||
LOG.info(() -> "downloading" + MAT_OF_SIZE + getSizeOfMat(m) + TOOK + time + MS);
|
||||
GpuEventBus.INSTANCE.post(new TaskResultEvent(time, "downloading Mat of size " + getSizeOfMat(m), ITERATIONS));
|
||||
}
|
||||
}
|
||||
|
||||
private void testUploadAndDownload(Mat m) {
|
||||
try (GpuMat gpuMat = new GpuMat()) {
|
||||
long time = TimingService.measureTime(() -> {
|
||||
gpuMat.upload(m);
|
||||
gpuMat.download(m);
|
||||
}, ITERATIONS);
|
||||
LOG.info(() -> "uploading and downloading" + MAT_OF_SIZE + getSizeOfMat(m) + TOOK + time + MS);
|
||||
GpuEventBus.INSTANCE.post(new TaskResultEvent(time, "uploading and downloading Mat of size " + getSizeOfMat(m), ITERATIONS));
|
||||
}
|
||||
}
|
||||
|
||||
private org.opencv.core.Size getSizeOfMat(Mat m) {
|
||||
return new org.opencv.core.Size(m.cols(), m.rows());
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 652 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 133 KiB |
Reference in New Issue
Block a user