Download City Scapes Dataset with script

Cem Sazara
Towards Data Science
2 min readSep 27, 2018

--

City Scapes dataset is a very popular dataset that consists of labeled street images (from video sequence). There are 5000 high-quality labeled frames and 20000 weakly annotated frames. The website for this dataset is www.cityscapes-dataset.com

When I was working with this dataset, I quickly realized the dataset can only be downloaded from the website after logging in. So, there is no direct download link. This means when you need to deploy a deep learning model to a cloud machine or to another linux machine, you need to get the data from another source: Dropbox etc. Some of the data files are really large: 44GB, 11GB, 6.6GB !!! . A solution to this problem is to login and download the data without a browser.

First, you need to create an account in the web page. You will use your username and password in the first line of the script to login to the page.

Here is the two line script:

wget --keep-session-cookies --save-cookies=cookies.txt --post-data 'username=myusername&password=mypassword&submit=Login' https://www.cityscapes-dataset.com/login/wget --load-cookies cookies.txt --content-disposition https://www.cityscapes-dataset.com/file-handling/?packageID=1

In the first line, put your username and password. This will login with your credentials and keep the associated cookies.

In the second line, you need to provide the packageID paramater and it downloads the file.

packageIDs map like this in the website:

1 -> gtFine_trainvaltest.zip (241MB)
2 -> gtCoarse.zip (1.3GB)
3 -> leftImg8bit_trainvaltest.zip (11GB)
4 -> leftImg8bit_trainextra.zip (44GB)
8 -> camera_trainvaltest.zip (2MB)
9 -> camera_trainextra.zip (8MB)
10 -> vehicle_trainvaltest.zip (2MB)
11 -> vehicle_trainextra.zip (7MB)
12 -> leftImg8bit_demoVideo.zip (6.6GB)
28 -> gtBbox_cityPersons_trainval.zip (2.2MB)

A screenshot from the download page:

You can see the GitHub repository for this script here.

--

--