cnn-cell-counting

A machine learning model using CNN to count number of cells in a medical image

View the Project on GitHub JizhiziLi/cnn-cell-counting

CNN-CELL-COUNTING

How to Setup

Step 1: Create a new conda virtual env. - conda create -n $name python=3.6

Step 2: Go into virtual env. - source activate $name

Step 3: Install all the required packages - pip install -r requirements

Step 4: Install matplotlib seperately - conda install matplotlib

Step 5: Deactivate the env - source deactivate $name

How to Run App

Step 1: Run the virtual env Source activate $name

Step 2: Run python run.py to start

Routes

  1. POST /print_coordinate:

    {
        "num":3
    }
    

    Give a specific number of image you want to process, get the well with coordinate printed in save folder.

  2. POST /plot_data:

    {
        "plot_name":"train_plot"
    }
    

    Give a pkl name, plots data and label on image.

  3. POST /generate_dataset:

    {
        "cell_size": 5,
        "crop_length": 50,
        "crop_width": 50,
        "crops_number_per_image": 60,
        "images_range": [
            1,
            3
        ],
        "save_name": "train"
    }
    

    Pass some parameters to generate a balanced labelled dataset used for training and testing.

  4. POST /linear_model:

    {
        "test": {
            "choice": 1,
            "data_set": "test"
        },
        "train": {
            "choice": 1,
            "data_set": "train"
        }
    }
    

    Pass some parameters to train linear model on training set and test on testing set. Relevant logs and figs will be generated.

  5. POST /logistic_model:

    {
        "test": {
            "choice": 1,
            "data_set": "test"
        },
        "train": {
            "choice": 2,
            "data_set": "train"
        }
    }
    

    Pass some parameters to train logistic model on training set and test on testing set. Relevant logs and figs will be generated.

  6. POST /cnn_model/train:

    {
        "cell_number": 16,
        "choice": "linear_count",
         "height": 50,
        "learning_rate": 0.0001,
        "number": 1000,
        "patience": 5000,
        "train_set_file": "train",
        "width": 50
    }
    

    Pass some parameters to train cnn model on training set. Other parameters include patience and learning_rate can also be modified to increase training efficiency and model performance. Logging will be displayed in folder ~/static/models/cnn_model.

  7. POST /cnn_model/test:

    {
        "test_set_file": "test",
        "params_path": "linear_count_params",
        "choice": "linear_count"
    }
    

    Pass some parameters to test cnn model on testing. params_path stands for path of params, choice stands for which final layer and output we are using. Available choice are linear_count/logistic_count/logistic_zeroOne. Logging will be displayed in folder ~/static/models/cnn_model.

Some examples

  1. Well image

Well

  1. Well image with coordinate print

coordinate

  1. Train/test data and label plotted

splitcrops

Dissertation and Slides

Dissertation

Slides

Note

The data used in this project is from the publication below, anyone wants to use the data please cite this paper.

Kan, A., Chakravorty, R., Bailey, J., Leckie, C., Markham, J., & Dowling, M.R. (2011). Automated and semi‐automated cell tracking: addressing portability challenges. Journal of microscopy, 244(2), 194-213.