Created
December 25, 2021 14:46
-
-
Save afspies/b1cf52bbc50168ec1d899b86acec20b2 to your computer and use it in GitHub Desktop.
Python Library Shape Conventions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Originally taken from Xander Steenbrugge | |
# cv2: | |
height, width, _ = img.shape | |
img_resized = cv2.resize(img, (new_width, new_height)) | |
img_pixel_values = img[top:down, left:right, :] | |
# PIL | |
width, height = img.size | |
img_resized = img.resize((new_width, new_height)) | |
# PyTorch | |
[n, channels, height, width] = pt_img_tensor.shape | |
[n, height, width, channels] = tf_img_tensor.shape # with data_format = 'channels_last' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment