Example #1
0
            if visualization:
                im_show = cv2.cvtColor(im, cv2.COLOR_RGB2BGR)
                cv2.rectangle(im_show, (int(target_pos[0] - target_sz[0] / 2),
                                        int(target_pos[1] - target_sz[1] / 2)),
                              (int(target_pos[0] + target_sz[0] / 2),
                               int(target_pos[1] + target_sz[1] / 2)),
                              (0, 255, 0), 3)
                cv2.putText(im_show, str(f), (40, 40),
                            cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 2,
                            cv2.LINE_AA)
                cv2.imshow(video, im_show)
                cv2.waitKey(1)

        toc = time.time() - tic
        fps = n_images / toc
        speed.append(fps)
        print('{:3d} Video: {:12s} Time: {:3.1f}s\tSpeed: {:3.1f}fps'.format(
            video_id, video, toc, fps))

        # save result
        test_path = join('result', dataset, 'DCFNet_test')
        if not isdir(test_path): makedirs(test_path)
        result_path = join(test_path, video + '.txt')
        with open(result_path, 'w') as f:
            for x in res:
                f.write(','.join(['{:.2f}'.format(i) for i in x]) + '\n')

    print('***Total Mean Speed: {:3.1f} (FPS)***'.format(np.mean(speed)))

    eval_auc(dataset, 'DCFNet_test', 0, 1)
Example #2
0
            if visualization:
                im_show = cv2.cvtColor(cv2.imread(frame_name_list[f]),
                                       cv2.COLOR_RGB2BGR)
                cv2.rectangle(
                    im_show,
                    (int(pos_x - target_w / 2), int(pos_y - target_h / 2)),
                    (int(pos_x + target_w / 2), int(pos_y + target_h / 2)),
                    (0, 255, 0), 3)
                cv2.putText(im_show, str(f), (40, 40),
                            cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 255), 2,
                            cv2.LINE_AA)
                cv2.imshow(video, im_show)
                cv2.waitKey(1)

        toc = time.time() - tic
        fps = num_frames / toc
        speed.append(fps)
        print('{:3d} Video: {:12s} Time: {:3.1f}s\tSpeed: {:3.1f}fps'.format(
            video_id, video, toc, fps))

        # save result
        test_path = os.path.join('result', dataset, 'Siamese-fc_test')
        if not os.path.isdir(test_path): os.makedirs(test_path)
        result_path = os.path.join(test_path, video + '.txt')
        with open(result_path, 'w') as f:
            for x in bboxes:
                f.write(','.join(['{:.2f}'.format(i) for i in x]) + '\n')

    eval_auc(dataset, 'Siamese-fc_test', 0, 1)