1 Star 0 Fork 1

deeplearningrepos/Learning-to-See-in-the-Dark

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
download_dataset.py 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
cchen156 提交于 2018-05-10 01:59 +08:00 . Update download link
import requests
import os
def download_file_from_google_drive(id, destination):
URL = "https://docs.google.com/uc?export=download"
session = requests.Session()
response = session.get(URL, params = { 'id' : id }, stream = True)
token = get_confirm_token(response)
if token:
params = { 'id' : id, 'confirm' : token }
response = session.get(URL, params = params, stream = True)
save_response_content(response, destination)
def get_confirm_token(response):
for key, value in response.cookies.items():
if key.startswith('download_warning'):
return value
return None
def save_response_content(response, destination):
CHUNK_SIZE = 32768
with open(destination, "wb") as f:
for chunk in response.iter_content(CHUNK_SIZE):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
print('Dowloading Sony subset... (25GB)')
download_file_from_google_drive('10kpAcvldtcb9G2ze5hTcF1odzu4V_Zvh', 'dataset/Sony.zip')
print('Dowloading Fuji subset... (52GB)')
download_file_from_google_drive('12hvKCjwuilKTZPe9EZ7ZTb-azOmUA3HT', 'dataset/Fuji.zip')
os.system('unzip dataset/Sony.zip -d dataset')
os.system('unzip dataset/Fuji.zip -d dataset')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/deeplearningrepos/Learning-to-See-in-the-Dark.git
git@gitee.com:deeplearningrepos/Learning-to-See-in-the-Dark.git
deeplearningrepos
Learning-to-See-in-the-Dark
Learning-to-See-in-the-Dark
master

搜索帮助