1 Star 0 Fork 1

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

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
download_models.py 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
cchen156 提交于 2018-04-17 12:53 +08:00 . first commit
import requests
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 Model (84Mb)')
download_file_from_google_drive('1wmx7AM6XWHjHIvpErmIouQgbQoMxAymG', 'checkpoint/Sony/model.ckpt.data-00000-of-00001')
download_file_from_google_drive('1OmrGMng1QuwUa8lf-_wBVvbRJwBr0ETr', 'checkpoint/Sony/model.ckpt.meta')
print('Dowloading Fuji Model (84Mb)')
download_file_from_google_drive('1PX5wA89d-JLmwQHqpBnyTYJxDVzC1gpt', 'checkpoint/Fuji/model.ckpt.data-00000-of-00001')
download_file_from_google_drive('1VzyzQ9JglcxxqUe8yn3-cAeB1pJ4jxf4', 'checkpoint/Fuji/model.ckpt.meta')
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

搜索帮助