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

    你可能感兴趣的文章
    OAuth2授权码模式详细流程(一)——站在OAuth2设计者的角度来理解code
    查看>>
    oauth2登录认证之SpringSecurity源码分析
    查看>>
    OAuth2:项目演示-模拟微信授权登录京东
    查看>>
    OA系统多少钱?OA办公系统中的价格选型
    查看>>
    OA系统选型:选择好的工作流引擎
    查看>>
    OA让企业业务流程管理科学有“据”
    查看>>
    OA项目之我的会议(会议排座&送审)
    查看>>
    OA项目之我的会议(查询)
    查看>>
    Object c将一个double值转换为时间格式
    查看>>
    object detection之Win10配置
    查看>>
    object detection训练自己数据
    查看>>
    object detection错误Message type "object_detection.protos.SsdFeatureExtractor" has no field named "bat
    查看>>
    object detection错误之Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
    查看>>
    object detection错误之no module named nets
    查看>>
    Object of type 'ndarray' is not JSON serializable
    查看>>
    Object Oriented Programming in JavaScript
    查看>>
    object references an unsaved transient instance - save the transient instance before flushing
    查看>>
    Object.keys()的详解和用法
    查看>>
    objectForKey与valueForKey在NSDictionary中的差异
    查看>>
    OBJECTIVE C (XCODE) 绘图功能简介(转载)
    查看>>