named_proposal_list = [
    name_proposal(x, y) for x, y in zip(gt_spans, proposal_list)
]
recall_list = []
IOU_thresh = [0.5, 0.7, 0.9]
for th in IOU_thresh:
    pv, pi = get_temporal_proposal_recall(proposal_list, [[y[1] for y in x]
                                                          for x in gt_spans],
                                          th)
    print((
        "IOU threshold {}. per video recall: {:02f}, per instance recall: {:02f}"
        .format(th, pv * 100, pi * 100)))
    recall_list.append(
        [args.overlap, th,
         np.mean(list(map(len, proposal_list))), pv, pi])
print(("average per video recall: {:.2f}, average per instance recall: {:.2f}".
       format(np.mean([x[3] for x in recall_list]),
              np.mean([x[4] for x in recall_list]))))

dumped_list = [
    dump_window_list(v, prs, args.frame_path, name_pattern)
    for v, prs in zip(videos, named_proposal_list) if v.id not in avoid_list
]

with open(args.output_file, "w") as of:
    for i, e in enumerate(dumped_list):
        of.write("# {}\n".format(i + 1))
        of.write(e)

print(("list written. got {} videos".format(len(dumped_list))))
Example #2
0
            )
        )
    )
    p_list.append((pv, pi))
print(("Average Recall: {:.04f} {:.04f}".format(*(np.mean(p_list, axis=0) * 100))))

if args.write_proposals:

    name_pattern = "img_*.jpg"
    frame_path = args.frame_path

    named_proposal_list = [
        name_proposal(x, y) for x, y in zip(gt_spans_full, proposal_list)
    ]
    allow_empty = args.dataset == "activitynet" and args.subset == "testing"
    dumped_list = [
        dump_window_list(
            v, prs, frame_path, name_pattern, score=score, allow_empty=allow_empty
        )
        for v, prs, score in zip(
            [x for x in video_list if x.id in pr_dict], named_proposal_list, score_list
        )
    ]

    with open(args.write_proposals, "w") as of:
        for i, e in enumerate(dumped_list):
            of.write("# {}\n".format(i + 1))
            of.write(e)

    print(("list written. got {} videos".format(len(dumped_list))))
IOU_thresh = np.arange(0.5, 1.0, 0.05)
p_list = []
for th in IOU_thresh:
    pv, pi = get_temporal_proposal_recall(proposal_list, gt_spans, th)
    print('IOU threshold {}. per video recall: {:02f}, per instance recall: {:02f}'.format(th, pv * 100, pi * 100))
    p_list.append((pv, pi))
print('Average Recall: {:.04f} {:.04f}'.format(*(np.mean(p_list, axis=0)*100)))

if args.write_proposals:

    name_pattern = 'frame*.jpg'
    frame_path = args.frame_path

    named_proposal_list = [name_proposal(x, y) for x, y in zip(gt_spans_full, proposal_list)]
    # allow_empty = args.dataset == 'activitynet' and args.subset == 'testing'
    dumped_list = [dump_window_list(v, prs, frame_path, name_pattern, score=score, allow_empty=True) for v, prs, score in
                   zip(filter(lambda x: x.id in pr_dict, video_list), named_proposal_list, score_list)]

    with open(args.write_proposals, 'w') as of:
        for i, e in enumerate(dumped_list):
            of.write('# {}\n'.format(i + 1))
            of.write(e)

    print('list {} written. got {} videos'.format(args.write_proposals, len(dumped_list)))


import pandas as pd
video_lst, t_start_lst, t_end_lst, score_lst = [], [], [], []
for k, v in pr_dict.items():
    video_lst.extend([k] * len(v))
    t_start_lst.extend([x[0] for x in v])
Example #4
0
videos = db.get_subset_videos(args.subset)

# generate proposals and name them
gt_spans = [[(x.num_label, x.time_span) for x in v.instances] for v in videos]  
proposal_list = list(map(lambda x: gen_exponential_sw_proposal(x,
                                                          overlap=args.overlap, # 0.6
                                                          time_step=args.time_step, # 1
                                                          max_level=args.max_level  # 8), videos))
print('average # of proposals: {} at overlap param {}'.format(np.mean(list(map(len, proposal_list))), args.overlap))

# [label,max_overlap,max_overlap_self,es(0),es(1)]
named_proposal_list = [name_proposal(x, y) for x,y in zip(gt_spans, proposal_list)]
recall_list = []
IOU_thresh = [0.5, 0.7, 0.9]
for th in IOU_thresh:
    #per_video_recall,per_instance_recall
    pv, pi = get_temporal_proposal_recall(proposal_list, [[y[1] for y in x] for x in gt_spans], th)
    print('IOU threshold {}. per video recall: {:02f}, per instance recall: {:02f}'.format(th, pv * 100, pi * 100))
    recall_list.append([args.overlap, th, np.mean(list(map(len, proposal_list))), pv, pi])
print("average per video recall: {:.2f}, average per instance recall: {:.2f}".format(
    np.mean([x[3] for x in recall_list]), np.mean([x[4] for x in recall_list])))

dumped_list = [dump_window_list(v, prs, args.frame_path, name_pattern) for v, prs in zip(videos, named_proposal_list) if v.id not in avoid_list]

with open(args.output_file, 'w') as of:
    for i, e in enumerate(dumped_list):
        of.write('# {}\n'.format(i + 1))
        of.write(e)

print('list written. got {} videos'.format(len(dumped_list)))