Code Monkey home page Code Monkey logo

micnet's Introduction

README

MICNet is a chimeric neural net that is used to predict antimicrobial susceptibility profiles from microscopic images. It uses an idea from the DALL-E net from OpenAI: We first train a variational autoencoder (VAE) on a bunch of susceptibility data (unsupervised). "Susceptibility" here is defined as minimum inhibitory concentration (MIC) measurements across a panel of antibiotics using the dilution broth method. Then, we chop off the encoder and replace it with a (pretrained) model, here an image model (ResNet). We finetune it to map image representations into the latent space of the VAE and then use the VAE decoder to generate MIC profiles for a given input image.

Install

conda create -n micnet python=3.8 -c conda-forge numpy pandas tqdm matplotlib

# Install your system-specific version of PyTorch, e.g. for Mac:
# https://pytorch.org/get-started/locally/
conda install pytorch torchvision torchaudio -c pytorch

# Install some utils
git clone www.github.com/phiweger/micnet
cd micnet && pip install -e .

# If you want to experiment with different learning rate:
# https://github.com/davidtvs/pytorch-lr-finder
pip install torch-lr-finder

Run

Note that the original data is under restricted access due to university regulations. It is provided, however, upon reasonable request, and subject to terms and conditions. Below, we nevertheless provide the code used to construct our predictive model(s).

To predict susceptibility profiles from images we use two datasets:

  1. A pretrained VAE in data/vae.pt. To find out how we trained and evaluated the model, see:
  • scipts/vae_train.py
  • scipts/vae_interpolate.py
  • scipts/vae_evaluate.py
  1. Example images from a previously published dataset (*); however, we chopped them up into crops available from OSF (https://osf.io/n3247/). You find a copy of the original data there, too. Cropping was done as specified in scripts/prepare_dibs_data.py.

Finally, to do the actual predicting, we used scripts/resnet_predict.py. Note that it will download a ResNet with pretrained weights.

In the data folder, you'll also find intermediate results.


(*): Zieliński, Bartosz, Anna Plichta, Krzysztof Misztal, Przemysław Spurek, Monika Brzychczy-Włoch, and Dorota Ochońska. 2017. “Deep Learning Approach to Bacterial Colony Classification.” PloS One 12 (9): e0184554.

micnet's People

Contributors

phiweger avatar

Watchers

 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.