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

    你可能感兴趣的文章
    NO32 网络层次及OSI7层模型--TCP三次握手四次断开--子网划分
    查看>>
    NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
    查看>>
    Node JS: < 一> 初识Node JS
    查看>>
    Node-RED中使用JSON数据建立web网站
    查看>>
    Node-RED中使用json节点解析JSON数据
    查看>>
    Node-RED中使用node-red-browser-utils节点实现选择Windows操作系统中的文件并实现图片预览
    查看>>
    Node-RED中使用Notification元件显示警告讯息框(温度过高提示)
    查看>>
    Node-RED中实现HTML表单提交和获取提交的内容
    查看>>
    Node.js 函数是什么样的?
    查看>>
    Node.js 实现类似于.php,.jsp的服务器页面技术,自动路由
    查看>>
    node.js 怎么新建一个站点端口
    查看>>
    Node.js 文件系统的各种用法和常见场景
    查看>>
    node.js 配置首页打开页面
    查看>>
    node.js+react写的一个登录注册 demo测试
    查看>>
    Node.js中环境变量process.env详解
    查看>>
    Node.js安装与配置指南:轻松启航您的JavaScript服务器之旅
    查看>>
    Node.js的循环与异步问题
    查看>>
    Nodejs express 获取url参数,post参数的三种方式
    查看>>
    nodejs libararies
    查看>>
    nodejs npm常用命令
    查看>>