昆虫分类检测数据集 昆虫102类9500张 带标注 voc yolo

昆虫分类检测数据集 昆虫102类9500张 带标注 voc yolo

昆虫分类检测数据集介绍

数据集概览

这是一个针对昆虫分类检测的数据集,包含了102个昆虫种类,共9500张图片,每张图片都使用VOC或YOLO格式进行了标注。该数据集可用于训练和评估目标检测模型,特别是YOLO系列模型。

数据集特点
  • 类别丰富: 包含102个昆虫种类,覆盖了多种常见的农业害虫。
  • 大规模: 共有9500张图片,适合用于深度学习模型的训练。
  • VOC/YOLO格式: 标注信息采用VOC或YOLO格式,适合用于目标检测模型。
数据集结构

假设数据集文件夹结构如下:

 

深色版本

insect_dataset/
├── images/
│   ├── train/
│   ├── val/
│   └── test/
├── annotations/
│   ├── train/
│   ├── val/
│   └── test/
└── data.yaml
  • images/ 目录下存放图片文件。
  • annotations/ 目录下存放对应的VOC或YOLO格式的标注文件。
  • data.yaml 文件定义了数据集的配置信息。
data.yaml 文件示例(YOLO格式)
# data.yaml
train: ./images/train
val: ./images/val
test: ./images/test

nc: 102  # 类别数量
names: [
    'rice leaf roller',
    'rice leaf caterpillar',
    'paddy stem maggot',
    'asiatic rice borer',
    'yellow rice borer',
    'rice gall midge',
    'Rice Stemfly',
    'brown plant hopper',
    'white backed plant hopper',
    'small brown plant hopper',
    'rice water weevil',
    'rice leaffhopper',
    'grain spreader thrips',
    'rice shell pest',
    'grub',
    'mole cricket',
    'wireworm',
    'white margined moth',
    'black cutworm',
    'large cutworm',
    'yellow cutworm',
    'red spider',
    'corn borer',
    'army worm',
    'aphids',
    'Potosiabre vitarsis'
    ...
]

请注意,由于篇幅限制,这里只列出了部分昆虫类别,实际的data.yaml文件应包含所有102个昆虫类别的名称。

关键代码示例

以下是一段Python代码示例,展示如何加载和查看数据集中的部分图片及其标注:

import os
import cv2
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle

def load_image_and_label(image_path, label_path):
    """
    加载图片和其对应的标注信息。
    
    Parameters:
        image_path (str): 图片路径。
        label_path (str): 标注文件路径。
        
    Returns:
        img (numpy.ndarray): 加载的图片。
        labels (list of dict): 标注信息列表。
    """
    img = cv2.imread(image_path)
    img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)  # 转换颜色空间
    
    if label_path.endswith('.xml'):  # VOC格式
        from xml.etree.ElementTree import ElementTree
        
        tree = ElementTree(file=label_path)
        root = tree.getroot()
        bboxes = []

        for obj in root.findall('object'):
            bbox = obj.find('bndbox')
            xmin = float(bbox.find('xmin').text)
            ymin = float(bbox.find('ymin').text)
            xmax = float(bbox.find('xmax').text)
            ymax = float(bbox.find('ymax').text)

            bboxes.append({
                'class_id': int(obj.find('name').text),
                'x_center': (xmin + xmax) / 2 / img.shape[1],
                'y_center': (ymin + ymax) / 2 / img.shape[0],
                'width': (xmax - xmin) / img.shape[1],
                'height': (ymax - ymin) / img.shape[0]
            })

        labels = [dict(b) for b in bboxes]

    elif label_path.endswith('.txt'):  # YOLO格式
        with open(label_path, 'r') as f:
            lines = f.readlines()
            labels = []
            for line in lines:
                class_id, x_center, y_center, width, height = map(float, line.strip().split())
                labels.append({
                    'class_id': class_id,
                    'x_center': x_center,
                    'y_center': y_center,
                    'width': width,
                    'height': height
                })

    return img, labels

