博客
关于我
RT-MDNet代码解读
阅读量:767 次
发布时间:2019-03-24

本文共 1867 字,大约阅读时间需要 6 分钟。

def genConfig(seq_path, set_type):    path, seqname = os.path.split(seq_path)        img_list = sorted([seq_path + '/img/' + p for p in os.listdir(seq_path + '/img') if os.path.splitext(p)[1] == '.jpg'])        if seqname == 'Jogging_1' or seqname == 'Skating2_1':        gt = np.loadtxt(seq_path + '/groundtruth_rect.1.txt')    elif seqname == 'Jogging_2' or seqname == 'Skating2_2':        gt = np.loadtxt(seq_path + '/groundtruth_rect.2.txt')    elif seqname == 'Human4':        gt = np.loadtxt(seq_path + '/groundtruth_rect.2.txt', delimiter=',')    else:        gt = np.loadtxt(seq_path + '/groundtruth_rect.txt', delimiter=',')        if seqname == 'David':        img_list = img_list[299:]    if seqname == 'Football1':        img_list = img_list[0:74]    if seqname == 'Freeman3':        img_list = img_list[0:460]    if seqname == 'Freeman4':        img_list = img_list[0:283]    if seqname == 'Diving':        img_list = img_list[0:215]    if seqname == 'Tiger1':        img_list = img_list[5:]        if gt.shape[1] == 8:        x_min = np.min(gt[:, [0, 2, 4, 6]], axis=1)[:, None]        y_min = np.min(gt[:, [1, 3, 5, 7]], axis=1)[:, None]        x_max = np.max(gt[:, [0, 2, 4, 6]], axis=1)[:, None]        y_max = np.max(gt[:, [1, 3, 5, 7]], axis=1)[:, None]        gt = np.concatenate((x_min, y_min, x_max - x_min, y_max - y_min), axis=1)        return img_list, gt

以下是关于代码的主要描述:

  • 函数定义与参数:

    • 函数genConfig接受两个参数:seq_path(序列路径)和set_type(数据类型)。
  • 图像路径处理:

    • 使用os.path.split(seq_path)分离文件路径和文件名。
    • seq_path + '/img/'中获取所有.jpg图像文件,并按名称排序生成图像列表img_list
  • ground truth数据处理:

    • 根据序列名称seqname选择不同的ground truth文件。
    • 对于特定场景(如Jogging_1Skating2_1等),加载相应的ground truth文件。
  • 图像子集筛选:

    • 针对不同场景调整图像子集范围。
    • 例如David设定从299th图像开始,Football1筛选0-74th图像等。
  • ground truth矩阵转换:

    • 当ground truth的形状为8列时,说明包含4个坐标点和宽高数据。
    • 使用np.concatenate合并最小值和最大值矩阵,构建最终ground truth矩阵。
  • 返回值:

    • 返回处理后的图像列表img_list和ground truth矩阵gt
  • 转载地址:http://cpnkk.baihongyu.com/

    你可能感兴趣的文章
    Pandas 对数据框的布尔比较
    查看>>
    pandas 根据不是常量的第三列的值将值从一列复制到另一列
    查看>>
    Pandas 读取具有浮点值的 csv 文件会导致奇怪的舍入和小数位数
    查看>>
    pandas 适用,但仅适用于满足条件的行
    查看>>
    Pandas-从具有嵌套列表列表的现有列创建动态列时出错
    查看>>
    Pandas-通过对列和索引的值求和来合并两个数据框
    查看>>
    pandas.read_csv()的详解-ChatGPT4o作答
    查看>>
    PANDAS.READ_EXCEL()输出‘;溢出错误:日期值超出范围‘;而不存在日期列
    查看>>
    Pandas数据可视化怎么做?用实战案例告诉你!
    查看>>
    Pandas数据结构之DataFrame常见操作
    查看>>
    pandas整合多份csv文件
    查看>>
    pandas某一列转数组list
    查看>>
    Pandas模块,我觉得掌握这些就够用了!
    查看>>
    Pandas玩转文本处理!
    查看>>
    SpringBoot 整合 Mybatis Plus 实现基本CRUD功能
    查看>>
    pandas的to_sql方法中使用if_exists=‘replace‘
    查看>>
    pandas读取parquet报错
    查看>>
    Pandas进阶大神!从0到100你只差这篇文章!
    查看>>
    spring5-介绍Spring框架
    查看>>
    Pandas:将一列与数据帧的所有其他列进行比较
    查看>>