https://github.com/polusai/theia
A scalable deep learning based bleed through correction algorithm.
https://github.com/polusai/theia
Last synced: about 1 year ago
JSON representation
A scalable deep learning based bleed through correction algorithm.
- Host: GitHub
- URL: https://github.com/polusai/theia
- Owner: PolusAI
- License: mit
- Created: 2023-04-13T14:50:51.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-02T14:00:22.000Z (over 2 years ago)
- Last Synced: 2024-04-14T02:55:37.208Z (about 2 years ago)
- Language: Python
- Size: 28.3 KB
- Stars: 0
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Theia (v0.1.2)
Bleed-Through Correction in Fluorescent Microscopy Images
## Installation
### Linux
- From PyPI: `pip install "theia-py==0.1.2"`
- Using poetry: `poetry add theia-py@0.1.2`
### MacOS (Apple Silicon)
1. Install xcode command line tools:
- `xcode-select --install`
2. Install miniforge:
- [Instructions](https://github.com/conda-forge/miniforge)
3. Disable the `base` conda environment from activating by default:
- `conda config --set auto_activate_base false`
4. Install poetry:
- `curl -sSL https://install.python-poetry.org | python3 -`
- Add poetry to your path using the hint provided by the poetry installer.
5. Create a conda environment:
- `conda create -n theia python=3.9`
- `conda activate theia`
6. Install tensorflow dependencies:
- `conda install -c apple tensorflow-deps`
7. Install using poetry:
- `poetry add theia-py@0.1.2`
### Windows
1. Re-evaluate your life choices.
2. Install Linux.
3. Read this document from the beginning.
## Usage
Here is a simple example of how to use Theia to correct a set of images.
For a more detailed example, see the streamlit app in `examples/rxrx.py`.
```python
import theia
# Load training and validation images
train_images = ...
valid_images = ...
# Make a tile-generator for feeding the model
train_generator = theia.TileGenerator(train_images, tile_size=(256, 256), normalize=False)
valid_generator = theia.TileGenerator(valid_images, tile_size=(256, 256), normalize=False)
# Build the model
model = theia.models.Neural(
num_channels=...,
channel_overlap=1,
kernel_size=5,
alpha=1,
beta=1,
tile_size=256,
)
model.early_stopping(
min_delta=1e-3,
patience=4,
verbose=1,
restore_best_weights=True,
)
model.compile(optimizer="adam")
model.fit_theia(
train_gen=train_gen,
valid_gen=valid_gen,
epochs=128,
verbose=1,
)
# Get the transformer
transformer = model.transformer
# Correct and save the images
for image in train_images + valid_images:
corrected_image = transformer.transform(image, remove_interactions=True)
with open("", "w") as f:
...
```