def draw_bounding_boxes(img, labels, class_names):
    """
    在图片上绘制边界框。
    
    Parameters:
        img (numpy.ndarray): 图片。
        labels (list of dict): 标注信息列表。
        class_names (list of str): 类别名称列表。
    """
    fig, ax = plt.subplots(1, figsize=(12, 12))
    ax.imshow(img)
    
    for label in labels:
        x_center, y_center, width, height = label['x_center'], label['y_center'], label['width'], label['height']
        h, w, _ = img.shape
        x_min = int((x_center - width / 2) * w)
        y_min = int((y_center - height / 2) * h)
        x_max = int((x_center + width / 2) * w)
        y_max = int((y_center + height / 2) * h)
        
        rect = Rectangle((x_min, y_min), x_max - x_min, y_max - y_min, linewidth=2, edgecolor='r', facecolor='none')
        ax.add_patch(rect)
        
        class_name = class_names[label['class_id']]
        ax.text(x_min, y_min, class_name, fontsize=12, color='red', backgroundcolor='white')
    
    plt.axis('off')
    plt.show()

if __name__ == "__main__":
    data_dir = "/path/to/your/dataset"
    train_images_dir = os.path.join(data_dir, "images/train")
    train_labels_dir = os.path.join(data_dir, "annotations/train")

    # 选择任何一张训练集中的图片及其对应的标注信息
    image_name = os.listdir(train_images_dir)[0]  # 选择第一张图片
    label_name = image_name.replace(".jpg", ".txt")  # 假设图片是.jpg格式,标签文件名相同但扩展名为.txt
    
    image_path = os.path.join(train_images_dir, image_name)
    label_path = os.path.join(train_labels_dir, label_name)
    
    img, labels = load_image_and_label(image_path, label_path)
    
    print(f"Loaded image shape: {img.shape}")
    print(f"Number of objects: {len

label | pie mun | box. num


rice leaf roller: (102. 168)
rice leaf caterpillar: (98, 125
paddy stan naggot: 71, 76
asiatic rice borer: (100. 126)
yellow rice borer:
99, 12
rice ga|1 nidge: (99, 11
Rice Stenfly: (70. 76)
brown plant hopper (101, 181)
hito backed plant hopper: (100, 127
snall browm plant hopper: (96. 149)
rice water wevil: (105, 121)
rice leafhopper (99, 135
rain spreader thrips: (98, 157
rice shell pest: (9. 109)
grub: (150. 176)
mole ericket: (142. 144
wirenarn; (99, 117
hite nergined noth: (54. 59)
black cutworm: (106, 137)
large cutworm: (98, 104)
yollow outworm: (100, 104)
red spider: (123, 138)
corn berer: (133. 149
army wom: (113. 122)
aphids: (134, 268)
Potosiabre vitarsis: (129. 179)
peach borer: (100. 101:
english grain aphid: (80. 134)
green bug; (73. 101)
bird cherry- oataphid; (95. 134
theat blossom midge: (83. 99
penthaleus major: (100. 104
longeged sopider nite: (93. 101)
sheat phleeothrips: (83. 107
wheat sanfly: (92. 95)
cerodanta denticornis: (B2, 93)
bt fly: (6B. 77
flea beetle: (141. 146)
cabbage arty worn: (94. 9
beet arny worm: (124. 126)
Beet spot flies: (9日, 147)
madow noth: (99, 105)
beet wevil: (134. 15
ricaer ient alismots chulsky: (57. 73) .
alfalfa wwil:
102, 1050
flax budworn: (162, 166
alfalfa plant bug: (123. 126)
tarnished plant bug: (95, 95
Locustoidea: (82, 90)
lytta polita: (130. 136)
Iegune blister beete: (55. B1)
blister beetle: (30, 34)
ther iaphie mraculata Buckton: (52. 91)
odontothrips-loti: (68. 60) .
Thriop: (9. 113)1
alfalfa sed chalcld: 05. 83)
Pieris canidia: (184. 188)
Aoolygus lucorun: (99. 104)
Limaodidee: (119. 14
Witeu8 vitifoliae: (79. 242)
Brevipoalpus lewisi McGregor: (55. 81)
oides decempunctata:
(97,125
Polyphagotars onemus latus: (31, 50)
Pseudococcus comstocki Kuwana: (92, 155)
parathrene regalis: (53, 60)
Ampelophaga: (157, 167)
Lycorma delicatula: (139, 161)
Xylotrechus;
(85,105)
Cicadella viridis: (81. 96)
Miridae:
(129,132)
Trial eur odes-vaporar iorum: (93, 175)
Erythroneura-apicalis: (43. 51)
Papi lio-xuthus:
(95,101)
Panonchus-citr i-McGregor: (97. 210)
PhyI locoptes-oleiverus-ashmead: (19, 99)
Icerya- purchasi-Maskell: (92. 124)
Unaspis-yanonensis: (79, 291)
Ceroplastes-rubens: (74. 262)
Chrysomphalus-aonidum: (73. 216)
Par lator ia-zizyphus-Lucus: (23, 132)
Nipacoccus-vastalor: (38, 97)
Aleurocanthus- spiniferus: (86, 255)
Tetr adacus- C -Bactrocera- minax: (83, 123)
Dacus-dorsalis-Hendel-: (98, 117)
Bactrocer a-tsuneonis: (61, 94)
Prodenia-litura: (119. 131)
Adr istyrannus: (91, 100)
PhyI locnistis-citrella-Stainton: (48. 59)
Toxoptera-citricidus: (71, 293)
Toxoptera-aurantii: (70. 220)
Aphis-citr icola-Vander-Goot: (71. 240)
Scirtothr ips- dorsalis-Hood: (80, 94)
Das ineura-sp: (34, 37)
Lawana- imitata-Mel ichar:
.81, 101)
Salurnis-marginella-Guerr: (136, 144)
Deporaus-marginatus-Pascoe: (7B, 79)
Chlumetia-transversa:
(54. 56)
Mango-flat- beak-leafhopper :
(40,43)
Rhyt idodera-bowr inii-white:
(118,124)
Sternochetus- frigidus: (97, 117)
Cicadellidae: (150, 154)
total: (9595, 13290)

Stkcd [股票代码] ShortName [股票简称] Accper [统计截止日期] Typrep [报表型编码] Indcd [行业代码] Indnme [行业名称] Source [公告来源] F060101B [净利润现金净含量] F060101C [净利润现金净含量TTM] F060201B [营业收入现金含量] F060201C [营业收入现金含量TTM] F060301B [营业收入现金净含量] F060301C [营业收入现金净含量TTM] F060401B [营业利润现金净含量] F060401C [营业利润现金净含量TTM] F060901B [筹资活动债权人现金净流量] F060901C [筹资活动债权人现金净流量TTM] F061001B [筹资活动股东现金净流量] F061001C [筹资活动股东现金净流量TTM] F061201B [折旧摊销] F061201C [折旧摊销TTM] F061301B [公司现金流1] F061302B [公司现金流2] F061301C [公司现金流TTM1] F061302C [公司现金流TTM2] F061401B [股权现金流1] F061402B [股权现金流2] F061401C [股权现金流TTM1] F061402C [股权现金流TTM2] F061501B [公司自由现金流(原有)] F061601B [股权自由现金流(原有)] F061701B [全部现金回收率] F061801B [营运指数] F061901B [资本支出与折旧摊销比] F062001B [现金适合比率] F062101B [现金再投资比率] F062201B [现金满足投资比率] F062301B [股权自由现金流] F062401B [企业自由现金流] Indcd1 [行业代码1] Indnme1 [行业名称1] 季度数据,所有沪深北上市公司的 分别包含excel、dta数据文件格式及其说明,便于不同软件工具对数据的分析应用 数据来源:基于上市公司年报及公告数据整理,或相关证券交易所、各部委、省、市数据 数据范围:基于沪深北证上市公司 A股(主板、中小企业板、创业板、科创板等)数据整理计算
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值