Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix numpy deprecation warning on creating ragged array when using _pad_image #1632

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/super_gradients/training/transforms/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ def _pad_image(image: np.ndarray, padding_coordinates: PaddingCoordinates, pad_v
pad_value = tuple(pad_value)

constant_values = ((pad_value, pad_value), (pad_value, pad_value), (0, 0))
# Fixes issue with numpy deprecation warning since constant_values is ragged array (Have to explicitly specify object dtype)
constant_values = np.array(constant_values, dtype=np.object_)

padding_values = (pad_h, pad_w, (0, 0))
else:
if isinstance(pad_value, numbers.Number):
Expand Down