CV领域数据集汇总

CV领域数据集汇总,第1张

CV领域数据集类别名汇总
    • COCO数据集
    • VOC数据集类别名
    • Visdrone 数据集
      • 数据集简介
      • 类别名
      • Visdrone数据集将标签变为YOLO格式

COCO数据集
person
bicycle
car
motorbike
aeroplane
bus
train
truck
boat
traffic light
fire hydrant
stop sign
parking meter
bench
bird
cat
dog
horse
sheep
cow
elephant
bear
zebra
giraffe
backpack
umbrella
handbag
tie
suitcase
frisbee
skis
snowboard
sports ball
kite
baseball bat
baseball glove
skateboard
surfboard
tennis racket
bottle
wine glass
cup
fork
knife
spoon
bowl
banana
apple
sandwich
orange
broccoli
carrot
hot dog
pizza
donut
cake
chair
sofa
pottedplant
bed
diningtable
toilet
tvmonitor
laptop
mouse
remote
keyboard
cell phone
microwave
oven
toaster
sink
refrigerator
book
clock
vase
scissors
teddy bear
hair drier
toothbrush
VOC数据集类别名
aeroplane
bicycle
bird
boat
bottle
bus
car
cat
chair
cow
diningtable
dog
horse
motorbike
person
pottedplant
sheep
sofa
train
tvmonitor
Visdrone 数据集 数据集简介

txt格式,每行从左往右分别:
,,,,,,,

类别名
pedestrian
people
bicycle
car
van
truck
tricycle
awning-tricycle
bus
motor

[ 'pedestrian', 'people', 'bicycle', 'car', 'van', 'truck', 'tricycle', 'awning-tricycle', 'bus', 'motor' ]

id2cls = {
    0: 'pedestrian',
    1: 'people',
    2: 'bicycle',
    3: 'car',
    4: 'van',
    5: 'truck',
    6: 'tricycle',
    7: 'awning-tricycle',
    8: 'bus',
    9: 'motor'
}

cls2id = {
    'pedestrian': 0,
    'people': 1,
    'bicycle': 2,
    'car': 3,
    'van': 4,
    'truck': 5,
    'tricycle': 6,
    'awning-tricycle': 7,
    'bus': 8,
    'motor': 9
}
Visdrone数据集将标签变为YOLO格式
# _*_ coding:utf-8 _*_
from tqdm import tqdm
import cv2
import time
import os
"""
Visdrone_txt -> YOLO_txt
时间: 2022.4.29
作者: 余小晖
"""

def convert_box(size, box):
    # Convert VisDrone box to YOLO xywh box
    # size= (w,h)
    dw = 1. / size[0]
    dh = 1. / size[1]
    xywh = (box[0] + box[2] / 2) * dw, (box[1] + box[3] / 2) * dh, box[2] * dw, box[3] * dh
    return xywh


file_path = './Visdrone/'
# files = os.listdir(file_path)
files = [ 'VisDrone2019-DET-train','VisDrone2019-DET-train', 'VisDrone2019-DET-val']
for file in files:
    img_path = file_path + file + '/images/'
    ann_path = file_path + file + '/annotations/'
    ann_save_path = file_path + file + '/labels-1/'
    if not os.path.exists(ann_save_path):
        os.makedirs(ann_save_path)
    imgs = os.listdir(img_path)
    for i, img in enumerate(tqdm(imgs)):
        if i == 9999:
            a = 1
        totle_name = img.split('.')[0]
        ann_name = totle_name+ '.txt'
        image = cv2.imread(img_path+ img)
        img_size = image.shape
        size = (img_size[1], img_size[0])
        with open(ann_path+ ann_name, 'r') as f:
            lines = f.readlines()
            for line in lines:
                line = line.strip().split(',')
                cls = int(line[5]) - 1  # Visdrone数据集原始标签中ID从1开始计数
                if line[4] != '0':  # line[4]=0 表示该数据有问题?
                    box = [float(x) for x in line]
                    xywh = convert_box(size, box)   # convert  VisDrone box to YOLO xywh box
                    label_value = [str(cls), str(xywh[0]), str(xywh[1]), str(xywh[2]), str(xywh[3])]
                    label_value = str.join(' ', label_value)
                    with open(ann_save_path+ ann_name, 'a')as s:
                        s.write(label_value+ '\n')
                else:
                    continue
    print(time.ctime())


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/790542.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-05
下一篇 2022-05-05

发表评论

登录后才能评论

评论列表(0条)

保存