Last active
May 26, 2020 20:35
-
-
Save Mohamedemad4/019840d76078863d1dc22a438ddf02f2 to your computer and use it in GitHub Desktop.
Downloads and Unzips the Entire KITTI dataset for the selected categories
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 requests as req | |
from bs4 import BeautifulSoup | |
import pprint | |
import os | |
b_url="http://www.cvlibs.net/datasets/kitti/raw_data.php?type={0}" | |
cats=["city","residential","campus","road"] | |
all_data_files=[] | |
all_calib_files=[] | |
for i in cats: | |
c=req.get(b_url.format(i)).content | |
links=[] | |
soup = BeautifulSoup(c, "lxml") | |
for link in soup.findAll('a'): | |
links.append(link.get('href')) | |
calib_files=[i for i in links if i.endswith("calib.zip")] | |
data_files=[i for i in links if i.endswith("sync.zip")] | |
all_data_files+=data_files | |
all_calib_files+=calib_files | |
all_calib_files=list(set(all_calib_files)) #rm all duplicates | |
all_data_files=list(set(all_data_files)) | |
pprint.pprint(all_calib_files) | |
pprint.pprint(all_data_files) | |
for i in all_data_files+all_calib_files: | |
os.system("wget -c {0} -O {1}".format(i,i.split("/")[-1])) | |
os.system("unzip -q -{0}".format(i.split("/")[-1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment