简介

数据集提供了带注释的热成像数据集和对应的无注释RGB图像,用于训练和验证神经网络。数据是由安装在车上的RGB相机和热成像相机获取的。

数据集总共包含14452张红外图像,其中10228张来自多个短视频;4224张来自一个长为144s的视频。所有视频都来自街道和高速路。大多数图片的采样率为1秒两帧,其中视频的帧率为1秒30帧;少数环境中目标较少时,采样率为1秒1帧。

使用MSCOCO labelvector进行标注。具体如下:

  • 类别 1:People
  • 类别 2:Bicycle —— 自行车和摩托车(与coco不一致)
  • 类别 3:Cars —— 私人汽车或者其他小型商用汽车。
  • 类别 18:Dogs
  • 类别 91:其他汽车 —— 大型卡车,船,拖车

文件夹结构

文件夹结构如下,包含3个文件夹。每个文件夹下又包含5个子文件。

  • train:包含8862采样后的图像;
  • val:包含1366张图片;
  • video:包含一个144s的视频;

各个子文件内容如下:

  • Annotated_thermal_8_bit:包含标注过的图像数据;
  • thermal_annotations.json:MSCOCO格式的标注数据;额外数据包含在 extra info中;
  • thermal_16_bit:图像;
  • thermal_8_bit:图像;
  • RGB:可见光图像;

具体使用

导入相关的包以及其它工作

from pycocotools.coco import COCO
%matplotlib inline
import matplotlib.pyplot as plt
import cv2

import os
import numpy as np
import random
# 定义变量
dataroot = '/media/xwxa/娱乐/Data/flirData/FLIR_ADAS_1_3' + os.sep

加载json文件

jsonfile = dataroot + 'train/thermal_annotations.json'
coco = COCO(jsonfile)
结果如下:
loading annotations into memory...
Done (t=0.28s)
creating index...
index created!

查看图片及对应注释

cls = 'person'
id = coco.getCatIds(cls)[0]
print(f'{cls} 对应的序号为 {id}')

cat = coco.loadCats(id)
print(f'{id} 对应的类别为 {cat}')
person 对应的序号为 1
1 对应的类别为 [{'name': 'person', 'id': 1, 'supercategory': 'unknown'}]
print(len(coco.imgs))
print(coco.imgs[0])
8862
{'extra_info': {}, 'subdirs': '.', 'id': 0, 'width': 640, 'file_name': 'thermal_8_bit/FLIR_00001.jpeg', 'height': 512}

查看特定的图片

ind = random.randint(0, len(coco.imgs))

imInfo = coco.imgs[ind]
annIds = coco.getAnnIds(imgIds=imInfo['id'])
imgfile = dataroot + 'train/' + imInfo['file_name']

print(f'{imInfo} \n对应的 annids 为\n{annIds}\n')

anns = coco.loadAnns(annIds)
if anns:
    print(anns[0])

img = cv2.imread(imgfile)

for ann in anns:
    x, y, w, h = ann['bbox']
    cv2.rectangle(img, (x,y), (x + w, y + h), (255,0,0), 2)
    cat = coco.loadCats(ann['category_id'])[0]['name']
    cv2.putText(img, cat, (x,y), cv2.FONT_HERSHEY_SIMPLEX, 1, (0,0,255), 2)
    
plt.imshow(img)
plt.show()
{'extra_info': {}, 'subdirs': '.', 'id': 6906, 'width': 640, 'file_name': 'thermal_8_bit/FLIR_06907.jpeg', 'height': 512} 
对应的 annids 为
[48274, 48275, 48276, 48277, 48278, 48279, 48280]

{'image_id': 6906, 'extra_info': {'human_annotated': True}, 'category_id': 3, 'iscrowd': 0, 'id': 48274, 'segmentation': [[547, 276, 547, 389, 639, 389, 639, 276]], 'bbox': [547, 276, 92, 113], 'area': 10396}

在这里插入图片描述

参考