All Articles

Python

Keras image resize raw bytes with size

> 코드, Numpy를 이용해서 resize

def resize_image_from_bytes(pre_image, original_size: tuple, target_size: tuple):
    img = np.frombuffer(pre_image, dtype=np.float32).reshape(original_size + (3,))
    img = image.array_to_img(img)
    return img.resize(target_size)

 

> 결과화면

'Python' 카테고리의 다른 글

Concat DataFrame if not exists  (0) 2023.03.13
Shape Classcification  (0) 2022.01.30
DataFrame to json utf8 한글  (0) 2022.01.07