Skip to content

jasonwang0228/FAST

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

29 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FAST: FrAme-multiplexed SpatioTemporal Learning Strategy

FAST Logo

Python PyTorch License: GPL v3

FAST is a real-time self-supervised denoising framework for fluorescence neural imaging, achieving enhanced image quality in low-SNR scenarios through spatiotemporal joint optimization. (https://doi.org/10.21203/rs.3.rs-6101322/v1)

โœจ Key Features

  • ๐Ÿš€ Real-Time Processing: >1000 fps denoising (hardware-dependent)
  • ๐Ÿค– Self-Supervised Learning: Eliminates need for clean ground truth
  • ๐Ÿ”„ Spatiotemporal Optimization: Frame-multiplexing enhances SNR
  • ๐Ÿ“Š High Adaptability: Suitable for various fluorescence imaging data

๐Ÿ›  Installation

Requirements

  • Python 3.9+
  • PyTorch 2.x (CUDA version aligned with your hardware)
  • CUDA-capable GPU (recommended)

Tested Environments

  • Windows 10: NVIDIA RTX 3060, RTX 3090, RTX 4070
  • Ubuntu 22.04: NVIDIA RTX A6000
  • CUDA Version: 12.4

Detailed Package Versions

numpy==1.24.1
torch==2.5.1
torchvision==0.20.1
torchaudio==2.5.1
scikit-image==0.24.0
tqdm==4.66.5
pyqt5==5.15.7
pyqt5-qt5==5.15.2
pyqt5-sip==12.11.0
csbdeep==0.8.1

Quick Setup

# Create and activate environment
conda create -n FAST python=3.9
conda activate FAST
pip install -r requirements.txt

๐Ÿš€ Quick Start

Command Line Mode

# Training mode
python main.py --config_path "./params.json"

# Testing mode (with pretrained model)
python main.py --config_path "./checkpoint/model_name/config.json" --test_path "./data/test/test_dir"

GUI Mode

# Launch training GUI
python Train_GUI.py

# Launch testing GUI
python Test_GUI.py

๐Ÿ“ Directory Structure

FAST/
โ”œโ”€โ”€ checkpoint/         # Model checkpoints
โ”‚   โ””โ”€โ”€ model_name
โ”œโ”€โ”€ data/              # Data directory
โ”‚   โ”œโ”€โ”€ test/          # Testing data
โ”‚   โ””โ”€โ”€ train/         # Training data
โ”œโ”€โ”€ datasets/          # Dataset processing
โ”‚   โ”œโ”€โ”€ dataAug.py     # Data augmentation
โ”‚   โ”œโ”€โ”€ data_process.py
โ”‚   โ””โ”€โ”€ dataset.py     # Dataset classes
โ”œโ”€โ”€ environment.yml    # Environment configuration
โ”œโ”€โ”€ FAST_logo.png     # Project logo
โ”œโ”€โ”€ log.txt           # Runtime logs
โ”œโ”€โ”€ main.py           # Main entry point
โ”œโ”€โ”€ models/           # Model architectures
โ”‚   โ”œโ”€โ”€ baseLayers.py
โ”‚   โ”œโ”€โ”€ loss/         # Loss functions
โ”‚   โ”‚   โ””โ”€โ”€ loss.py
โ”‚   โ””โ”€โ”€ Unet_Lite.py  # Main model
โ”œโ”€โ”€ params.json       # Configuration file
โ”œโ”€โ”€ result/           # Output results
โ”‚   โ””โ”€โ”€ model_name
โ”œโ”€โ”€ Test_GUI.py       # GUI for testing
โ”œโ”€โ”€ test_in_gui.py
โ”œโ”€โ”€ test.py          # Testing script
โ”œโ”€โ”€ Train_GUI.py      # GUI for training
โ”œโ”€โ”€ train_in_gui.py
โ”œโ”€โ”€ train.py         # Training script
โ””โ”€โ”€ utils/           # Utility functions
    โ”œโ”€โ”€ config.py    # Configuration utils
    โ”œโ”€โ”€ fileSplit.py
    โ”œโ”€โ”€ general.py   # General utilities
    โ””โ”€โ”€ __init__.py

โš™๏ธ Configuration

Customize model parameters by modifying params.json:

{
    "data_extension": "tif",
    "epochs": 100,
    "miniBatch_size": 4,
    "lr": 0.0001,
    "weight_decay": 0.9,
    "gpu_ids": "0",
    "train_frames": 2000,
    "data_type": "3D",
    "denoising_strategy": "FAST",
    "seed": 123,
    "save_freq": 25,
    "clip_gradients": 20.0,
    "num_workers": 0,
    "batch_size": 1
}

๐Ÿ“ Usage Guide

Training a Model on Your Own Data (3 Steps)

  1. Prepare Training Data
    Place one or more .tif/.tiff files (each should be an xy-t stack, ideally >1000 frames per file) into a new folder under ./data/train/, e.g., ./data/train/MyTrainDataset/.

  2. Edit Configuration
    Open params.json and set "train_folder": "path/to/MyTrainDataset". Adjust other parameters as neededโ€”see the Configuration section for details on each option.

  3. Start Training
    Run the following command to train the model:

    python main.py --config_path "./params.json"

    After training, model weights and the config file will be saved in ./checkpoint/model_name/.


Using Your Trained FAST Model for Denoising (2 Steps)

  1. Prepare Test Data
    Place one or more .tif/.tiff files (xy-t stacks to be denoised) into a folder under ./data/test/, e.g., ./data/test/MyTestDataset/.

  2. Run Inference
    Use the following command to denoise your data with the trained model:

    python main.py --config_path "./checkpoint/model_name/config.json" --test_path "./data/test/MyTestDataset"

    After completion, you will find the processed results in the ./result/model_name directory.

๐Ÿค Contributing

We welcome contributions, particularly:

  1. ๐Ÿ› Bug reports and fixes
  2. โœจ New feature proposals and implementations
  3. ๐Ÿ“š Documentation improvements
  4. ๐ŸŽจ Code optimizations

Coding Standards

  • Use UpperCamelCase for class names
  • Use lowercase_with_underscores for functions and variables
  • Include docstrings for core functions
  • Follow PEP8 standards (validate using flake8)

๐Ÿ“„ License

This project is licensed under the GNU General Public License v3.0. This means you are free to:

  • โœ… Use
  • โœ… Modify
  • โœ… Distribute

But you must:

  • โš ๏ธ Disclose source
  • โš ๏ธ Include original copyright
  • โš ๏ธ Use the same license

See LICENSE file for full text.

โ“ FAQ

Coming soon

๐Ÿ“ฎ Contact


Citation

If you use FAST in your research, please cite our paper:

@article{wang2024real,
    title={Real-time self-supervised denoising for high-speed fluorescence neural imaging},
    author={Yiqun Wang and Others},
    journal={https://doi.org/10.21203/rs.3.rs-6101322/v1},
    year={2025}
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.0%
  • Shell 1.0%