Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data
src Improved Adam parametrization Jul 26, 2018
trained_network
.gitignore
Dockerfile initial commit Jul 14, 2018
LICENSE initial commit Jul 14, 2018
README.md
eval.py
server.py
train.py

README.md

Automated multi-objective preference articulation

This repo contains the neural network architecture for learning a preference articulation function between several objectives. This is the SNN architecture presented used in the paper Toward intelligent nanoscopy: A machine learning approach for automated optimization of super-resolution optical microscopy. It contains the code for training a model from scratch, and deplyoing a model on a server using the Docker file.

Dependencies

  • Install pytorch
  • Install these python packages:
pip install numpy scikit-learn scikit-image request

Training a network

Use the script python train.py:

usage: train.py [-h] [-m MARGIN] [-bs BATCH_SIZE] [-ep NB_EPOCHS]
                [-rs RANDOM_STATE] [--cuda]
                data_path results_path

train a network model

positional arguments:
  data_path             path to the data to use
  results_path          where to save the results

optional arguments:
  -h, --help            show this help message and exit
  -m MARGIN, --margin MARGIN
                        margin of the loss
  -bs BATCH_SIZE, --batch-size BATCH_SIZE
                        SGD batch size
  -ep NB_EPOCHS, --nb-epochs NB_EPOCHS
                        SGD number of epochs
  -rs RANDOM_STATE, --random-state RANDOM_STATE
                        random state of train/valid/test split
  --cuda                use GPU or not

Installation Instructions for server use

Installing docker

  • Getting the Docker installation file from https://www.docker.com/community-edition#/download depending of your operating system.
  • Starting the installation and following instruction. It should be straightforward, though docker can take few minutes to start.

Building the image

  • Clone the repository: git clone https://github.com/PDKlab/STEDPreferenceSNN
  • Enter the repository: cd STEDPreferenceSNN
  • Build the Docker image: docker build -t pnet .

Starting the server

You have two choices to start the server:

  1. Start with pre-installed trained models in the image:

    docker run --rm -p 5000:5000 pnet /bin/bash -c "cd /workspace/executable/ && python server.py trained_models/<experiment>"

    • <experiment> is one of the pre-installed experiment folder
  2. Start with your experiment, create a Docker volume linking to your experiment folder:

    docker run --rm -v "<my-experiment-folder>:/mnt/experiment" -p 5000:5000 pnet /bin/bash -c "cd /workspace/executable/ && python server.py /mnt/experiment"

Using the virtual API

Once a server is started, you can talk to it with the virtual VirtualNet API . src/models/virtual.py provides an interface example for interacting with the deployed model. It can be used in the following way:

  • Instanciate a VirtualNet with an ip address and you can use its .predict(set) method.
  • set should be a set of objective to evaluate.

Question?

Feel free to send me an email @ louis-emile.robitaille.1@ulaval.ca

You can’t perform that action at this time.