Coder Social home page Coder Social logo

wj-zhang / bacteria-id Goto Github PK

View Code? Open in Web Editor NEW

This project forked from csho33/bacteria-id

0.0 1.0 0.0 14.37 MB

Source code and demos for "Rapid identification of pathogenic bacteria using Raman spectroscopy and deep learning"

License: MIT License

Jupyter Notebook 96.16% Python 3.84%

bacteria-id's Introduction

bacteria-ID

This repo contains demonstrations of using convolutional neural networks (CNNs) to identify the Raman spectra of pathogenic bacteria. This repository is adapted from the codebase used to produce the results in the paper "Rapid identification of pathogenic bacteria using Raman spectroscopy and deep learning."

The best place to start is with the Jupyter notebooks which are documented and commented, and should run out-of-the-box. We have provided pre-trained models that have been trained on the reference datasets.

Requirements

The code in this repo has been tested with the following software versions:

  • Python 3.7.0
  • PyTorch 0.4.1
  • Scikit-Learn 0.20.0
  • Numpy 1.15.1
  • Jupyter 5.0.0
  • Seaborn 0.9.0
  • Matplotlib 3.0.0

We recommend using the Anaconda Python distribution, which is available for Windows, MacOS, and Linux. Installation for all required packages (listed above) has been tested using the standard instructions from the providers of each package. Once Anaconda is installed, it should take no more than 10 minutes to install all of the requirements on a standard laptop or desktop computer.

Data

The data for the experiments can be downloaded here and should be saved in the data subdirectory, which should look like:

data/X_finetune.npy
data/y_finetune.npy
data/X_test.npy
data/y_test.npy
data/X_2018clinical.npy
data/y_2018clinical.npy
data/X_2019clinical.npy
data/y_2019clinical.npy

Files

This repo should contain the following files:

  • 1_reference_finetuning.ipynb - demonstrates fine-tuning a pre-trained CNN on the 30-isolate classification task
  • 2_prediction.ipynb - demonstrates making predictions with a fine-tuned CNN
  • 3_clinical_finetuning.ipynb - demonstrates fine-tuning a pre-trained CNN using clinical data and making predictions for individual patients
  • config.py - contains information about the provided dataset
  • datasets.py - contains code for setting up datasets and dataloaders for spectral data
  • resnet.py - contains ResNet CNN model class
  • training.py - contains code for training CNN and making predictions
  • reference_model.ckpt - saved parameters for pre-trained CNN to be used for notebooks 1 and 2
  • clinical_model.ckpt - saved parameters for pre-trained CNN to be used for demo 3

Running the notebooks

Experiment times reported in the notebooks were achieved on a 2018 Macbook Pro. If you find any bugs or have questions, please contact [email protected]

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.