简体   繁体   中英

Read images from a bucket in GCP for ML

I have created a bucket in GCP containing my images dataset.

The path to it is: xray-competition-bucket/img_align_celeba

How do I read it from GCP to Jupyter Lab in Vertex AI?

My code is:

MAIN_PATH = '/gcs/xray-competition-bucket/img_align_celeba'

image_paths = glob((MAIN_PATH + "/*.jpg"))

and the result is that image_paths is an empty array.

Note: I also tried the path gs://my_bucket/...

You will need to download the GCS file locally using gsutil or the python SDK if you want to use glob. There are also libraries like GCSFS or TensorFlow's GFile which offer a pythonic file-system interface for working with GCS. For example, here is GFile.glob .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM