首页 >> 大全

最后修改COCO128.yaml文件

2023-12-25 大全 45 作者:考证青年

数据集处理

解压图像

先解压

tar -xvf ILSVRC2012_img_train.tar 

解压之后其实还是1000个tar压缩包(对应1000个类别),需要再次解压,解压脚本unzip.sh如下(PS:可能需要自己改一下目录 dir ):

(这里也可以用解压软件一键解压)

批量解压脚本

dir=./train 
for x in `ls $dir/*tar` do     filename=`basename $x .tar`     mkdir $dir/$filename     tar -xvf $x -C $dir/$filename 
done 
rm *.tar

执行 sh 脚本

chmod 777 unzip.sh
./ unzip.sh

报错:./unzip.sh: line 3: error near token = $x .tar`’

直接使用指令ls *.tar | xargs -n1 tar xvf

将当前文件夹下的tar解压linux批量解压方法

或者:

批量解压zip文件

import os
import shutil
import zipfile# 首先引入需要的工具包
# shutil为后期移动文件所需,可以忽略此项 
# 路径改这里!
#parent_path = r'输入路径,会解压该路径下的所有zip压缩文件'
parent_path = r'E:\py\python3.7\test\test99\zip' 
# 文件类型选择
# 可以自行更改压缩文件类型,需要引入其它工具包,如tarfile等
# 这里是因为在自己的windows上,zip比较常见,其他类型请自行更改
file_flag = '.zip'   #修改需解压的格式 例如:.rar
# 删除已解压的zip文件
# 不建议初次使用,在确定程序无误后可以添加使用
def del_old_zip(file_path):os.remove(file_path)  
# 解压
def decompress(file_path, root):# 开始# zipfile打开zip文件z = zipfile.ZipFile(f'{file_path}', 'r') # 解压z.extractall(path=f"{root}")    # path为解压路径,解包后位于该路径下 # 判断是否需要重复解包for names in z.namelist():if names.endswith(file_flag):z.close()return 1 # 结束z.close() return 0# 因为我在使用过程中发现有些zip解包后会混在一起
# 在平时大家手动解压时可能也会遇到提示是否覆盖的问题
# 下面的两个函数解决这一问题 
# 开始要先创建一个大文件夹  与压缩包名字相同
# 避免后期混乱和麻烦
def start_dir_make(root, dirname):os.chdir(root)os.mkdir(dirname)return os.path.join(root, dirname) 
# 去除多余文件夹
def rem_dir_extra(root, father_dir_name):# 递归要注意信息的正常处理  搞不好上一个调用已经改变了东西  而下面的调用还是使用之前的数据 try: # 判断文件夹重名  开始for item in os.listdir(os.path.join(root, father_dir_name)): # 第一步判断是不是一个文件夹,如果不是则跳过本次循环if not os.path.isdir(os.path.join(root, father_dir_name, item)):continue # 判断是否要脱掉一层目录结构# 文件夹名字要相同,且子目录中只有单独的一个文件夹if item == father_dir_name and len(os.listdir(os.path.join(root, father_dir_name))) == 1: # 改变工作目录os.chdir(root)                 # 将无用文件夹重命名,因为直接移动会有重名错误os.rename(father_dir_name, father_dir_name + '-old')                 # 移动文件后删除空文件夹shutil.move(os.path.join(root, father_dir_name + '-old', item), os.path.join(root))os.rmdir(os.path.join(root, father_dir_name + '-old')) # 将去掉一层目录结构后的文件夹继续作为父本递归处理下去# 这里要注意,上面已经发生过数据的改动,所以下面递归传参一定要正确!rem_dir_extra(root, item) else: # 处理那些不满足上面条件的文件夹rem_dir_extra(os.path.join(root, father_dir_name), item) except Exception as e: # 打印错误信息print("清除文件夹出错" + str(e)) 
# 入口
if __name__ == '__main__': flag = 1 while flag: #  循环遍历文件夹for root, dirs, files in os.walk(parent_path): # 读取文件名for name in files:if name.endswith(file_flag): # 创建文件夹new_ws = start_dir_make(root, name.replace(file_flag, '')) # zip文件地址zip_path = os.path.join(root, name) # 解压flag = decompress(zip_path, new_ws) # 删除解压后的文件# 有点危险# 但不删除又可能会重复运行# 一定要备份或先测试,不然可能会凉,自己选择修改del_old_zip(zip_path) # 去掉多余的文件结构rem_dir_extra(root, name.replace(file_flag, '')) print(f'{root}\\{name}'.join(['文件:', '\n解压完成\n']))# 由于解压可能解了好几次 所以可能会有已经解压好的父级目录重名无法处理 这里要再处理一次rem_dir_extra(os.path.split(parent_path)[0], os.path.split(parent_path)[1])  print("解压完成啦,记得检查有没有zip格式之外的呀!\n\n其他格式需要自己改一下了")

查看文件夹下文件数量

ls -l|grep "^-" |wc -l

统计文件名中包含某个名称()的文件的文件总数

find -name "n15075141_*" | wc -l

这里我使用这官方提供的脚本文件

#!/bin/bash
#
# script to extract ImageNet dataset
# ILSVRC2012_img_train.tar (about 138 GB)
# ILSVRC2012_img_val.tar (about 6.3 GB)
# make sure ILSVRC2012_img_train.tar & ILSVRC2012_img_val.tar in your current directory
#
#  Adapted from:
#  https://github.com/facebook/fb.resnet.torch/blob/master/INSTALL.md
#  https://gist.github.com/BIGBALLON/8a71d225eff18d88e469e6ea9b39cef4
# 
#  imagenet/train/
#  ├── n01440764
#  │   ├── n01440764_10026.JPEG
#  │   ├── n01440764_10027.JPEG
#  │   ├── ......
#  ├── ......
#  imagenet/val/
#  ├── n01440764
#  │   ├── ILSVRC2012_val_00000293.JPEG
#  │   ├── ILSVRC2012_val_00002138.JPEG
#  │   ├── ......
#  ├── ......
#
#
# Make imagnet directory
#
mkdir imagenet
#
# Extract the training data:
#
# Create train directory; move .tar file; change directory
mkdir imagenet/train && mv ILSVRC2012_img_train.tar imagenet/train/ && cd imagenet/train
# Extract training set; remove compressed file
tar -xvf ILSVRC2012_img_train.tar && rm -f ILSVRC2012_img_train.tar
#
# At this stage imagenet/train will contain 1000 compressed .tar files, one for each category
#
# For each .tar file: 
#   1. create directory with same name as .tar file
#   2. extract and copy contents of .tar file into directory
#   3. remove .tar file
find . -name "*.tar" | while read NAME ; do mkdir -p "${NAME%.tar}"; tar -xvf "${NAME}" -C "${NAME%.tar}"; rm -f "${NAME}"; done
#
# This results in a training directory like so:
#
#  imagenet/train/
#  ├── n01440764
#  │   ├── n01440764_10026.JPEG
#  │   ├── n01440764_10027.JPEG
#  │   ├── ......
#  ├── ......
#
# Change back to original directory
cd ../..
#
# Extract the validation data and move images to subfolders:
#
# Create validation directory; move .tar file; change directory; extract validation .tar; remove compressed file
mkdir imagenet/val && mv ILSVRC2012_img_val.tar imagenet/val/ && cd imagenet/val && tar -xvf ILSVRC2012_img_val.tar && rm -f ILSVRC2012_img_val.tar
# get script from soumith and run; this script creates all class directories and moves images into corresponding directories
wget -qO- https://raw.githubusercontent.com/soumith/imagenetloader.torch/master/valprep.sh | bash
#
# This results in a validation directory like so:
#
#  imagenet/val/
#  ├── n01440764
#  │   ├── ILSVRC2012_val_00000293.JPEG
#  │   ├── ILSVRC2012_val_00002138.JPEG
#  │   ├── ......
#  ├── ......
#
#
# Check total files after extract
#
#  $ find train/ -name "*.JPEG" | wc -l
#  1281167
#  $ find val/ -name "*.JPEG" | wc -l
#  50000
#

参考文章

具体类别如下1000类信息

处理标签和图像

因为标签很少,图像较多,只有部分图像有标签对应,所以需要删除多余的图像。

数据集目录结构如下

先查看一下类别信息

在2中的meta.mat文件中存放着类型信息(1000)类

配置

下通过命令打开图片

xdg-open n02098286_4811.JPEG

在一个文件夹下就是一类的

将标签全部复制到ann下

修改文件最后修改日期__修改文件最后会跳出确定保存吗

遍历文件夹下的所有子文件夹,并将指定的文件复制到指定目录

# coding: utf-8
from PIL import Image, ImageDraw, ImageFont
import os
import shutil
import cv2 as cv
import numpy as np
import json#批量复制
# 为了防止重名覆盖问题,先使用改名软件将文件名全部改了def batchCopy(src,des,suffix):print("封装代码")for root, dirs, files in os.walk(src):print(root)all_files = os.listdir(root)filtered_files = [file for file in all_files if file.endswith(suffix)]# 遍历原文件夹中的文件if (len(filtered_files)):for i in range(len(files)):full_file_name = root+"/"+files[i]print("要被复制的全文件路径全名:", full_file_name)shutil.copy(full_file_name, des)  # shutil.copy函数放入原文件的路径文件全名  然后放入目标文件夹if __name__ == "__main__":src = "/home/ubuntu/data/ilsvrc2012/ILSVRC2012_img_train_new/imagenet/val"  # 原文件夹路径des = "/home/ubuntu/data/ilsvrc2012/imageval"  # 目标文件夹路径suffix = ".JPEG"batchCopy(src,des,suffix)

删除两文件夹多出的文件,两文件夹文件后缀名不同,单个文件夹有多个后缀名文件

参考代码

就是图片比标签多,将多余的图片删除,使得图片和标签数量一一对应

# encoding:utf-8
import os
import os.path# 删除pic_dir中比txt_dir多出的文件
pic_dir = 'D:\\dataset\\total'  # 你的图片文件夹路径
txt_dir = 'D:\\dataset\\ann'  # 你的标签文件夹路径def txt(rootdir):a = []for parent, dirnames, filenames in os.walk(rootdir):for filenames in filenames:filenames = filenames.split('.')[0]  # 获取无后缀名的文件名称a.append(filenames)return adef pic(rootdir):b = []for parent, dirnames, filenames in os.walk(rootdir):for filenames in filenames:filenames = filenames.split('.')[0]  # 获取无后缀名的文件名称b.append(filenames)return bif __name__ == '__main__':txt_set = txt(txt_dir)txt_set = set(txt_set)  # 删除txt_set中的重复pic_set = pic(pic_dir)pic_set = set(pic_set)  # 删除pic_set中的重复# comp=txt_set-pic_setcomp = pic_set - txt_set  # 图片比标注多时,进行做差print("ok")print(len(comp))for item in comp:# 删去这些无标注的图片for root, dirs, files in os.walk(pic_dir):for file in files:filename = file.split('.')[0]  # 获取无后缀名的文件名称if item == filename:os.remove(pic_dir + '/' + file)# file = pic_dir + '/' + item + '.png' #删除pic_dir中多出的文件# if os.path.exists(file):#     os.remove(file)#     print(file)

这种方法删除很慢,特别是有70W张图片待删除

高效删除多余图片方法

效果:

统计待删除txt文件的行数

file_path = '/home/ubuntu/code/yolov8-pytorch-master/myDel.txt'  # 替换成你的文本文件路径with open(file_path, 'r') as file:lines = file.readlines()num_lines = len(lines)
print("文本文件的行数:", num_lines)

待删除图像张(半分钟就找出来了)

后缀转换后:

VOC转YOLO

提供了标签是xml的,就和voc是一样的

首先获取类别信息文件(.txt)

0 n01440764 tench 鱼
1 n01443537 goldfish 鱼
2 n01484850 great_white_shark 鱼
3 n01491361 tiger_shark 鱼
4 n01494475 hammerhead 鱼
5 n01496331 electric_ray 鱼
6 n01498041 stingray 鱼
7 n01514668 cock 鸡
8 n01514859 hen 鸡
9 n01518878 ostrich 鸵鸟
10 n01530575 brambling 鸟
11 n01531178 goldfinch 鸟
12 n01532829 house_finch 鸟
13 n01534433 junco 鸟
14 n01537544 indigo_bunting 鸟
15 n01558993 robin 鸟
16 n01560419 bulbul 鸟
17 n01580077 jay 鸟
18 n01582220 magpie 鸟
19 n01592084 chickadee 鸟
20 n01601694 water_ouzel 鸟
21 n01608432 kite 鸟
22 n01614925 bald_eagle 鹰
23 n01616318 vulture 鹰
24 n01622779 great_grey_owl 猫头鹰
25 n01629819 European_fire_salamander 壁虎
26 n01630670 common_newt 壁虎
27 n01631663 eft 壁虎
28 n01632458 spotted_salamander 壁虎
29 n01632777 axolotl 壁虎
30 n01641577 bullfrog 蛤蟆
31 n01644373 tree_frog 青蛙
32 n01644900 tailed_frog 青蛙
33 n01664065 loggerhead 龟
34 n01665541 leatherback_turtle 龟
35 n01667114 mud_turtle 龟
36 n01667778 terrapin 龟
37 n01669191 box_turtle 龟
38 n01675722 banded_gecko 蜥蜴
39 n01677366 common_iguana 蜥蜴
40 n01682714 American_chameleon 蜥蜴
41 n01685808 whiptail 蜥蜴
42 n01687978 agama 蜥蜴
43 n01688243 frilled_lizard 蜥蜴
44 n01689811 alligator_lizard 蜥蜴
45 n01692333 Gila_monster 蜥蜴
46 n01693334 green_lizard 蜥蜴
47 n01694178 African_chameleon 蜥蜴
48 n01695060 Komodo_dragon 蜥蜴
49 n01697457 African_crocodile 鳄鱼
50 n01698640 American_alligator 鳄鱼
51 n01704323 triceratops 恐龙
52 n01728572 thunder_snake 蛇
53 n01728920 ringneck_snake 蛇
54 n01729322 hognose_snake 蛇
55 n01729977 green_snake 蛇
56 n01734418 king_snake 蛇
57 n01735189 garter_snake 蛇
58 n01737021 water_snake 蛇
59 n01739381 vine_snake 蛇
60 n01740131 night_snake 蛇
61 n01742172 boa_constrictor 蛇
62 n01744401 rock_python 蛇
63 n01748264 Indian_cobra 蛇
64 n01749939 green_mamba 蛇
65 n01751748 sea_snake 蛇
66 n01753488 horned_viper 蛇
67 n01755581 diamondback 蛇
68 n01756291 sidewinder 蛇
69 n01768244 trilobite 化石
70 n01770081 harvestman 蜘蛛
71 n01770393 scorpion 蝎子
72 n01773157 black_and_gold_garden_spider 蜘蛛
73 n01773549 barn_spider 蜘蛛
74 n01773797 garden_spider 蜘蛛
75 n01774384 black_widow 蜘蛛
76 n01774750 tarantula 蜘蛛
77 n01775062 wolf_spider 蜘蛛
78 n01776313 tick 蜘蛛
79 n01784675 centipede 蜈蚣
80 n01795545 black_grouse 鸟
81 n01796340 ptarmigan 鸟
82 n01797886 ruffed_grouse 鸟
83 n01798484 prairie_chicken 鸟
84 n01806143 peacock 孔雀
85 n01806567 quail 鸟
86 n01807496 partridge 鸟
87 n01817953 African_grey 鸟
88 n01818515 macaw 鸟
89 n01819313 sulphur-crested_cockatoo 鸟
90 n01820546 lorikeet 鸟
91 n01824575 coucal 鸟
92 n01828970 bee_eater 鸟
93 n01829413 hornbill 鸟
94 n01833805 hummingbird 鸟
95 n01843065 jacamar 鸟
96 n01843383 toucan 鸟
97 n01847000 drake 鸭子
98 n01855032 red-breasted_merganser 鹅
99 n01855672 goose 鹅
100 n01860187 black_swan 鹅
101 n01871265 tusker 大象
102 n01872401 echidna 刺猬
103 n01873310 platypus 鸭嘴兽
104 n01877812 wallaby 袋鼠
105 n01882714 koala 考拉
106 n01883070 wombat 土拨鼠
107 n01910747 jellyfish 水母
108 n01914609 sea_anemone 珊瑚
109 n01917289 brain_coral 珊瑚
110 n01924916 flatworm 海洋生物
111 n01930112 nematode 海蛇
112 n01943899 conch 海螺
113 n01944390 snail 蜗牛
114 n01945685 slug 蜗牛
115 n01950731 sea_slug 海洋生物
116 n01955084 chiton 海洋生物
117 n01968897 chambered_nautilus 海螺
118 n01978287 Dungeness_crab 螃蟹
119 n01978455 rock_crab 螃蟹
120 n01980166 fiddler_crab 螃蟹
121 n01981276 king_crab 螃蟹
122 n01983481 American_lobster 龙虾
123 n01984695 spiny_lobster 龙虾
124 n01985128 crayfish 龙虾
125 n01986214 hermit_crab 寄居蟹
126 n01990800 isopod 海洋生物
127 n02002556 white_stork 鸟
128 n02002724 black_stork 鸟
129 n02006656 spoonbill 鸟
130 n02007558 flamingo 鸟
131 n02009229 little_blue_heron 鸟
132 n02009912 American_egret 鸟
133 n02011460 bittern 鸟
134 n02012849 crane 鸟
135 n02013706 limpkin 鸟
136 n02017213 European_gallinule 鸟
137 n02018207 American_coot 鸟
138 n02018795 bustard 鸟
139 n02025239 ruddy_turnstone 鸟
140 n02027492 red-backed_sandpiper 鸟
141 n02028035 redshank 鸟
142 n02033041 dowitcher 鸟
143 n02037110 oystercatcher 鸟
144 n02051845 pelican 鸟
145 n02056570 king_penguin 企鹅
146 n02058221 albatross 鸟
147 n02066245 grey_whale 鲸鱼
148 n02071294 killer_whale 鲸鱼
149 n02074367 dugong 海象
150 n02077923 sea_lion 海狮
151 n02085620 Chihuahua 狗
152 n02085782 Japanese_spaniel 狗
153 n02085936 Maltese_dog 狗
154 n02086079 Pekinese 狗
155 n02086240 Shih-Tzu 狗
156 n02086646 Blenheim_spaniel 狗
157 n02086910 papillon 狗
158 n02087046 toy_terrier 狗
159 n02087394 Rhodesian_ridgeback 狗
160 n02088094 Afghan_hound 狗
161 n02088238 basset 狗
162 n02088364 beagle 狗
163 n02088466 bloodhound 狗
164 n02088632 bluetick 狗
165 n02089078 black-and-tan_coonhound 狗
166 n02089867 Walker_hound 狗
167 n02089973 English_foxhound 狗
168 n02090379 redbone 狗
169 n02090622 borzoi 狗
170 n02090721 Irish_wolfhound 狗
171 n02091032 Italian_greyhound 狗
172 n02091134 whippet 狗
173 n02091244 Ibizan_hound 狗
174 n02091467 Norwegian_elkhound 狗
175 n02091635 otterhound 狗
176 n02091831 Saluki 狗
177 n02092002 Scottish_deerhound 狗
178 n02092339 Weimaraner 狗
179 n02093256 Staffordshire_bullterrier 狗
180 n02093428 American_Staffordshire_terrier 狗
181 n02093647 Bedlington_terrier 狗
182 n02093754 Border_terrier 狗
183 n02093859 Kerry_blue_terrier 狗
184 n02093991 Irish_terrier 狗
185 n02094114 Norfolk_terrier 狗
186 n02094258 Norwich_terrier 狗
187 n02094433 Yorkshire_terrier 狗
188 n02095314 wire-haired_fox_terrier 狗
189 n02095570 Lakeland_terrier 狗
190 n02095889 Sealyham_terrier 狗
191 n02096051 Airedale 狗
192 n02096177 cairn 狗
193 n02096294 Australian_terrier 狗
194 n02096437 Dandie_Dinmont 狗
195 n02096585 Boston_bull 狗
196 n02097047 miniature_schnauzer 狗
197 n02097130 giant_schnauzer 狗
198 n02097209 standard_schnauzer 狗
199 n02097298 Scotch_terrier 狗
200 n02097474 Tibetan_terrier 狗
201 n02097658 silky_terrier 狗
202 n02098105 soft-coated_wheaten_terrier 狗
203 n02098286 West_Highland_white_terrier 狗
204 n02098413 Lhasa 狗
205 n02099267 flat-coated_retriever 狗
206 n02099429 curly-coated_retriever 狗
207 n02099601 golden_retriever 狗
208 n02099712 Labrador_retriever 狗
209 n02099849 Chesapeake_Bay_retriever 狗
210 n02100236 German_short-haired_pointer 狗
211 n02100583 vizsla 狗
212 n02100735 English_setter 狗
213 n02100877 Irish_setter 狗
214 n02101006 Gordon_setter 狗
215 n02101388 Brittany_spaniel 狗
216 n02101556 clumber 狗
217 n02102040 English_springer 狗
218 n02102177 Welsh_springer_spaniel 狗
219 n02102318 cocker_spaniel 狗
220 n02102480 Sussex_spaniel 狗
221 n02102973 Irish_water_spaniel 狗
222 n02104029 kuvasz 狗
223 n02104365 schipperke 狗
224 n02105056 groenendael 狗
225 n02105162 malinois 狗
226 n02105251 briard 狗
227 n02105412 kelpie 狗
228 n02105505 komondor 狗
229 n02105641 Old_English_sheepdog 狗
230 n02105855 Shetland_sheepdog 狗
231 n02106030 collie 狗
232 n02106166 Border_collie 狗
233 n02106382 Bouvier_des_Flandres 狗
234 n02106550 Rottweiler 狗
235 n02106662 German_shepherd 狗
236 n02107142 Doberman 狗
237 n02107312 miniature_pinscher 狗
238 n02107574 Greater_Swiss_Mountain_dog 狗
239 n02107683 Bernese_mountain_dog 狗
240 n02107908 Appenzeller 狗
241 n02108000 EntleBucher 狗
242 n02108089 boxer 狗
243 n02108422 bull_mastiff 狗
244 n02108551 Tibetan_mastiff 狗
245 n02108915 French_bulldog 狗
246 n02109047 Great_Dane 狗
247 n02109525 Saint_Bernard 狗
248 n02109961 Eskimo_dog 狗
249 n02110063 malamute 狗
250 n02110185 Siberian_husky 狗
251 n02110341 dalmatian 狗
252 n02110627 affenpinscher 狗
253 n02110806 basenji 狗
254 n02110958 pug 狗
255 n02111129 Leonberg 狗
256 n02111277 Newfoundland 狗
257 n02111500 Great_Pyrenees 狗
258 n02111889 Samoyed 狗
259 n02112018 Pomeranian 狗
260 n02112137 chow 狗
261 n02112350 keeshond 狗
262 n02112706 Brabancon_griffon 狗
263 n02113023 Pembroke 狗
264 n02113186 Cardigan 狗
265 n02113624 toy_poodle 狗
266 n02113712 miniature_poodle 狗
267 n02113799 standard_poodle 狗
268 n02113978 Mexican_hairless 狗
269 n02114367 timber_wolf 狼
270 n02114548 white_wolf 狼
271 n02114712 red_wolf 狼
272 n02114855 coyote 狼
273 n02115641 dingo 狼
274 n02115913 dhole 狼
275 n02116738 African_hunting_dog 狼
276 n02117135 hyena 狼
277 n02119022 red_fox 狐狸
278 n02119789 kit_fox 狐狸
279 n02120079 Arctic_fox 狐狸
280 n02120505 grey_fox 狐狸
281 n02123045 tabby 猫
282 n02123159 tiger_cat 猫
283 n02123394 Persian_cat 猫
284 n02123597 Siamese_cat 猫
285 n02124075 Egyptian_cat 猫
286 n02125311 cougar 猫
287 n02127052 lynx288 n02128385 leopard 豹
289 n02128757 snow_leopard 豹
290 n02128925 jaguar 豹
291 n02129165 lion 狮子
292 n02129604 tiger 老虎
293 n02130308 cheetah 豹
294 n02132136 brown_bear 熊
295 n02133161 American_black_bear 熊
296 n02134084 ice_bear 熊
297 n02134418 sloth_bear 熊
298 n02137549 mongoose 猫鼬
299 n02138441 meerkat 猫鼬
300 n02165105 tiger_beetle 昆虫
301 n02165456 ladybug 昆虫
302 n02167151 ground_beetle 昆虫
303 n02168699 long-horned_beetle 昆虫
304 n02169497 leaf_beetle 昆虫
305 n02172182 dung_beetle 昆虫
306 n02174001 rhinoceros_beetle 昆虫
307 n02177972 weevil 昆虫
308 n02190166 fly 昆虫
309 n02206856 bee 昆虫
310 n02219486 ant 昆虫
311 n02226429 grasshopper 昆虫
312 n02229544 cricket 昆虫
313 n02231487 walking_stick 昆虫
314 n02233338 cockroach 昆虫
315 n02236044 mantis 昆虫
316 n02256656 cicada 昆虫
317 n02259212 leafhopper 昆虫
318 n02264363 lacewing 昆虫
319 n02268443 dragonfly 蜻蜓
320 n02268853 damselfly 蜻蜓
321 n02276258 admiral 蝴蝶
322 n02277742 ringlet 蝴蝶
323 n02279972 monarch 蝴蝶
324 n02280649 cabbage_butterfly 蝴蝶
325 n02281406 sulphur_butterfly 蝴蝶
326 n02281787 lycaenid 蝴蝶
327 n02317335 starfish 海星
328 n02319095 sea_urchin 海胆
329 n02321529 sea_cucumber 海洋生物
330 n02325366 wood_rabbit 兔子
331 n02326432 hare 兔子
332 n02328150 Angora 兔子
333 n02342885 hamster 鼠
334 n02346627 porcupine 鼠
335 n02356798 fox_squirrel 松鼠
336 n02361337 marmot 鼠
337 n02363005 beaver 鼠
338 n02364673 guinea_pig 鼠
339 n02389026 sorrel 马
340 n02391049 zebra 斑马
341 n02395406 hog 猪
342 n02396427 wild_boar 猪
343 n02397096 warthog 猪
344 n02398521 hippopotamus 河马
345 n02403003 ox 牛
346 n02408429 water_buffalo 牛
347 n02410509 bison 牛
348 n02412080 ram349 n02415577 bighorn 羊
350 n02417914 ibex 羊
351 n02422106 hartebeest 羊
352 n02422699 impala 羊
353 n02423022 gazelle 羊
354 n02437312 Arabian_camel 骆驼
355 n02437616 llama 羊驼
356 n02441942 weasel 狸
357 n02442845 mink 狸
358 n02443114 polecat 狸
359 n02443484 black-footed_ferret 狸
360 n02444819 otter 狸
361 n02445715 skunk 狸
362 n02447366 badger 狸
363 n02454379 armadillo 穿山甲
364 n02457408 three-toed_sloth 树懒
365 n02480495 orangutan 狒狒
366 n02480855 gorilla 猩猩
367 n02481823 chimpanzee 猴子
368 n02483362 gibbon 猴子
369 n02483708 siamang 猴子
370 n02484975 guenon 猴子
371 n02486261 patas 猴子
372 n02486410 baboon 猴子
373 n02487347 macaque 猴子
374 n02488291 langur 猴子
375 n02488702 colobus 猴子
376 n02489166 proboscis_monkey 猴子
377 n02490219 marmoset 猴子
378 n02492035 capuchin 猴子
379 n02492660 howler_monkey 猴子
380 n02493509 titi 猴子
381 n02493793 spider_monkey 猴子
382 n02494079 squirrel_monkey 猴子
383 n02497673 Madagascar_cat 猴子
384 n02500267 indri 猴子
385 n02504013 Indian_elephant 大象
386 n02504458 African_elephant 大象
387 n02509815 lesser_panda 浣熊
388 n02510455 giant_panda 熊猫
389 n02514041 barracouta 鱼
390 n02526121 eel 鱼
391 n02536864 coho 鱼
392 n02606052 rock_beauty 鱼
393 n02607072 anemone_fish 鱼
394 n02640242 sturgeon 鱼
395 n02641379 gar 鱼
396 n02643566 lionfish 鱼
397 n02655020 puffer 鱼
398 n02666196 abacus 算盘
399 n02667093 abaya 穆斯林
400 n02669723 academic_gown 学士服
401 n02672831 accordion 手风琴
402 n02676566 acoustic_guitar 吉他
403 n02687172 aircraft_carrier 航空母舰
404 n02690373 airliner 飞机
405 n02692877 airship 飞艇
406 n02699494 altar 教堂
407 n02701002 ambulance 救护车
408 n02704792 amphibian 水陆两用车
409 n02708093 analog_clock 钟
410 n02727426 apiary 箱子
411 n02730930 apron 围裙
412 n02747177 ashcan 垃圾箱
413 n02749479 assault_rifle 枪
414 n02769748 backpack 背包
415 n02776631 bakery 面包柜
416 n02777292 balance_beam 体操
417 n02782093 balloon 热气球
418 n02783161 ballpoint 钢笔
419 n02786058 Band_Aid 邦迪
420 n02787622 banjo 乐器
421 n02788148 bannister 楼梯
422 n02790996 barbell 杠铃
423 n02791124 barber_chair 座椅
424 n02791270 barbershop 理发
425 n02793495 barn 木屋
426 n02794156 barometer 表
427 n02795169 barrel 酒桶
428 n02797295 barrow 手推车
429 n02799071 baseball 棒球
430 n02802426 basketball 篮球
431 n02804414 bassinet 婴儿
432 n02804610 bassoon 乐器
433 n02807133 bathing_cap 游泳
434 n02808304 bath_towel 婴儿毛巾
435 n02808440 bathtub 浴缸
436 n02814533 beach_wagon 轿车
437 n02814860 beacon 灯塔
438 n02815834 beaker 烧杯
439 n02817516 bearskin 守卫
440 n02823428 beer_bottle 啤酒
441 n02823750 beer_glass 啤酒
442 n02825657 bell_cote 建筑
443 n02834397 bib 围兜
444 n02835271 bicycle-built-for-two 双人自行车
445 n02837789 bikini 比基尼
446 n02840245 binder 笔记本
447 n02841315 binoculars 望远镜
448 n02843684 birdhouse 信箱
449 n02859443 boathouse 小屋
450 n02860847 bobsled 雪橇
451 n02865351 bolo_tie 项链
452 n02869837 bonnet 帽子
453 n02870880 bookcase 书柜
454 n02871525 bookshop 书店
455 n02877765 bottlecap 瓶盖
456 n02879718 bow 弓箭
457 n02883205 bow_tie 领结
458 n02892201 brass 墓碑
459 n02892767 brassiere 胸罩
460 n02894605 breakwater 海岸
461 n02895154 breastplate 盔甲
462 n02906734 broom 扫帚
463 n02909870 bucket 水桶
464 n02910353 buckle 皮带
465 n02916936 bulletproof_vest 防弹背心
466 n02917067 bullet_train 火车
467 n02927161 butcher_shop 肉铺
468 n02930766 cab 出租车
469 n02939185 caldron 锅
470 n02948072 candle 蜡烛
471 n02950826 cannon 炮
472 n02951358 canoe 艇
473 n02951585 can_opener 订书机
474 n02963159 cardigan 毛衣
475 n02965783 car_mirror 反光镜
476 n02966193 carousel 旋转木马
477 n02966687 carpenter’s_kit 工具箱
478 n02971356 carton 盒子
479 n02974003 car_wheel 轮胎
480 n02977058 cash_machine 取款机
481 n02978881 cassette 磁带
482 n02979186 cassette_player 磁带
483 n02980441 castle 城堡
484 n02981792 catamaran 帆船
485 n02988304 CD_player cd播放器
486 n02992211 cello 大提琴
487 n02992529 cellular_telephone 手机
488 n02999410 chain 铁链
489 n03000134 chainlink_fence 铁丝网
490 n03000247 chain_mail 铁丝网
491 n03000684 chain_saw 电锯
492 n03014705 chest 木箱
493 n03016953 chiffonier 木柜
494 n03017168 chime 锣鼓
495 n03018349 china_cabinet 柜子
496 n03026506 Christmas_stocking 袜子
497 n03028079 church 教堂
498 n03032252 cinema 剧院
499 n03041632 cleaver 刀
500 n03042490 cliff_dwelling 堡垒
501 n03045698 cloak 斗篷
502 n03047690 clog 鞋子
503 n03062245 cocktail_shaker 瓶子
504 n03063599 coffee_mug 杯子
505 n03063689 coffeepot 壶
506 n03065424 coil 螺旋
507 n03075370 combination_lock 锁
508 n03085013 computer_keyboard 键盘
509 n03089624 confectionery 糖果
510 n03095699 container_ship 船
511 n03100240 convertible 轿车
512 n03109150 corkscrew 开瓶器
513 n03110669 cornet 号(乐器)
514 n03124043 cowboy_boot 靴子
515 n03124170 cowboy_hat 帽子
516 n03125729 cradle 婴儿床
517 n03126707 crane 起重机
518 n03127747 crash_helmet 头盔
519 n03127925 crate 木箱
520 n03131574 crib 婴儿床
521 n03133878 Crock_Pot 电饭锅
522 n03134739 croquet_ball 推球
523 n03141823 crutch 拐杖
524 n03146219 cuirass 盔甲
525 n03160309 dam 水库
526 n03179701 desk 办公桌
527 n03180011 desktop_computer 电脑
528 n03187595 dial_telephone 电话机
529 n03188531 diaper 尿布
530 n03196217 digital_clock 闹钟
531 n03197337 digital_watch 手表
532 n03201208 dining_table 餐桌
533 n03207743 dishrag 垫子
534 n03207941 dishwasher 洗碗柜
535 n03208938 disk_brake 车轮
536 n03216828 dock 港口
537 n03218198 dogsled 雪橇
538 n03220513 dome 穹顶
539 n03223299 doormat 地毯
540 n03240683 drilling_platform 油田
541 n03249569 drum 鼓
542 n03250847 drumstick 鼓棒
543 n03255030 dumbbell 哑铃
544 n03259280 Dutch_oven 锅
545 n03271574 electric_fan 风扇
546 n03272010 electric_guitar 电吉他
547 n03272562 electric_locomotive 火车
548 n03290653 entertainment_center 电视机
549 n03291819 envelope 信
550 n03297495 espresso_maker 咖啡机
551 n03314780 face_powder 化妆品
552 n03325584 feather_boa 绒毛
553 n03337140 file 柜子
554 n03344393 fireboat 喷泉
555 n03345487 fire_engine 消防车
556 n03347037 fire_screen 壁炉
557 n03355925 flagpole 旗杆
558 n03372029 flute 笛子
559 n03376595 folding_chair 座椅
560 n03379051 football_helmet 橄榄球
561 n03384352 forklift 叉车
562 n03388043 fountain 喷泉
563 n03388183 fountain_pen 钢笔
564 n03388549 four-poster 床
565 n03393912 freight_car 火车
566 n03394916 French_horn 圆号
567 n03400231 frying_pan 平底锅
568 n03404251 fur_coat 裘皮
569 n03417042 garbage_truck 卡车
570 n03424325 gasmask 面具
571 n03425413 gas_pump 加油
572 n03443371 goblet 酒杯
573 n03444034 go-kart 卡丁车
574 n03445777 golf_ball 高尔夫
575 n03445924 golfcart 高尔夫车
576 n03447447 gondola 小船
577 n03447721 gong 锣鼓
578 n03450230 gown 婚纱
579 n03452741 grand_piano 钢琴
580 n03457902 greenhouse 大棚
581 n03459775 grille 轿车
582 n03461385 grocery_store 菜场
583 n03467068 guillotine 断头台
584 n03476684 hair_slide 发饰
585 n03476991 hair_spray 发蜡
586 n03478589 half_track 坦克
587 n03481172 hammer 榔头
588 n03482405 hamper 竹筒
589 n03483316 hand_blower 吹风机
590 n03485407 hand-held_computer pos机
591 n03485794 handkerchief 手帕
592 n03492542 hard_disc 硬盘
593 n03494278 harmonica 口风琴
594 n03495258 harp 竖琴
595 n03496892 harvester 起重机
596 n03498962 hatchet 斧头
597 n03527444 holster 手枪
598 n03529860 home_theater 电视机
599 n03530642 honeycomb 蜂巢
600 n03532672 hook 钩子
601 n03534580 hoopskirt 裙子
602 n03535780 horizontal_bar 体操
603 n03538406 horse_cart 马车
604 n03544143 hourglass 沙漏
605 n03584254 iPod 音乐播放器
606 n03584829 iron 电熨斗
607 n03590841 jack-o’-lantern 南瓜灯
608 n03594734 jean 牛仔裤
609 n03594945 jeep 吉普车
610 n03595614 jersey T恤
611 n03598930 jigsaw_puzzle 拼图
612 n03599486 jinrikisha 黄包车
613 n03602883 joystick 操纵杆
614 n03617480 kimono 和服
615 n03623198 knee_pad 护具
616 n03627232 knot 绳结
617 n03630383 lab_coat 医生
618 n03633091 ladle 勺子
619 n03637318 lampshade 灯
620 n03642806 laptop 笔记本电脑
621 n03649909 lawn_mower 割草机
622 n03657121 lens_cap 镜头盖
623 n03658185 letter_opener 小刀
624 n03661043 library 图书馆
625 n03662601 lifeboat 救生船
626 n03666591 lighter 打火机
627 n03670208 limousine 加长车
628 n03673027 liner 轮船
629 n03676483 lipstick 口红
630 n03680355 Loafer 鞋子
631 n03690938 lotion 护肤品
632 n03691459 loudspeaker 音响
633 n03692522 loupe 放大镜
634 n03697007 lumbermill 原木
635 n03706229 magnetic_compass 指南针
636 n03709823 mailbag 包
637 n03710193 mailbox 邮箱
638 n03710637 maillot 泳衣
639 n03710721 maillot 泳衣
640 n03717622 manhole_cover 窨井盖
641 n03720891 maraca 手摇铃
642 n03721384 marimba 木琴
643 n03724870 mask 面具
644 n03729826 matchstick 火柴
645 n03733131 maypole 绳子
646 n03733281 maze 迷宫
647 n03733805 measuring_cup 烧杯
648 n03742115 medicine_chest 冰箱
649 n03743016 megalith 石柱
650 n03759954 microphone 话筒
651 n03761084 microwave 微波炉
652 n03763968 military_uniform 军人
653 n03764736 milk_can 水壶
654 n03769881 minibus 小客车
655 n03770439 miniskirt 短裙
656 n03770679 minivan 面包车
657 n03773504 missile 导弹
658 n03775071 mitten 手套
659 n03775546 mixing_bowl 碗
660 n03776460 mobile_home 房车
661 n03777568 Model_T 老爷车
662 n03777754 modem 路由器
663 n03781244 monastery 建筑
664 n03782006 monitor 显示器
665 n03785016 moped 摩托车
666 n03786901 mortar 砚
667 n03787032 mortarboard 学士帽
668 n03788195 mosque 建筑
669 n03788365 mosquito_net 蚊帐
670 n03791053 motor_scooter 助动车
671 n03792782 mountain_bike 自行车
672 n03792972 mountain_tent 帐篷
673 n03793489 mouse 键盘鼠标
674 n03794056 mousetrap 捕鼠夹
675 n03796401 moving_van 货车
676 n03803284 muzzle 狗嘴套
677 n03804744 nail 钉子
678 n03814639 neck_brace 颈托
679 n03814906 necklace 项链
680 n03825788 nipple 奶瓶
681 n03832673 notebook 笔记本电脑
682 n03837869 obelisk 建筑
683 n03838899 oboe 黑管
684 n03840681 ocarina 埙
685 n03841143 odometer 仪表盘
686 n03843555 oil_filter 机油滤清器
687 n03854065 organ 管风琴
688 n03857828 oscilloscope 示波器
689 n03866082 overskirt 礼服
690 n03868242 oxcart 牛车
691 n03868863 oxygen_mask 呼吸器
692 n03871628 packet 零食
693 n03873416 paddle 划桨
694 n03874293 paddlewheel 水轮
695 n03874599 padlock 锁
696 n03876231 paintbrush 刷子
697 n03877472 pajama 睡衣
698 n03877845 palace 建筑
699 n03884397 panpipe 乐器
700 n03887697 paper_towel 纸巾
701 n03888257 parachute 降落伞
702 n03888605 parallel_bars 体操
703 n03891251 park_bench 长椅
704 n03891332 parking_meter 停车缴费器
705 n03895866 passenger_car 火车
706 n03899768 patio 院子
707 n03902125 pay-phone 公用电话
708 n03903868 pedestal 柱子
709 n03908618 pencil_box 文具袋
710 n03908714 pencil_sharpener 卷笔刀
711 n03916031 perfume 香水
712 n03920288 Petri_dish 培养皿
713 n03924679 photocopier 打印机
714 n03929660 pick 吉他拨片
715 n03929855 pickelhaube 头盔
716 n03930313 picket_fence 栅栏
717 n03930630 pickup 轿车
718 n03933933 pier 桥
719 n03935335 piggy_bank 储蓄罐
720 n03937543 pill_bottle 药丸
721 n03938244 pillow 枕头
722 n03942813 ping-pong_ball 乒乓球
723 n03944341 pinwheel 风车
724 n03947888 pirate 帆船
725 n03950228 pitcher 茶壶
726 n03954731 plane 刨子
727 n03956157 planetarium 建筑
728 n03958227 plastic_bag 塑料袋
729 n03961711 plate_rack 碗架
730 n03967562 plow 推土机
731 n03970156 plunger 搋子
732 n03976467 Polaroid_camera 相机
733 n03976657 pole 杆子
734 n03977966 police_van 警车
735 n03980874 poncho 披风
736 n03982430 pool_table 桌球
737 n03983396 pop_bottle 瓶子
738 n03991062 pot 盆栽
739 n03992509 potter’s_wheel 陶艺
740 n03995372 power_drill 钻机
741 n03998194 prayer_rug 毯子
742 n04004767 printer 打印机
743 n04005630 prison 监狱
744 n04008634 projectile 导弹
745 n04009552 projector 投影仪
746 n04019541 puck 冰球
747 n04023962 punching_bag 拳击
748 n04026417 purse 手提袋
749 n04033901 quill 羽毛笔
750 n04033995 quilt 床
751 n04037443 racer 赛车
752 n04039381 racket 网球
753 n04040759 radiator 加热器
754 n04041544 radio 收音机
755 n04044716 radio_telescope 卫星接收器
756 n04049303 rain_barrel 酒桶
757 n04065272 recreational_vehicle 房车
758 n04067472 reel 鱼竿
759 n04069434 reflex_camera 相机
760 n04070727 refrigerator 冰箱
761 n04074963 remote_control 遥控器
762 n04081281 restaurant 餐厅
763 n04086273 revolver 手枪
764 n04090263 rifle 狙击枪
765 n04099969 rocking_chair 摇椅
766 n04111531 rotisserie 烤箱
767 n04116512 rubber_eraser 橡皮
768 n04118538 rugby_ball 橄榄球
769 n04118776 rule 尺
770 n04120489 running_shoe 运动鞋
771 n04125021 safe 保险箱
772 n04127249 safety_pin 回形针
773 n04131690 saltshaker 调料瓶
774 n04133789 sandal 拖鞋
775 n04136333 sarong 长裙
776 n04141076 sax 萨克斯
777 n04141327 scabbard 剑
778 n04141975 scale 秤
779 n04146614 school_bus 校车
780 n04147183 schooner 帆船
781 n04149813 scoreboard 计分板
782 n04152593 screen 显示器
783 n04153751 screw 螺丝
784 n04154565 screwdriver 螺丝刀
785 n04162706 seat_belt 安全带
786 n04179913 sewing_machine 缝纫机
787 n04192698 shield 盾牌
788 n04200800 shoe_shop 鞋店
789 n04201297 shoji 榻榻米
790 n04204238 shopping_basket 购物篮
791 n04204347 shopping_cart 购物车
792 n04208210 shovel 铲子
793 n04209133 shower_cap 浴帽
794 n04209239 shower_curtain 浴帘
795 n04228054 ski 滑雪
796 n04229816 ski_mask 面罩
797 n04235860 sleeping_bag 睡袋
798 n04238763 slide_rule 游标卡尺
799 n04239074 sliding_door 移门
800 n04243546 slot 老虎机
801 n04251144 snorkel 游泳眼镜
802 n04252077 snowmobile 滑雪车
803 n04252225 snowplow 铲雪车
804 n04254120 soap_dispenser 洗手液
805 n04254680 soccer_ball 足球
806 n04254777 sock 袜子
807 n04258138 solar_dish 太阳能板
808 n04259630 sombrero 帽子
809 n04263257 soup_bowl 碗
810 n04264628 space_bar 键盘
811 n04265275 space_heater 电热器
812 n04266014 space_shuttle 航天飞船
813 n04270147 spatula 锅铲
814 n04273569 speedboat 快艇
815 n04275548 spider_web 蜘蛛网
816 n04277352 spindle 毛线
817 n04285008 sports_car 运动型轿车
818 n04286575 spotlight 探照灯
819 n04296562 stage 乐队
820 n04310018 steam_locomotive 蒸汽机车
821 n04311004 steel_arch_bridge 桥
822 n04311174 steel_drum 鼓
823 n04317175 stethoscope 听诊器
824 n04325704 stole 担架
825 n04326547 stone_wall 石堆
826 n04328186 stopwatch 秒表
827 n04330267 stove 火炉
828 n04332243 strainer 滤网
829 n04335435 streetcar 公交车
830 n04336792 stretcher 担架
831 n04344873 studio_couch 沙发
832 n04346328 stupa 皇宫
833 n04347754 submarine 轮船
834 n04350905 suit 西装
835 n04355338 sundial 日晷
836 n04355933 sunglass 墨镜
837 n04356056 sunglasses 墨镜
838 n04357314 sunscreen 防晒霜
839 n04366367 suspension_bridge 桥
840 n04367480 swab 拖把
841 n04370456 sweatshirt 连帽衫
842 n04371430 swimming_trunks 沙滩裤
843 n04371774 swing 秋千
844 n04372370 switch 开关
845 n04376876 syringe 针筒
846 n04380533 table_lamp 台灯
847 n04389033 tank 坦克
848 n04392985 tape_player 磁带播放器
849 n04398044 teapot 茶壶
850 n04399382 teddy 毛绒玩具
851 n04404412 television 电视机
852 n04409515 tennis_ball 网球
853 n04417672 thatch 草屋
854 n04418357 theater_curtain 幕布
855 n04423845 thimble 指套
856 n04428191 thresher 装甲车
857 n04429376 throne 皇位
858 n04435653 tile_roof 瓦片
859 n04442312 toaster 面包机
860 n04443257 tobacco_shop 烟酒店
861 n04447861 toilet_seat 马桶
862 n04456115 torch 火炬
863 n04458633 totem_pole 图腾
864 n04461696 tow_truck 大卡车
865 n04462240 toyshop 玩具店
866 n04465501 tractor 拖拉机
867 n04467665 trailer_truck 大货车
868 n04476259 tray 碟子
869 n04479046 trench_coat 风衣
870 n04482393 tricycle 儿童自行车
871 n04483307 trimaran 船
872 n04485082 tripod 三脚架
873 n04486054 triumphal_arch 拱门
874 n04487081 trolleybus 巴士
875 n04487394 trombone 长号
876 n04493381 tub 浴缸
877 n04501370 turnstile 闸机
878 n04505470 typewriter_keyboard 打字机
879 n04507155 umbrella 伞
880 n04509417 unicycle 独轮车
881 n04515003 upright 钢琴
882 n04517823 vacuum 吸尘器
883 n04522168 vase 花瓶
884 n04523525 vault 拱廊
885 n04525038 velvet 珊瑚绒
886 n04525305 vending_machine 自动贩卖机
887 n04532106 vestment 教皇袍
888 n04532670 viaduct 桥
889 n04536866 violin 小提琴
890 n04540053 volleyball 排球
891 n04542943 waffle_iron 煎饼锅
892 n04548280 wall_clock 挂钟
893 n04548362 wallet 钱夹
894 n04550184 wardrobe 柜子
895 n04552348 warplane 飞机
896 n04553703 washbasin 台盆
897 n04554684 washer 洗衣机
898 n04557648 water_bottle 水瓶
899 n04560804 water_jug 水壶
900 n04562935 water_tower 煤气包
901 n04579145 whiskey_jug 水壶
902 n04579432 whistle 哨子
903 n04584207 wig 头发
904 n04589890 window_screen 窗户
905 n04590129 window_shade 百叶窗
906 n04591157 Windsor_tie 领带
907 n04591713 wine_bottle 葡萄酒
908 n04592741 wing 飞机
909 n04596742 wok 炒锅
910 n04597913 wooden_spoon 勺子
911 n04599235 wool 围巾
912 n04604644 worm_fence 栅栏
913 n04606251 wreck 沉船
914 n04612504 yawl 帆船
915 n04613696 yurt 蒙古包
916 n06359193 web_site 网页
917 n06596364 comic_book 海报
918 n06785654 crossword_puzzle 填字游戏
919 n06794110 street_sign 交通标志
920 n06874185 traffic_light 交通灯
921 n07248320 book_jacket 书
922 n07565083 menu 菜单
923 n07579787 plate 菜
924 n07583066 guacamole 菜
925 n07584110 consomme 菜
926 n07590611 hot_pot 菜
927 n07613480 trifle 蛋糕
928 n07614500 ice_cream 冰激凌
929 n07615774 ice_lolly 棒冰
930 n07684084 French_loaf 面包
931 n07693725 bagel 甜甜圈
932 n07695742 pretzel 面包
933 n07697313 cheeseburger 汉堡
934 n07697537 hotdog 热狗
935 n07711569 mashed_potato 焗饭
936 n07714571 head_cabbage 蔬菜
937 n07714990 broccoli 西蓝花
938 n07715103 cauliflower 花椰菜
939 n07716358 zucchini 蔬菜
940 n07716906 spaghetti_squash 金瓜
941 n07717410 acorn_squash 南瓜
942 n07717556 butternut_squash 南瓜
943 n07718472 cucumber 黄瓜
944 n07718747 artichoke 蔬菜
945 n07720875 bell_pepper 青椒
946 n07730033 cardoon 花
947 n07734744 mushroom 蘑菇
948 n07742313 Granny_Smith 苹果
949 n07745940 strawberry 草莓
950 n07747607 orange 橙子
951 n07749582 lemon 柠檬
952 n07753113 fig 水果
953 n07753275 pineapple 菠萝
954 n07753592 banana 香蕉
955 n07754684 jackfruit 榴莲
956 n07760859 custard_apple 水果
957 n07768694 pomegranate 石榴
958 n07802026 hay 草垛
959 n07831146 carbonara 意大利面
960 n07836838 chocolate_sauce 甜品
961 n07860988 dough 面团
962 n07871810 meat_loaf 肉酱
963 n07873807 pizza 披萨
964 n07875152 potpie 派
965 n07880968 burrito 肉卷
966 n07892512 red_wine 红酒
967 n07920052 espresso 咖啡
968 n07930864 cup 茶
969 n07932039 eggnog 饮料杯
970 n09193705 alp 雪山
971 n09229709 bubble 泡泡
972 n09246464 cliff 悬崖
973 n09256479 coral_reef 珊瑚
974 n09288635 geyser 温泉
975 n09332890 lakeside 风景
976 n09399592 promontory 小岛
977 n09421951 sandbar 沙滩
978 n09428293 seashore 海滩
979 n09468604 valley 瀑布
980 n09472597 volcano 火山
981 n09835506 ballplayer 棒球
982 n10148035 groom 婚礼
983 n10565667 scuba_diver 潜水
984 n11879895 rapeseed 油菜花
985 n11939491 daisy 菊花
986 n12057211 yellow_lady’s_slipper 植物
987 n12144580 corn 玉米
988 n12267677 acorn 松果
989 n12620546 hip 植物
990 n12768682 buckeye 栗子
991 n12985857 coral_fungus 菌菇
992 n12998815 agaric 菌菇
993 n13037406 gyromitra 菌菇
994 n13040303 stinkhorn 菌菇
995 n13044778 earthstar 菌菇
996 n13052670 hen-of-the-woods 菌菇
997 n13054560 bolete 菌菇
998 n13133613 ear 玉米
999 n15075141 toilet_tissue 卷筒纸

使用脚本将数字编号和末尾中文删除

import codecs
import ospath = 'D:/code/yolov8-pytorch-master/voc_classes.txt'  # 标签文件train路径
newFile = 'D:/code/yolov8-pytorch-master/voc_classesNew.txt'
# 读取路径下的txt文件
t = codecs.open(path, mode='r', encoding='utf-8')
line = t.readline()  # 以行的形式进行读取文件
list1 = []    # 保存了信息列表
while line:a = line.split()list1.append(a)line = t.readline()
t.close()lt = open(newFile, "w")
newlist1 = list1for num in range(0, len(newlist1)):del newlist1[num][0]del newlist1[num][2]for num in range(0, len(newlist1)):lt.writelines(' '.join(newlist1[num]) + '\n')  # 每个元素以空格间隔,一行元素写完并换行
lt.close()
print(" 修改完成")

转换的时候,列表存在编码问题

删掉修改就行

处理思路为;

先转成voc格式

在将voc格式转yolo格式

转voc格式

转将xml数据转换为标准的VOC格式

.py里面有一些参数需要设置。

分别是、、、、,第一次训练可以仅修改

import os
import random
import xml.etree.ElementTree as ETimport numpy as npfrom utils.utils import get_classes#--------------------------------------------------------------------------------------------------------------------------------#
#   annotation_mode用于指定该文件运行时计算的内容
#   annotation_mode为0代表整个标签处理过程,包括获得VOCdevkit/VOC2007/ImageSets里面的txt以及训练用的2007_train.txt、2007_val.txt
#   annotation_mode为1代表获得VOCdevkit/VOC2007/ImageSets里面的txt
#   annotation_mode为2代表获得训练用的2007_train.txt、2007_val.txt
#--------------------------------------------------------------------------------------------------------------------------------#
annotation_mode     = 0
#-------------------------------------------------------------------#
#   必须要修改,用于生成2007_train.txt、2007_val.txt的目标信息
#   与训练和预测所用的classes_path一致即可
#   如果生成的2007_train.txt里面没有目标信息
#   那么就是因为classes没有设定正确
#   仅在annotation_mode为0和2的时候有效
#-------------------------------------------------------------------#
classes_path        = 'model_data/voc_classesNew.txt'
#--------------------------------------------------------------------------------------------------------------------------------#
#   trainval_percent用于指定(训练集+验证集)与测试集的比例,默认情况下 (训练集+验证集):测试集 = 9:1
#   train_percent用于指定(训练集+验证集)中训练集与验证集的比例,默认情况下 训练集:验证集 = 9:1
#   仅在annotation_mode为0和1的时候有效
#--------------------------------------------------------------------------------------------------------------------------------#
trainval_percent    = 0.9
train_percent       = 0.9
#-------------------------------------------------------#
#   指向VOC数据集所在的文件夹
#   默认指向根目录下的VOC数据集
#-------------------------------------------------------#
VOCdevkit_path  = 'VOCdevkit'VOCdevkit_sets  = [('2007', 'train'), ('2007', 'val')]
classes, _      = get_classes(classes_path)#-------------------------------------------------------#
#   统计目标数量
#-------------------------------------------------------#
photo_nums  = np.zeros(len(VOCdevkit_sets))
nums        = np.zeros(len(classes))
def convert_annotation(year, image_id, list_file):in_file = open(os.path.join(VOCdevkit_path, 'VOC%s/Annotations/%s.xml'%(year, image_id)), encoding='utf-8')tree=ET.parse(in_file)root = tree.getroot()for obj in root.iter('object'):difficult = 0 if obj.find('difficult')!=None:difficult = obj.find('difficult').textcls = obj.find('name').textif cls not in classes or int(difficult)==1:continuecls_id = classes.index(cls)xmlbox = obj.find('bndbox')b = (int(float(xmlbox.find('xmin').text)), int(float(xmlbox.find('ymin').text)), int(float(xmlbox.find('xmax').text)), int(float(xmlbox.find('ymax').text)))list_file.write(" " + ",".join([str(a) for a in b]) + ',' + str(cls_id))nums[classes.index(cls)] = nums[classes.index(cls)] + 1if __name__ == "__main__":random.seed(0)if " " in os.path.abspath(VOCdevkit_path):raise ValueError("数据集存放的文件夹路径与图片名称中不可以存在空格,否则会影响正常的模型训练,请注意修改。")if annotation_mode == 0 or annotation_mode == 1:print("Generate txt in ImageSets.")xmlfilepath     = os.path.join(VOCdevkit_path, 'VOC2007/Annotations')saveBasePath    = os.path.join(VOCdevkit_path, 'VOC2007/ImageSets/Main')temp_xml        = os.listdir(xmlfilepath)total_xml       = []for xml in temp_xml:if xml.endswith(".xml"):total_xml.append(xml)num     = len(total_xml)  list    = range(num)  tv      = int(num*trainval_percent)  tr      = int(tv*train_percent)  trainval= random.sample(list,tv)  train   = random.sample(trainval,tr)  print("train and val size",tv)print("train size",tr)ftrainval   = open(os.path.join(saveBasePath,'trainval.txt'), 'w')  ftest       = open(os.path.join(saveBasePath,'test.txt'), 'w')  ftrain      = open(os.path.join(saveBasePath,'train.txt'), 'w')  fval        = open(os.path.join(saveBasePath,'val.txt'), 'w')  for i in list:  name=total_xml[i][:-4]+'\n'  if i in trainval:  ftrainval.write(name)  if i in train:  ftrain.write(name)  else:  fval.write(name)  else:  ftest.write(name)  ftrainval.close()  ftrain.close()  fval.close()  ftest.close()print("Generate txt in ImageSets done.")if annotation_mode == 0 or annotation_mode == 2:print("Generate 2007_train.txt and 2007_val.txt for train.")type_index = 0for year, image_set in VOCdevkit_sets:image_ids = open(os.path.join(VOCdevkit_path, 'VOC%s/ImageSets/Main/%s.txt'%(year, image_set)), encoding='utf-8').read().strip().split()list_file = open('%s_%s.txt'%(year, image_set), 'w', encoding='utf-8')for image_id in image_ids:list_file.write('%s/VOC%s/JPEGImages/%s.jpg'%(os.path.abspath(VOCdevkit_path), year, image_id))convert_annotation(year, image_id, list_file)list_file.write('\n')photo_nums[type_index] = len(image_ids)type_index += 1list_file.close()print("Generate 2007_train.txt and 2007_val.txt for train done.")def printTable(List1, List2):for i in range(len(List1[0])):print("|", end=' ')for j in range(len(List1)):print(List1[j][i].rjust(int(List2[j])), end=' ')print("|", end=' ')print()str_nums = [str(int(x)) for x in nums]tableData = [classes, str_nums]colWidths = [0]*len(tableData)len1 = 0for i in range(len(tableData)):for j in range(len(tableData[i])):if len(tableData[i][j]) > colWidths[i]:colWidths[i] = len(tableData[i][j])printTable(tableData, colWidths)if photo_nums[0] <= 500:print("训练集数量小于500,属于较小的数据量,请注意设置较大的训练世代(Epoch)以满足足够的梯度下降次数(Step)。")if np.sum(nums) == 0:print("在数据集中并未获得任何目标,请注意修改classes_path对应自己的数据集,并且保证标签名字正确,否则训练将会没有任何效果!")print("在数据集中并未获得任何目标,请注意修改classes_path对应自己的数据集,并且保证标签名字正确,否则训练将会没有任何效果!")print("在数据集中并未获得任何目标,请注意修改classes_path对应自己的数据集,并且保证标签名字正确,否则训练将会没有任何效果!")print("(重要的事情说三遍)。")

需要注意的是,xml中的类别是文件名,为了识别匹配到类别信息,类别txt文件需要对应

类别文件保留名称

修改文件最后修改日期__修改文件最后会跳出确定保存吗

这时再执行.py

看得出类别已经识别了

只不过后续还得将名称和类别做一次转换

将xml文件转化为txt文件,xml文件包含了对应的GT框以及图片长宽大小等信息,通过对其解析,并进行归一化最终读到txt文件中同时生成train、val和test数据集中图片的绝对路径,用于索引到图片位置

获取纯类别信息的txt

import codecs
import ospath = 'D:/code/yolov8-pytorch-master/voc_classesNew.txt'  # 标签文件train路径
newFile = 'D:/code/yolov8-pytorch-master/voc_classesNew2.txt'
# 读取路径下的txt文件
t = codecs.open(path, mode='r', encoding='utf-8')
line = t.readline()  # 以行的形式进行读取文件
list1 = []    # 保存了信息列表
while line:a = line.split()list1.append(a)line = t.readline()
t.close()lt = open(newFile, "w")
newlist1 = list1for num in range(0, len(newlist1)):del newlist1[num][0]for num in range(0, len(newlist1)):lt.writelines(' '.join(newlist1[num]) + '\n')  # 每个元素以空格间隔,一行元素写完并换行
lt.close()
print(" 修改完成")

在上述类别信息txt中存在个别编码错误,需要改一下编码

查看一下VOC中数据格式

最后一个999是类别编号(最后一行)

代码

import xml.etree.ElementTree as ET
import pickle
import os
from os import listdir, getcwd
from os.path import join
import random
from shutil import copyfile# 根据自己的数据标签修改
classes=["tumor"]def clear_hidden_files(path):dir_list = os.listdir(path)for i in dir_list:abspath = os.path.join(os.path.abspath(path), i)if os.path.isfile(abspath):if i.startswith("._"):os.remove(abspath)else:clear_hidden_files(abspath)def convert(size, box):dw = 1./size[0]dh = 1./size[1]x = (box[0] + box[1])/2.0y = (box[2] + box[3])/2.0w = box[1] - box[0]h = box[3] - box[2]x = x*dww = w*dwy = y*dhh = h*dhreturn (x,y,w,h)def convert_annotation(image_id):in_file = open('VOCdevkit/VOC2007/Annotations/%s.xml' %image_id)out_file = open('VOCdevkit/VOC2007/YOLOLabels/%s.txt' %image_id, 'w')tree=ET.parse(in_file)root = tree.getroot()size = root.find('size')w = int(size.find('width').text)h = int(size.find('height').text)for obj in root.iter('object'):difficult = obj.find('difficult').textcls = obj.find('name').textif cls not in classes or int(difficult) == 1:continuecls_id = classes.index(cls)xmlbox = obj.find('bndbox')b = (float(xmlbox.find('xmin').text), float(xmlbox.find('xmax').text), float(xmlbox.find('ymin').text), float(xmlbox.find('ymax').text))bb = convert((w,h), b)out_file.write(str(cls_id) + " " + " ".join([str(a) for a in bb]) + '\n')in_file.close()out_file.close()wd = os.getcwd()
wd = os.getcwd()
data_base_dir = os.path.join(wd, "VOCdevkit/")
if not os.path.isdir(data_base_dir):os.mkdir(data_base_dir)
work_sapce_dir = os.path.join(data_base_dir, "VOC2007/")
if not os.path.isdir(work_sapce_dir):os.mkdir(work_sapce_dir)
annotation_dir = os.path.join(work_sapce_dir, "Annotations/")
if not os.path.isdir(annotation_dir):os.mkdir(annotation_dir)
clear_hidden_files(annotation_dir)
image_dir = os.path.join(work_sapce_dir, "JPEGImages/")
if not os.path.isdir(image_dir):os.mkdir(image_dir)
clear_hidden_files(image_dir)
yolo_labels_dir = os.path.join(work_sapce_dir, "YOLOLabels/")
if not os.path.isdir(yolo_labels_dir):os.mkdir(yolo_labels_dir)
clear_hidden_files(yolo_labels_dir)
yolov5_images_dir = os.path.join(data_base_dir, "images/")
if not os.path.isdir(yolov5_images_dir):os.mkdir(yolov5_images_dir)
clear_hidden_files(yolov5_images_dir)
yolov5_labels_dir = os.path.join(data_base_dir, "labels/")
if not os.path.isdir(yolov5_labels_dir):os.mkdir(yolov5_labels_dir)
clear_hidden_files(yolov5_labels_dir)
yolov5_images_train_dir = os.path.join(yolov5_images_dir, "train/")
if not os.path.isdir(yolov5_images_train_dir):os.mkdir(yolov5_images_train_dir)
clear_hidden_files(yolov5_images_train_dir)
yolov5_images_test_dir = os.path.join(yolov5_images_dir, "val/")
if not os.path.isdir(yolov5_images_test_dir):os.mkdir(yolov5_images_test_dir)
clear_hidden_files(yolov5_images_test_dir)
yolov5_labels_train_dir = os.path.join(yolov5_labels_dir, "train/")
if not os.path.isdir(yolov5_labels_train_dir):os.mkdir(yolov5_labels_train_dir)
clear_hidden_files(yolov5_labels_train_dir)
yolov5_labels_test_dir = os.path.join(yolov5_labels_dir, "val/")
if not os.path.isdir(yolov5_labels_test_dir):os.mkdir(yolov5_labels_test_dir)
clear_hidden_files(yolov5_labels_test_dir)train_file = open(os.path.join(wd, "yolov5_train.txt"), 'w')
test_file = open(os.path.join(wd, "yolov5_val.txt"), 'w')
train_file.close()
test_file.close()
train_file = open(os.path.join(wd, "yolov5_train.txt"), 'a')
test_file = open(os.path.join(wd, "yolov5_val.txt"), 'a')
list_imgs = os.listdir(image_dir) # list image files
probo = random.randint(1, 100)
print("Probobility: %d" % probo)
for i in range(0,len(list_imgs)):path = os.path.join(image_dir,list_imgs[i])if os.path.isfile(path):image_path = image_dir + list_imgs[i]voc_path = list_imgs[i](nameWithoutExtention, extention) = os.path.splitext(os.path.basename(image_path))(voc_nameWithoutExtention, voc_extention) = os.path.splitext(os.path.basename(voc_path))annotation_name = nameWithoutExtention + '.xml'annotation_path = os.path.join(annotation_dir, annotation_name)label_name = nameWithoutExtention + '.txt'label_path = os.path.join(yolo_labels_dir, label_name)probo = random.randint(1, 100)print("Probobility: %d" % probo)if(probo < 80): # train datasetif os.path.exists(annotation_path):train_file.write(image_path + '\n')convert_annotation(nameWithoutExtention) # convert labelcopyfile(image_path, yolov5_images_train_dir + voc_path)copyfile(label_path, yolov5_labels_train_dir + label_name)else: # test datasetif os.path.exists(annotation_path):test_file.write(image_path + '\n')convert_annotation(nameWithoutExtention) # convert labelcopyfile(image_path, yolov5_images_test_dir + voc_path)copyfile(label_path, yolov5_labels_test_dir + label_name)
train_file.close()
test_file.close()

关键就在于如何将1000类的信息写到代码里面的列表中去。。。。

实现代码

import codecs
import ospath = 'D:/code/yolov8-pytorch-master/voc_classes.txt'  # 类别文件路径
newpath = 'D:/code/yolov8-pytorch-master/voc_classList.txt'  # 生成类别列表#   ["n1507514100","n150751410","n15075142","n15075141"]  DEMO# 使用with open打开文件,这样不用调用close()方法来关闭文件了
with open(path, 'r') as f:# readlines()方法,读取文件中所有行,每一行作为一个字符串存入在列表中,并且换行符用\n来表示。content = f.readlines()#print(content)separator = '\\'
newcontent = []
for i in range(len(content)):newcontent =newcontent+[content[i].replace('\n','')]#print(content[i].split('\\',1)[0])#print(type(content[i].split('\\',1)[0]))
print(newcontent)

读写文件详解,将数据写入一个文件或读一个文件写入另一个文件中

在 中如何删除指定字符之前或之后的所有内容

去除字符串最后的换行符‘\n’

得到代码

import xml.etree.ElementTree as ET
import pickle
import os
from os import listdir, getcwd
from os.path import join
import random
from shutil import copyfile# 根据自己的数据标签修改
classes=['n01440764', 'n01443537', 'n01484850', 'n01491361', 'n01494475', 'n01496331', 'n01498041', 'n01514668', 'n01514859', 'n01518878', 'n01530575', 'n01531178', 'n01532829', 'n01534433', 'n01537544', 'n01558993', 'n01560419', 'n01580077', 'n01582220', 'n01592084', 'n01601694', 'n01608432', 'n01614925', 'n01616318', 'n01622779', 'n01629819', 'n01630670', 'n01631663', 'n01632458', 'n01632777', 'n01641577', 'n01644373', 'n01644900', 'n01664065', 'n01665541', 'n01667114', 'n01667778', 'n01669191', 'n01675722', 'n01677366', 'n01682714', 'n01685808', 'n01687978', 'n01688243', 'n01689811', 'n01692333', 'n01693334', 'n01694178', 'n01695060', 'n01697457', 'n01698640', 'n01704323', 'n01728572', 'n01728920', 'n01729322', 'n01729977', 'n01734418', 'n01735189', 'n01737021', 'n01739381', 'n01740131', 'n01742172', 'n01744401', 'n01748264', 'n01749939', 'n01751748', 'n01753488', 'n01755581', 'n01756291', 'n01768244', 'n01770081', 'n01770393', 'n01773157', 'n01773549', 'n01773797', 'n01774384', 'n01774750', 'n01775062', 'n01776313', 'n01784675', 'n01795545', 'n01796340', 'n01797886', 'n01798484', 'n01806143', 'n01806567', 'n01807496', 'n01817953', 'n01818515', 'n01819313', 'n01820546', 'n01824575', 'n01828970', 'n01829413', 'n01833805', 'n01843065', 'n01843383', 'n01847000', 'n01855032', 'n01855672', 'n01860187', 'n01871265', 'n01872401', 'n01873310', 'n01877812', 'n01882714', 'n01883070', 'n01910747', 'n01914609', 'n01917289', 'n01924916', 'n01930112', 'n01943899', 'n01944390', 'n01945685', 'n01950731', 'n01955084', 'n01968897', 'n01978287', 'n01978455', 'n01980166', 'n01981276', 'n01983481', 'n01984695', 'n01985128', 'n01986214', 'n01990800', 'n02002556', 'n02002724', 'n02006656', 'n02007558', 'n02009229', 'n02009912', 'n02011460', 'n02012849', 'n02013706', 'n02017213', 'n02018207', 'n02018795', 'n02025239', 'n02027492', 'n02028035', 'n02033041', 'n02037110', 'n02051845', 'n02056570', 'n02058221', 'n02066245', 'n02071294', 'n02074367', 'n02077923', 'n02085620', 'n02085782', 'n02085936', 'n02086079', 'n02086240', 'n02086646', 'n02086910', 'n02087046', 'n02087394', 'n02088094', 'n02088238', 'n02088364', 'n02088466', 'n02088632', 'n02089078', 'n02089867', 'n02089973', 'n02090379', 'n02090622', 'n02090721', 'n02091032', 'n02091134', 'n02091244', 'n02091467', 'n02091635', 'n02091831', 'n02092002', 'n02092339', 'n02093256', 'n02093428', 'n02093647', 'n02093754', 'n02093859', 'n02093991', 'n02094114', 'n02094258', 'n02094433', 'n02095314', 'n02095570', 'n02095889', 'n02096051', 'n02096177', 'n02096294', 'n02096437', 'n02096585', 'n02097047', 'n02097130', 'n02097209', 'n02097298', 'n02097474', 'n02097658', 'n02098105', 'n02098286', 'n02098413', 'n02099267', 'n02099429', 'n02099601', 'n02099712', 'n02099849', 'n02100236', 'n02100583', 'n02100735', 'n02100877', 'n02101006', 'n02101388', 'n02101556', 'n02102040', 'n02102177', 'n02102318', 'n02102480', 'n02102973', 'n02104029', 'n02104365', 'n02105056', 'n02105162', 'n02105251', 'n02105412', 'n02105505', 'n02105641', 'n02105855', 'n02106030', 'n02106166', 'n02106382', 'n02106550', 'n02106662', 'n02107142', 'n02107312', 'n02107574', 'n02107683', 'n02107908', 'n02108000', 'n02108089', 'n02108422', 'n02108551', 'n02108915', 'n02109047', 'n02109525', 'n02109961', 'n02110063', 'n02110185', 'n02110341', 'n02110627', 'n02110806', 'n02110958', 'n02111129', 'n02111277', 'n02111500', 'n02111889', 'n02112018', 'n02112137', 'n02112350', 'n02112706', 'n02113023', 'n02113186', 'n02113624', 'n02113712', 'n02113799', 'n02113978', 'n02114367', 'n02114548', 'n02114712', 'n02114855', 'n02115641', 'n02115913', 'n02116738', 'n02117135', 'n02119022', 'n02119789', 'n02120079', 'n02120505', 'n02123045', 'n02123159', 'n02123394', 'n02123597', 'n02124075', 'n02125311', 'n02127052', 'n02128385', 'n02128757', 'n02128925', 'n02129165', 'n02129604', 'n02130308', 'n02132136', 'n02133161', 'n02134084', 'n02134418', 'n02137549', 'n02138441', 'n02165105', 'n02165456', 'n02167151', 'n02168699', 'n02169497', 'n02172182', 'n02174001', 'n02177972', 'n02190166', 'n02206856', 'n02219486', 'n02226429', 'n02229544', 'n02231487', 'n02233338', 'n02236044', 'n02256656', 'n02259212', 'n02264363', 'n02268443', 'n02268853', 'n02276258', 'n02277742', 'n02279972', 'n02280649', 'n02281406', 'n02281787', 'n02317335', 'n02319095', 'n02321529', 'n02325366', 'n02326432', 'n02328150', 'n02342885', 'n02346627', 'n02356798', 'n02361337', 'n02363005', 'n02364673', 'n02389026', 'n02391049', 'n02395406', 'n02396427', 'n02397096', 'n02398521', 'n02403003', 'n02408429', 'n02410509', 'n02412080', 'n02415577', 'n02417914', 'n02422106', 'n02422699', 'n02423022', 'n02437312', 'n02437616', 'n02441942', 'n02442845', 'n02443114', 'n02443484', 'n02444819', 'n02445715', 'n02447366', 'n02454379', 'n02457408', 'n02480495', 'n02480855', 'n02481823', 'n02483362', 'n02483708', 'n02484975', 'n02486261', 'n02486410', 'n02487347', 'n02488291', 'n02488702', 'n02489166', 'n02490219', 'n02492035', 'n02492660', 'n02493509', 'n02493793', 'n02494079', 'n02497673', 'n02500267', 'n02504013', 'n02504458', 'n02509815', 'n02510455', 'n02514041', 'n02526121', 'n02536864', 'n02606052', 'n02607072', 'n02640242', 'n02641379', 'n02643566', 'n02655020', 'n02666196', 'n02667093', 'n02669723', 'n02672831', 'n02676566', 'n02687172', 'n02690373', 'n02692877', 'n02699494', 'n02701002', 'n02704792', 'n02708093', 'n02727426', 'n02730930', 'n02747177', 'n02749479', 'n02769748', 'n02776631', 'n02777292', 'n02782093', 'n02783161', 'n02786058', 'n02787622', 'n02788148', 'n02790996', 'n02791124', 'n02791270', 'n02793495', 'n02794156', 'n02795169', 'n02797295', 'n02799071', 'n02802426', 'n02804414', 'n02804610', 'n02807133', 'n02808304', 'n02808440', 'n02814533', 'n02814860', 'n02815834', 'n02817516', 'n02823428', 'n02823750', 'n02825657', 'n02834397', 'n02835271', 'n02837789', 'n02840245', 'n02841315', 'n02843684', 'n02859443', 'n02860847', 'n02865351', 'n02869837', 'n02870880', 'n02871525', 'n02877765', 'n02879718', 'n02883205', 'n02892201', 'n02892767', 'n02894605', 'n02895154', 'n02906734', 'n02909870', 'n02910353', 'n02916936', 'n02917067', 'n02927161', 'n02930766', 'n02939185', 'n02948072', 'n02950826', 'n02951358', 'n02951585', 'n02963159', 'n02965783', 'n02966193', 'n02966687', 'n02971356', 'n02974003', 'n02977058', 'n02978881', 'n02979186', 'n02980441', 'n02981792', 'n02988304', 'n02992211', 'n02992529', 'n02999410', 'n03000134', 'n03000247', 'n03000684', 'n03014705', 'n03016953', 'n03017168', 'n03018349', 'n03026506', 'n03028079', 'n03032252', 'n03041632', 'n03042490', 'n03045698', 'n03047690', 'n03062245', 'n03063599', 'n03063689', 'n03065424', 'n03075370', 'n03085013', 'n03089624', 'n03095699', 'n03100240', 'n03109150', 'n03110669', 'n03124043', 'n03124170', 'n03125729', 'n03126707', 'n03127747', 'n03127925', 'n03131574', 'n03133878', 'n03134739', 'n03141823', 'n03146219', 'n03160309', 'n03179701', 'n03180011', 'n03187595', 'n03188531', 'n03196217', 'n03197337', 'n03201208', 'n03207743', 'n03207941', 'n03208938', 'n03216828', 'n03218198', 'n03220513', 'n03223299', 'n03240683', 'n03249569', 'n03250847', 'n03255030', 'n03259280', 'n03271574', 'n03272010', 'n03272562', 'n03290653', 'n03291819', 'n03297495', 'n03314780', 'n03325584', 'n03337140', 'n03344393', 'n03345487', 'n03347037', 'n03355925', 'n03372029', 'n03376595', 'n03379051', 'n03384352', 'n03388043', 'n03388183', 'n03388549', 'n03393912', 'n03394916', 'n03400231', 'n03404251', 'n03417042', 'n03424325', 'n03425413', 'n03443371', 'n03444034', 'n03445777', 'n03445924', 'n03447447', 'n03447721', 'n03450230', 'n03452741', 'n03457902', 'n03459775', 'n03461385', 'n03467068', 'n03476684', 'n03476991', 'n03478589', 'n03481172', 'n03482405', 'n03483316', 'n03485407', 'n03485794', 'n03492542', 'n03494278', 'n03495258', 'n03496892', 'n03498962', 'n03527444', 'n03529860', 'n03530642', 'n03532672', 'n03534580', 'n03535780', 'n03538406', 'n03544143', 'n03584254', 'n03584829', 'n03590841', 'n03594734', 'n03594945', 'n03595614', 'n03598930', 'n03599486', 'n03602883', 'n03617480', 'n03623198', 'n03627232', 'n03630383', 'n03633091', 'n03637318', 'n03642806', 'n03649909', 'n03657121', 'n03658185', 'n03661043', 'n03662601', 'n03666591', 'n03670208', 'n03673027', 'n03676483', 'n03680355', 'n03690938', 'n03691459', 'n03692522', 'n03697007', 'n03706229', 'n03709823', 'n03710193', 'n03710637', 'n03710721', 'n03717622', 'n03720891', 'n03721384', 'n03724870', 'n03729826', 'n03733131', 'n03733281', 'n03733805', 'n03742115', 'n03743016', 'n03759954', 'n03761084', 'n03763968', 'n03764736', 'n03769881', 'n03770439', 'n03770679', 'n03773504', 'n03775071', 'n03775546', 'n03776460', 'n03777568', 'n03777754', 'n03781244', 'n03782006', 'n03785016', 'n03786901', 'n03787032', 'n03788195', 'n03788365', 'n03791053', 'n03792782', 'n03792972', 'n03793489', 'n03794056', 'n03796401', 'n03803284', 'n03804744', 'n03814639', 'n03814906', 'n03825788', 'n03832673', 'n03837869', 'n03838899', 'n03840681', 'n03841143', 'n03843555', 'n03854065', 'n03857828', 'n03866082', 'n03868242', 'n03868863', 'n03871628', 'n03873416', 'n03874293', 'n03874599', 'n03876231', 'n03877472', 'n03877845', 'n03884397', 'n03887697', 'n03888257', 'n03888605', 'n03891251', 'n03891332', 'n03895866', 'n03899768', 'n03902125', 'n03903868', 'n03908618', 'n03908714', 'n03916031', 'n03920288', 'n03924679', 'n03929660', 'n03929855', 'n03930313', 'n03930630', 'n03933933', 'n03935335', 'n03937543', 'n03938244', 'n03942813', 'n03944341', 'n03947888', 'n03950228', 'n03954731', 'n03956157', 'n03958227', 'n03961711', 'n03967562', 'n03970156', 'n03976467', 'n03976657', 'n03977966', 'n03980874', 'n03982430', 'n03983396', 'n03991062', 'n03992509', 'n03995372', 'n03998194', 'n04004767', 'n04005630', 'n04008634', 'n04009552', 'n04019541', 'n04023962', 'n04026417', 'n04033901', 'n04033995', 'n04037443', 'n04039381', 'n04040759', 'n04041544', 'n04044716', 'n04049303', 'n04065272', 'n04067472', 'n04069434', 'n04070727', 'n04074963', 'n04081281', 'n04086273', 'n04090263', 'n04099969', 'n04111531', 'n04116512', 'n04118538', 'n04118776', 'n04120489', 'n04125021', 'n04127249', 'n04131690', 'n04133789', 'n04136333', 'n04141076', 'n04141327', 'n04141975', 'n04146614', 'n04147183', 'n04149813', 'n04152593', 'n04153751', 'n04154565', 'n04162706', 'n04179913', 'n04192698', 'n04200800', 'n04201297', 'n04204238', 'n04204347', 'n04208210', 'n04209133', 'n04209239', 'n04228054', 'n04229816', 'n04235860', 'n04238763', 'n04239074', 'n04243546', 'n04251144', 'n04252077', 'n04252225', 'n04254120', 'n04254680', 'n04254777', 'n04258138', 'n04259630', 'n04263257', 'n04264628', 'n04265275', 'n04266014', 'n04270147', 'n04273569', 'n04275548', 'n04277352', 'n04285008', 'n04286575', 'n04296562', 'n04310018', 'n04311004', 'n04311174', 'n04317175', 'n04325704', 'n04326547', 'n04328186', 'n04330267', 'n04332243', 'n04335435', 'n04336792', 'n04344873', 'n04346328', 'n04347754', 'n04350905', 'n04355338', 'n04355933', 'n04356056', 'n04357314', 'n04366367', 'n04367480', 'n04370456', 'n04371430', 'n04371774', 'n04372370', 'n04376876', 'n04380533', 'n04389033', 'n04392985', 'n04398044', 'n04399382', 'n04404412', 'n04409515', 'n04417672', 'n04418357', 'n04423845', 'n04428191', 'n04429376', 'n04435653', 'n04442312', 'n04443257', 'n04447861', 'n04456115', 'n04458633', 'n04461696', 'n04462240', 'n04465501', 'n04467665', 'n04476259', 'n04479046', 'n04482393', 'n04483307', 'n04485082', 'n04486054', 'n04487081', 'n04487394', 'n04493381', 'n04501370', 'n04505470', 'n04507155', 'n04509417', 'n04515003', 'n04517823', 'n04522168', 'n04523525', 'n04525038', 'n04525305', 'n04532106', 'n04532670', 'n04536866', 'n04540053', 'n04542943', 'n04548280', 'n04548362', 'n04550184', 'n04552348', 'n04553703', 'n04554684', 'n04557648', 'n04560804', 'n04562935', 'n04579145', 'n04579432', 'n04584207', 'n04589890', 'n04590129', 'n04591157', 'n04591713', 'n04592741', 'n04596742', 'n04597913', 'n04599235', 'n04604644', 'n04606251', 'n04612504', 'n04613696', 'n06359193', 'n06596364', 'n06785654', 'n06794110', 'n06874185', 'n07248320', 'n07565083', 'n07579787', 'n07583066', 'n07584110', 'n07590611', 'n07613480', 'n07614500', 'n07615774', 'n07684084', 'n07693725', 'n07695742', 'n07697313', 'n07697537', 'n07711569', 'n07714571', 'n07714990', 'n07715103', 'n07716358', 'n07716906', 'n07717410', 'n07717556', 'n07718472', 'n07718747', 'n07720875', 'n07730033', 'n07734744', 'n07742313', 'n07745940', 'n07747607', 'n07749582', 'n07753113', 'n07753275', 'n07753592', 'n07754684', 'n07760859', 'n07768694', 'n07802026', 'n07831146', 'n07836838', 'n07860988', 'n07871810', 'n07873807', 'n07875152', 'n07880968', 'n07892512', 'n07920052', 'n07930864', 'n07932039', 'n09193705', 'n09229709', 'n09246464', 'n09256479', 'n09288635', 'n09332890', 'n09399592', 'n09421951', 'n09428293', 'n09468604', 'n09472597', 'n09835506', 'n10148035', 'n10565667', 'n11879895', 'n11939491', 'n12057211', 'n12144580', 'n12267677', 'n12620546', 'n12768682', 'n12985857', 'n12998815', 'n13037406', 'n13040303', 'n13044778', 'n13052670', 'n13054560', 'n13133613', 'n15075141']def clear_hidden_files(path):dir_list = os.listdir(path)for i in dir_list:abspath = os.path.join(os.path.abspath(path), i)if os.path.isfile(abspath):if i.startswith("._"):os.remove(abspath)else:clear_hidden_files(abspath)def convert(size, box):dw = 1./size[0]dh = 1./size[1]x = (box[0] + box[1])/2.0y = (box[2] + box[3])/2.0w = box[1] - box[0]h = box[3] - box[2]x = x*dww = w*dwy = y*dhh = h*dhreturn (x,y,w,h)def convert_annotation(image_id):in_file = open('VOCdevkit/VOC2007/Annotations/%s.xml' %image_id)out_file = open('VOCdevkit/VOC2007/YOLOLabels/%s.txt' %image_id, 'w')tree=ET.parse(in_file)root = tree.getroot()size = root.find('size')w = int(size.find('width').text)h = int(size.find('height').text)for obj in root.iter('object'):difficult = obj.find('difficult').textcls = obj.find('name').text#在这里完成标签中类别转换# if cls =='n15075141':#     cls = 'toilet_tissue'if cls not in classes or int(difficult) == 1:continuecls_id = classes.index(cls)xmlbox = obj.find('bndbox')b = (float(xmlbox.find('xmin').text), float(xmlbox.find('xmax').text), float(xmlbox.find('ymin').text), float(xmlbox.find('ymax').text))bb = convert((w,h), b)out_file.write(str(cls_id) + " " + " ".join([str(a) for a in bb]) + '\n')in_file.close()out_file.close()wd = os.getcwd()
wd = os.getcwd()
data_base_dir = os.path.join(wd, "VOCdevkit/")
if not os.path.isdir(data_base_dir):os.mkdir(data_base_dir)
work_sapce_dir = os.path.join(data_base_dir, "VOC2007/")
if not os.path.isdir(work_sapce_dir):os.mkdir(work_sapce_dir)
annotation_dir = os.path.join(work_sapce_dir, "Annotations/")
if not os.path.isdir(annotation_dir):os.mkdir(annotation_dir)
clear_hidden_files(annotation_dir)
image_dir = os.path.join(work_sapce_dir, "JPEGImages/")
if not os.path.isdir(image_dir):os.mkdir(image_dir)
clear_hidden_files(image_dir)
yolo_labels_dir = os.path.join(work_sapce_dir, "YOLOLabels/")
if not os.path.isdir(yolo_labels_dir):os.mkdir(yolo_labels_dir)
clear_hidden_files(yolo_labels_dir)
yolov5_images_dir = os.path.join(data_base_dir, "images/")
if not os.path.isdir(yolov5_images_dir):os.mkdir(yolov5_images_dir)
clear_hidden_files(yolov5_images_dir)
yolov5_labels_dir = os.path.join(data_base_dir, "labels/")
if not os.path.isdir(yolov5_labels_dir):os.mkdir(yolov5_labels_dir)
clear_hidden_files(yolov5_labels_dir)
yolov5_images_train_dir = os.path.join(yolov5_images_dir, "train/")
if not os.path.isdir(yolov5_images_train_dir):os.mkdir(yolov5_images_train_dir)
clear_hidden_files(yolov5_images_train_dir)
yolov5_images_test_dir = os.path.join(yolov5_images_dir, "val/")
if not os.path.isdir(yolov5_images_test_dir):os.mkdir(yolov5_images_test_dir)
clear_hidden_files(yolov5_images_test_dir)
yolov5_labels_train_dir = os.path.join(yolov5_labels_dir, "train/")
if not os.path.isdir(yolov5_labels_train_dir):os.mkdir(yolov5_labels_train_dir)
clear_hidden_files(yolov5_labels_train_dir)
yolov5_labels_test_dir = os.path.join(yolov5_labels_dir, "val/")
if not os.path.isdir(yolov5_labels_test_dir):os.mkdir(yolov5_labels_test_dir)
clear_hidden_files(yolov5_labels_test_dir)train_file = open(os.path.join(wd, "yolov8_train.txt"), 'w')
test_file = open(os.path.join(wd, "yolov8_val.txt"), 'w')
train_file.close()
test_file.close()
train_file = open(os.path.join(wd, "yolov8_train.txt"), 'a')
test_file = open(os.path.join(wd, "yolov8_val.txt"), 'a')
list_imgs = os.listdir(image_dir) # list image files
probo = random.randint(1, 100)
print("Probobility: %d" % probo)
for i in range(0,len(list_imgs)):path = os.path.join(image_dir,list_imgs[i])if os.path.isfile(path):image_path = image_dir + list_imgs[i]voc_path = list_imgs[i](nameWithoutExtention, extention) = os.path.splitext(os.path.basename(image_path))(voc_nameWithoutExtention, voc_extention) = os.path.splitext(os.path.basename(voc_path))annotation_name = nameWithoutExtention + '.xml'annotation_path = os.path.join(annotation_dir, annotation_name)label_name = nameWithoutExtention + '.txt'label_path = os.path.join(yolo_labels_dir, label_name)probo = random.randint(1, 100)print("Probobility: %d" % probo)if(probo < 80): # train datasetif os.path.exists(annotation_path):train_file.write(image_path + '\n')convert_annotation(nameWithoutExtention) # convert labelcopyfile(image_path, yolov5_images_train_dir + voc_path)copyfile(label_path, yolov5_labels_train_dir + label_name)else: # test datasetif os.path.exists(annotation_path):test_file.write(image_path + '\n')convert_annotation(nameWithoutExtention) # convert labelcopyfile(image_path, yolov5_images_test_dir + voc_path)copyfile(label_path, yolov5_labels_test_dir + label_name)
train_file.close()
test_file.close()

这样转换后,类别信息就对啦!

最后修改.yaml文件

同样也是需要修改类别信息

将1000类插入进去

代码如下

#读取所有的行数,并按列输出
SaveList = []  # 存档列表
# 读取文本内容到列表filepath = r'D:\code\yolov8-pytorch-master\voc_classes3.txt'
with open(filepath, "r", encoding='utf-8') as file:for line in file:line = line.strip('\n')  # 删除换行符SaveList.append(line)file.close()
print(SaveList)
#写入存档到文件
writhpath = r'D:\code\yolov8-pytorch-master\voc_classes4.txt'
#(按列写入)
# with open(writhpath,"w",encoding='utf-8') as file:
#     for i,j,z in zip(SaveList[0].split(), SaveList[1].split(), SaveList[2].split()):#此处修改为你自己的行数SaveList[1],或者添加行
#                 file.write(str(i)+'   '+str(j)+'   '+str(z)+'\n')
#     file.close()
#按行写入
with open(writhpath,"w+",encoding='utf-8') as file2:i = 0     #类别起始编号for line in SaveList:file2.writelines(str(i) + ': '+line+'\n')i = i+1file2.close()

日常工具搬运——逐行写入txt文件

按行读取txt文件任意行内容,并按列写入另一个txt文件中(修改行数后直接使用)

结果如下:

0: tench
1: goldfish
2: great_white_shark
3: tiger_shark
4: hammerhead
5: electric_ray
6: stingray
7: cock
8: hen
9: ostrich
10: brambling
11: goldfinch
12: house_finch
13: junco
14: indigo_bunting
15: robin
16: bulbul
17: jay
18: magpie
19: chickadee
20: water_ouzel
21: kite
22: bald_eagle
23: vulture
24: great_grey_owl
25: European_fire_salamander
26: common_newt
27: eft
28: spotted_salamander
29: axolotl
30: bullfrog
31: tree_frog
32: tailed_frog
33: loggerhead
34: leatherback_turtle
35: mud_turtle
36: terrapin
37: box_turtle
38: banded_gecko
39: common_iguana
40: American_chameleon
41: whiptail
42: agama
43: frilled_lizard
44: alligator_lizard
45: Gila_monster
46: green_lizard
47: African_chameleon
48: Komodo_dragon
49: African_crocodile
50: American_alligator
51: triceratops
52: thunder_snake
53: ringneck_snake
54: hognose_snake
55: green_snake
56: king_snake
57: garter_snake
58: water_snake
59: vine_snake
60: night_snake
61: boa_constrictor
62: rock_python
63: Indian_cobra
64: green_mamba
65: sea_snake
66: horned_viper
67: diamondback
68: sidewinder
69: trilobite
70: harvestman
71: scorpion
72: black_and_gold_garden_spider
73: barn_spider
74: garden_spider
75: black_widow
76: tarantula
77: wolf_spider
78: tick
79: centipede
80: black_grouse
81: ptarmigan
82: ruffed_grouse
83: prairie_chicken
84: peacock
85: quail
86: partridge
87: African_grey
88: macaw
89: sulphur-crested_cockatoo
90: lorikeet
91: coucal
92: bee_eater
93: hornbill
94: hummingbird
95: jacamar
96: toucan
97: drake
98: red-breasted_merganser
99: goose
100: black_swan
101: tusker
102: echidna
103: platypus
104: wallaby
105: koala
106: wombat
107: jellyfish
108: sea_anemone
109: brain_coral
110: flatworm
111: nematode
112: conch
113: snail
114: slug
115: sea_slug
116: chiton
117: chambered_nautilus
118: Dungeness_crab
119: rock_crab
120: fiddler_crab
121: king_crab
122: American_lobster
123: spiny_lobster
124: crayfish
125: hermit_crab
126: isopod
127: white_stork
128: black_stork
129: spoonbill
130: flamingo
131: little_blue_heron
132: American_egret
133: bittern
134: crane
135: limpkin
136: European_gallinule
137: American_coot
138: bustard
139: ruddy_turnstone
140: red-backed_sandpiper
141: redshank
142: dowitcher
143: oystercatcher
144: pelican
145: king_penguin
146: albatross
147: grey_whale
148: killer_whale
149: dugong
150: sea_lion
151: Chihuahua
152: Japanese_spaniel
153: Maltese_dog
154: Pekinese
155: Shih-Tzu
156: Blenheim_spaniel
157: papillon
158: toy_terrier
159: Rhodesian_ridgeback
160: Afghan_hound
161: basset
162: beagle
163: bloodhound
164: bluetick
165: black-and-tan_coonhound
166: Walker_hound
167: English_foxhound
168: redbone
169: borzoi
170: Irish_wolfhound
171: Italian_greyhound
172: whippet
173: Ibizan_hound
174: Norwegian_elkhound
175: otterhound
176: Saluki
177: Scottish_deerhound
178: Weimaraner
179: Staffordshire_bullterrier
180: American_Staffordshire_terrier
181: Bedlington_terrier
182: Border_terrier
183: Kerry_blue_terrier
184: Irish_terrier
185: Norfolk_terrier
186: Norwich_terrier
187: Yorkshire_terrier
188: wire-haired_fox_terrier
189: Lakeland_terrier
190: Sealyham_terrier
191: Airedale
192: cairn
193: Australian_terrier
194: Dandie_Dinmont
195: Boston_bull
196: miniature_schnauzer
197: giant_schnauzer
198: standard_schnauzer
199: Scotch_terrier
200: Tibetan_terrier
201: silky_terrier
202: soft-coated_wheaten_terrier
203: West_Highland_white_terrier
204: Lhasa
205: flat-coated_retriever
206: curly-coated_retriever
207: golden_retriever
208: Labrador_retriever
209: Chesapeake_Bay_retriever
210: German_short-haired_pointer
211: vizsla
212: English_setter
213: Irish_setter
214: Gordon_setter
215: Brittany_spaniel
216: clumber
217: English_springer
218: Welsh_springer_spaniel
219: cocker_spaniel
220: Sussex_spaniel
221: Irish_water_spaniel
222: kuvasz
223: schipperke
224: groenendael
225: malinois
226: briard
227: kelpie
228: komondor
229: Old_English_sheepdog
230: Shetland_sheepdog
231: collie
232: Border_collie
233: Bouvier_des_Flandres
234: Rottweiler
235: German_shepherd
236: Doberman
237: miniature_pinscher
238: Greater_Swiss_Mountain_dog
239: Bernese_mountain_dog
240: Appenzeller
241: EntleBucher
242: boxer
243: bull_mastiff
244: Tibetan_mastiff
245: French_bulldog
246: Great_Dane
247: Saint_Bernard
248: Eskimo_dog
249: malamute
250: Siberian_husky
251: dalmatian
252: affenpinscher
253: basenji
254: pug
255: Leonberg
256: Newfoundland
257: Great_Pyrenees
258: Samoyed
259: Pomeranian
260: chow
261: keeshond
262: Brabancon_griffon
263: Pembroke
264: Cardigan
265: toy_poodle
266: miniature_poodle
267: standard_poodle
268: Mexican_hairless
269: timber_wolf
270: white_wolf
271: red_wolf
272: coyote
273: dingo
274: dhole
275: African_hunting_dog
276: hyena
277: red_fox
278: kit_fox
279: Arctic_fox
280: grey_fox
281: tabby
282: tiger_cat
283: Persian_cat
284: Siamese_cat
285: Egyptian_cat
286: cougar
287: lynx
288: leopard
289: snow_leopard
290: jaguar
291: lion
292: tiger
293: cheetah
294: brown_bear
295: American_black_bear
296: ice_bear
297: sloth_bear
298: mongoose
299: meerkat
300: tiger_beetle
301: ladybug
302: ground_beetle
303: long-horned_beetle
304: leaf_beetle
305: dung_beetle
306: rhinoceros_beetle
307: weevil
308: fly
309: bee
310: ant
311: grasshopper
312: cricket
313: walking_stick
314: cockroach
315: mantis
316: cicada
317: leafhopper
318: lacewing
319: dragonfly
320: damselfly
321: admiral
322: ringlet
323: monarch
324: cabbage_butterfly
325: sulphur_butterfly
326: lycaenid
327: starfish
328: sea_urchin
329: sea_cucumber
330: wood_rabbit
331: hare
332: Angora
333: hamster
334: porcupine
335: fox_squirrel
336: marmot
337: beaver
338: guinea_pig
339: sorrel
340: zebra
341: hog
342: wild_boar
343: warthog
344: hippopotamus
345: ox
346: water_buffalo
347: bison
348: ram
349: bighorn
350: ibex
351: hartebeest
352: impala
353: gazelle
354: Arabian_camel
355: llama
356: weasel
357: mink
358: polecat
359: black-footed_ferret
360: otter
361: skunk
362: badger
363: armadillo
364: three-toed_sloth
365: orangutan
366: gorilla
367: chimpanzee
368: gibbon
369: siamang
370: guenon
371: patas
372: baboon
373: macaque
374: langur
375: colobus
376: proboscis_monkey
377: marmoset
378: capuchin
379: howler_monkey
380: titi
381: spider_monkey
382: squirrel_monkey
383: Madagascar_cat
384: indri
385: Indian_elephant
386: African_elephant
387: lesser_panda
388: giant_panda
389: barracouta
390: eel
391: coho
392: rock_beauty
393: anemone_fish
394: sturgeon
395: gar
396: lionfish
397: puffer
398: abacus
399: abaya
400: academic_gown
401: accordion
402: acoustic_guitar
403: aircraft_carrier
404: airliner
405: airship
406: altar
407: ambulance
408: amphibian
409: analog_clock
410: apiary
411: apron
412: ashcan
413: assault_rifle
414: backpack
415: bakery
416: balance_beam
417: balloon
418: ballpoint
419: Band_Aid
420: banjo
421: bannister
422: barbell
423: barber_chair
424: barbershop
425: barn
426: barometer
427: barrel
428: barrow
429: baseball
430: basketball
431: bassinet
432: bassoon
433: bathing_cap
434: bath_towel
435: bathtub
436: beach_wagon
437: beacon
438: beaker
439: bearskin
440: beer_bottle
441: beer_glass
442: bell_cote
443: bib
444: bicycle-built-for-two
445: bikini
446: binder
447: binoculars
448: birdhouse
449: boathouse
450: bobsled
451: bolo_tie
452: bonnet
453: bookcase
454: bookshop
455: bottlecap
456: bow
457: bow_tie
458: brass
459: brassiere
460: breakwater
461: breastplate
462: broom
463: bucket
464: buckle
465: bulletproof_vest
466: bullet_train
467: butcher_shop
468: cab
469: caldron
470: candle
471: cannon
472: canoe
473: can_opener
474: cardigan
475: car_mirror
476: carousel
477: carpenter’s_kit
478: carton
479: car_wheel
480: cash_machine
481: cassette
482: cassette_player
483: castle
484: catamaran
485: CD_player
486: cello
487: cellular_telephone
488: chain
489: chainlink_fence
490: chain_mail
491: chain_saw
492: chest
493: chiffonier
494: chime
495: china_cabinet
496: Christmas_stocking
497: church
498: cinema
499: cleaver
500: cliff_dwelling
501: cloak
502: clog
503: cocktail_shaker
504: coffee_mug
505: coffeepot
506: coil
507: combination_lock
508: computer_keyboard
509: confectionery
510: container_ship
511: convertible
512: corkscrew
513: cornet
514: cowboy_boot
515: cowboy_hat
516: cradle
517: crane
518: crash_helmet
519: crate
520: crib
521: Crock_Pot
522: croquet_ball
523: crutch
524: cuirass
525: dam
526: desk
527: desktop_computer
528: dial_telephone
529: diaper
530: digital_clock
531: digital_watch
532: dining_table
533: dishrag
534: dishwasher
535: disk_brake
536: dock
537: dogsled
538: dome
539: doormat
540: drilling_platform
541: drum
542: drumstick
543: dumbbell
544: Dutch_oven
545: electric_fan
546: electric_guitar
547: electric_locomotive
548: entertainment_center
549: envelope
550: espresso_maker
551: face_powder
552: feather_boa
553: file
554: fireboat
555: fire_engine
556: fire_screen
557: flagpole
558: flute
559: folding_chair
560: football_helmet
561: forklift
562: fountain
563: fountain_pen
564: four-poster
565: freight_car
566: French_horn
567: frying_pan
568: fur_coat
569: garbage_truck
570: gasmask
571: gas_pump
572: goblet
573: go-kart
574: golf_ball
575: golfcart
576: gondola
577: gong
578: gown
579: grand_piano
580: greenhouse
581: grille
582: grocery_store
583: guillotine
584: hair_slide
585: hair_spray
586: half_track
587: hammer
588: hamper
589: hand_blower
590: hand-held_computer
591: handkerchief
592: hard_disc
593: harmonica
594: harp
595: harvester
596: hatchet
597: holster
598: home_theater
599: honeycomb
600: hook
601: hoopskirt
602: horizontal_bar
603: horse_cart
604: hourglass
605: iPod
606: iron
607: jack-o’-lantern
608: jean
609: jeep
610: jersey
611: jigsaw_puzzle
612: jinrikisha
613: joystick
614: kimono
615: knee_pad
616: knot
617: lab_coat
618: ladle
619: lampshade
620: laptop
621: lawn_mower
622: lens_cap
623: letter_opener
624: library
625: lifeboat
626: lighter
627: limousine
628: liner
629: lipstick
630: Loafer
631: lotion
632: loudspeaker
633: loupe
634: lumbermill
635: magnetic_compass
636: mailbag
637: mailbox
638: maillot
639: maillot
640: manhole_cover
641: maraca
642: marimba
643: mask
644: matchstick
645: maypole
646: maze
647: measuring_cup
648: medicine_chest
649: megalith
650: microphone
651: microwave
652: military_uniform
653: milk_can
654: minibus
655: miniskirt
656: minivan
657: missile
658: mitten
659: mixing_bowl
660: mobile_home
661: Model_T
662: modem
663: monastery
664: monitor
665: moped
666: mortar
667: mortarboard
668: mosque
669: mosquito_net
670: motor_scooter
671: mountain_bike
672: mountain_tent
673: mouse
674: mousetrap
675: moving_van
676: muzzle
677: nail
678: neck_brace
679: necklace
680: nipple
681: notebook
682: obelisk
683: oboe
684: ocarina
685: odometer
686: oil_filter
687: organ
688: oscilloscope
689: overskirt
690: oxcart
691: oxygen_mask
692: packet
693: paddle
694: paddlewheel
695: padlock
696: paintbrush
697: pajama
698: palace
699: panpipe
700: paper_towel
701: parachute
702: parallel_bars
703: park_bench
704: parking_meter
705: passenger_car
706: patio
707: pay-phone
708: pedestal
709: pencil_box
710: pencil_sharpener
711: perfume
712: Petri_dish
713: photocopier
714: pick
715: pickelhaube
716: picket_fence
717: pickup
718: pier
719: piggy_bank
720: pill_bottle
721: pillow
722: ping-pong_ball
723: pinwheel
724: pirate
725: pitcher
726: plane
727: planetarium
728: plastic_bag
729: plate_rack
730: plow
731: plunger
732: Polaroid_camera
733: pole
734: police_van
735: poncho
736: pool_table
737: pop_bottle
738: pot
739: potter’s_wheel
740: power_drill
741: prayer_rug
742: printer
743: prison
744: projectile
745: projector
746: puck
747: punching_bag
748: purse
749: quill
750: quilt
751: racer
752: racket
753: radiator
754: radio
755: radio_telescope
756: rain_barrel
757: recreational_vehicle
758: reel
759: reflex_camera
760: refrigerator
761: remote_control
762: restaurant
763: revolver
764: rifle
765: rocking_chair
766: rotisserie
767: rubber_eraser
768: rugby_ball
769: rule
770: running_shoe
771: safe
772: safety_pin
773: saltshaker
774: sandal
775: sarong
776: sax
777: scabbard
778: scale
779: school_bus
780: schooner
781: scoreboard
782: screen
783: screw
784: screwdriver
785: seat_belt
786: sewing_machine
787: shield
788: shoe_shop
789: shoji
790: shopping_basket
791: shopping_cart
792: shovel
793: shower_cap
794: shower_curtain
795: ski
796: ski_mask
797: sleeping_bag
798: slide_rule
799: sliding_door
800: slot
801: snorkel
802: snowmobile
803: snowplow
804: soap_dispenser
805: soccer_ball
806: sock
807: solar_dish
808: sombrero
809: soup_bowl
810: space_bar
811: space_heater
812: space_shuttle
813: spatula
814: speedboat
815: spider_web
816: spindle
817: sports_car
818: spotlight
819: stage
820: steam_locomotive
821: steel_arch_bridge
822: steel_drum
823: stethoscope
824: stole
825: stone_wall
826: stopwatch
827: stove
828: strainer
829: streetcar
830: stretcher
831: studio_couch
832: stupa
833: submarine
834: suit
835: sundial
836: sunglass
837: sunglasses
838: sunscreen
839: suspension_bridge
840: swab
841: sweatshirt
842: swimming_trunks
843: swing
844: switch
845: syringe
846: table_lamp
847: tank
848: tape_player
849: teapot
850: teddy
851: television
852: tennis_ball
853: thatch
854: theater_curtain
855: thimble
856: thresher
857: throne
858: tile_roof
859: toaster
860: tobacco_shop
861: toilet_seat
862: torch
863: totem_pole
864: tow_truck
865: toyshop
866: tractor
867: trailer_truck
868: tray
869: trench_coat
870: tricycle
871: trimaran
872: tripod
873: triumphal_arch
874: trolleybus
875: trombone
876: tub
877: turnstile
878: typewriter_keyboard
879: umbrella
880: unicycle
881: upright
882: vacuum
883: vase
884: vault
885: velvet
886: vending_machine
887: vestment
888: viaduct
889: violin
890: volleyball
891: waffle_iron
892: wall_clock
893: wallet
894: wardrobe
895: warplane
896: washbasin
897: washer
898: water_bottle
899: water_jug
900: water_tower
901: whiskey_jug
902: whistle
903: wig
904: window_screen
905: window_shade
906: Windsor_tie
907: wine_bottle
908: wing
909: wok
910: wooden_spoon
911: wool
912: worm_fence
913: wreck
914: yawl
915: yurt
916: web_site
917: comic_book
918: crossword_puzzle
919: street_sign
920: traffic_light
921: book_jacket
922: menu
923: plate
924: guacamole
925: consomme
926: hot_pot
927: trifle
928: ice_cream
929: ice_lolly
930: French_loaf
931: bagel
932: pretzel
933: cheeseburger
934: hotdog
935: mashed_potato
936: head_cabbage
937: broccoli
938: cauliflower
939: zucchini
940: spaghetti_squash
941: acorn_squash
942: butternut_squash
943: cucumber
944: artichoke
945: bell_pepper
946: cardoon
947: mushroom
948: Granny_Smith
949: strawberry
950: orange
951: lemon
952: fig
953: pineapple
954: banana
955: jackfruit
956: custard_apple
957: pomegranate
958: hay
959: carbonara
960: chocolate_sauce
961: dough
962: meat_loaf
963: pizza
964: potpie
965: burrito
966: red_wine
967: espresso
968: cup
969: eggnog
970: alp
971: bubble
972: cliff
973: coral_reef
974: geyser
975: lakeside
976: promontory
977: sandbar
978: seashore
979: valley
980: volcano
981: ballplayer
982: groom
983: scuba_diver
984: rapeseed
985: daisy
986: yellow_lady’s_slipper
987: corn
988: acorn
989: hip
990: buckeye
991: coral_fungus
992: agaric
993: gyromitra
994: stinkhorn
995: earthstar
996: hen-of-the-woods
997: bolete
998: ear
999: toilet_tissue

整合到.yaml中(前面需要空两格)

完成

数据集介绍

数据集介绍

关于我们

最火推荐

小编推荐

联系我们


版权声明:本站内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 88@qq.com 举报,一经查实,本站将立刻删除。备案号:桂ICP备2021009421号
Powered By Z-BlogPHP.
复制成功
微信号:
我知道了