Skip to content

Commit 0b15921

Browse files
authored
Merge pull request adipandas#4 from adipandas/developer
Bug fix for `RuntimeError: OrderedDict mutated during iteration bug` in Tracker class
2 parents d9342d4 + 5b7305d commit 0b15921

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

tracking-caffe-model.ipynb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 3,
5+
"execution_count": 1,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -21,7 +21,7 @@
2121
},
2222
{
2323
"cell_type": "code",
24-
"execution_count": 4,
24+
"execution_count": 2,
2525
"metadata": {},
2626
"outputs": [],
2727
"source": [
@@ -51,7 +51,8 @@
5151
" def update(self, detections):\n",
5252
" \n",
5353
" if len(detections) == 0: # if no object detected in the frame\n",
54-
" for objectID in self.lost.keys():\n",
54+
" lost_ids = list(self.lost.keys())\n",
55+
" for objectID in lost_ids:\n",
5556
" self.lost[objectID] +=1\n",
5657
" if self.lost[objectID] > self.maxLost: self.removeObject(objectID)\n",
5758
" \n",
@@ -127,7 +128,7 @@
127128
},
128129
{
129130
"cell_type": "code",
130-
"execution_count": 5,
131+
"execution_count": 3,
131132
"metadata": {},
132133
"outputs": [],
133134
"source": [
@@ -148,7 +149,7 @@
148149
},
149150
{
150151
"cell_type": "code",
151-
"execution_count": 6,
152+
"execution_count": 4,
152153
"metadata": {},
153154
"outputs": [],
154155
"source": [
@@ -169,7 +170,7 @@
169170
},
170171
{
171172
"cell_type": "code",
172-
"execution_count": 7,
173+
"execution_count": 5,
173174
"metadata": {},
174175
"outputs": [],
175176
"source": [
@@ -186,7 +187,7 @@
186187
},
187188
{
188189
"cell_type": "code",
189-
"execution_count": 8,
190+
"execution_count": null,
190191
"metadata": {
191192
"scrolled": true
192193
},
@@ -238,6 +239,13 @@
238239
"cv.destroyWindow(\"image\")"
239240
]
240241
},
242+
{
243+
"cell_type": "code",
244+
"execution_count": null,
245+
"metadata": {},
246+
"outputs": [],
247+
"source": []
248+
},
241249
{
242250
"cell_type": "code",
243251
"execution_count": null,
@@ -262,7 +270,7 @@
262270
"name": "python",
263271
"nbconvert_exporter": "python",
264272
"pygments_lexer": "ipython3",
265-
"version": "3.6.8"
273+
"version": "3.6.9"
266274
}
267275
},
268276
"nbformat": 4,

tracking-tensorflow-ssd_mobilenet_v2_coco_2018_03_29.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
" def update(self, detections):\n",
5252
" \n",
5353
" if len(detections) == 0: # if no object detected in the frame\n",
54-
" for objectID in self.lost.keys():\n",
54+
" lost_ids = list(self.lost.keys())\n",
55+
" for objectID in lost_ids:\n",
5556
" self.lost[objectID] +=1\n",
5657
" if self.lost[objectID] > self.maxLost: self.removeObject(objectID)\n",
5758
" \n",
@@ -318,9 +319,9 @@
318319
],
319320
"metadata": {
320321
"kernelspec": {
321-
"display_name": "drlnd",
322+
"display_name": "Python 3",
322323
"language": "python",
323-
"name": "drlnd"
324+
"name": "python3"
324325
},
325326
"language_info": {
326327
"codemirror_mode": {
@@ -332,7 +333,7 @@
332333
"name": "python",
333334
"nbconvert_exporter": "python",
334335
"pygments_lexer": "ipython3",
335-
"version": "3.6.8"
336+
"version": "3.6.9"
336337
}
337338
},
338339
"nbformat": 4,

tracking-yolo-model.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
" def update(self, detections):\n",
5252
" \n",
5353
" if len(detections) == 0: # if no object detected in the frame\n",
54-
" for objectID in self.lost.keys():\n",
54+
" lost_ids = list(self.lost.keys())\n",
55+
" for objectID in lost_ids:\n",
5556
" self.lost[objectID] +=1\n",
5657
" if self.lost[objectID] > self.maxLost: self.removeObject(objectID)\n",
5758
" \n",
@@ -311,9 +312,9 @@
311312
],
312313
"metadata": {
313314
"kernelspec": {
314-
"display_name": "drlnd",
315+
"display_name": "Python 3",
315316
"language": "python",
316-
"name": "drlnd"
317+
"name": "python3"
317318
},
318319
"language_info": {
319320
"codemirror_mode": {
@@ -325,7 +326,7 @@
325326
"name": "python",
326327
"nbconvert_exporter": "python",
327328
"pygments_lexer": "ipython3",
328-
"version": "3.6.8"
329+
"version": "3.6.9"
329330
}
330331
},
331332
"nbformat": 4,

0 commit comments

Comments
 (0)