补充数据集:
1.筛选出不存在在已给labels的类别,找到对应的xml文件
# -*- coding: utf-8 -*-
"""
Created on Mon May 3 14:43:53 2021
@author: ASUS
"""
import xml.etree.ElementTree as ET
from os import getcwd
import os
import random
random.seed(0)
xmlfilepath=r'Annotations'
saveBasePath=r"ids"
map_ = []
l = []
with open("feature-5-17/labels.txt", "r") as f:
for line in f.readlines():
line = line.strip('\n') #去掉列表中每一个元素的换行符
# print(line)
l.append(line)
print(l)
#----------------------------------------------------------------------#
# 想要增加测试集修改trainval_percent
# train_percent不需要修改
#----------------------------------------------------------------------#
#trainval_percent=1
#train_percent=1
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)
#ftrain.close()
def convert_annotation(i):
in_file = open('Annotations/%s'%(i), encoding='utf-8')
tree=ET.parse(in_file)
root = tree.getroot()
# map_ = []
for obj in root.iter('object'):
id_ = obj.find('name').text
if id_ not in l:
print(i,id_)
# print(id_)
l.append(id_)
# print(id_)
map_.append(id_)
#
# return map_
#image_ids = open('ImageSets/Main/%s.txt'%(image_set)).read().strip().split()
#list_file = open('%s_%s.txt'%(year, image_set), 'w')
#for image_id in image_ids:
# list_file.write('JPEGImages/%s.jpg'%(image_id))
#mao_ = []
for i in total_xml:
convert_annotation(i)
#ans = set(mao_)
mao_ = set(map_)
print(mao_)
ftrainval = open(os.path.join(saveBasePath,'id_all.txt'), 'w+')
for i in mao_:
ftrainval.write(i + '\n')
ftrainval.close()
walk
步行
Non-motorized vehicles
非机动车行驶
Round the island
环岛行驶
Motor vehicle
机动车行驶
Keep on the right side of the road
靠右侧道路行驶
Keep on the left side of the road
靠左侧道路行驶
Drive straight and turn right at the grade separation
立体交叉直行和右转弯行驶
Drive straight and turn left
立体交叉直行和左转弯行驶
Honk
鸣喇叭
Turn right
向右转弯
Turn left and right
向左向右转弯
Turn left
向左转弯
One way, straight
直行
Go straight and turn right
直行和向右转弯
Go straight and turn left
直行和向左转弯
Minimum Speed Limit
最低限速
Minimum Speed Limit
最低限速
Minimum Speed Limit
最低限速
Minimum Speed Limit
最低限速
Minimum Speed Limit
最低限速
Minimum Speed Limit
最低限速
Minimum Speed Limit
最低限速
Pedestrian Crossing
人行横道
No Overtaking
超车
Ban animal-drawn vehicles entering
禁止畜力车进入
Ban large passenger vehicles from entering
禁止大型客车驶入
Prohibition of electric tricycles
禁止电动三轮车驶入
No U-turn
禁止掉头
Prohibition of non-motorized vehicles
禁止非机动车进入
No left turn for trucks
禁止载货汽车左转
It is forbidden to tow or trailer vehicles
禁止汽车拖、挂车驶入
Prohibit pedestrians entering
禁止行人进入
Prohibit motorized vehicles
禁止机动车驶入
Prohibit honking
禁止鸣喇叭
Two-wheeled motorcycles are prohibited
禁止二轮摩托车驶入
Prohibit certain two types of vehicles from entering
禁止某两种车驶入
Prohibition straight
禁止直行
No rickshaws are allowed
禁止人力车进入
Prohibition of human-powered cargo tricycles from entering
禁止人力货运三轮车进入
Human-powered passenger tricycles are prohibited from entering
禁止人力货运三轮车进入
Prohibition of tricycles and motor vehicles
禁止三轮车机动车通行
Prohibited right turn
禁止向右转弯
No left or right turn
禁止向左向右转弯
Prohibited right turn and straight
禁止直行和向右转弯
Prohibition of tricycles and motor vehicles
禁止三轮车机动车通行
Prohibited left turn
禁止向左转弯
Prohibition of right turning of passenger cars
禁止小客车右转
Prohibition of entry of small passenger cars
禁止小型客车驶入
Prohibit laden car into
禁止载货汽车驶入
Prohibit entry of vehicles transporting dangerous goods
禁止运输危险物品车辆驶入
Prohibited left turn and straight
禁止直行和向左转弯
Prohibit tractors from entering
进行拖拉机驶入
Limit axle load
限制轴重
Limit axle load
限制轴重
Limit axle load
限制轴重
Limit axle load
限制轴重
Limit axle load
限制轴重
No thoroughfare
禁止通行
Parking inspection
停车检查
customs
海关
Give Way to Oncoming Vehicles
会车让行
Slow down and give way
减速让行
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit height
限制高度
Limit speed
限制速度
Limit speed
限制速度
Limit speed
限制速度
Limit speed
限制速度
Limit speed
限制速度
Limit speed
限制速度
Limit weight
限制质量
Limit weight
限制质量
Limit weight
限制质量
Limit weight
限制质量
Limit weight
限制质量
Limit weight
限制质量
Limit weight
限制质量
Limit weight
限制质量
No parking
禁止停车
No Entry
禁止驶入
No long-term parking
禁止长时停车
Speed restrictions lifted
解除限制速度
Speed restrictions lifted
解除限制速度
Speed restrictions lifted
解除限制速度
Speed restrictions lifted
解除限制速度
Speed restrictions lifted
解除限制速度
Speed restrictions lifted
解除限制速度
Speed restrictions lifted
解除限制速度
Speed restrictions lifted
解除限制速度
Speed restrictions lifted
解除限制速度
Park to give way
停车让行
Limit width
限制宽度
Limit width
限制宽度
Limit width
限制宽度
Limit width
限制宽度
Limit width
限制宽度
Limit width
限制宽度
Limit width
限制宽度
Limit width
限制宽度
Dangerous road near the mountain
傍山险路
Dangerous road near the mountain
傍山险路
Village
村庄
Embankment road
堤坝路
Embankment road
堤坝路
T-shaped plane crossing
丁字平面交叉
Ferry
渡口
Narrow on both sides
两侧变窄
Watch out for falling rocks
注意落石
Reverse detour
反向弯路
Reverse detour
反向弯路
Manshuiqiao
漫水桥
Crossroads
十字交叉路口
Crossroads
十字交叉路口
Y-shaped intersection
Y形交叉路口
Y-shaped intersection
Y形交叉路口
Road Narrows on Left
左侧变窄
Y-shaped intersection
Y形交叉路口
T intersection
T形交叉路口
T intersection
T形交叉路口
T intersection
T形交叉路口
Roundabout
环形交叉路口
Continuous detour
连续弯路
slopes
连续下坡
uneven road
路面不平
Watch out for rain (snow) days
注意雨(雪)天
Low-lying road
路面低洼
High road surface
路面高突
stroll
慢行
Up a steep slope
上陡坡
Construction
施工
Cross plane
十字平面交叉
Accident-prone road
事故易发路段
Two-way traffic
双向交通
Watch out for wild animals
注意野生动物
Tunnel
隧道
Tunnel driving lights
隧道开车灯
Hump bridge
驼峰桥
Unguarded railway crossing
无人看守铁路道口
Down steep slope
下陡坡
Sharp detour
急弯路
Sharp detour
急弯路
Slippery
易滑
Watch out for semaphores
注意信号灯
Someone guards the railway crossing
有人看守铁路道口
Narrowing on the right
右侧变窄
Detour right
右侧绕行
Narrow on both sides
两侧变窄
Pay attention to keeping the distance between cars
注意保持车距
Pay attention to adverse weather conditions
注意不利气象条件
Pay attention to the disabled
注意残疾人
Watch out for tidal lanes
注意潮汐车道
Pay attention to foggy days
注意雾天
Pay attention to children
注意儿童
Pay attention to non-motorized vehicles
注意非机动车
Pay attention to pedestrians
注意行人
Pay attention to confluence
注意合流
Pay attention to confluence
注意合流
crosswinds
注意横风
Watch out for icing on the road
注意路面结冰
Watch out for falling rocks
注意落石
Drive With Caution
注意危险
Pay attention to livestock
注意牲畜
Detour on the left
左侧绕行
Left and right detour
左右绕行
Pay attention to the queues of vehicles ahead
注意前方车辆排队
io:其他指示标志 Other signs
wo:其他警告标志 Other warning signs
po:其他禁止标志 Other prohibition signs