FranciscusRenatus / measuring-inequalities-sview

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

measuring-inequalities-sview

Code used for the paper: Measuring social, environmental and health inequalities using deep learning and street imagery

Data preperation

1. Get labels /data-prep/get_labels.py

The initial data download for labels (for each Lower Super Output Area - LSOA) need to be completed from the corresponding websites (as described below with links). The script reads these downloaded files in, and computes the deciles from the input values that are used in training as labels.

2. Exctract features from images /data-prep/vgg_features_extract.py

This script uses VGG16 pre-trained network weights to extract 4096D vectors (i.e. codes) from each of the street level images used.

3. Create HDF5 data for training /data-prep/make_hdf5.py

Creating hdf5 files from VGG16 features and pickle files for labels to be used in training.

Reads in: (i) features (codes) extracted from images using VGG16 (extract_features_gview.py), (ii) metadata containing labels, and input image ids

Outputs: (i) HDF5 file with features (4096D codes extracted from VGG16), (ii) labels file with corresponding variable values

Ordinal classification (deep learning based assignment to deciles)

/classification/ordinal_classification_sview_tboard.py

The assignment of each postcode to an outcome decile is an ordinal classification task, for which we used the network shown below. We used pre-trained weights of the VGG16, and only trained for the weights of the fully connected layers.

Aggregation

/aggregation/get_lsoa_level_predictions.py

Ground truth data for our analysis was only available at the Lower Super Output Area (LSOA) level for the cities we focused on. To test the performance of our networks, we needed predictions at the LSOA level and not image level. The mean continuous output value for each LSOA was computed by averaging postcode-level continuous outputs generated by the final layer of trained networks before the application of the fore-mentioned sigmoid function. The mean value computed for each LSOA was then converted to a decile category, and compared to the LSOA’s actual decile.

Pre-trained models in Tensorflow

Will be made available soon for trained networks using London images

About


Languages

Language:Python 100.0%