Visitar URL original
updated COLAB notebooks to install a CUDA version compatible with DLC… · DeepLabCut/DeepLabCut@258b19b · GitHub
Skip to content

Commit 258b19b

Browse files
authored
updated COLAB notebooks to install a CUDA version compatible with DLC (#2506)
1 parent 8ce2377 commit 258b19b

7 files changed

Lines changed: 106 additions & 88 deletions

‎examples/COLAB/COLAB_3miceDemo.ipynb‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
},
4444
"outputs": [],
4545
"source": [
46+
"# Installs a CUDA version compatible with tensorflow on COLAB\n",
47+
"!apt update && apt install cuda-11-8\n",
48+
"\n",
4649
"# Install the latest DeepLabCut version:\n",
4750
"!pip install \"deeplabcut[tf]\""
4851
]

‎examples/COLAB/COLAB_DEMO_SuperAnimal.ipynb‎

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
},
5555
"outputs": [],
5656
"source": [
57+
"!apt update && apt install cuda-11-8\n",
5758
"!pip install deeplabcut[tf,modelzoo]"
5859
]
5960
},
@@ -80,12 +81,12 @@
8081
},
8182
{
8283
"cell_type": "markdown",
83-
"source": [
84-
"## Please select a video you want to run SuperAnimal-X on:"
85-
],
8684
"metadata": {
8785
"id": "GXf8N4v28Xqo"
88-
}
86+
},
87+
"source": [
88+
"## Please select a video you want to run SuperAnimal-X on:"
89+
]
8990
},
9091
{
9192
"cell_type": "code",
@@ -110,14 +111,14 @@
110111
},
111112
{
112113
"cell_type": "markdown",
114+
"metadata": {
115+
"id": "A8sDYMa08f62"
116+
},
113117
"source": [
114118
"## Next select the model you want to use, Quadruped or TopViewMouse\n",
115119
"- See http://modelzoo.deeplabcut.org/ for more details on these models\n",
116120
"- The pcutoff is for visualization only, namely only keypoints with a value over what you set are shown. 0 is low confidience, 1 is perfect confidience of the model."
117-
],
118-
"metadata": {
119-
"id": "A8sDYMa08f62"
120-
}
121+
]
121122
},
122123
{
123124
"cell_type": "code",
@@ -133,12 +134,12 @@
133134
},
134135
{
135136
"cell_type": "markdown",
136-
"source": [
137-
"## Okay, let's go! 🐭🦓🐻"
138-
],
139137
"metadata": {
140138
"id": "zsB0pGtj9Luq"
141-
}
139+
},
140+
"source": [
141+
"## Okay, let's go! 🐭🦓🐻"
142+
]
142143
},
143144
{
144145
"cell_type": "code",
@@ -163,18 +164,23 @@
163164
},
164165
{
165166
"cell_type": "markdown",
167+
"metadata": {
168+
"id": "gPLZSBpD34Mj"
169+
},
166170
"source": [
167171
"## Let's view the video in Colab:\n",
168172
"- otherwise, you can download and look at the video from the left side of your screen! It will end with _labeled.mp4\n",
169173
"- If your data doesn't work as well as you'd like, consider fine-tuning our model on your data, changing the pcutoff, changing the scale-range\n",
170174
"(pick values smaller and larger than your video image input size). See our repo for more details."
171-
],
172-
"metadata": {
173-
"id": "gPLZSBpD34Mj"
174-
}
175+
]
175176
},
176177
{
177178
"cell_type": "code",
179+
"execution_count": null,
180+
"metadata": {
181+
"id": "ejFJ1Pbg33i6"
182+
},
183+
"outputs": [],
178184
"source": [
179185
"from base64 import b64encode\n",
180186
"from IPython.display import HTML\n",
@@ -186,12 +192,7 @@
186192
" <source src=\"%s\" type=\"video/mp4\">\n",
187193
"</video>\n",
188194
"\"\"\" % data_url)"
189-
],
190-
"metadata": {
191-
"id": "ejFJ1Pbg33i6"
192-
},
193-
"execution_count": null,
194-
"outputs": []
195+
]
195196
}
196197
],
197198
"metadata": {
@@ -225,4 +226,4 @@
225226
},
226227
"nbformat": 4,
227228
"nbformat_minor": 0
228-
}
229+
}

