File size: 2,183 Bytes
dffe983
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
# For reference on dataset card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/datasetcard.md?plain=1
# Doc / guide: https://huggingface.co/docs/hub/datasets-cards
{}
---

# Dataset Card for DLC Speed Benchmarking ZIP

This supports the dlc-live benchmarking [zip](https://github.com/DeepLabCut/DeepLabCut-live/blob/427c12609307ef685e4193c91026567308820cbe/dlclive/benchmark.py#L40) formally hosted on our Harvard Rowland server. 
All information can be found in our publication:

Real-time, low-latency closed-loop feedback using markerless posture tracking
Gary A Kane, Gonçalo Lopes, Jonny L Saunders, Alexander Mathis, Mackenzie W Mathis 
https://elifesciences.org/articles/61909



### Direct Use

```python
"""
DeepLabCut Toolbox (deeplabcut.org)
© A. & M. Mathis Labs

Licensed under GNU Lesser General Public License v3.0
"""

# Script for running the official benchmark from Kane et al, 2020.
# Please share your results at https://github.com/DeepLabCut/DLC-inferencespeed-benchmark

import os, pathlib
import glob

from dlclive import benchmark_videos, download_benchmarking_data

datafolder = os.path.join(
    pathlib.Path(__file__).parent.absolute(), "Data-DLC-live-benchmark"
)

if not os.path.isdir(datafolder):  # only download if data doesn't exist!
    # Downloading data.... this takes a while (see terminal)
    download_benchmarking_data(datafolder)

n_frames = 10000  # change to 10000 for testing on a GPU!
pixels = [2500, 10000, 40000, 160000, 320000, 640000]

dog_models = glob.glob(datafolder + "/dog/*[!avi]")
dog_video = glob.glob(datafolder + "/dog/*.avi")[0]
mouse_models = glob.glob(datafolder + "/mouse_lick/*[!avi]")
mouse_video = glob.glob(datafolder + "/mouse_lick/*.avi")[0]

this_dir = os.path.dirname(os.path.realpath(__file__))
# storing results in /benchmarking/results: (for your PR)
out_dir = os.path.normpath(this_dir + "/results")

if not os.path.isdir(out_dir):
    os.mkdir(out_dir)

for m in dog_models:
    benchmark_videos(m, dog_video, output=out_dir, n_frames=n_frames, pixels=pixels)

for m in mouse_models:
    benchmark_videos(m, mouse_video, output=out_dir, n_frames=n_frames, pixels=pixels)
```