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

root = os.path.dirname(os.path.abspath(__file__))

g = Geppetto()
b = Rectangle()
b = b.linear((300,300), 10)
b = b.linear((0,300), 20)
b = b.linear((300,0), 30)
g.add(b)

path = b.groundtruth()
pathdict = dict((x.frame, x) for x in path)

start = 0
stop = len(g) - 1
given = [pathdict[start], pathdict[stop]]

svm = model.PathModel(g, given)

predicted = dp.track(given[0], given[-1], svm, g, pairwisecost = 0.000001)

vit = visualize.highlight_path(g, predicted)
base = "tmp"

try:
    os.makedirs(base)
except:
    pass
visualize.save(vit, lambda x: "{0}/{1}.jpg".format(base, x))
Exemplo n.º 4
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)
Exemplo n.º 5
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))