Created
October 28, 2022 05:34
-
-
Save BrambleXu/9ce3ddc2925702898418451bbb391987 to your computer and use it in GitHub Desktop.
download zip file and up zip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import tarfile | |
import urllib.request | |
from datetime import datetime | |
import zipfile | |
data_dir = "./data/" | |
if not os.path.exists(data_dir): | |
os.mkdir(data_dir) | |
url = "https://storage.googleapis.com/kaggle-data-sets/1271215/2118595/compressed/VOC2012_test.zip?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=gcp-kaggle-com%40kaggle-161607.iam.gserviceaccount.com%2F20221027%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20221027T022952Z&X-Goog-Expires=259200&X-Goog-SignedHeaders=host&X-Goog-Signature=5e2c235b7719fb9183398086bb7650e39d7cecd7c2c5412c701afdca892a7e3f05c82862f252c5e29457e90a98a359f7896510f9e757350deafb72800f7c38a7cc094803fb09d4bc044d62795cdaacc7d9d0f43777c40f8acc89f82d25377745c873d39cd97520b0124d850b1a167fbd4eb6c3b9be02b8845e649427f2e97271175c6621623d46f66c3199cdc5721d23ce46ff0e0444e99d368502bc1c73de7cac69aadabffdf5d76ad28a627c2f5fd48e98bfb470afd7d37eae04b4bda191f20d3ab2f4e68495d5e089a824d593e60d81872349848df79d2f25ae8cd6facf55c3eed54568a08c12c80e01dbe30af565251f20a101c9e85ab3cf788f32146920" | |
target_path = os.path.join(data_dir, "VOC2012_test.zip") | |
time_start = datetime.now() | |
if not os.path.exists(target_path): | |
urllib.request.urlretrieve(url, target_path) | |
with zipfile.ZipFile(target_path, 'r') as zf: | |
zf.extractall(data_dir) | |
time_end = datetime.now() - time_start | |
print(f"Download: {time_end}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download tar