GithubHelp home page GithubHelp logo

volume-em / empanada Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 26.22 MB

Panoptic segmentation algorithms for 2D and 3D electron microscopy images

Home Page: https://empanada.readthedocs.io/en/latest/index.html

License: GNU General Public License v2.0

Python 100.00%
deep-learning electron-microscopy instance-segmentation panoptic-segmentation pytorch segmentation semantic-segmentation

empanada's People

Contributors

conradry avatar

Stargazers

 avatar  avatar

Watchers

 avatar

empanada's Issues

MitoNet example / tutorial

Hi,
I am currently using MitoNet in napari, but my datasets are growing in size so want to automate the segmentation process using python (ideally with jupyter notebooks) instead of the point and click process in napari. I didn't find an minimal example of running the MitoNet models (with the same / similar parameters like in empanada-napari) in the documentation nor the repository of empanada-dl / empanada-napari.

I would be very happy to be pointed into the right direction or provided with some script to start from.
Thanks in advance,
Paul

PS: I already tried to load the models using torch.jit, causing a "not implemented" error related to cuda.

Download model from dropbox

Hi @team,

I just noticed the model is downloaded from a dropbox

from .autonotebook import tqdm as notebook_tqdm
Downloading: "https://www.dropbox.com/s/crp3jhr55ie3d3s/MitoNet_v2.pth?dl=1" to /home/jovyan/.empanada/MitoNet_v2.pth
100%|211M/211M [00:08<00:00, 25.2MB/s]

it would be nice to have it hosted on a "more" permanent repo, like zenodo maybe?

Cheers,

Romain

How do you train/transfer learn on your own 3D images?

Thanks for publishing this, it looks like a great project to me! However, I have tested the provided model in Napari on my data and so far the results don't look as good as my old model for which I did transfer learning with CellPose. But I could imagine that there is more potential here if I do the transfer learning on a model that has already been trained on other mitochondria. Unfortunately, I have only found examples of what the configuration files for training can look like, but nothing about what I then need to do with these files: https://empanada.readthedocs.io/en/latest/tutorial/config.html#training Will there perhaps be more detailed instructions to follow?

Warmup and optimization seems to slow inferencing

When I use Engine3D to inference, PyTorch optimization after the first batch slows down the whole inferencing run. Is this normal behavior? The whole inferencing is faster when disabling optimization, controlled by torch.jit.optimized_execution(should_optimize=BOOLEAN), mentioned here. Running on MitoNet data on a CentOS workstation with an A30.

def stack_inference(engine, volume, axis_name):
    with torch.jit.optimized_execution(should_optimize=True):
        stack, trackers = engine.infer_on_axis(volume, axis_name)

With optimization:

