3
$\begingroup$

I havee about 2000 images, I have uploaded them to my Google drive. How do I make colab see and read these images. All the images are in one folder.

$\endgroup$
2
$\begingroup$

There are some commands you must run, designed specifically for Colab:

from google.colab import drive
drive.mount('/content/drive')

With this, an authentication page will open. They want you to explicitly allow an access to your Drive. Click on the link and get a key code, that you can insert into an input line. At that point, you Colab Notebook is ready to access the data within you Drive account.

Each file path commonly starts with:

"/content/drive/My Drive/ ... your folders.../"

Within Colab Notebook, linux shell commands are also working, and can be accessd by putting ! before them (as in Jupyter).


NB: google.colab commands do not work outside Google Colab Notebooks, therefore, if you download your .ipybn file, remember to change those line or it'll throw error.

$\endgroup$
4
  • $\begingroup$ I did this and assigned a variable to all content in the folder and tried to split the folder's content into training and testing, but it kept bring error. Can you direct me on how to get to splitting the data? $\endgroup$ – na2016 Jan 17 '20 at 9:00
  • $\begingroup$ It's hard for me without knowing your code and your folder structure. Can you update your information? Please also consider creating a new question about it (since it's not exactly the same topic above) $\endgroup$ – Leevo Jan 17 '20 at 9:24
  • $\begingroup$ Thank you. I have just created another question. I hope to get an answer there. $\endgroup$ – na2016 Jan 17 '20 at 9:30
  • 1
    $\begingroup$ I joined this community to upvote your answer. /content/drive/My Drive/ this took me more than an hour to search for. Other permutations and combinations to get the folder path might not work. $\endgroup$ – Prasad Raghavendra Feb 27 '20 at 4:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.