def load_detrac_xml(fname):
    """Loads UA-DETRAC annotations data from xml files

    Competition Site: http://detrac-db.rit.albany.edu/download

    Params
    ------
    fname : str
        Filename to load data from

    Kwargs
    ------
    Currently none of these arguments used.

    Returns
    ------
    df : pandas.DataFrame
        The returned dataframe has the following columns
            'X', 'Y', 'Width', 'Height', 'Confidence', 'ClassId', 'Visibility'
        The dataframe is indexed by ('FrameId', 'Id')
    """

    with io.open(fname) as fd:
        doc = xmltodict.parse(fd.read())
    frameList = doc['sequence']['frame']

    parsedGT = []
    for f in frameList:
        fid = int(f['@num'])
        targetList = f['target_list']['target']
        if not isinstance(targetList, list):
            targetList = [targetList]

        for t in targetList:
            row = []
            row.append(fid)
            row.append(int(t['@id']))
            row.append(float(t['box']['@left']))
            row.append(float(t['box']['@top']))
            row.append(float(t['box']['@width']))
            row.append(float(t['box']['@height']))
            row.append(1)
            row.append(-1)
            row.append(-1)
            row.append(-1)
            parsedGT.append(row)

    df = pd.DataFrame(parsedGT,
                      columns=['FrameId', 'Id', 'X', 'Y', 'Width', 'Height', 'Confidence', 'ClassId', 'Visibility', 'unused'])
    df.set_index(['FrameId', 'Id'], inplace=True)

    # Account for matlab convention.
    df[['X', 'Y']] -= (1, 1)

    # Removed trailing column
    del df['unused']

    return df
Loads UA-DETRAC annotations data from xml files

    Competition Site: http://detrac-db.rit.albany.edu/download

    Params
    ------
    fname : str
        Filename to load data from

    Kwargs
    ------
    Currently none of these arguments used.

    Returns
    ------
    df : pandas.DataFrame
        The returned dataframe has the following columns
            'X', 'Y', 'Width', 'Height', 'Confidence', 'ClassId', 'Visibility'
        The dataframe is indexed by ('FrameId', 'Id')
    
motmetrics/io.py