Skip to content

Commit d74acfa

Browse files
adding uv #1185 and adding dino models to notebooks
1 parent d318fa0 commit d74acfa

3 files changed

Lines changed: 33 additions & 23 deletions

File tree

notebooks/run_Cellpose-SAM.ipynb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@
101101
},
102102
"outputs": [],
103103
"source": [
104-
"!pip install git+https://www.github.com/mouseland/cellpose.git"
104+
"!uv pip install git+https://www.github.com/mouseland/cellpose.git\n",
105+
"!uv pip install git+https://github.com/facebookresearch/dinov3.git"
105106
]
106107
},
107108
{
@@ -135,7 +136,11 @@
135136
"if core.use_gpu()==False:\n",
136137
" raise ImportError(\"No GPU access, change your runtime\")\n",
137138
"\n",
138-
"model = models.CellposeModel(gpu=True)"
139+
"model = models.CellposeModel(gpu=True)\n",
140+
"\n",
141+
"### You can also use other pretrained models, like the DINO models \n",
142+
"# model = models.CellposeModel(gpu=True, pretrained_model=\"cpdino\")\n",
143+
"# model = models.CellposeModel(gpu=True, pretrained_model=\"cpdino-vitb\")"
139144
]
140145
},
141146
{
@@ -225,7 +230,7 @@
225230
"\n",
226231
"- If you have a histological image taken in brightfield, you don't need to adjust the channels.\n",
227232
"\n",
228-
"- If you have a fluroescent image with multiple stains, you should choose one channel with a cytoplasm/membrane stain, one channel with a nuclear stain, and set the third channel to `None`. Choosing multiple channels may produce segmentaiton of all the structures in the image. If you have retrained the model on your data with a thrid stain (described below), you can run segmentation with all channels. "
233+
"- If you have a fluroescent image with multiple stains, you should choose one channel with a cytoplasm/membrane stain, one channel with a nuclear stain, and set the third channel to `None`. Choosing multiple channels may produce segmentaiton of all the structures in the image. If you have retrained the model on your data with a third stain (described below), you can run segmentation with all channels. "
229234
]
230235
},
231236
{

notebooks/test_Cellpose-SAM.ipynb

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
{
44
"cell_type": "markdown",
55
"metadata": {
6-
"id": "view-in-github",
7-
"colab_type": "text"
6+
"colab_type": "text",
7+
"id": "view-in-github"
88
},
99
"source": [
1010
"<a href=\"https://colab.research.google.com/github/MouseLand/cellpose/blob/main/notebooks/test_Cellpose-SAM.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
@@ -54,7 +54,8 @@
5454
},
5555
"outputs": [],
5656
"source": [
57-
"!pip install git+https://www.github.com/mouseland/cellpose.git"
57+
"!uv pip install git+https://www.github.com/mouseland/cellpose.git\n",
58+
"!uv pip install git+https://github.com/facebookresearch/dinov3.git"
5859
]
5960
},
6061
{
@@ -87,7 +88,11 @@
8788
"if core.use_gpu()==False:\n",
8889
" raise ImportError(\"No GPU access, change your runtime\")\n",
8990
"\n",
90-
"model = models.CellposeModel(gpu=True)"
91+
"model = models.CellposeModel(gpu=True)\n",
92+
"\n",
93+
"### You can also use other pretrained models, like the DINO models \n",
94+
"# model = models.CellposeModel(gpu=True, pretrained_model=\"cpdino\")\n",
95+
"# model = models.CellposeModel(gpu=True, pretrained_model=\"cpdino-vitb\")"
9196
]
9297
},
9398
{
@@ -314,6 +319,11 @@
314319
},
315320
{
316321
"cell_type": "code",
322+
"execution_count": null,
323+
"metadata": {
324+
"id": "fd-6Hji-n9_H"
325+
},
326+
"outputs": [],
317327
"source": [
318328
"# DISPLAY RESULTS stitching\n",
319329
"plt.figure(figsize=(15,3))\n",
@@ -326,22 +336,17 @@
326336
" imgout[outX, outY] = np.array([255,75,75])\n",
327337
" plt.imshow(imgout)\n",
328338
" plt.title('iplane = %d'%iplane)"
329-
],
330-
"metadata": {
331-
"id": "fd-6Hji-n9_H"
332-
},
333-
"execution_count": null,
334-
"outputs": []
339+
]
335340
}
336341
],
337342
"metadata": {
338343
"accelerator": "GPU",
339344
"colab": {
340-
"provenance": [],
341-
"include_colab_link": true
345+
"include_colab_link": true,
346+
"provenance": []
342347
},
343348
"kernelspec": {
344-
"display_name": "cellpose",
349+
"display_name": "s2p_test",
345350
"language": "python",
346351
"name": "python3"
347352
},
@@ -355,9 +360,9 @@
355360
"name": "python",
356361
"nbconvert_exporter": "python",
357362
"pygments_lexer": "ipython3",
358-
"version": "3.11.9"
363+
"version": "3.11.14"
359364
}
360365
},
361366
"nbformat": 4,
362367
"nbformat_minor": 0
363-
}
368+
}

notebooks/train_Cellpose-SAM.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
{
44
"cell_type": "markdown",
55
"metadata": {
6-
"id": "view-in-github",
7-
"colab_type": "text"
6+
"colab_type": "text",
7+
"id": "view-in-github"
88
},
99
"source": [
1010
"<a href=\"https://colab.research.google.com/github/MouseLand/cellpose/blob/main/notebooks/train_Cellpose-SAM.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
@@ -113,7 +113,7 @@
113113
},
114114
"outputs": [],
115115
"source": [
116-
"!pip install git+https://www.github.com/mouseland/cellpose.git"
116+
"!uv pip install git+https://www.github.com/mouseland/cellpose.git"
117117
]
118118
},
119119
{
@@ -346,8 +346,8 @@
346346
"metadata": {
347347
"accelerator": "GPU",
348348
"colab": {
349-
"provenance": [],
350-
"include_colab_link": true
349+
"include_colab_link": true,
350+
"provenance": []
351351
},
352352
"kernelspec": {
353353
"display_name": "cellpose",

0 commit comments

Comments
 (0)