‎examples/COLAB/COLAB_DEMO_mouse_openfield.ipynb‎

Lines changed: 70 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,10 @@
11
{
2-
"nbformat": 4,
3-
"nbformat_minor": 0,
4-
"metadata": {
5-
"accelerator": "GPU",
6-
"colab": {
7-
"name": "Colab_DEMO_mouse_openfield.ipynb",
8-
"provenance": [],
9-
"collapsed_sections": []
10-
},
11-
"kernelspec": {
12-
"display_name": "Python [default]",
13-
"language": "python",
14-
"name": "python3"
15-
},
16-
"language_info": {
17-
"codemirror_mode": {
18-
"name": "ipython",
19-
"version": 3
20-
},
21-
"file_extension": ".py",
22-
"mimetype": "text/x-python",
23-
"name": "python",
24-
"nbconvert_exporter": "python",
25-
"pygments_lexer": "ipython3",
26-
"version": "3.6.9"
27-
}
28-
},
292
"cells": [
303
{
314
"cell_type": "markdown",
325
"metadata": {
33-
"id": "view-in-github",
34-
"colab_type": "text"
6+
"colab_type": "text",
7+
"id": "view-in-github"
358
},
369
"source": [
3710
"<a href=\"https://colab.research.google.com/github/DeepLabCut/DeepLabCut/blob/master/examples/COLAB/COLAB_DEMO_mouse_openfield.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
@@ -74,42 +47,52 @@
7447
},
7548
{
7649
"cell_type": "code",
50+
"execution_count": null,
51+
"metadata": {},
52+
"outputs": [],
53+
"source": [
54+
"# Installs a CUDA version compatible with tensorflow on COLAB\n",
55+
"!apt update && apt install cuda-11-8"
56+
]
57+
},
58+
{
59+
"cell_type": "code",
60+
"execution_count": null,
7761
"metadata": {
7862
"id": "Ew6r4hotoQjt"
7963
},
64+
"outputs": [],
8065
"source": [
8166
"# Clone the entire deeplabcut repo so we can use the demo data:\n",
8267
"!git clone -l -s https://github.com/DeepLabCut/DeepLabCut.git cloned-DLC-repo\n",
8368
"%cd cloned-DLC-repo\n",
8469
"!ls"
85-
],
86-
"execution_count": null,
87-
"outputs": []
70+
]
8871
},
8972
{
9073
"cell_type": "code",
74+
"execution_count": null,
9175
"metadata": {
9276
"id": "yDaY78dFoxyD"
9377
},
78+
"outputs": [],
9479
"source": [
9580
"%cd /content/cloned-DLC-repo/examples/openfield-Pranav-2018-10-30\n",
9681
"!ls"
97-
],
98-
"execution_count": null,
99-
"outputs": []
82+
]
10083
},
10184
{
10285
"cell_type": "code",
86+
"execution_count": null,
10387
"metadata": {
10488
"id": "q23BzhA6CXxu"
10589
},
90+
"outputs": [],
10691
"source": [
10792
"# Install the latest DeepLabCut version (this will take a few minutes to install all the dependencies!)\n",
10893
"%cd /content/cloned-DLC-repo/\n",
10994
"!pip install \".[tf]\""
110-
],
111-
"execution_count": null,
112-
"outputs": []
95+
]
11396
},
11497
{
11598
"cell_type": "markdown",
@@ -122,29 +105,29 @@
122105
},
123106
{
124107
"cell_type": "code",
108+
"execution_count": null,
125109
"metadata": {
126110
"id": "sXufoX6INe6w"
127111
},
112+
"outputs": [],
128113
"source": [
129114
"import deeplabcut"
130-
],
131-
"execution_count": null,
132-
"outputs": []
115+
]
133116
},
134117
{
135118
"cell_type": "code",
119+
"execution_count": null,
136120
"metadata": {
137121
"id": "Z7ZlDr3wV4D1"
138122
},
123+
"outputs": [],
139124
"source": [
140125
"#create a path variable that links to the config file:\n",
141126
"path_config_file = '/content/cloned-DLC-repo/examples/openfield-Pranav-2018-10-30/config.yaml'\n",
142127
"\n",
143128
"# Loading example data set:\n",
144129
"deeplabcut.load_demo_data(path_config_file)"
145-
],
146-
"execution_count": null,
147-
"outputs": []
130+
]
148131
},
149132
{
150133
"cell_type": "markdown",
@@ -158,9 +141,11 @@
158141
},
159142
{
160143
"cell_type": "code",
144+
"execution_count": null,
161145
"metadata": {
162146
"id": "_pOvDq_2oEJW"
163147
},
148+
"outputs": [],
164149
"source": [
165150
"#let's also change the display and save_iters just in case Colab takes away the GPU... \n",
166151
"#if that happens, you can reload from a saved point. Typically, you want to train to 200,000 + iterations.\n",
@@ -170,9 +155,7 @@
170155
"\n",
171156
"#this will run until you stop it (CTRL+C), or hit \"STOP\" icon, or when it hits the end (default, 1.03M iterations). \n",
172157
"#Whichever you chose, you will see what looks like an error message, but it's not an error - don't worry...."
173-
],
174-
"execution_count": null,
175-
"outputs": []
158+
]
176159
},
177160
{
178161
"cell_type": "markdown",
@@ -196,17 +179,17 @@
196179
},
197180
{
198181
"cell_type": "code",
182+
"execution_count": null,
199183
"metadata": {
200184
"id": "nv4zlbrnoEJg"
201185
},
186+
"outputs": [],
202187
"source": [
203188
"%matplotlib notebook\n",
204189
"deeplabcut.evaluate_network(path_config_file,plotting=True)\n",
205190
"\n",
206191
"# Here you want to see a low pixel error! Of course, it can only be as good as the labeler, so be sure your labels are good!"
207-
],
208-
"execution_count": null,
209-
"outputs": []
192+
]
210193
},
211194
{
212195
"cell_type": "markdown",
@@ -234,15 +217,15 @@
234217
},
235218
{
236219
"cell_type": "code",
220+
"execution_count": null,
237221
"metadata": {
238222
"id": "Y_LZiS_0oEJl"
239223
},
224+
"outputs": [],
240225
"source": [
241226
"videofile_path = ['/content/cloned-DLC-repo/examples/openfield-Pranav-2018-10-30/videos/m3v1mp4.mp4'] #Enter the list of videos to analyze.\n",
242227
"deeplabcut.analyze_videos(path_config_file,videofile_path, videotype='.mp4')"
243-
],
244-
"execution_count": null,
245-
"outputs": []
228+
]
246229
},
247230
{
248231
"cell_type": "markdown",
@@ -256,14 +239,14 @@
256239
},
257240
{
258241
"cell_type": "code",
242+
"execution_count": null,
259243
"metadata": {
260244
"id": "6aDF7Q7KoEKE"
261245
},
246+
"outputs": [],
262247
"source": [
263248
"deeplabcut.create_labeled_video(path_config_file,videofile_path)"
264-
],
265-
"execution_count": null,
266-
"outputs": []
249+
]
267250
},
268251
{
269252
"cell_type": "markdown",
@@ -277,14 +260,41 @@
277260
},
278261
{
279262
"cell_type": "code",
263+
"execution_count": null,
280264
"metadata": {
281265
"id": "gX21zZbXoEKJ"
282266
},
267+
"outputs": [],
283268
"source": [
284269
"deeplabcut.plot_trajectories(path_config_file,videofile_path)"
285-
],
286-
"execution_count": null,
287-
"outputs": []
270+
]
271+
}
272+
],
273+
"metadata": {
274+
"accelerator": "GPU",
275+
"colab": {
276+
"collapsed_sections": [],
277+
"name": "Colab_DEMO_mouse_openfield.ipynb",
278+
"provenance": []
279+
},
280+
"kernelspec": {
281+
"display_name": "Python [default]",
282+
"language": "python",
283+
"name": "python3"
284+
},
285+
"language_info": {
286+
"codemirror_mode": {
287+
"name": "ipython",
288+
"version": 3
289+
},
290+
"file_extension": ".py",
291+
"mimetype": "text/x-python",
292+
"name": "python",
293+
"nbconvert_exporter": "python",
294+
"pygments_lexer": "ipython3",
295+
"version": "3.6.9"
288296
}
289-
]
297+
},
298+
"nbformat": 4,
299+
"nbformat_minor": 0
290300
}

0 commit comments

Comments
 (0)