FairMOT训练kitti tracking数据集的汽车类(参考FairVehicle)

工作情况:
kitti数据集的标签(转换成FairMOT类似的gt)

以下是处理图片和gt文本的程序操作,仅做个人记录!!!

1.将原先kitti tracking数据集的标签 修改 去掉type用文本来表示 改成数字代表 同时将空格改成逗号

在这里插入图片描述

效果图

在这里插入图片描述

kitti tracking 标签含义:
The label files contain the following information, which can be read and
written using the matlab tools (readLabels.m) provided within this devkit. 
All values (numerical or strings) are separated via spaces, each row 
corresponds to one object. The 17 columns represent:

#Values    Name      Description
----------------------------------------------------------------------------
   1    frame        Frame within the sequence where the object appearers
   1    track id     Unique tracking id of this object within this sequence
   1    type         Describes the type of object: 'Car', 'Van', 'Truck',
                     'Pedestrian', 'Person_sitting', 'Cyclist', 'Tram',
                     'Misc' or 'DontCare'
   1    truncated    Integer (0,1,2) indicating the level of truncation.
                     Note that this is in contrast to the object detection
                     benchmark where truncation is a float in [0,1].
   1    occluded     Integer (0,1,2,3) indicating occlusion state:
                     0 = fully visible, 1 = partly occluded
                     2 = largely occluded, 3 = unknown
   1    alpha        Observation angle of object, ranging [-pi..pi]
   4    bbox         2D bounding box of object in the image (0-based index):
                     contains left, top, right, bottom pixel coordinates
   3    dimensions   3D object dimensions: height, width, length (in meters)
   3    location     3D object location x,y,z in camera coordinates (in meters)
   1    rotation_y   Rotation ry around Y-axis in camera coordinates [-pi..pi]
   1    score        Only for results: Float, indicating confidence in
                     detection, needed for p/r curves, higher is better.

附 转换代码:

import os
import numpy as np
import pandas as pd
import os.path as osp


def replace(file, old_content, new_content):
    content = read_file(file)
    content = content.replace(old_content, new_content)
    rewrite_file(file, content)

# 读文件内容
def read_file(file):
    with open(file, encoding='UTF-8') as f:
        read_all = f.read()
        f.close()

    return read_all

# 写内容到文件
def rewrite_file(file, data):
    with open(file, 'w', encoding='UTF-8') as f:
        f.write(data)
        f.close()

src_data='/media/ckq/data/kitti/MOT/images/train'
seqs = [s for s in os.listdir(src_data)]
#print(seqs)
for seq in seqs:
    path=osp.join(src_data,seq,'gt/gt.txt')
    # seq_gt_path = osp.join(src_data, seq, 'gt/gt.txt')
    # print(seq_gt_path)
    # gt = np.loadtxt(seq_gt_path, dtype=np.str, delimiter=',')  # 加载成np格式
    # print(str(gt))
    replace(path, ' ', ',')
    replace(path, 'DontCare', '10')
    replace(path, 'Person', '1')
    replace(path, 'Pedestrian', '2')
    replace(path, 'Car', '3')
    replace(path, 'Person_sitting', '4')
    replace(path, 'Cyclist', '5')
    replace(path, 'Van', '6')
    replace(path, 'Truck', '7')
    replace(path, 'Tram', '8')
    replace(path, 'Misc', '9')

2.之后开始给每个数据及的每张图片进行标签: 首先说一下 我的需求是标注Car: kitti数据集标签生成 gen_lables_kitti_car.py:

附代码(对照FairMOT 和`FairVehicle的生成标签代码写):

import os.path as osp
import os
import shutil
import numpy as np


def mkdirs(d):
    # if not osp.exists(d):
    if not osp.isdir(d):
        os.makedirs(d)

data_root = '/media/ckq/data/kitti/'
seq_root = data_root + 'MOT/images/train'
label_root = data_root + 'MOT/labels_with_ids/train'

if not os.path
  • 7
    点赞
  • 53
    收藏
    觉得还不错? 一键收藏
  • 12
    评论
Kitti tracking数据集是一个广泛用于计算机视觉和自动驾驶研究的数据集。它包括来自于汽车驾驶场景的视觉和激光雷达数据。该数据集提供了多个数据集版本,如Kitti raw数据集Kitti odometry数据集Kitti tracking数据集Kitti tracking数据集包含了21个序列,每个序列都有连续的图像帧、激光雷达点云和标注信息。这些标注信息包括车辆、行人、自行车等对象的边界框和运动轨迹。这使得研究者可以利用该数据集进行目标检测、跟踪和运动预测等任务的研究。 你可以通过Kitti数据集官网获取更多关于Kitti tracking数据集的详细信息和下载链接。 <span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [kitti数据集简介、百度网盘分享 kitti-object、kitti-tracking 全套数据集 自动驾驶](https://blog.csdn.net/qq_41590635/article/details/110350825)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [KITTI tracking数据集](https://blog.csdn.net/qq_29931083/article/details/106460698)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值