Refine tracklets stored either in pickle or h5 format. The procedure is done in two stages: (i) freshly-converted detections are read by the TrackletManager, which automatically attempts to optimize tracklet continuity by assigning higher priority to long tracks while maximizing
(
config,
pickle_or_h5_file,
video,
min_swap_len=2,
min_tracklet_len=2,
max_gap=2,
trail_len=0,
)
| 919 | |
| 920 | |
| 921 | def refine_tracklets( |
| 922 | config, |
| 923 | pickle_or_h5_file, |
| 924 | video, |
| 925 | min_swap_len=2, |
| 926 | min_tracklet_len=2, |
| 927 | max_gap=2, |
| 928 | trail_len=0, |
| 929 | ): |
| 930 | """ |
| 931 | Refine tracklets stored either in pickle or h5 format. |
| 932 | The procedure is done in two stages: |
| 933 | (i) freshly-converted detections are read by the TrackletManager, |
| 934 | which automatically attempts to optimize tracklet continuity by |
| 935 | assigning higher priority to long tracks while maximizing |
| 936 | keypoint likelihood; |
| 937 | (ii) loaded tracklets are displayed into the TrackletVisualizer |
| 938 | for manual editing. Individual labels can be dragged around |
| 939 | like in the labeling toolbox; several of them can also be simultaneously |
| 940 | selected using the Lasso tool in order to re-assign multiple tracks |
| 941 | to another identity at once. |
| 942 | |
| 943 | Parameters |
| 944 | ---------- |
| 945 | config: str |
| 946 | Full path of the config.yaml file. |
| 947 | |
| 948 | pickle_or_h5_file: str |
| 949 | Full path of either the pickle file obtained after calling |
| 950 | deeplabcut.convert_detections2tracklets, or the h5 file written after |
| 951 | refining the tracklets a first time. Note that refined tracklets are |
| 952 | always stored in the h5 format. |
| 953 | |
| 954 | video: str |
| 955 | Full path of the corresponding video. |
| 956 | If the video duration and the total length of the tracklets disagree |
| 957 | by more than 5%, a message is printed indicating that the selected |
| 958 | video may not be the right one. |
| 959 | |
| 960 | min_swap_len : float, optional (default=2) |
| 961 | Minimum swap length. |
| 962 | Set to 2 by default. Retained swaps appear in the right panel in |
| 963 | shaded regions. |
| 964 | |
| 965 | min_tracklet_len : float, optional (default=2) |
| 966 | Minimum tracklet length. |
| 967 | By default, tracklets shorter than 2 frames are discarded, |
| 968 | leaving missing data instead. If set to 0, all tracklets are kept. |
| 969 | |
| 970 | max_gap : int, optional (default=2). |
| 971 | Maximal gap size (in number of frames) of missing data to be filled. |
| 972 | The procedure fits a cubic spline over all individual trajectories, |
| 973 | and fills all gaps smaller than or equal to 2 frames by default. |
| 974 | |
| 975 | trail_len : int, optional (default=0) |
| 976 | Number of trailing points. None by default, to accelerate visualization. |
| 977 | """ |
| 978 | manager = TrackletManager(config, min_swap_len, min_tracklet_len, max_gap) |
nothing calls this directly
no test coverage detected