Discriminative Active Learning

This repository contains the code used to run the deep active learning experiments detailed in our paper - https://arxiv.org/abs/1907.06347

You may use the code in this repository, but note that this isn't a complete active learning library and is not fully generic. Replicating the experiments and using the implementations should be easy, but adapting the code to new datasets and experiment types may take a bit of effort.

For the blog post detailing the thought process and relevant background for the algorithm, click here.

Dependencies

In order to run our code, you'll need these main packages:

Running the Code

The code is run using the main.py file in the following way:

python3 main.py <experiment_index> <dataset> <batch_size> <initial_size> <iterations> <method> <experiment_folder> -method2 <method2> -idx <indices_folder> -gpu <gpus>

There are also three optional parameters:

Possible Method Names

These are the possible names of methods that can be used in the experiments:

Directory Structure

main.py

This file contains the logic which runs the active learning experiment and saves the results to the relevant folder.

models.py

This file contains all of the neural network models and training functions used by the query methods.

query_methods.py

this file contains the query strategy implementations for all of the methods detailed in the blog.

Examples

python3 main.py 0 "mnist" 100 100 20 "Random" "/path/to/experiment/folder" -idx "/path/to/folder/with/initial/index/file"
python3 main.py 7 "cifar10" 5000 5000 5 "DiscriminativeLearned" "/path/to/experiment/folder" -idx "/path/to/folder/with/initial/index/file"
python3 main.py 0 "cifar100" 5000 5000 3 "Adversarial" "/path/to/experiment/folder" -method2 "Bayesian" -gpu 2