tf.keras.preprocessing

    PIL과 opencv에서의 image 변환.

    필요성 tensorflow.keras.preprocessing 에서의 image를 이용한 이미지 로딩의 경우, PIL.Image.Image를 이미지 타입으로 사용함. from tensorflow.keras.preprocessing import image image_tf = image.load_img('test.gif') print(f'type : {type(image_tf)}') type : opencv를 이용한 전처리를 할 경우에는 이 두 라이브러리의 데이터간 변환이 필요했음. 방법 방법 자체는 매우 간단한데, opencv의 python라이브러리는 실제로 numpy의 ndarray를 이미지 타입으로 사용하기 때문에 PIL.Image.Image와 numpy의 array간의 변환을 이용하면 된다. 단, c..