FocA: A deep learning tool for reliable, near-real-time imaging focus analysis in automated cell assay pipelines
The increasing use of automation in cellular assays and cell culture presents significant opportunities to enhance the scale and throughput of imaging assays, but to do so, reliable data quality and consistency are critical. Realizing the full potential of automation will thus require the design of robust analysis pipelines that span the entire workflow in question. Here we present FocA, a deep learning tool that, in near real-time, identifies in-focus and out-of-focus images generated on a fully automated cell biology research platform, the NYSCF Global Stem Cell Array®. The tool is trained on small patches of downsampled images to maximize computational efficiency without compromising accuracy, and optimized to make sure no sub-quality images are stored and used in downstream analyses. The tool automatically generates balanced and maximally diverse training sets to avoid bias. The resulting model correctly identifies 100% of out-of-focus and 98% of in-focus images in under 4 seconds per 96-well plate, and achieves this result even in heavily downsampled data (~30 times smaller than native resolution). Integrating the tool into automated workflows minimizes the need for human verification as well as the collection and usage of low-quality data. FocA thus offers a solution to ensure reliable image data hygiene and improve the efficiency of automated imaging workflows using minimal computational resources.
Read the paper here:
Winchell, J., Comolet, G., Buckley-Herd, G., Hutson, D., Bose, N., Paull, D., & Migliori, B. (2023). FocA: A deep learning tool for reliable, near-real-time imaging focus analysis in automated cell assay pipelines. SLAS Discovery.
- FocA: A deep learning tool for reliable, near-real-time imaging focus analysis in automated cell assay pipelines - The New York Stem Cell Foundation
- Using the Tool
- Python 3.8.10
- Tensorflow 2.8.0
- CUDA 11.5 + cuDNN
NOTE: Tested on Ubuntu 22.04, you may encounter issues when using operating systems...
- Slack integration
- Automated train/test set generation with class imbalance compensation
First clone the main branch of the repository and navigate into the main directory:
git clone -b main [email protected]:NYSCF/foca_release.git
cd foca_release/
FocA depends on the use of Anaconda which can be downloaded here
-
Create and activate a conda environment with a modern python version:
conda create -n foca python=3.8.10 pip conda activate foca
-
Install the required libraries:
pip install -r requirements.txt
-
Update parameters in
input/config.py
-
Run tests in project root directory to ensure the parameters entered are valid:
pytest # test everything pytest tests/test_deployment.py # test only deployment code pytest tests/test_train.py # test only model training code
NOTE: Only deployment tests need to pass, if you're using our pre-trained weights
After updating the parameters in input/config.py
, run
python train/train_model.py
This command will train a model and save the final weights to a subdirectory called foca_weights/
(this can be changed using the -n
flag described below) of the WEIGHT_DIR
path specified in input/config.py
.
You can add optional flags:
-n model_name
: name of model directory; if exists, you will be asked if you want to overwrite it-y yaml_name
: name of YAML file containing model training parameters; default isdefault.yaml
-d device
: choose to train usingCPU
orGPU
, default isGPU
but will compute onCPU
if not available--verbose
: add this if you want more verbose output during training, there is no argument for this flag--generic
: add this if your data is not formatted like the example, it will train the model without optimizing plate variety but will still attempt to balance the two classes-h
: print descriptions of what different flags mean
After downloading the weights here, extract the zip file and specify the folder's location as the MODEL_WEIGHTS
parameter in input/config.py
.
After updating the parameters in input/config.py
and either training your own model or downloading our weights, run
python deployment/foca_main.py
This command will search subdirectories of IMAGE_DIR/
(specified in input/config.py
) for new scans of plates, analyze any previously un-analyzed plate scans, and write the results to the CSV file CSV_OUTPUT
(also specified in input/config.py
).
You can add optional flags:
-r run_name
: process all plates in a single run-p plate_name
: process a single plate--overwrite_scans
: overwrite existing scan data-h
: print descriptions of what different flags mean
Data should be structured according to this pattern:
<path_to_runs/>/RUN-NAME/RUN-NAME_PLATE-NAME/TIFF<scale-in-micron-meters-per-pixel>/RUN-NAME_PLATE-NAME_SCAN-DATETIME/Well_ROWCOL_Ch<channel_number>_<scale-in-micron-meters-per-pixel>um.tiff
for example:
/network_drive/DeadTotalImages/RUN0020/RUN0020_PLATE_201/TIFF06/RUN0020_PLATE_201_11-23-2022-2-10-44-PM/Well_B10_Ch2_6um.tiff
For more information on either training a model or deploying the tool, feel free to open an issue.
If you find this repository useful for your research, please consider giving us a star ⭐ and cite our publication:
FocA: A deep learning tool for reliable, near-real-time imaging focus analysis in automated cell assay pipelines
Jeff Winchell, Gabriel Comolet, Geoff Buckley-Herd, Dillion Hutson, Neeloy Bose, Daniel Paull, Bianca Migliori
SLAS Discovery j.slasd.2023.08.004; doi: https://doi.org/10.1016/j.slasd.2023.08.004
FocASM © 2023 by NYSCF is licensed under Business Source License 1.1.