Skip to content

Gpu frame comparison 96 - #111

Merged
chani0343 merged 10 commits into
mainfrom
gpu-frame-comparison-96
Nov 11, 2025
Merged

chani0343 merged 10 commits into
mainfrom
gpu-frame-comparison-96

Conversation

@chani0343

Copy link
Copy Markdown
Collaborator

GPU-Accelerated Frame Change Detection for DeepStream

Implements intelligent frame skipping using GPU-only processing to optimize DeepStream pipeline performance.

Key Features

  • GPU-Only Processing: Direct CUDA-EGL integration with DeepStream NvBufSurface
  • Multi-Algorithm Detection: MSE, SSIM, and Optical Flow on GPU
  • Optimized Thresholds: Achieves 86% frame skip ratio (7/50 frames processed)
  • Memory Safe: Proper GPU memory management and cleanup
  • C++ Performance: pybind11 integration for maximum efficiency

Closes #96

chani0343 and others added 8 commits November 4, 2025 19:58
- Move frame comparison operations from CPU to GPU
- Created GPUFrameChangeDetector with OpenCV CUDA functions
- Implemented GPU-based MSE, SSIM, and optical flow calculations
- Added gpu_frames_skipping_pipeline.py with GPU frame processing
- Uses cv2.cuda.resize, cv2.cuda.absdiff, cv2.cuda.multiply for GPU ops
- Downloads to CPU only for final calculations (mean, std)
- Eliminates GPU→CPU→GPU copies for frame processing
- Maintains same thresholds and logic as CPU version
Co-authored-by: Sarah Gershuni <sarah556726@gmail.com>
Co-authored-by: Chani Orlinski <c9992946@gmail.com>
Co-authored-by: Sarah Gershuni <sarah556726@gmail.com>
Co-authored-by: Chani Orlinski <c9992946@gmail.com>
- Implemented CUDA-EGL GPU buffer access from DeepStream
- Added C++ pybind11 wrapper for GPU frame processing
- Integrated MSE, SSIM, and Optical Flow detection algorithms
- Created GPU-based frame skipping pipeline for DeepStream
- Added Makefile for building C++ extensions with CUDA support
- Add C++ GPU frame change detector with CUDA-EGL integration
- Add pybind11 wrapper for DeepStream GPU buffer access
- Update pipeline to use GPU-only frame processing
- Fix Makefile to compile correct GPU modules
- Implement same logic as CPU version but entirely on GPU
- Updated GPU thresholds: MSE<10.0, SSIM>0.995, FLOW<0.05
- Achieved 7/50 frame processing (86% skip rate)
- Removed deprecated gpu_buffer files
- Updated gpu_probe with improved frame processing
@chani0343 chani0343 linked an issue Nov 9, 2025 that may be closed by this pull request

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add typings

Comment thread src/gpu_frames_skipping_pipeline.py Outdated

stats = {"total": 0, "skipped": 0, "processed": 0}

def get_jetson_frame(gst_buffer, batch_id):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you using this function? I am a bit confused since to me it seems like it's not called anywhere

Comment thread src/gpu_frames_skipping_pipeline.py Outdated
print(f" Skip Ratio: {skip_ratio:.1%}")

if __name__ == "__main__":
run_jetson_pipeline() No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a newline

Sarah5567 and others added 2 commits November 10, 2025 14:36
Co-authored-by: Sarah Gershuni <sarah556726@gmail.com>
Co-authored-by: Chani Orlinski <c9992946@gmail.com>
@chani0343
chani0343 merged commit 78f8efa into main Nov 11, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move frame comparison technique ops to GPU

3 participants