博客
关于我
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/

    你可能感兴趣的文章
    MySQL 存储引擎
    查看>>
    mysql 存储过程 注入_mysql 视图 事务 存储过程 SQL注入
    查看>>
    MySQL 存储过程参数:in、out、inout
    查看>>
    mysql 存储过程每隔一段时间执行一次
    查看>>
    mysql 存在update不存在insert
    查看>>
    Mysql 学习总结(86)—— Mysql 的 JSON 数据类型正确使用姿势
    查看>>
    Mysql 学习总结(87)—— Mysql 执行计划(Explain)再总结
    查看>>
    Mysql 学习总结(88)—— Mysql 官方为什么不推荐用雪花 id 和 uuid 做 MySQL 主键
    查看>>
    Mysql 学习总结(89)—— Mysql 库表容量统计
    查看>>
    mysql 实现主从复制/主从同步
    查看>>
    mysql 审核_审核MySQL数据库上的登录
    查看>>
    mysql 导入 sql 文件时 ERROR 1046 (3D000) no database selected 错误的解决
    查看>>
    mysql 导入导出大文件
    查看>>
    MySQL 导出数据
    查看>>
    mysql 将null转代为0
    查看>>
    mysql 常用
    查看>>
    MySQL 常用列类型
    查看>>
    mysql 常用命令
    查看>>
    Mysql 常见ALTER TABLE操作
    查看>>
    MySQL 常见的 9 种优化方法
    查看>>