March 2018
Beginner to intermediate
306 pages
9h 54m
English
You need to complete the following steps:
import cv2import numpy as np
image_bgr = cv2.imread('../data/Lena.png', cv2.IMREAD_COLOR)print(image_bgr.shape)
image_bgr_float = image_bgr.astype(np.float32)image_rgb = image_bgr_float[..., ::-1]tensor_chw = np.transpose(image_rgb, (2, 0, 1))tensor_nchw = tensor_chw[np.newaxis, ...]print(tensor_nchw.shape)