Open PatrickRooney opened 1 year ago
This method seems to work:
from google.colab import drive drive.mount('/content/gdrive')
train_mugs = '/content/gdrive/MyDrive/images_CNN_jpg/train/mugs/' train_books = '/content/gdrive/MyDrive/images_CNN_jpg/train/books/'
test_mugs = '/content/gdrive/MyDrive/images_CNN_jpg/test/mugs/' test_books = '/content/gdrive/MyDrive/images_CNN_jpg/test/books/'
import os os.listdir(test_mugs)
['IMG_1914.HEIC.jpg', 'IMG_1918.HEIC.jpg']
Thanks to Adam Nelson's post https://levelup.gitconnected.com/how-to-get-data-from-gdrive-into-google-colab-b0a807c01300
I'm working on Exercise 3 from 03_Conv_NN_in_TF: Take 10 photos of two different things and build your own CNN image classifier using the techniques we've built here.
I have 20 images saved in my Google drive folders (train/mugs, train/books, test/mugs, test/books) with which to build a Conv_NN classifier (see the screenshot below for the train/mugs files).
How do I read these files into my colab notebook?
I tried
!wget https://drive.google.com/drive/u/0/folders/1QLadgsowxtVp0UUWrpL3Z3cSwRsoxe8K
and it appears to read something in but
!ls 1QLadgsowxtVp0UUWrpL3Z3cSwRsoxe8K
didn't produce the expect 8 filenames but only displayed
1QLadgsowxtVp0UUWrpL3Z3cSwRsoxe8K
I don't like not seeing the folder names as I assigned them in Google drive (train/mugs). Is there any way around that?
Here's what Google drive shows for my train/mugs folder:
Thank you in advance for any code or help you can give me on how to read in these image files!