You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dlclive/LiveVideoInference.py
+87-69Lines changed: 87 additions & 69 deletions
Original file line number
Diff line number
Diff line change
@@ -17,20 +17,22 @@
17
17
18
18
19
19
defget_system_info() ->dict:
20
-
"""Return summary info for system running benchmark.
20
+
"""
21
+
Returns a summary of system information relevant to running benchmarking.
21
22
22
23
Returns
23
24
-------
24
25
dict
25
-
Dictionary containing the following system information:
26
-
* ``host_name`` (str): name of machine
27
-
* ``op_sys`` (str): operating system
28
-
* ``python`` (str): path to python (which conda/virtual environment)
29
-
* ``device`` (tuple): (device type (``'GPU'`` or ``'CPU'```), device information)
30
-
* ``freeze`` (list): list of installed packages and versions
31
-
* ``python_version`` (str): python version
32
-
* ``git_hash`` (str, None): If installed from git repository, hash of HEAD commit
33
-
* ``dlclive_version`` (str): dlclive version from :data:`dlclive.VERSION`
26
+
A dictionary containing the following system information:
27
+
- host_name (str): Name of the machine.
28
+
- op_sys (str): Operating system.
29
+
- python (str): Path to the Python executable, indicating the conda/virtual environment in use.
30
+
- device_type (str): Type of device used ('GPU' or 'CPU').
31
+
- device (list): List containing the name of the GPU or CPU brand.
32
+
- freeze (list): List of installed Python packages with their versions.
33
+
- python_version (str): Version of Python in use.
34
+
- git_hash (str or None): If installed from git repository, hash of HEAD commit.
35
+
- dlclive_version (str): Version of the DLCLive package.
34
36
"""
35
37
36
38
# Get OS and host name
@@ -101,35 +103,55 @@ def analyze_live_video(
101
103
save_video=False,
102
104
):
103
105
"""
104
-
Analyze a video to track keypoints using an imported DeepLabCut model, visualize keypoints on the video, and optionally save the keypoint data and the labelled video.
105
-
106
-
Parameters:
107
-
-----------
106
+
Analyzes a video to track keypoints using a DeepLabCut model, and optionally saves the keypoint data and the labeled video.
107
+
108
+
Parameters
109
+
----------
110
+
model_path : str
111
+
Path to the DeepLabCut model.
112
+
model_type : str
113
+
Type of the model (e.g., 'onnx').
114
+
device : str
115
+
Device to run the model on ('cpu' or 'cuda').
108
116
camera : float, default=0 (webcam)
109
-
The camera to record the live video from
117
+
The camera to record the live video from.
110
118
experiment_name : str, default = "Test"
111
119
Prefix to label generated pose and video files
120
+
precision : str, optional, default='FP32'
121
+
Precision type for the model ('FP32' or 'FP16').
122
+
snapshot : str, optional
123
+
Snapshot to use for the model, if using pytorch as model type.
124
+
display : bool, optional, default=True
125
+
Whether to display frame with labelled key points.
112
126
pcutoff : float, optional, default=0.5
113
-
The probability cutoff value below which keypoints are not visualized.
127
+
Probability cutoff below which keypoints are not visualized.
114
128
display_radius : int, optional, default=5
115
-
The radius of the circles drawn to represent keypoints on the video frames.
116
-
resize : tuple of int (width, height) or None, optional, default=None
117
-
The size to which the frames should be resized. If None, the frames are not resized.
118
-
cropping : list of int, optional, default=None
119
-
Cropping parameters in pixel number: [x1, x2, y1, y2]
129
+
Radius of circles drawn for keypoints on video frames.
130
+
resize : tuple of int (width, height) or None, optional
131
+
Resize dimensions for video frames. e.g. if resize = 0.5, the video will be processed in half the original size. If None, no resizing is applied.
132
+
cropping : list of int or None, optional
133
+
Cropping parameters [x1, x2, y1, y2] in pixels. If None, no cropping is applied.
Parameters for dynamic cropping. If the state is true, then dynamic cropping will be performed. That means that if an object is detected (i.e. any body part > detectiontreshold), then object boundaries are computed according to the smallest/largest x position and smallest/largest y position of all body parts. This window is expanded by the margin and from then on only the posture within this crop is analyzed (until the object is lost, i.e. <detection treshold). The current position is utilized for updating the crop window for the next frame (this is why the margin is important and should be set large enough given the movement of the animal).
120
136
save_poses : bool, optional, default=False
121
137
Whether to save the detected poses to CSV and HDF5 files.
0 commit comments