-
Notifications
You must be signed in to change notification settings - Fork 116
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
Image preprocessing block (flip, rotate, resize) #683
Conversation
} | ||
}, | ||
) | ||
flip_type: Union[str, WorkflowParameterSelector(kind=[STRING_KIND]), Literal["vertical", "horizontal", "both"]] = Field( # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove str here
np_image: np.ndarray, width: Optional[int], height: Optional[int] | ||
) -> np.ndarray: | ||
if width is None and height is None: | ||
return np_image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return np_image | |
return np_image.copy() |
We should return copy of the image to be consistent with remainder of this method where copy is returned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
def apply_rotate_image(np_image: np.ndarray, rotation_degrees: Optional[int]): | ||
if rotation_degrees is None or rotation_degrees == 0: | ||
return np_image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return np_image | |
return np_image.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
def apply_rotate_image(np_image: np.ndarray, rotation_degrees: Optional[int]): | ||
if rotation_degrees is None or rotation_degrees == 0: | ||
return np_image | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already returned, else is not required (can save one indent level)
…ence into image_preprocessing_block
Description
Add a block that supports resizing, flipping, and rotating
Type of change
How has this change been tested, please provide a testcase or example of how you tested the change?
UI editor & with tests
Any specific deployment considerations
n/a
Docs
n/a