목록2021/10/26 (1)
강
[Python] Imagenet grayscale to rgb channel 처리
AWS S3에 있는 Imagenet validation dataset 50000개를 가지고 추론 작업을 해보고 있었다. 작업을 위한 코드는 다음과 같다. img = read_image_from_s3(file) # s3에서 image를 가져오는 함수 img = img.resize((224, 224), Image.ANTIALIAS) # file의 가로, 세로를 224x224로 resize img = np.array(img) # 이미지를 numpy type으로 변경 img = img.reshape((1, img.shape[0], img.shape[1], img.shape[2])) # batch size를 추가 위의 코드를 이미지의 개수만큼 반복을 하여 image 전처리를 진행한다. 정상적으로 진행 되는 이미지..
Python
2021. 10. 26. 15:03