资源简介
1-keras_get_xml_LocationAndName_to_cropPic.py
说明:此程序解析xml文件,得到xmin xmax ymin ymax和name,将数据集中的特定位置的图片crop下,保存到固定文件夹下,同类目标放到同类目录下。
代码片段和文件信息
import xml.dom.minidom
import os
import cv2
################
FindPath = ‘D:\\kinect_xml_all\\‘ #D:\\Annotations-old I:\\xml
FileNames = os.listdir(FindPath)
pic_path = ‘D:\\kinect_pic_all\\‘
save_path_pic = ‘I:\\pic_244_244\\‘
Resnet_height = 224
Rsenet_width = 224
start_name = 0
one_location_list = []
all_location_list = []
all_name_list = []
def get_all_location(now_box_root):
for box_i in range(len(now_box_root)):
location_xmin = now_box[box_i].getElementsByTagName(‘xmin‘)
location_xmax = now_box[box_i].getElementsByTagName(‘xmax‘)
location_ymin = now_box[box_i].getElementsByTagName(‘ymin‘)
location_ymax = now_box[box_i].getElementsByTagName(‘ymax‘)
location_xmin = location_xmin[0].firstChild.data
locatio
- 上一篇:DLA-cluster.py
- 下一篇:Prometheus企业级监控平台.pptx
评论
共有 条评论