def generateSkippedGT(gtfile, skip, fmt):
    """Generates temporary ground-truth file with some frames skipped."""
    del fmt  # unused
    tf = NamedTemporaryFile(delete=False, mode='w')
    with io.open(gtfile) as fd:
        lines = fd.readlines()
        for line in lines:
            arr = line.strip().split(',')
            fr = int(arr[0])
            if fr % (skip + 1) != 1:
                continue
            pos = line.find(',')
            newline = str(fr // (skip + 1) + 1) + line[pos:]
            tf.write(newline)
    tf.close()
    tempfile = tf.name
    return tempfile
Generates temporary ground-truth file with some frames skipped.
motmetrics/apps/evaluateTracking.py