(empanada) [benjaminr@cp0293 empanada]$ time python inference_3D.py 
model config: {'class_names': {1: 'mito'}, 'labels': [1], 'thing_list': [1], 'model': 'https://zenodo.org/record/6861565/files/MitoNet_v1.pth?download=1', 'model_quantized': 'https://zenodo.org/record/6861565/files/MitoNet_v1_quantized.pth?download=1', 'padding_factor': 16, 'norms': {'mean': 0.57571, 'std': 0.12765}, 'description': 'MitoNet_v1 was trained on the large CEM-MitoLab dataset and is a generalist for mitochondrial segmentation. The underlying architecture is PanopticDeeplab. This model is fairly large but powerful. If GPU memory is a limitation, try using MitoNet_v1_mini instead. Read the preprint: https://www.biorxiv.org/content/10.1101/2022.03.17.484806\n', 'FINETUNE': {'criterion': 'PanopticLoss', 'criterion_params': {'ce_weight': 1, 'l1_weight': 0.01, 'mse_weight': 200, 'pr_weight': 1, 'top_k_percent': 0.2}, 'dataset_class': 'SingleClassInstanceDataset', 'dataset_params': {'weight_gamma': 0.7}, 'engine': 'PanopticDeepLabEngine', 'engine_params': {'confidence_thr': 0.5, 'label_divisor': 1000, 'nms_kernel': 7, 'nms_threshold': 0.1, 'stuff_area': 64, 'thing_list': [1], 'void_label': 0}}}
Predicting xy...
  0%|                                                                                                                                                                     | 0/512 [00:00<?, ?it/s]/srv/scratch/benjaminr/anaconda3/envs/empanada/lib/python3.9/site-packages/torch/nn/modules/module.py:1130: UserWarning: operator() sees varying value in profiling, ignoring and this should be handled by GUARD logic (Triggered internally at  /opt/conda/conda-bld/pytorch_1659484806139/work/torch/csrc/jit/codegen/cuda/parser.cpp:3513.)
  return forward_call(*input, **kwargs)
  0%|▎                                                                                                                                                            | 1/512 [00:05<47:01,  5.52s/it]/srv/scratch/benjaminr/anaconda3/envs/empanada/lib/python3.9/site-packages/torch/nn/modules/module.py:1130: UserWarning: operator() profile_node %3387 : int[] = prim::profile_ivalue(%3385)
 does not have profile information (Triggered internally at  /opt/conda/conda-bld/pytorch_1659484806139/work/torch/csrc/jit/codegen/cuda/graph_fuser.cpp:104.)
  return forward_call(*input, **kwargs)
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 512/512 [01:00<00:00,  8.53it/s]
Propagating labels backward through the stack...
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 512/512 [00:02<00:00, 181.20it/s]
Post-processing {'xy': [<empanada.inference.tracker.InstanceTracker object at 0x7fb252851880>]}
Creating stack segmentation for class mito...
Total mito objects 190

real    1m19.001s
user    1m24.997s
sys     0m12.129s

Without optimization:

(empanada) [benjaminr@cp0293 empanada]$ time python inference_3D.py 
model config: {'class_names': {1: 'mito'}, 'labels': [1], 'thing_list': [1], 'model': 'https://zenodo.org/record/6861565/files/MitoNet_v1.pth?download=1', 'model_quantized': 'https://zenodo.org/record/6861565/files/MitoNet_v1_quantized.pth?download=1', 'padding_factor': 16, 'norms': {'mean': 0.57571, 'std': 0.12765}, 'description': 'MitoNet_v1 was trained on the large CEM-MitoLab dataset and is a generalist for mitochondrial segmentation. The underlying architecture is PanopticDeeplab. This model is fairly large but powerful. If GPU memory is a limitation, try using MitoNet_v1_mini instead. Read the preprint: https://www.biorxiv.org/content/10.1101/2022.03.17.484806\n', 'FINETUNE': {'criterion': 'PanopticLoss', 'criterion_params': {'ce_weight': 1, 'l1_weight': 0.01, 'mse_weight': 200, 'pr_weight': 1, 'top_k_percent': 0.2}, 'dataset_class': 'SingleClassInstanceDataset', 'dataset_params': {'weight_gamma': 0.7}, 'engine': 'PanopticDeepLabEngine', 'engine_params': {'confidence_thr': 0.5, 'label_divisor': 1000, 'nms_kernel': 7, 'nms_threshold': 0.1, 'stuff_area': 64, 'thing_list': [1], 'void_label': 0}}}
Predicting xy...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 512/512 [00:23<00:00, 21.46it/s]
Propagating labels backward through the stack...
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 512/512 [00:02<00:00, 220.48it/s]
Post-processing {'xy': [<empanada.inference.tracker.InstanceTracker object at 0x7fd31cf2c610>]}
Creating stack segmentation for class mito...
Total mito objects 190

real    0m42.225s
user    0m49.972s
sys     0m11.978s

Missing dependencies

Hi team!

It seems some explicitly used dependencies (import foo ...) are not listed as part of the setup.cfg file

imagehash
mlflow
networkx
simpleitk
tqdm

Could you please update this, for the next release?

Cheers!

Command line

How can I train, finetune and inference using a command line without opening GUI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.