An image feature extractor with self-supervised learning
Project description
cytoself
cytoself is a self-supervised platform that we developed for learning features of protein subcellular localization from microscopy images. This model is described in detail in our recent preprint [2]. The representations derived from cytoself encapsulate highly specific features that can derive functional insights for proteins on the sole basis of their localization.
Applying cytoself to images of endogenously labeled proteins from the recently released OpenCell database creates a highly resolved protein localization atlas [1].
[1] Cho, Nathan H., et al. "OpenCell: proteome-scale endogenous tagging enables the cartography of human cellular organization." bioRxiv (2021).
https://www.biorxiv.org/content/10.1101/2021.03.29.437595v1
[2] Kobayashi, Hirofumi, et al. "Self-Supervised Deep-Learning Encodes High-Resolution Features of Protein Subcellular Localization." bioRxiv (2021).
https://www.biorxiv.org/content/10.1101/2021.03.29.437595v1
How cytoself works
cytoself uses images and its identity information as a label to learn the localization patterns of proteins. We used cell images where single protein is labeled and the ID of labeled protein as identity information.
What's in this repository
This repository offers three main components:
DataManager
,
cytoself.models
,
and
Analytics
.
DataManager
is a simple module to handle train, validate and test data.
You may want to modify it to adapt to your own data structure.
This module is in
cytoself.data_loader.data_manager
.
cytoself.models
contains modules for three different variants of the cytoself model:
a model without split-quantization, a model without the pretext task, and the 'full' model (refer to our preprint for details about these variants).
There is a submodule for each model variant that provides methods for constructing, compiling, and training the models (which are built using tensorflow).
Analytics
is a simple module to perform analytic processes such as dimension reduction and plotting.
You may want to modify it too to perform your own analysis. This module is in
cytoself.analysis.analytics
.
Installation
Recommended: create a new environment and install cytoself on the environment from pypi
conda create -y -n cytoself python=3.7
conda activate cytoself
pip install cytoself
(Option) Install TensorFlow GPU
If your computer is equipped with GPUs that support Tensorflow 1.15, you can install Tensorflow-gpu to utilize GPUs. Install the following packages before cytoself, or uninstall the existing CPU versions and reinstall the GPU versions again with conda.
conda install h5py=2.10.0
conda install tensorflow-gpu=1.15
For the developers
You can also install cytoself from this GitHub repository.
git clone https://github.com/royerlab/cytoself.git
pip install .
Troubleshooting
In case of getting errors in the installation, run the following code inside the cytoself folder to manually install the dependencies.
pip install -r requirements.txt
As a reference for a complete dependency, the snapshot of a working environment can be found in
environment.yml
Example script
A minimal example script is in
example/simple_training.py
.
Test if this package runs in your computer with command
python examples/simple_example.py
Computation resources
It is highly recommended to use GPU to run cytoself. A full model with image shape (100, 100, 2) and batch size 64 can take ~9GB of GPU memory.
Tested Environment
Google Colab (CPU/GPU/TPU)
macOS 10.14.6, RAM 32GB (CPU)
Windows10 Pro 64bit, RAM 32GB (CPU)
Ubuntu 18.04.5 LTS, TITAN xp, CUDA 10.2 (GPU)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cytoself-0.0.1.2.tar.gz
.
File metadata
- Download URL: cytoself-0.0.1.2.tar.gz
- Upload date:
- Size: 44.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.55.1 importlib-metadata/4.11.1 keyring/23.0.1 rfc3986/1.4.0 colorama/0.4.4 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b006483b25a9d5feda073e96c98698bd6cfb3a2b6511123727c40467656e9628 |
|
MD5 | 0c8551c44364e5ae2427a4a5c90ef813 |
|
BLAKE2b-256 | 67eb2be00d45fe359411b7a6a2cbeec1797a2aa7c0921696834e358e8ae166ec |
File details
Details for the file cytoself-0.0.1.2-py3-none-any.whl
.
File metadata
- Download URL: cytoself-0.0.1.2-py3-none-any.whl
- Upload date:
- Size: 58.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.55.1 importlib-metadata/4.11.1 keyring/23.0.1 rfc3986/1.4.0 colorama/0.4.4 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b8f46c4c57e9a200743fd8131ef0dd8d5681f0a4377c8f59e7598da9d2c67ed |
|
MD5 | 336f3605360ddac8ec8d7349312dd079 |
|
BLAKE2b-256 | 254e2789846dd58294e00ef0c70a8c6f29e8fe8c1bb96c5432ba405b33263100 |