Skip to content

[Testing] Rewrite python tests for Normalize, CvtColor, BilateralFilter, BndBox, Histogram, GammaContrast, Composite#64

Merged
zacharyvincze merged 19 commits intoROCm:developfrom
zacharyvincze:zv/testing/rewrite-remaining-pytests
Sep 12, 2025
Merged

[Testing] Rewrite python tests for Normalize, CvtColor, BilateralFilter, BndBox, Histogram, GammaContrast, Composite#64
zacharyvincze merged 19 commits intoROCm:developfrom
zacharyvincze:zv/testing/rewrite-remaining-pytests

Conversation

@zacharyvincze
Copy link
Copy Markdown
Contributor

Motivation

Aims to rewrite python tests so that they are no longer reliant on expected test images.

Technical Details

  • Rewrites python tests for Normalize, CvtColor, BilateralFilter, BndBox, Histogram, GammaContrast and Composite.
  • Fixes a bug in the Histogram python operator definition for which the batch size was hard-coded to 1 for the generated output tensor size.
  • Removes the now unused expected test images.

Test Plan

  • Run python/C++ tests to ensure new tests pass and that there is no regression (with the removal of test images).

Test Result

  • All C++/Python tests are passing as expected.

Submission Checklist

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR rewrites Python tests for multiple computer vision operators to eliminate dependency on expected test images and makes tests more maintainable by using generated random tensors instead. It also fixes a batch size bug in the Histogram operator's Python bindings.

  • Rewrites tests for Normalize, CvtColor, BilateralFilter, BndBox, Histogram, GammaContrast, and Composite operators
  • Fixes hardcoded batch size bug in Histogram operator Python definition
  • Removes dependency on expected test images by using tensor comparison approach

Reviewed Changes

Copilot reviewed 10 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test_op_normalize.py Replaces image-based tests with parametrized tests using generated tensors
test_op_non_max_suppression.py Updates to use tensor generation and comparison instead of binary file comparison
test_op_histogram.py Converts from grayscale image input to generated tensor input with tensor comparison
test_op_gamma_contrast.py Replaces image loading with generated tensor approach and tensor comparison
test_op_cvt_color.py Updates color conversion tests to use generated tensors and parametrized color codes
test_op_composite.py Converts composite operation tests to use generated tensors for all inputs
test_op_bnd_box.py Replaces hardcoded bounding box setup with random box generation
test_op_bilateral_filter.py Updates bilateral filter tests with generated tensors and expanded parameter testing
test_helpers.py Adds generic tensor generation function and updates parameter naming
py_op_histogram.cpp Fixes batch size calculation bug that was hardcoded to 1

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@zacharyvincze zacharyvincze merged commit 003cb76 into ROCm:develop Sep 12, 2025
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci:precheckin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants