Code Monkey home page Code Monkey logo

classification-under-assistance's Introduction

Classification Under Human Assistance

This is a repository containing the code and data for the paper:

A. De, N. Okati, A. Zarezade and M. Gomez-Rodriguez. Classification Under Human Assistance.

The paper is available on archive.

Pre-requisites

This code depends on the following packages:

  1. numpy
  2. scipy
  3. matplotlib
  4. sklearn
  5. Keras (for preprocessing image datasets)
  6. Tensorflow (for preprocessing image datasets)

Code structure

  • algorithms.py and baseline_classes.py contain the implementation of our algorithms and the baselines.
  • train.py training script.
  • test.py testing and plotting script
  • generate_human_error.py generates human error for the image datasets.
  • generate_synthetic.py generates synthetic datasets.
  • preprocess.py preprocessing and feature extraction of image datasets script
  • cross_validate.py finds the best \lambda value using cross validation
  • /Results contains pretrained models
  • /plots contains the figures of the paper
  • /data preprocessed real datasets and generated synthetic datasets are saved in this folder.

Execution

Test and generate the figures:

python test.py --dataset=dataset_name --svm_type=svm_type

For example: python test.py --dataset=Messidor --svm_type=soft_linear_with_offset

The figures will be saved in /plots folder.

Available datasets : ['Messidor', 'Stare', 'Aptos', 'Linear','Kernel','hard_linear']

  • Messidor, Stare and Aptos are the real datasets.

  • Linear and Kernel are the synthetic datasets.

Available svm types: ['soft_linear_with_offset'(default), 'hard_linear_with_offset', 'soft_linear_without_offset', 'hard_linear_without_offset','soft_kernel_with_offset']

Run the algorithms:

python train.py --dataset=dataset_name --svm_type=svm_type

For example: python train.py --dataset=Stare --svm_type=soft_linear_with_offset

All the default parameters are set based on the paper. You can change them in the code.

The results will be saved in /Results folder. The results corresponding to all datasets are already generated and saved in /Results.

Regenerate synthetic data:

There is no need to run this script if you want to use the same synthetic data as mentioned in the paper, but, if you wish to generate synthetic datasets with new settings you can modify the generate_synthetic.py script and then run:

python generate_synthetic.py name_of_the_synthetic_dataset

For example: python generate_synthetic.py Linear

Synthetic datasets : ['Linear','hard_linear','Kernel']

and then train and test to see the new results.

Change the human error for the real datasets:

python generate_human_error.py name_of_image_dataset

For example: python generate_human_error.py Stare

image datasets are : ['Messidor,'Stare','Aptos']

and then train and test to see the new results.


Pre-processing

The datasets are preprocessed and saved in data folder and there is no need to download them again, but, if you wish to change the preprocessing or feature extraction method, you may download the Messidor, Stare, and Aptos datasets and use preprocess.py to preprocess them. You will also need Resnet or VGG16 to generate feature vectors of the image datasets.

python preprocess.py

Cross Validation

We found \lambda values using cross validation. The code can be run using:

python cross_validate.py dataset_name

For example: python cross_validate.py Stare

Plots

Plots are generated using python test.py --dataset=dataset_name --svm_type=svm_type

All plots are generated and saved in /plots folder.

classification-under-assistance's People

Contributors

nastaran75 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.