| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -242,19 +242,22 @@ def video_inference_superanimal( | |||
| 242 | 242 | not require too much training. However, you can make them higher if you see a | |
| 243 | 243 | substaintial gain in the training logs. | |
| 244 | 244 | ||
| 245 | - Examples (TensorFlow Engine) | ||
| 245 | + Examples | ||
| 246 | 246 | -------- | |
| 247 | 247 | ||
| 248 | - >>> import deeplabcut.modelzoo.video_inference.video_inference_superanimal as video_inference_superanimal | ||
| 249 | - >>> superanimal_name = 'superanimal_topviewmouse_dlcrnet' | ||
| 250 | - >>> videotype = 'mp4' | ||
| 248 | + >>> from deeplabcut.modelzoo.video_inference import video_inference_superanimal | ||
| 249 | + >>> videos = ["/path/to/my/video.mp4"] | ||
| 250 | + >>> superanimal_name = "superanimal_topviewmouse" | ||
| 251 | + >>> videotype = "mp4" | ||
| 251 | 252 | >>> scale_list = [200, 300, 400] | |
| 252 | 253 | >>> video_inference_superanimal( | |
| 253 | - video, | ||
| 254 | - video_adapt = True, | ||
| 254 | + videos, | ||
| 255 | 255 | superanimal_name, | |
| 256 | - videotype = '.avi', | ||
| 256 | + model_name="hrnet_w32", | ||
| 257 | + detector_name="fasterrcnn_resnet50_fpn_v2", | ||
| 257 | 258 | scale_list = scale_list, | |
| 259 | + videotype = videotype, | ||
| 260 | + video_adapt = True, | ||
| 258 | 261 | ) | |
| 259 | 262 | ||
| 260 | 263 | Tips: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,11 +75,14 @@ You can simply call the model and run video inference. | |||
| 75 | 75 | To note, a good step is typically to use our self-supervised video adaptation method to reduce jitter. In the `deeplabcut.video_inference_superanimal` simply function set the `video_adapt` option to __True__. Be aware, that enabling this option will (minimally) extend the processing time. | |
| 76 | 76 | ||
| 77 | 77 | ```python | |
| 78 | - video_path = 'demo-video.mp4' | ||
| 79 | - superanimal_name = 'superanimal_quadruped_hrnetw32' | ||
| 78 | + import deeplabcut | ||
| 79 | + video_path = "demo-video.mp4" | ||
| 80 | + superanimal_name = "superanimal_quadruped" | ||
| 80 | 81 | ||
| 81 | 82 | deeplabcut.video_inference_superanimal([video_path], | |
| 82 | 83 | superanimal_name, | |
| 84 | + model_name="hrnet_w32", | ||
| 85 | + detector_name="fasterrcnn_resnet50_fpn_v2", | ||
| 83 | 86 | video_adapt = False) | |
| 84 | 87 | ``` | |
| 85 | 88 | ||
@@ -89,13 +92,19 @@ deeplabcut.video_inference_superanimal([video_path], | |||
| 89 | 92 | In our work we introduced a spatial-pyramid for smartly rescaling images. Imagine if you frames are much larger than what we trained on, it would be hard for the model to find the animal! Here, you can simply guide the model with the `scale_list`: | |
| 90 | 93 | ||
| 91 | 94 | ```python | |
| 92 | - video_path = 'demo-video.mp4' | ||
| 93 | - superanimal_name = 'superanimal_quadruped_dlcrnet' | ||
| 95 | + import deeplabcut | ||
| 96 | + video_path = "demo-video.mp4" | ||
| 97 | + superanimal_name = "superanimal_quadruped" | ||
| 94 | 98 | ||
| 95 | 99 | # The purpose of the scale list is to aggregate predictions from various image sizes. We anticipate the appearance size of the animal in the images to be approximately 400 pixels. | |
| 96 | 100 | scale_list = range(200, 600, 50) | |
| 97 | 101 | ||
| 98 | - deeplabcut.video_inference_superanimal([video_path], superanimal_name, scale_list=scale_list, video_adapt = False) | ||
| 102 | + deeplabcut.video_inference_superanimal([video_path], | ||
| 103 | + superanimal_name, | ||
| 104 | + model_name="hrnet_w32", | ||
| 105 | + detector_name="fasterrcnn_resnet50_fpn_v2", | ||
| 106 | + scale_list=scale_list, | ||
| 107 | + video_adapt = False) | ||
| 99 | 108 | ``` | |
| 100 | 109 | ||
| 101 | 110 | #### Practical example: Using transfer learning with superanimal weights. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments