python生成数据集.Json文件

数据集的处理需要将txt文件和其他信息打包成.Json文件,因此使用的是python语言,代码附上,欢迎讨论。

import json
import os
import pandas as pd
import numpy as np

dict_name = {'Key1':"vidoe_dir", 'Key2':"init_rect",'Key3':"img_names", "Key4":"gt_rect", "Key5":"attr"
            }
attr = ["Scale Variation", "Partial Occlusion", "Out-of-View", "Camera Motion", "Similar Object"]
def read_bb_anno(seq_path, files):
    bb_anno_file = os.path.join(seq_path, files, "groundtruth.txt")
    gt = pd.read_csv(bb_anno_file, delimiter=',', usecols=[1,2,3,4], header=None, na_filter=False, low_memory=False)
    col = list(gt.columns)
    gt[col] = gt[col].apply(pd.to_numeric, errors='coerce').fillna(0)
    gt = np.array(gt, dtype=np.float32)[:-1]
    return gt

def generate_json(work_path):
    &
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值