wqw547243068 / school-of-ai-beijing

School of AI 北京
https://wqw547243068.github.io/school-of-ai-beijing/
MIT License
20 stars 15 forks source link

【问题】Google Colab环境问题 #3

Open zhouqihong opened 5 years ago

wqw547243068 commented 5 years ago

(1)参考这篇博客,里面有这节课的图片下载代码

folder = 'teddys'
file = 'urls_teddys.txt'
path = Path('data/bears')
dest = path/folder
dest.mkdir(parents=True, exist_ok=True)

download_images(path/file, dest, max_pics=200)

# 如果下载出现问题,uncomment下列代码查看
# download_images(path/file, dest, max_pics=20, max_workers=0)

(2)去fastai源代码里找image_download的定义 (3)fastai官网类似帖子 来自fastai中文笔记 Step 4: Saving your data files 如果你希望改写你的文件,你需要允许你的Colaboratory instance读取和改写你的 Google Drive. 你只需要在每一个notebook的第一个Cell中写入以下代码

from google.colab import drive
drive.mount('/content/gdrive', force_remount=True)
root_dir = "/content/gdrive/My Drive/"
base_dir = root_dir + 'fastai-v3/'

现在,Google Drive 变成了一个文件系统允许标准python读写文件. 不要忘记给所有notebook的根目录地址前加上 base_dir . 例如, 在 lesson2-download.ipynb 5th cell, 做一下修改

path = Path(base_dir + 'data/bears')
dest = path/folder
dest.mkdir(parents=True, exist_ok=True)
zhouqihong commented 5 years ago

太感动了,谢谢王老师,谢谢您的回复,您辛苦了! 祝好! 周启红


发件人: Qiwen Wang notifications@github.com 发送时间: 2019年5月12日 22:45 收件人: wqw547243068/school-of-ai-beijing 抄送: zhouqihong; State change 主题: Re: [wqw547243068/school-of-ai-beijing] 如何下载图片 (#3)

(1)参考这篇博客https://zhuanlan.zhihu.com/p/56567350,里面有这节课的图片下载代码

folder = 'teddys'

file = 'urls_teddys.txt'

path = Path('data/bears')

dest = path/folder

dest.mkdir(parents=True, exist_ok=True)

download_images(path/file, dest, max_pics=200)

如果下载出现问题,uncomment下列代码查看

download_images(path/file, dest, max_pics=20, max_workers=0)

(2)去fastai源代码里找image_download的定义https://github.com/fastai/fastai/blob/master/fastai/widgets/image_downloader.py

― You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/wqw547243068/school-of-ai-beijing/issues/3#issuecomment-491601949, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AMBCA74VQZ4HZCKANJMJG23PVAUR3ANCNFSM4HMJTZOQ.

wqw547243068 commented 5 years ago

不一定管用,上面是从drive里读数据,好像跟你的不一样,必要的话,把那你的代码贴出来