Exemplo n.º 1
0
def visualizepaths(data, dir):
    for engine, predictions in data.iteritems():
        for id, (prediction, groundtruth, video) in enumerate(predictions):
            for cpf, path in prediction.iteritems():
                logger.info("Visualizing engine {0} path {1} cpf {2}"
                            .format(str(engine), id, cpf))
                filepath = "{0}/{1}/{2}/{3}".format(dir, str(engine), id, cpf)
                try:
                    os.makedirs(filepath)
                except OSError:
                    pass
                vis = visualize.highlight_paths(video, [path, groundtruth])
                visualize.save(vis, lambda x: "{0}/{1}.jpg".format(filepath, x))
Exemplo n.º 2
0
seed4 = vision.Box(156, 57, 156 + 71, 57 + 115, 900)
seed5 = vision.Box(181, 42, 181 + 51, 42 + 106, 405)
seed6 = vision.Box(199, 54, 199 + 60, 54 + 142, 210)
badseed = vision.Box(358, 12, 358 + 33, 12 + 25, 150)
seeds = [seed, seed2, seed5, seed6]

category = 'sofa'
detfile = '/csail/vision-videolabelme/databases/video_adapt/home_ac_a/frames/5/dets-sun11-dpm-{0}.mat'.format(category)
detections = vision.detectionreader.exemplarsvm(detfile)
detections = list(detections)
detections.sort(key = lambda x: -x.score)

print detections[0]

realprior = ThreeD(video, patches, projections).build(detections)
predicted = vision.track.dp.fill([detections[0]], video, last = detections[0].frame + 1000, pool = pool, hogbin = 4, pairwisecost = 0.01, c = 0.1, realprior = realprior)

#path = ("/csail/vision-videolabelme/databases/"
#        "video_adapt/home_ac_a/frames/5/bundler-5")
#
#video = vision.flatframeiterator(path, 1, 5)
#
#root = os.path.join(path, "pmvs")
#patches, projections = pmvs.read(root)
#
#seed = vision.Box(55, 39, 55 + 270, 39 + 136, 145)
#predicted = track(video, [seed], patches, projections)
#
vit = visualize.highlight_paths(video, [predicted])
visualize.save(vit, lambda x: "tmp/path{0}.jpg".format(x))
Exemplo n.º 3
0
#
#stop = 1768

g = frameiterator("/scratch/vatic/syn-occlusion2")
b = [Box(592, 48, 592 + 103, 48 + 326, 20)]
stop = 22

g = frameiterator("/scratch/virat/frames/VIRAT_S_000302_04_000453_000484")
b = [Box(156, 96, 156 + 50, 96 + 24, 270),
     Box(391, 83, 391 + 48, 83 + 22, 459)]
stop = 500

pool = multiprocessing.Pool(24)

frame, score, path, marginals = marginals.pick(b, g,
                                               last = stop,
                                               pool = pool,
                                               pairwisecost = .01,
                                               dim = (40, 40),
                                               sigma = 1,
                                               erroroverlap = 0.5,
                                               hogbin = 8,
                                               clickradius = 10,
                                               c = 1)

pickle.dump(marginals, open("occlusion.pkl", "w"))

visualize.save(visualize.highlight_paths(g, [path]), lambda x: "tmp/path{0}.jpg".format(x))

print "frame {0} with score {1}".format(frame, score)