Skip to content

Commit

Permalink
#43 add benchmark "blur-faces-single-stream"
Browse files Browse the repository at this point in the history
  • Loading branch information
tomskikh committed Jan 30, 2023
1 parent 028b98e commit 2b2c51d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions gpumat/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,24 @@ def benchmark_gpu_blur_faces_parallel(
results[i][1].copyTo(results[i][0])


def benchmark_gpu_blur_faces_single_stream(
gst_buffer: Gst.Buffer,
nvds_frame_meta: pyds.NvDsFrameMeta,
data: BenchmarkData,
):
with nvds_to_gpu_mat(gst_buffer, nvds_frame_meta) as frame_mat:
stream = cv2.cuda.Stream()
results = []
for x, y in data.points:
roi_mat = cv2.cuda.GpuMat(frame_mat, (x, y, FACE_WIDTH, FACE_HEIGHT))
results.append(
(roi_mat, data.cuda_blur_filter.apply(roi_mat, stream=stream))
)
stream.waitForCompletion()
for roi_mat, blurred_mat in results:
blurred_mat.copyTo(roi_mat)


def benchmark_gpu_blur_faces_in_cpu(
gst_buffer: Gst.Buffer,
nvds_frame_meta: pyds.NvDsFrameMeta,
Expand Down Expand Up @@ -185,6 +203,7 @@ def benchmark_gpu_download_upload(
'draw-rectangles': (benchmark_cpu_draw_rectangles, benchmark_gpu_draw_rectangles),
'blur-faces': (benchmark_cpu_blur_faces, benchmark_gpu_blur_faces),
'blur-faces-parallel': (None, benchmark_gpu_blur_faces_parallel),
'blur-faces-single-stream': (None, benchmark_gpu_blur_faces_single_stream),
'blur-faces-in-cpu': (None, benchmark_gpu_blur_faces_in_cpu),
'download-upload': (None, benchmark_gpu_download_upload),
}
Expand Down
1 change: 1 addition & 0 deletions gpumat/run_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ GPU_BENCHMARK_NAMES=(
"draw-rectangles"
"blur-faces"
"blur-faces-parallel"
"blur-faces-single-stream"
"blur-faces-in-cpu"
"download-upload"
)
Expand Down

0 comments on commit 2b2c51d

Please sign in to comment.