Esempio 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))
Esempio n. 2
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))
Esempio n. 3
0
logging.basicConfig(level = logging.INFO)

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)
Esempio n. 4
0
from vision import *
from vision.track import dp
from vision import visualize
import os
import logging
import multiprocessing

logging.basicConfig(level=logging.INFO)

name = "VIRAT_S_040104_05_000939_001116"
root = os.path.dirname(os.path.abspath(__file__))
#iter = frameiterator("/scratch/virat/frames/{0}".format(name))
iter = frameiterator("/scratch/vatic/uci-basketball")

#start = Box(234, 115, 234 + 72, 115 + 44, 0)
#start = Box(434, 184, 434 + 112, 184 + 75, 0)
start = Box(492, 254, 492 + 16, 254 + 18, 20315)
stop = Box(510, 270, 510 + 16, 270 + 18, 20385)
#stop  = 20385

given = [start, stop]

pool = multiprocessing.Pool(24)
predicted = dp.fill(given, iter, pool=pool, pairwisecost=1.0, c=100)

vit = visualize.highlight_path(iter, predicted)
visualize.save(vit, lambda x: "tmp/path{0}.jpg".format(x))
Esempio n. 5
0
id = "toy"
pool = multiprocessing.Pool(24)
root = os.path.dirname(os.path.abspath(__file__))

for _ in range(1):
    print "Given frames are:", ", ".join(str(x.frame) for x in given)
    print "Simulating with {0} clicks".format(len(given))
    askingfor = alearn.pick(g,
                            given,
                            pool=pool,
                            skip=1,
                            bgskip=10,
                            bgsize=5e3,
                            plot="tmp/",
                            errortube=100000)
    print "Requested frame {0}".format(askingfor)
    print "Visualizing path with {0} clicks".format(len(given))

    vit = visualize.highlight_path(g, interpolation.LinearFill(given))
    base = "{0}/visualize/{1}/clicks{2}/wants{3}".format(
        root, id, len(given), askingfor)
    try:
        os.makedirs(base)
    except:
        pass

    visualize.save(vit, lambda x: "{0}/{1}.jpg".format(base, x))

    given.append(pathdict[askingfor])
    given.sort(key=lambda x: x.frame)
Esempio n. 6
0
given = [pathdict[start], pathdict[stop]]

for _ in range(20):
    print "Given frames are:", ", ".join(str(x.frame) for x in given)
    print "Simulating with {0} clicks".format(len(given))
    base = "{0}/visualize/{1}/clicks{2}/tmp".format(root, id, len(given))
    try:
        os.makedirs(base)
    except:
        pass
    askingfor = alearn.pick(iter, given, pool = pool, skip = 1,
                            bgskip = 3, bgsize = 5e5, errortube = 100000,
                            plot = base)
    print "Requested frame {0}".format(askingfor)
    print "Visualizing path with {0} clicks".format(len(given))
    
    vit = visualize.highlight_path(iter, interpolation.LinearFill(given))
    base = "{0}/visualize/{1}/clicks{2}/wants{3}".format(root, id,
                                                            len(given),
                                                            askingfor)
    try:
        os.makedirs(base)
    except:
        pass

    visualize.save(vit, lambda x: "{0}/{1}.jpg".format(base, x))

    given.append(pathdict[askingfor])
    given.sort(key = lambda x: x.frame)
Esempio n. 7
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))
Esempio n. 8
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)