Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omnipose integration and advanced version of the detectors. #14

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4f6070f
Update deps, parent pom and target version.
tinevez Jul 4, 2024
ce65fdd
Better harness new cellpose logs.
tinevez Nov 16, 2023
2294d5e
Fix creating the right factory with the advanced cellpose detector.
tinevez Nov 28, 2023
13040e4
add pretrained models from CP
gletort Feb 13, 2024
1e099dd
add resample option in advanced
gletort Feb 13, 2024
5f8c223
change chanels handling, add min size
gletort Feb 20, 2024
a83ae64
Format code using imglib2 style.
tinevez Mar 28, 2024
72bc0a0
Fix capitaization weirdness.
tinevez Jul 9, 2024
6e6d796
Fix name and doc link of the advanced config panel.
tinevez Mar 28, 2024
6f1d78e
Fix link to doc of the advanced detector.
tinevez Mar 28, 2024
07925e9
Put the config panels in a scrollpane.
tinevez Mar 28, 2024
be5ebe2
Protect against misfits when specifying channel numbers.
tinevez May 21, 2024
2d616ad
Add nclasses arg and channel handling for omnipose advanced detector
marieanselmet Jun 5, 2024
7c3f08b
Add nclasses arg and channel handling for omnipose advanced detector
marieanselmet Jun 5, 2024
2610a9d
Shorten long label in the UI.
tinevez Jun 5, 2024
2ea07a0
Minor code style changes. No change on the UI.
tinevez Jun 5, 2024
89cfeee
Modifs to use custom models with omnipose version 1.0.6
marieanselmet Jul 9, 2024
46219cf
Fix TrackMate wiki doc links.
tinevez Jul 10, 2024
66538f8
Minor code style change.
tinevez Jul 10, 2024
4255c7f
Update README.md
marieanselmet Jul 16, 2024
e3853e6
Update README.md
marieanselmet Jul 16, 2024
534b449
Correct the link to the advanced omnipose detector wiki page.
tinevez Jul 19, 2024
61d957e
Update parent to pom-scijava to 39.0.0 and TrackMate to v8 line.
tinevez Nov 7, 2024
b8deea7
Fix Apache Tailer deprecated methods usage.
tinevez Nov 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 51 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,62 @@ If you use the Omnipose TrackMate module for your research, please also cite the
## Example
https://github.com/marieanselmet/TrackMate-Omnipose/assets/32811540/3c2365c9-8d1b-4057-b4d1-2939e4e2b818

*E. Coli, Marie Anselmet and Rodrigo Arias Cartin, Barras lab, Institut Pasteur*
*E. coli, Marie Anselmet and Rodrigo Arias Cartin, Barras lab, Institut Pasteur*


## Omnipose installation
### Omnipose installation

This code works with the Omnipose version 0.3.6. It doesn't work with the last version of Omnipose.
The integration works with Omnipose version 1.0.6.

To install Omnipose, you can refer directly to the installation guide provided on the [Omnipose repository](https://github.com/kevinjohncutler/omnipose#how-to-install-omnipose).
Like for the cellpose integration, you need to have a working Python installation of omnipose on the computer you want to use this extension with.
To install Omnipose, you can refer directly to the installation guide provided on the [Omnipose release page on PypI](https://pypi.org/project/omnipose/), but some steps may generate errors.

An example Windows installation working on GPU:
We give below a tested procude to install omnipose on a Mac Intel, Mac M1 to M3 and Windows with GPU support via mamba.

An example Windows installation working on GPU (may need to adapt the cuda version to your drivers):
```sh
mamba create -n omnipose-106 'python==3.9.18' pytorch torchvision pytorch-cuda=11.8 -c pytorch -c nvidia -y
mamba activate omnipose-106
pip install natsort
pip install scipy==1.11.4
pip install omnipose==1.0.6
```
conda create -n omnipose
conda activate omnipose
conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.8 -c pytorch -c nvidia
pip install omnipose==0.3.6
pip install cellpose-omni==0.7.3

An example Mac Intel installation:
```sh
mamba create -n omnipose-106 'python==3.9.18'
mamba activate omnipose-106
mamba install pytorch torchvision -c pytorch
pip install natsort
pip install scipy==1.11.4
pip install fastremap==1.12.2
pip install omnipose==1.0.6
```

The default models *bact_phase_omni* and *bact_fluor_omni* are stored in the cellpose pretrained models folder.
An example Mac M1 to M3 installation:
```sh
mamba create -n omnipose-106 'python==3.9.18'
mamba activate omnipose-106
mamba install pytorch torchvision -c pytorch
pip install natsort
pip install scipy==1.11.4
pip install omnipose==1.0.6
```

### Troubleshooting "Found 0 spots" errors with pretrained models

On some systems we have noticed that sometimes TrackMate returns 0 detections for the cellpose and omnipose detectors, even when the installation of these two programs worked correctly.
In most cases, this is due to the fact that the pretrained models have not been downloaded prior to running the TrackMate integration. If the model your trying to call doesn't exist on your computer, a message should appear in the TrackMate logger after the preview step.
To fix this, the easiest way is to launch the omnipose Python GUI, and segment a single small image.
This will trigger the download of the pretrained models.
After this, the TrackMate Omnipose integration should work as expected.

### Custom models

You can use in this TrackMate-Omnipose integration your own custom models that were trained on the same version 1.0.6 of Omnipose.
In the last versions of Omnipose, some changes were made, in particular in the way to call the models and the default parameters values. We made our code as robust as possible to deal with these changes but we can't ensure this TrackMate integration of Omnipose is compatible with custom models trained on all the previous versions of Omnipose.

### Omnipose advanced detector

Choosing the Omnipose advanced detector gives the possibility to tune the values of the mask and the flow threshold.
Details about the meaning of the mask and flow thresholds can be found [here](https://omnipose.readthedocs.io/settings.html).
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>34.0.0</version>
<version>39.0.0</version>
<relativePath />
</parent>

<groupId>sc.fiji</groupId>
<artifactId>TrackMate-Cellpose</artifactId>
<version>0.1.3-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>

<name>TrackMate-Cellpose</name>
<description>TrackMate detector based on cellpose and omnipose.</description>
Expand Down Expand Up @@ -89,7 +89,7 @@
<!-- NB: Deploy releases to the SciJava Maven repository. -->
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>

<TrackMate.version>7.11.1</TrackMate.version>
<TrackMate.version>8.0.0-SNAPSHOT</TrackMate.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public List< String > toCmdLine( final String imagesDir )

// First channel.
cmd.add( "--chan" );
cmd.add( "" + chan );
cmd.add( "" + (chan) );

// Second channel.
if ( chan2 >= 0 )
Expand Down
Loading
Loading