Exemplo n.º 1
0
def trackforward(id, frame, tracker, trackid, tracks):
    frame = int(frame)
    trackid = int(trackid)
    job = session.query(Job).get(id)
    segment = job.segment
    video = segment.video
    paths = [path for path in readpaths(tracks) if path is not None]
    paths = trackutils.totrackpaths(paths)

    logger.info("Job Id: {0}".format(id))
    logger.info("Algorithm: {0}".format(tracker))

    start = frame
    stop = segment.stop
    
    outpath = tracking.api.online(tracker, start, stop, video.location, trackid, paths)
    path = trackutils.fromtrackpath(outpath, job, start, stop)
    attrs = [(x.attributeid, x.frame, x.value) for x in path.attributes]

    logger.info("Path: {0}".format(path))

    return {
        "label": 0,
        "boxes": [tuple(x) for x in path.getboxes()],
        "attributes": attrs
    }
Exemplo n.º 2
0
def trackforward(id, frame, tracker, trackid, tracks):
    frame = int(frame)
    trackid = int(trackid)
    job = session.query(Job).get(id)
    segment = job.segment
    video = segment.video
    paths = [path for path in readpaths(tracks) if path is not None]
    paths = trackutils.totrackpaths(paths)

    logger.info("Job Id: {0}".format(id))
    logger.info("Algorithm: {0}".format(tracker))

    start = frame
    stop = segment.stop

    outpath = tracking.api.online(tracker, start, stop, video.location,
                                  trackid, paths)
    path = trackutils.fromtrackpath(outpath, job, start, stop)
    attrs = [(x.attributeid, x.frame, x.value) for x in path.attributes]

    logger.info("Path: {0}".format(path))

    return {
        "label": 0,
        "boxes": [tuple(x) for x in path.getboxes()],
        "attributes": attrs
    }
Exemplo n.º 3
0
def trackbetweenframes(id, leftframe, rightframe, tracker, trackid, tracks):
    leftframe = int(leftframe)
    rightframe = int(rightframe)
    trackid = int(trackid)
    job = session.query(Job).get(id)
    segment = job.segment
    video = segment.video
    paths = [path for path in readpaths(tracks) if path is not None]
    paths = trackutils.totrackpaths(paths)

    logger.info("Job Id: {0}".format(id))
    logger.info("Algorithm: {0}".format(tracker))

    outpath = tracking.api.bidirectional(tracker, leftframe, rightframe,
                                         video.location, trackid, paths)
    path = trackutils.fromtrackpath(outpath, job, leftframe, rightframe)
    attrs = [(x.attributeid, x.frame, x.value) for x in path.attributes]

    logger.info("Path: {0}".format(path))

    return {
        "label": 0,
        "boxes": [tuple(x) for x in path.getboxes()],
        "attributes": attrs
    }
Exemplo n.º 4
0
def trackforward(id, start, end, tracker, trackid):
    session = db.session
    start = int(start)
    trackid = int(trackid)
    job = session.query(Job).get(id)
    segment = job.segment
    video = segment.video

    try:
        end = int(end)
    except ValueError:
        end = segment.stop

    tracks = request.get_json(force=True)
    paths = [path for path in readpaths(tracks) if path is not None]
    paths = trackutils.totrackpaths(paths)

    logger.info("trackforward job info:")
    logger.info("Job Id: {0}".format(id))
    logger.info("Algorithm: {0}".format(tracker))
    logger.info("start frame: {0}".format(start))
    logger.info("end frame: {0}".format(end))
    logger.info("len paths: {0}".format(len(paths)))

    # paths here is only used by tracking api for finding the first frame to do
    # tracking initiliazation0
    outpath = tracking.api.online(tracker, start, end, video.location, trackid,
                                  paths)
    path = trackutils.fromtrackpath(outpath, job, start, end)
    attrs = [(x.attributeid, x.frame, x.value) for x in path.attributes]

    #    logger.info("path: {0}".format(path.getboxes()))
    #    logger.info("tracked boxes: {}".format([tuple(x) for x in path.getboxes()]))

    return {
        "label": 0,
        "boxes": [tuple(x) for x in path.getboxes()],
        "attributes": attrs
    }
Exemplo n.º 5
0
def trackbetweenframes(id, leftframe, rightframe, tracker, trackid, tracks):
    leftframe = int(leftframe)
    rightframe = int(rightframe)
    trackid = int(trackid)
    job = session.query(Job).get(id)
    segment = job.segment
    video = segment.video
    paths = [path for path in readpaths(tracks) if path is not None]
    paths = trackutils.totrackpaths(paths)

    logger.info("Job Id: {0}".format(id))
    logger.info("Algorithm: {0}".format(tracker))
    
    outpath = tracking.api.bidirectional(tracker, leftframe, rightframe, video.location, trackid, paths)
    path = trackutils.fromtrackpath(outpath, job, leftframe, rightframe)
    attrs = [(x.attributeid, x.frame, x.value) for x in path.attributes]

    logger.info("Path: {0}".format(path))

    return {
        "label": 0,
        "boxes": [tuple(x) for x in path.getboxes()],
        "attributes": attrs
    }