|
1 | 1 | FAQ |
2 | 2 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
3 | 3 |
|
| 4 | +---------------------- |
| 5 | +Cellpose settings and usage |
| 6 | +---------------------- |
| 7 | + |
4 | 8 | **Q: What should I set the** ``--flow_threshold``/``--cellprob_threshold``/``--diameter`` **parameter to?** |
5 | 9 |
|
6 | 10 | These parameters should be set experimentally by running Cellpose, viewing the results, and tuning the parameters |
|
18 | 22 | Some additional information on precision and accuracy can be found `here <https://forum.image.sc/t/how-to-interpret-cellposes-average-precision-model-evaluation-value/75231/3>`_. |
19 | 23 |
|
20 | 24 |
|
21 | | -**Q: How do I download the pretrained models?** |
22 | | - |
23 | | - The new Cellpose-SAM model (cpsam) will be downloaded from `https://huggingface.co/mouseland/cellpose-sam/blob/main/cpsam`_. |
24 | | - |
25 | | - The old models will be downloaded automatically from the `website <https://www.cellpose.org/>`_ when you first run a |
26 | | - pretrained model in cellpose. If you are having issues with the downloads, you can download them from this |
27 | | - `google drive zip file <https://drive.google.com/file/d/1zHGFYCqRCTwTPwgEUMNZu0EhQy2zaovg/view?usp=sharing>`_, |
28 | | - unzip the file and put the models in your home directory under the path ``.cellpose/models/``, |
29 | | - e.g. on Windows this would be ``C:/Users/YOUR_USERNAME/.cellpose/models/`` or on Linux this would be |
30 | | - ``/home/YOUR_USERNAME/.cellpose/models/``, so ``/home/YOUR_USERNAME/.cellpose/models/cyto_0`` is the full |
31 | | - path to one model for example. If you cannot access google drive, the models are also available on |
32 | | - baidu: https://pan.baidu.com/s/1CARpRGCBHIYaz7KeyoX-fg thanks to @qixinbo! |
33 | | - |
34 | | - |
35 | 25 | **Q: How can I use cellpose to recognize different types of cells in the same image?** |
36 | 26 |
|
37 | 27 | Cellpose does not natively support recognizing different types of cells (aka 'multiclass segmentation'). |
|
68 | 58 | `here <https://pytorch.org/docs/stable/threading_environment_variables.html>`_. |
69 | 59 |
|
70 | 60 |
|
| 61 | +---------------------- |
| 62 | +Models and training |
| 63 | +---------------------- |
| 64 | + |
| 65 | +**Q: How do I download the pretrained models?** |
| 66 | + |
| 67 | + The new Cellpose-SAM model (cpsam) will be downloaded from `huggingface <https://huggingface.co/mouseland/cellpose-sam/blob/main/cpsam>`_. |
| 68 | + |
| 69 | + The old models will be downloaded automatically from the `website <https://www.cellpose.org/>`_ when you first run a |
| 70 | + pretrained model in cellpose. If you are having issues with the downloads, you can download them from this |
| 71 | + `google drive zip file <https://drive.google.com/file/d/1zHGFYCqRCTwTPwgEUMNZu0EhQy2zaovg/view?usp=sharing>`_, |
| 72 | + unzip the file and put the models in your home directory under the path ``.cellpose/models/``, |
| 73 | + e.g. on Windows this would be ``C:/Users/YOUR_USERNAME/.cellpose/models/`` or on Linux this would be |
| 74 | + ``/home/YOUR_USERNAME/.cellpose/models/``, so ``/home/YOUR_USERNAME/.cellpose/models/cyto_0`` is the full |
| 75 | + path to one model for example. If you cannot access google drive, the models are also available on |
| 76 | + baidu: https://pan.baidu.com/s/1CARpRGCBHIYaz7KeyoX-fg thanks to @qixinbo! |
| 77 | + |
| 78 | + |
71 | 79 | **Q: How does HITL work?** |
72 | 80 |
|
73 | 81 | In cellpose HITL training always starts from a pretrained model but incorporates more training |
@@ -111,4 +119,35 @@ colab/a cluster)** |
111 | 119 |
|
112 | 120 | 5. Evaluate the trained model on the next image. |
113 | 121 |
|
114 | | - 6. Repeat 3-5 until you have a working fine-tuned model. |
| 122 | + 6. Repeat 3-5 until you have a working fine-tuned model. |
| 123 | + |
| 124 | + |
| 125 | +**Q: Why should I always start from the built-in cellpose model for fine-tuning rather than my fine-tuned model?** |
| 126 | + |
| 127 | + Cellpose uses transfer learning, |
| 128 | + where a pre-trained network is used as a starting point that is 'good enough'. Cellpose was trained on a large |
| 129 | + and diverse training set of images so that it is a generalist segmentation model: it will segment many types |
| 130 | + of images. However, it is not perfect. This means that the |
| 131 | + network parameters are somewhat close to predicting good outputs for a new dataset. |
| 132 | + |
| 133 | + After HITL training, you have a new trained network, with parameterst that are closer to your ideal network for that |
| 134 | + particular image dataset. To improve the model, you should then take this better performing network and train it again, no? |
| 135 | + |
| 136 | + This is actually a bad idea. The result would be that the network would learn on your data, but it would start to |
| 137 | + memorize your data instead of generalizing. This is because each time you train a model, you are moving away from the |
| 138 | + generalist, pre-trained parameters, and toward a smaller target distribution of images. Done enough times, the network |
| 139 | + may lose the ability to generalize to new images. |
| 140 | + |
| 141 | + Instead, the cellpose GUI forces you to always start with a pretrained model that is known to perform well to make |
| 142 | + the iteration cycle more robust. New data is added each cycle, but the model will always start with the generalist |
| 143 | + pre-trained model to produce a new fine-tuned model. As you continue the training cycle, the model will converge |
| 144 | + on the best model parameters to segment your images. You *should* use the new models to predict the segmentation, |
| 145 | + that is the point of the HITL design. Eventually, you will have a model that doesn't need additional training |
| 146 | + to accurately predict your segmentation. |
| 147 | + |
| 148 | + |
| 149 | +**Q: Why not train from scratch?** |
| 150 | + |
| 151 | + You also have the option to train from scratch, but that will take much |
| 152 | + longer and requires much more data. The CP4 network leverages extensive pretraining (300k natural images, |
| 153 | + 23k cellular images). You will need something similar to this to get generalist results. |
0 commit comments