max_pid_id = max(max_pid_id, track[video_name][frame_name]['num_boxes'])
            if use_orb:
                cor_file = os.path.join(image_dir, video_name, "".join([frame_id, '_', next_frame_id, '_orb.txt']))
            else:
                cor_file = os.path.join(image_dir, video_name, "".join([frame_id, '_', next_frame_id, '.txt']))

            # regenerate the missed pair-matching txt
            if not os.path.exists(cor_file) or os.stat(cor_file).st_size<200:
                
                dm = "/home/yuliang/code/PoseTrack-CVPR2017/external/deepmatching/deepmatching"
                img1_path = os.path.join(image_dir,video_name,frame_name)
                img2_path = os.path.join(image_dir,video_name,next_frame_name)

                if use_orb:
                    orb_matching(img1_path,img2_path, os.path.join(image_dir, video_name), frame_id, next_frame_id)
                else:
                    cmd = "%s %s %s -nt 20 -downscale 2 -out %s"%(dm,img1_path,img2_path,cor_file)
                    os.system(cmd)

            all_cors = np.loadtxt(cor_file)

            # if there is no people in this frame, then copy the info from former frame
            if track[video_name][next_frame_name]['num_boxes'] == 0:
                track[video_name][next_frame_name] = copy.deepcopy(track[video_name][frame_name])
                continue
            cur_all_pids, cur_all_pids_fff = stack_all_pids(track[video_name], frame_list[:-1], idx, max_pid_id, link_len)
            match_indexes, match_scores = best_matching_hungarian(
                all_cors, cur_all_pids, cur_all_pids_fff, track[video_name][next_frame_name], weights, weights_fff, num, mag)
        
            for pid1, pid2 in match_indexes:
Beispiel #2
0
        # init tracking info of the first frame in one video
        if idx == 0:
            for pid in range(1, track[frame_name]['num_boxes'] + 1):
                track[frame_name][pid]['new_pid'] = pid
                track[frame_name][pid]['match_score'] = 0

        max_pid_id = max(max_pid_id, track[frame_name]['num_boxes'])
        cor_file = os.path.join(
            image_dir, "".join([frame_id, '_', next_frame_id, '_orb.txt']))

        # regenerate the missed pair-matching txt
        if not os.path.exists(cor_file) or os.stat(cor_file).st_size < 200:
            img1_path = os.path.join(image_dir, frame_name)
            img2_path = os.path.join(image_dir, next_frame_name)
            orb_matching(img1_path, img2_path, image_dir, frame_id,
                         next_frame_id)

        all_cors = np.loadtxt(cor_file)

        # if there is no people in this frame, then copy the info from former frame
        if track[next_frame_name]['num_boxes'] == 0:
            track[next_frame_name] = copy.deepcopy(track[frame_name])
            continue
        cur_all_pids, cur_all_pids_fff = stack_all_pids(
            track, frame_list[:-1], idx, max_pid_id, link_len)
        match_indexes, match_scores = best_matching_hungarian(
            all_cors, cur_all_pids, cur_all_pids_fff, track[next_frame_name],
            weights, weights_fff, num, mag)

        for pid1, pid2 in match_indexes:
            if match_scores[pid1][pid2] > match_thres:
Beispiel #3
0
                max_pid_id = max(max_pid_id, track[frame_name]['num_boxes'])
                temp_folder = os.path.join('E:/3DMPB/temp',
                                           image_dir.split('\\')[-2],
                                           image_dir.split('\\')[-1])
                if not os.path.exists(temp_folder):
                    os.makedirs(temp_folder)
                cor_file = os.path.join(
                    temp_folder,
                    "".join([frame_id, '_', next_frame_id, '_orb.txt']))

                # regenerate the missed pair-matching txt
                if not os.path.exists(
                        cor_file) or os.stat(cor_file).st_size < 200:
                    img1_path = os.path.join(image_dir, name)
                    img2_path = os.path.join(image_dir, next_name)
                    orb_matching(img1_path, img2_path, temp_folder, frame_id,
                                 next_frame_id)

                all_cors = np.loadtxt(cor_file)

                # if there is no people in this frame, then copy the info from former frame
                if track[next_frame_name]['num_boxes'] == 0:
                    track[next_frame_name] = copy.deepcopy(track[frame_name])
                    continue
                cur_all_pids, cur_all_pids_fff = stack_all_pids(
                    track, frame_list[:-1], idx, max_pid_id, link_len)
                match_indexes, match_scores = best_matching_hungarian(
                    all_cors, cur_all_pids, cur_all_pids_fff,
                    track[next_frame_name], weights, weights_fff, num, mag)

                for pid1, pid2 in match_indexes:
                    if match_scores[pid1][pid2] > match_thres: