Skip to main content

No project description provided

Project description

Pose estimation of C. elegans

PyPI version

Overview

The wormpose package estimates the challenging poses of C. elegans (coiled, blurred etc.) in videos where the simple non coiled frames are already labeled.

We train a convolutional neural network with synthetic worm images so that there is no need for human annotated labels.

Pipeline

Installation

pip install --upgrade wormpose

This will install a command line command "wormpose", that you can call directly in the terminal. Alternatively, you can use Jupyter notebooks or directly call the Python functions.

If you install wormpose with the pip option --user, please check that the local user folder where pip installs the script is in your PATH variable.

# How to run wormpose from the terminal:
wormpose COMMAND ARGUMENTS

# The available commands are:
# datagen, train, predict, postprocess, viz, calibrate

# Get information on the arguments for each command by calling:
wormpose COMMAND -h

Most of the commands make extensive use of multi processing, so we recommend you use a system with as many CPU cores as possible. A GPU is recommended to train the network, please check Tensorflow documentation to install Tensorflow with GPU support. Wormpose supports any Tensorflow version above 1.15, so including 2.x.

Steps

1 - Assemble a dataset composed of worm videos and features. Choose your dataset loader: "tierpsy" for Tierpsy tracker, "sample_data" for our simple sample data loader, and "amolf" custom loader for Amolf data. Or use your own dataset loader (instructions).

2 - Generate training data

Create a folder for your experiments, and run all the following commands from this same folder. You can analyze different datasets from this same folder, as long as they have a different name.

The datagen command will create binary files *.tfrecord containing labeled images for training and evaluation, as well as a configuration file.

wormpose datagen DATASET_LOADER_NAME DATASET_PATH

3 - Train the neural network

wormpose train DATASET_PATH

4 - Predict

wormpose predict DATASET_PATH

5 - Optional : Postprocess the results with interpolation and smoothing

wormpose postprocess DATASET_PATH

6 - Optional : Visualize the predictions as images

wormpose viz DATASET_PATH

7 - Optional: Calibrate to fine tune the image score threshold

wormpose calibrate DATASET_LOADER_NAME DATASET_PATH

All generated files will be stored in a "experiments" folder in the directory where the scripts are ran, or use the --work_dir option to specify a custom directory.

+-- experiments (or the value of work_dir)
|   +-- dataset_name
|   |   +-- config.json 
|   |   +-- training_data  // contains the generated files used for training the network
|   |   |   +-- *.tfrecord 
|   |   +-- model_checkpoints  // contains the trained models
|   |   +-- results  // contains the video analysis results
|   |   |   +-- video_name0 
|   |   |   |   +-- results.h5  // original and new angles and skeletons, image scores
|   |   |   |   +-- images_results.zip  // Optional, when the script visualize_results is run. Visualize predicted skeletons overlaid on top of the original frame.
|   |   |   +-- video_name1  
|   |   |   |    ...
|   |   +-- calibration  // contains results of calibrate script to assess the image score 

Tutorial

tutorial_sample_data goes over the whole wormpose pipeline with some sample data.

How to load your own data

Check this example of a custom dataset loader.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wormpose, version 0.0.48
Filename, size File type Python version Upload date Hashes
Filename, size wormpose-0.0.48-py3-none-any.whl (22.9 MB) File type Wheel Python version py3 Upload date Hashes View
Filename, size wormpose-0.0.48.tar.gz (40.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page