저는 로컬 또는 클라우드에서 학습 할 수있는 기계 학습 코드를 작성하고 있습니다. 후드 아래에서 PIL을 사용하는 이미지를로드하려면 keras.preprocessing을 사용하고 있습니다. 로컬 파일은 정상적으로 작동하지만 'gs : // ...'와 같은 Google Cloud Storage 경로는 이해할 수 없습니다.keras.preprocessing을 사용하여 Google Cloud Storage에서 이미지를로드하는 방법
.../lib/python2.7/site-packages/keras/preprocessing/image.py", line 320, in load_img img = pil_image.open(path) File .../lib/python2.7/site-packages/PIL/Image.py", line 2530, in open fp = builtins.open(filename, "rb") IOError: [Errno 2] No such file or directory: 'gs://myapp-some-bucket/123.png'
이 일을 올바른 방법은 무엇입니까 :
from keras.preprocessing import image image.load_img("gs://myapp-some-bucket/123.png")
저는 Keras에 익숙하지 않습니다. 직접 GCS 액세스를 지원하지 않을 수도 있습니다. 데이터 세트가 크지 않은 경우 미리 설치된 gsutil cli를 사용하여 데이터 세트를 먼저 VM에 복사 할 수 있습니다. 파이썬에서는 os.system ('gsutil cp YOUR_GCS_FILE.')을 호출 할 수 있습니다. –