Exemplo n.º 1
0
def loadFiles(shot, reference, evireference, label, evidence, consensus=None):

    shot = loadShot(shot)
    label = loadLabel(label)
    evidence = loadEvidence(evidence)

    # check that labels are only provided for selected shots
    labelShots = set(
        tuple(s) for _, s in label[['videoID', 'shotNumber']].iterrows())
    if not labelShots.issubset(set(shot.index)):
        msg = ('Labels should only be computed for provided shots.')
        raise ValueError(msg)

    # check that evidence is provided for every unique label
    labelNames = set(label['personName'].unique())
    evidenceNames = set(evidence['personName'].unique())
    if labelNames != evidenceNames:
        msg = ('There must be exactly one evidence '
               'per unique name in label submission.')
        raise ValueError(msg)

    # check that there is no more than one evidence per label
    if len(evidenceNames) != len(evidence):
        msg = ('There must be exactly one evidence '
               'per unique name in label submission.')
        raise ValueError(msg)

    # check that evidences are chosen among selected shots
    evidenceShots = set(tuple(s) for _, s in evidence[['videoID', 'shotNumber']].iterrows())
    if not evidenceShots.issubset(set(shot.index)):
        msg = ('Evidences should only be chosen among provided shots.')
        raise ValueError(msg)

    # only keep labels for shot with consensus
    if consensus:
        consensus = loadShot(consensus)
        mask = label.apply(
            lambda x: (x['videoID'], x['shotNumber']) in set(consensus.index),
            axis=1)
        label = label[mask]

    reference = loadLabelReference(reference)
    evireference = loadEvidenceReference(evireference)

    return reference, evireference, label, evidence
Exemplo n.º 2
0
def loadFiles(shot, reference, label):

    shot = loadShot(shot)
    label = loadLabel(label)

    checkSubmission(shot, label)

    reference = loadLabelReference(reference)

    return shot, reference, label
def loadFiles(shot, reference, label, consensus=None):

    shot = loadShot(shot)
    label = loadLabel(label)

    # check that labels are only provided for selected shots
    labelShots = set(tuple(s) for _, s in label[["videoID", "shotNumber"]].iterrows())
    if not labelShots.issubset(set(shot.index)):
        msg = "Labels should only be computed for provided shots."
        raise ValueError(msg)

    # only keep labels for shot with consensus
    if consensus:
        consensus = loadShot(consensus)
        mask = label.apply(lambda x: (x["videoID"], x["shotNumber"]) in set(consensus.index), axis=1)
        label = label[mask]

    reference = loadLabelReference(reference)

    return reference, label
Exemplo n.º 4
0
def loadFiles(shot, reference, label, consensus=None):

    shot = loadShot(shot)
    label = loadLabel(label)

    # check that labels are only provided for selected shots
    labelShots = set(
        tuple(s) for _, s in label[['videoID', 'shotNumber']].iterrows())
    if not labelShots.issubset(set(shot.index)):
        msg = ('Labels should only be computed for provided shots.')
        raise ValueError(msg)

    # only keep labels for shot with consensus
    if consensus:
        consensus = loadShot(consensus)
        mask = label.apply(
            lambda x: (x['videoID'], x['shotNumber']) in set(consensus.index),
            axis=1)
        label = label[mask]

    reference = loadLabelReference(reference)

    return reference, label