|
1 | 1 | { |
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 | | - }, |
29 | 2 | "cells": [ |
30 | 3 | { |
31 | 4 | "cell_type": "markdown", |
32 | 5 | "metadata": { |
33 | | - "id": "view-in-github", |
34 | | - "colab_type": "text" |
| 6 | + "colab_type": "text", |
| 7 | + "id": "view-in-github" |
35 | 8 | }, |
36 | 9 | "source": [ |
37 | 10 | "<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 | 47 | }, |
75 | 48 | { |
76 | 49 | "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, |
77 | 61 | "metadata": { |
78 | 62 | "id": "Ew6r4hotoQjt" |
79 | 63 | }, |
| 64 | + "outputs": [], |
80 | 65 | "source": [ |
81 | 66 | "# Clone the entire deeplabcut repo so we can use the demo data:\n", |
82 | 67 | "!git clone -l -s https://github.com/DeepLabCut/DeepLabCut.git cloned-DLC-repo\n", |
83 | 68 | "%cd cloned-DLC-repo\n", |
84 | 69 | "!ls" |
85 | | - ], |
86 | | - "execution_count": null, |
87 | | - "outputs": [] |
| 70 | + ] |
88 | 71 | }, |
89 | 72 | { |
90 | 73 | "cell_type": "code", |
| 74 | + "execution_count": null, |
91 | 75 | "metadata": { |
92 | 76 | "id": "yDaY78dFoxyD" |
93 | 77 | }, |
| 78 | + "outputs": [], |
94 | 79 | "source": [ |
95 | 80 | "%cd /content/cloned-DLC-repo/examples/openfield-Pranav-2018-10-30\n", |
96 | 81 | "!ls" |
97 | | - ], |
98 | | - "execution_count": null, |
99 | | - "outputs": [] |
| 82 | + ] |
100 | 83 | }, |
101 | 84 | { |
102 | 85 | "cell_type": "code", |
| 86 | + "execution_count": null, |
103 | 87 | "metadata": { |
104 | 88 | "id": "q23BzhA6CXxu" |
105 | 89 | }, |
| 90 | + "outputs": [], |
106 | 91 | "source": [ |
107 | 92 | "# Install the latest DeepLabCut version (this will take a few minutes to install all the dependencies!)\n", |
108 | 93 | "%cd /content/cloned-DLC-repo/\n", |
109 | 94 | "!pip install \".[tf]\"" |
110 | | - ], |
111 | | - "execution_count": null, |
112 | | - "outputs": [] |
| 95 | + ] |
113 | 96 | }, |
114 | 97 | { |
115 | 98 | "cell_type": "markdown", |
|
122 | 105 | }, |
123 | 106 | { |
124 | 107 | "cell_type": "code", |
| 108 | + "execution_count": null, |
125 | 109 | "metadata": { |
126 | 110 | "id": "sXufoX6INe6w" |
127 | 111 | }, |
| 112 | + "outputs": [], |
128 | 113 | "source": [ |
129 | 114 | "import deeplabcut" |
130 | | - ], |
131 | | - "execution_count": null, |
132 | | - "outputs": [] |
| 115 | + ] |
133 | 116 | }, |
134 | 117 | { |
135 | 118 | "cell_type": "code", |
| 119 | + "execution_count": null, |
136 | 120 | "metadata": { |
137 | 121 | "id": "Z7ZlDr3wV4D1" |
138 | 122 | }, |
| 123 | + "outputs": [], |
139 | 124 | "source": [ |
140 | 125 | "#create a path variable that links to the config file:\n", |
141 | 126 | "path_config_file = '/content/cloned-DLC-repo/examples/openfield-Pranav-2018-10-30/config.yaml'\n", |
142 | 127 | "\n", |
143 | 128 | "# Loading example data set:\n", |
144 | 129 | "deeplabcut.load_demo_data(path_config_file)" |
145 | | - ], |
146 | | - "execution_count": null, |
147 | | - "outputs": [] |
| 130 | + ] |
148 | 131 | }, |
149 | 132 | { |
150 | 133 | "cell_type": "markdown", |
|
158 | 141 | }, |
159 | 142 | { |
160 | 143 | "cell_type": "code", |
| 144 | + "execution_count": null, |
161 | 145 | "metadata": { |
162 | 146 | "id": "_pOvDq_2oEJW" |
163 | 147 | }, |
| 148 | + "outputs": [], |
164 | 149 | "source": [ |
165 | 150 | "#let's also change the display and save_iters just in case Colab takes away the GPU... \n", |
166 | 151 | "#if that happens, you can reload from a saved point. Typically, you want to train to 200,000 + iterations.\n", |
|
170 | 155 | "\n", |
171 | 156 | "#this will run until you stop it (CTRL+C), or hit \"STOP\" icon, or when it hits the end (default, 1.03M iterations). \n", |
172 | 157 | "#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 | + ] |
176 | 159 | }, |
177 | 160 | { |
178 | 161 | "cell_type": "markdown", |
|
196 | 179 | }, |
197 | 180 | { |
198 | 181 | "cell_type": "code", |
| 182 | + "execution_count": null, |
199 | 183 | "metadata": { |
200 | 184 | "id": "nv4zlbrnoEJg" |
201 | 185 | }, |
| 186 | + "outputs": [], |
202 | 187 | "source": [ |
203 | 188 | "%matplotlib notebook\n", |
204 | 189 | "deeplabcut.evaluate_network(path_config_file,plotting=True)\n", |
205 | 190 | "\n", |
206 | 191 | "# 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 | + ] |
210 | 193 | }, |
211 | 194 | { |
212 | 195 | "cell_type": "markdown", |
|
234 | 217 | }, |
235 | 218 | { |
236 | 219 | "cell_type": "code", |
| 220 | + "execution_count": null, |
237 | 221 | "metadata": { |
238 | 222 | "id": "Y_LZiS_0oEJl" |
239 | 223 | }, |
| 224 | + "outputs": [], |
240 | 225 | "source": [ |
241 | 226 | "videofile_path = ['/content/cloned-DLC-repo/examples/openfield-Pranav-2018-10-30/videos/m3v1mp4.mp4'] #Enter the list of videos to analyze.\n", |
242 | 227 | "deeplabcut.analyze_videos(path_config_file,videofile_path, videotype='.mp4')" |
243 | | - ], |
244 | | - "execution_count": null, |
245 | | - "outputs": [] |
| 228 | + ] |
246 | 229 | }, |
247 | 230 | { |
248 | 231 | "cell_type": "markdown", |
|
256 | 239 | }, |
257 | 240 | { |
258 | 241 | "cell_type": "code", |
| 242 | + "execution_count": null, |
259 | 243 | "metadata": { |
260 | 244 | "id": "6aDF7Q7KoEKE" |
261 | 245 | }, |
| 246 | + "outputs": [], |
262 | 247 | "source": [ |
263 | 248 | "deeplabcut.create_labeled_video(path_config_file,videofile_path)" |
264 | | - ], |
265 | | - "execution_count": null, |
266 | | - "outputs": [] |
| 249 | + ] |
267 | 250 | }, |
268 | 251 | { |
269 | 252 | "cell_type": "markdown", |
|
277 | 260 | }, |
278 | 261 | { |
279 | 262 | "cell_type": "code", |
| 263 | + "execution_count": null, |
280 | 264 | "metadata": { |
281 | 265 | "id": "gX21zZbXoEKJ" |
282 | 266 | }, |
| 267 | + "outputs": [], |
283 | 268 | "source": [ |
284 | 269 | "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" |
288 | 296 | } |
289 | | - ] |
| 297 | + }, |
| 298 | + "nbformat": 4, |
| 299 | + "nbformat_minor": 0 |
290 | 300 | } |
0 commit comments