@@ -510,8 +510,8 @@ def create_labeled_video(
510510 When True, f(x) = max(0, (x - pcutoff)/(1 - pcutoff)). Defaults to False.
511511 plot_bboxes (bool, optional): If using Pytorch and in Top-Down mode,
512512 setting this to true will also plot the bounding boxes. Defaults to True.
513- bboxes_pcutoff (float, optional): If plotting bounding boxes, this overrides the bboxes_pcutoff
514- set in the model configuration. Defaults to None.
513+ bboxes_pcutoff (float, optional): Minimum bounding box confidence required for plotting.
514+ When ``None``, the value is loaded from the project configuration. Defaults to None.
515515 max_workers (int | None): Maximum number of processes to use for multiprocessing.
516516 Set this parameter to limit the total RAM-usage of simultaneous processes.
517517 Default: no maximum (i.e. number of spawned processes is based on the number of
@@ -585,6 +585,8 @@ def create_labeled_video(
585585 track_method = auxfun_multianimal .get_track_method (cfg , track_method = track_method )
586586 if pcutoff is None :
587587 pcutoff = cfg ["pcutoff" ]
588+ if bboxes_pcutoff is None :
589+ bboxes_pcutoff = cfg .bboxes_pcutoff
588590
589591 # Get individuals from the config
590592 individuals = cfg .get ("individuals" , ["" ])
@@ -604,11 +606,6 @@ def create_labeled_video(
604606 model_config = PoseConfig .from_yaml (model_config_path )
605607 if model_config .select ("train_settings.weight_init.memory_replay" ):
606608 superanimal_name = model_config ["train_settings" ]["weight_init" ]["dataset" ]
607- if bboxes_pcutoff is None :
608- bboxes_pcutoff = model_config .select ("detector.model.box_score_thresh" ) or 0.6
609- else :
610- if bboxes_pcutoff is None :
611- bboxes_pcutoff = 0.6
612609
613610 if init_weights == "" :
614611 DLCscorer , DLCscorerlegacy = auxiliaryfunctions .get_scorer_name (
@@ -1084,6 +1081,7 @@ def create_video_with_all_detections(
10841081 modelprefix = "" ,
10851082 confidence_to_alpha : bool | Callable [[float ], float ] = False ,
10861083 plot_bboxes : bool = True ,
1084+ bboxes_pcutoff : float | None = None ,
10871085 ** kwargs ,
10881086):
10891087 """Create a video labeled with all the detections stored in a '*_full.pickle' file.
@@ -1118,6 +1116,8 @@ def create_video_with_all_detections(
11181116 plot_bboxes (bool, optional): If detections were produced using a Pytorch Top-Down model,
11191117 setting this parameter to True will also plot
11201118 the bounding boxes generated by the detector. Defaults to True.
1119+ bboxes_pcutoff (float, optional): Minimum bounding box confidence required for plotting.
1120+ When ``None``, the value is loaded from the project configuration. Defaults to None.
11211121 kwargs (dict, optional): Additional arguments.
11221122 For torch-based shuffles, can be used to specify:
11231123 - snapshot_index
@@ -1127,6 +1127,7 @@ def create_video_with_all_detections(
11271127
11281128 from deeplabcut .core .inferenceutils import Assembler
11291129
1130+ # TODO @deruyter92 2026-09-01: This should be refactored to ProjectConfig.from_any()
11301131 cfg = auxiliaryfunctions .read_config (config )
11311132 trainFraction = cfg ["TrainingFraction" ][trainingsetindex ]
11321133 DLCscorername , _ = auxiliaryfunctions .get_scorer_name (
@@ -1137,6 +1138,9 @@ def create_video_with_all_detections(
11371138 ** kwargs ,
11381139 )
11391140
1141+ if bboxes_pcutoff is None :
1142+ bboxes_pcutoff = cfg .bboxes_pcutoff
1143+
11401144 videos = collect_video_paths (videos , extensions = video_extensions )
11411145 if not videos :
11421146 return
@@ -1193,9 +1197,6 @@ def create_video_with_all_detections(
11931197 clip = vp (fname = video , sname = outputname , codec = "mp4v" )
11941198 ny , nx = clip .height , clip .width
11951199
1196- bboxes_pcutoff = 0.6
1197- if pytorch_cfg := (metadata .get ("data" ) or {}).get ("pytorch-config" ):
1198- bboxes_pcutoff = PoseConfig .from_any (pytorch_cfg ).select ("detector.model.box_score_thresh" ) or 0.6
11991200 bboxes_color = (255 , 0 , 0 )
12001201
12011202 for n in trange (clip .nframes ):
0 commit comments