This repository holds scripts to process building functions and predict building functions based on streetview images by finetuning a tensorflow convolutional neural network.
A dataset of buildings, the BAG (data viewer | get data via WFS), was used to derive all building centroids and functions in Amsterdam.
concatenateBuildingFunctions.Rmd: The building functions were concatenated from multiple text entries to multi-label numerical classes. Functions for buildings are residential, meeting, industry, office, accomodation, education, shop and other.
downloadStreetviewImages.py: This script finds streetview images for a list of coordinates and stores images, metadata and information on download proces. The script is modified from a streetview script by Adrian Letchford. The streetview API is apparently not maintained by Google, but does still work (knocks on wood). Input list of coordinates is retrieved from a .csv file in ./input folder and output information (metadata, images, download process information) is stored in ./data repository.
checkImageJPG.py: Checks if images have correct JPG format
createDistributionImages.py: After having the data in the correct format, a random distribution of buildings is appointed to training (60%), validation (20%) and testing (20%) categories. The random distribution is made so that buildings in the same neighbourhood do not get in separate categories. Otherwise training and testing might be biased, because two identical buildings in the same street can both be in training and testing dataset.
retrainAdj.py: Re-training a convolutional neural network with premade training, validation and test datasets and to give more outcome statistics. Script was modified from image retraining script by Tensorflow. This script has to be run from terminal as:
$ python2 ./retrain_adj.py --image_dir /home/david/Documents/streetview-
master/data_valid_resid_any/F30
fixOutcomeStatisticsMeetingOffice.py: The outcome statistics of meeting and office were fixed, because presence and absence values were turned around.
calculateStatisticsDistanceAge.py: Calculates the statistical association between independent variables distance, building age, streetview image age and neighbourhood with the amount of correct predictions
createBackup.py: A script that makes a back-up of reports/scripts and stores it on a USB-stick.
Feel free to download, share and use these scripts.
- author = "David Swinkels"
- github = "davidswinkels"
- purpose = "Part of MSc thesis Geo-Information Science at Wageningen University"
- status = "Production"