All Projects → oscarkey → Multitask Learning

oscarkey / Multitask Learning

Licence: mit
MSc group project: Reproduction of 'Multi-Task Learning using Uncertainty to Weigh Losses for Scene Geometry and Semantics'; A. Kendall, Y. Gal, R. Cipolla

Projects that are alternatives of or similar to Multitask Learning

Pyhat
Python Hyperspectral Analysis Tools
Stars: ✭ 32 (-3.03%)
Mutual labels:  jupyter-notebook
Pm Pyro
PyMC3-like Interface for Pyro
Stars: ✭ 33 (+0%)
Mutual labels:  jupyter-notebook
Object detection tools
Object detection useful tools for TensorFlow Object Detection API
Stars: ✭ 33 (+0%)
Mutual labels:  jupyter-notebook
Madmom tutorials
Tutorials for the madmom package.
Stars: ✭ 32 (-3.03%)
Mutual labels:  jupyter-notebook
Gaze Estimation
A deep learning based gaze estimation framework implemented with PyTorch
Stars: ✭ 33 (+0%)
Mutual labels:  jupyter-notebook
Voice emotion
Detecting emotion in voices
Stars: ✭ 33 (+0%)
Mutual labels:  jupyter-notebook
Musings
Repo of some side-issues/Sub-problems and their solutions I have encountered in my ML work in past few years.
Stars: ✭ 32 (-3.03%)
Mutual labels:  jupyter-notebook
Aws Deepracer Workshops
DeepRacer workshop content
Stars: ✭ 968 (+2833.33%)
Mutual labels:  jupyter-notebook
Yolact Tutorial
A tutorial for using YOLACT in Google Colab
Stars: ✭ 33 (+0%)
Mutual labels:  jupyter-notebook
Pytorch Softplus Normalization Uncertainty Estimation Bayesian Cnn
PyTorch code for Paper "Uncertainty Estimations by Softplus normalization in Bayesian Convolutional Neural Networks with Variational Inference"
Stars: ✭ 33 (+0%)
Mutual labels:  jupyter-notebook
Omx
Open Matrix (OMX)
Stars: ✭ 32 (-3.03%)
Mutual labels:  jupyter-notebook
Lectures2020
Stars: ✭ 33 (+0%)
Mutual labels:  jupyter-notebook
Numerical methods youtube
Stars: ✭ 32 (-3.03%)
Mutual labels:  jupyter-notebook
Pydata Amsterdam 2016
Machine Learning with Scikit-Learn (material for pydata Amsterdam 2016)
Stars: ✭ 32 (-3.03%)
Mutual labels:  jupyter-notebook
Multi Label
Pytorch code for multi-Instance multi-label problem
Stars: ✭ 33 (+0%)
Mutual labels:  jupyter-notebook
2016learnpython
Python Teaching, Seminars for 2nd year students of School of Linguistics NRU HSE
Stars: ✭ 32 (-3.03%)
Mutual labels:  jupyter-notebook
Attentive Neural Processes
implementing "recurrent attentive neural processes" to forecast power usage (w. LSTM baseline, MCDropout)
Stars: ✭ 33 (+0%)
Mutual labels:  jupyter-notebook
Natural Language Processing
Resources for "Natural Language Processing" Coursera course.
Stars: ✭ 969 (+2836.36%)
Mutual labels:  jupyter-notebook
Geemap
A Python package for interactive mapping with Google Earth Engine, ipyleaflet, and folium
Stars: ✭ 959 (+2806.06%)
Mutual labels:  jupyter-notebook
Simple Ssd For Beginners
This repository contains easy SSD(Single Shot MultiBox Detector) implemented with Pytorch and is easy to read and learn
Stars: ✭ 33 (+0%)
Mutual labels:  jupyter-notebook

Reproduction of 'Multi-Task Learning using Uncertainty to Weigh Losses for Scene Geometry and Semantics'

Kendall, Y. Gal and R. Cipolla. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018

Reproduction implemented by D. Baerg, O. Key, J. Materzynska, and M. Tong as part of the MSc Computer Science at the University of Oxford.

In many applications of machine learning it is beneficial to have a single model achieve several objectives simultaneously. This can be more computationally efficient and produce more accurate results than training separate models for each task [1]. However, this opens the question of how to combine the losses from each individual task into a single overall loss.

One option is to use a simple weighted sum of the loss of each individual task. However, using a grid search to find the weights can be very expensive, and may not find the optimal values because it is limited in resolution. The weights might also have varying optimal values at different epochs during training, and so any value of the fixed weights may not be optimal for the entire training procedure.

The hypothesis that the paper presents and tests is that a multi-task model will achieve higher accuracy when using a loss which weights each task by a function of its homoscedastic aleatoric uncertainty, rather than by fixed weights. Moreover, a multi-task model will achieve higher accuracy than several single task models learning each task individually.

For more details, including the derivation of the loss function, see reports/aml_report_oscar_key.pdf or the original paper.

Our results

On a simple task, using the Fashion MNIST dataset, we are able to reproduce results analogous to those in the original paper.

On the Cityscapes task, as used by the original paper, we are unable to reproduce the baseline results. We ran out of time during the project to debug the baselines.

Again, for more details see reports/aml_report_oscar_key.pdf.

Fashion MNIST task

The model performs two tasks. The first is classification of the input image into one of the 10 classes. The second is to compress the image down to a low dimensional representation, and then reconstruct the original image (i.e. an autoencoder). In a similar fashion to the original paper, the model has a larger shared encoder module and two small decoders, one for each task.

We use the cross-entropy loss function for the classification task, and the L2 loss function from the reconstruction task. We follow similar steps to the original paper to derive the overall loss function, see mnist_loss.py.

The results below, analogous to those in the original paper, demonstrate that weighting the loss of each task by a function of the learned heteroscedastic variance of the task results in higher accuracy than setting the weights by grid search, or when training each task individually.

This supports the hypothesis of the original paper, however only weakly because the Fashion MNIST task is not as rich as the majority of real-world tasks in computer vision.

Table of results on the Fashion MNIST task
Results on the Fashion MNIST task

Graphs of classfication accuracy and reconstruction error on Fashion MNIST task
Graphs showing classification accuracy and reconstruction error for the different loss functions

Running the code

Initialise the environment using pipenv install.

To use Sacred with a database, create a file multitask-learning/sacred_creds.py with two constants url and database_name. See the Sacred docs for how to configure these.

To use Sacred without a database, use the command line argument with save_to_db=False.

Fashion MNIST

pipenv shell
PYTHONPATH="multitask-learning" python3.7 multitask-learning/mnisttask/mnist.py with save_to_db=False

See mnist.py for configuration arguments.

Cityscapes

Request, download and extract the Cityscapes dataset

pipenv shell
PYTHONPATH="multitask-learning" python3.7 multitask-learning/cityscapestask/main.py with save_to_db=False root_dir_train=... root_dir_validation=...

Set root_dir_train and root_dir_validation to the training and validation sets downloaded from Cityscapes.

In the original paper the authors run several experiments on 'Tiny Cityscapes', which is a downsampled version of the full-size dataset. scripts/create_tiny_cityscapes.py will create this smaller dataset.

[1] Baxter, Jonathan. "A model of inductive bias learning." Journal of artificial intelligence research 12 (2000): 149-198.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].