MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / cross_validate_paf_graphs

Function cross_validate_paf_graphs

deeplabcut/core/crossvalutils.py:376–453  ·  view source on GitHub ↗
(
    config,
    inference_config,
    full_data_file,
    metadata_file,
    output_name="",
    pcutoff=0.1,
    oks_sigma=0.1,
    margin=0,
    greedy=False,
    add_discarded=True,
    calibrate=False,
    overwrite_config=True,
    n_graphs=10,
    paf_inds=None,
    symmetric_kpts=None,
)

Source from the content-addressed store, hash-verified

374
375
376def cross_validate_paf_graphs(
377 config,
378 inference_config,
379 full_data_file,
380 metadata_file,
381 output_name="",
382 pcutoff=0.1,
383 oks_sigma=0.1,
384 margin=0,
385 greedy=False,
386 add_discarded=True,
387 calibrate=False,
388 overwrite_config=True,
389 n_graphs=10,
390 paf_inds=None,
391 symmetric_kpts=None,
392):
393 cfg = auxiliaryfunctions.read_config(config)
394 inf_cfg = auxiliaryfunctions.read_plainconfig(inference_config)
395 inf_cfg_temp = inf_cfg.copy()
396 inf_cfg_temp["pcutoff"] = pcutoff
397
398 with open(full_data_file, "rb") as file:
399 data = pickle.load(file)
400 with open(metadata_file, "rb") as file:
401 metadata = pickle.load(file)
402
403 params = _set_up_evaluation(data)
404 to_ignore = auxfun_multianimal.filter_unwanted_paf_connections(cfg, params["paf_graph"])
405 best_graphs = _get_n_best_paf_graphs(
406 data,
407 metadata,
408 params["paf_graph"],
409 ignore_inds=to_ignore,
410 n_graphs=n_graphs,
411 )
412 paf_scores = best_graphs[1]
413 if paf_inds is None:
414 paf_inds = best_graphs[0]
415
416 if calibrate:
417 trainingsetfolder = auxiliaryfunctions.get_training_set_folder(cfg)
418 calibration_file = os.path.join(
419 cfg["project_path"],
420 str(trainingsetfolder),
421 "CollectedData_" + cfg["scorer"] + ".h5",
422 )
423 else:
424 calibration_file = ""
425
426 results = _benchmark_paf_graphs(
427 cfg,
428 inf_cfg_temp,
429 data,
430 paf_inds,
431 greedy,
432 add_discarded,
433 oks_sigma=oks_sigma,

Callers

nothing calls this directly

Calls 5

_set_up_evaluationFunction · 0.85
_get_n_best_paf_graphsFunction · 0.85
_benchmark_paf_graphsFunction · 0.85
loadMethod · 0.80
read_configMethod · 0.45

Tested by

no test coverage detected