当前位置: 首页 > news >正文

济南手机网站直播平台网站建设

济南手机网站,直播平台网站建设,无区域公司怎么注册,wordpress采集文章【工业机器视觉】基于深度学习的仪表盘识读#xff08;2#xff09;-CSDN博客 数据标注 标注扩展 Labelme 和 LabelImg 都是用于创建机器学习和计算机视觉项目所需标注数据的工具。它们都允许用户通过图形界面手动标注图像#xff0c;但各自有其特点和适用场景。 Labelme…【工业机器视觉】基于深度学习的仪表盘识读2-CSDN博客 数据标注 标注扩展 Labelme 和 LabelImg 都是用于创建机器学习和计算机视觉项目所需标注数据的工具。它们都允许用户通过图形界面手动标注图像但各自有其特点和适用场景。 Labelme 开发语言Python标注类型Labelme 支持多种标注类型包括但不限于多边形polygon、矩形rectangle、线段line、点point等。它非常适合需要精确标注物体边界的情况比如在医疗影像、自动驾驶等领域。文件格式标注结果通常保存为 JSON 文件其中包含每个标注对象的坐标信息、标签名称等。灵活性Labelme 提供了插件系统可以扩展其功能如支持更多的图像格式或添加自定义的标注类型。跨平台基于 Python 的 Qt 库构建可以在 Windows、macOS 和 Linux 上运行。 LabelImg 开发语言Python标注类型主要支持矩形框bounding box标注适合于目标检测任务。对于需要简单快速地对多个对象进行框选标注的任务来说非常方便。文件格式标注结果可以保存为 Pascal VOC XML 格式或者 YOLO txt 格式这两种格式都是目标检测任务中常用的标注文件格式。轻量化相比于 LabelmeLabelImg 更加轻量化易于安装和使用尤其适合初学者。跨平台同样基于 Python 的 Qt 库可以在不同操作系统上运行。 安装扩展包 pip install labelme labelimg 指针区域 使用labelimg进行BOX标注标签类别{area_p, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9}p0~p9为最低位x0.001标签类别area_p为其他高位指针区域标签类别。 示例 标签文件是VOC XML文件数据后面再通过脚本转换成YOLO格式数据。 梅花针分割 使用labelme进行实例切割标签类别{pointer, circle_area}pointer是红色梅花针区域circel_area是刻度圆。 示例 标签文件是JSON格式文件数据后面再通过脚本转换成YOLO格式数据。 字轮区域 使用labelimg进行BOX标注标签类别{d0, d1, d2, d3, d4, d5, d6, d7, d8, d9,  d10, d11, d12, d13, d14, d15, d16, d17, d18, d19}d0~9表示数字刚好在字轮窗口中心位置也就是非过渡状态d10~19表示各个数字的过渡状态。 示例 标签文件是VOC XML文件数据后面再通过脚本转换成YOLO格式数据。 数据划分 在深度学习中训练集和验证集是用于模型开发过程中的两个重要数据集。它们各自扮演着不同的角色确保最终模型的性能和泛化能力。 训练集Training Set 用途训练集主要用于训练模型。即在这个数据集上调整模型的权重或参数使模型能够学习到数据中的特征和模式。特点通常包含大量带标签的数据样本这些数据样本应该尽可能地代表实际应用环境中的数据分布。影响如果训练集的质量不高如数据量不足、标注不准确或偏差可能会导致模型过拟合或欠拟合从而影响其性能。 验证集Validation Set 用途验证集用于在训练过程中评估模型的表现帮助选择模型的最佳配置例如超参数调优。它提供了一个独立于训练集的反馈机制用以监测模型是否开始过拟合训练数据。特点与训练集类似验证集也应该是有代表性的并且它的标签也是已知的。但是它不应该被用来直接更新模型参数相反它是用来决定何时停止训练早停法或选择最佳模型架构/超参数。影响通过验证集可以有效防止过拟合确保模型不仅在训练数据上表现良好而且在未见过的数据上也能保持良好的性能。 注意事项 划分比例常见的是将数据划分为70%训练集和30%验证集或者采用交叉验证的方法来更充分利用有限的数据。具体的比例可以根据实际情况调整。测试集除了训练集和验证集之外有时还会有一个测试集Test Set用于最终评估模型的真实性能。测试集在整个训练和验证过程中都应该保持完全独立直到最后评估时才使用。 正确管理和使用训练集和验证集对于构建一个有效的深度学习模型至关重要。这有助于确保模型不仅能很好地适应训练数据还能对新数据做出准确预测。 数据划分代码 import argparse import os import random from os import getcwd# root getcwd() \\my_datas\\pointer-seg\\ root getcwd() \\my_datas\\detect-pointer\\ # root getcwd() \\my_datas\\detect-digit\\ parser argparse.ArgumentParser()parser.add_argument(--img_path, defaultIMAGES, typestr,helpinput images file path) parser.add_argument(--txt_path, defaultTXT_LABELS, typestr,helpoutput txt label path) opt parser.parse_args()trainval_percent 1.0 train_percent 0.9 imgfilepath root opt.img_path txtsavepath root opt.txt_path total_img os.listdir(imgfilepath) if not os.path.exists(txtsavepath):os.makedirs(txtsavepath)num len(total_img) list_index range(num) tv int(num * trainval_percent) tr int(tv * train_percent) trainval random.sample(list_index, tv) train random.sample(trainval, tr)try:os.remove(txtsavepath /trainval.txt)os.remove(txtsavepath /train.txt)os.remove(txtsavepath /valid.txt) except:pass file_trainval open(txtsavepath /trainval.txt, w) file_train open(txtsavepath /train.txt, w) file_val open(txtsavepath /valid.txt, w)for i in list_index:name total_img[i] \nif i in trainval:file_trainval.write(imgfilepath / name)if i in train:file_train.write(imgfilepath / name)else:file_val.write(imgfilepath / name)file_trainval.close() file_train.close() file_val.close()IMAGES为所有需要学习的数据图片目录  数据转换 VOC XML 转 YOLO import os import shutil import xml.etree.ElementTree as ET from tqdm import tqdmsets [train, valid] project_name detect-pointer classes [area_p, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9] # project_name detect-digit # classes [d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, # d10, d11, d12, d13, d14, d15, d16, d17, d18, d19]abs_path os.getcwd()def convert(size, box):dw 1. / (size[0])dh 1. / (size[1])x (box[0] box[1]) / 2.0 - 1y (box[2] box[3]) / 2.0 - 1w box[1] - box[0]h box[3] - box[2]x x * dww w * dwy y * dhh h * dhreturn x, y, w, hdef convert_annotation(image_id, image_set):in_file open(rmy_datas\%s\ANNOTATIONS\%s.xml % (project_name, image_id), encodingUTF-8)out_file open(rmy_datas\%s\%s\labels\%s.txt % (project_name, image_set, 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))b1, b2, b3, b4 b# 标注越界修正if b2 w:b2 wif b4 h:b4 hb (b1, b2, b3, b4)bb convert((w, h), b)out_file.write(str(cls_id) .join([str(a) for a in bb]) \n)# 删除文件夹中所有文件 def del_all_file(path):for root, dirs, files in os.walk(path):for f in files:os.remove(os.path.join(root, f))del_all_file(fmy_datas\\{project_name}\\train\images) print(train\images delete success.) del_all_file(fmy_datas\\{project_name}\\train\labels) print(train\labels delete success.) del_all_file(fmy_datas\\{project_name}\\valid\images) print(valid\images delete success.) del_all_file(fmy_datas\\{project_name}\\valid\labels) print(valid\labels delete success.)for image_set in sets:image_files open(rmy_datas\%s\TXT_LABELS\%s.txt % (project_name, image_set)).read().strip().split()for image_file in tqdm(image_files):image_id os.path.basename(image_file)[:-4]convert_annotation(image_id, image_set)shutil.copyfile(image_file, rmy_datas\%s\%s\images\%s % (project_name,image_set, os.path.basename(image_file)))JSON 转 YOLO import json import os import shutil from tqdm import tqdmimport numpy as npproject_name pointer-seg sets [train, valid] classes [pointer, circle_area] abs_path os.getcwd()def convert(size, box):dw 1. / (size[0])dh 1. / (size[1])x (box[0] box[1]) / 2.0 - 1y (box[2] box[3]) / 2.0 - 1w box[1] - box[0]h box[3] - box[2]x x * dww w * dwy y * dhh h * dhreturn x, y, w, hdef pointer_distance(x1, y1, x2, y2):dis np.sqrt((x2 - x1) ** 2 (y2 - y1) ** 2)return disdef json_to_yolo(path):with open(path, encodingUTF-8) as f:labelme_data json.load(f)width labelme_data[imageWidth]height labelme_data[imageHeight]yolo_lines []for shape in labelme_data[shapes]:if shape[shape_type] polygon:# 多边形label shape[label]points shape[points]class_idx classes.index(label)txt_string f{class_idx} for x, y in points:x / widthy / heighttxt_string f{x} {y} yolo_lines.append(txt_string.strip() \n)elif shape[shape_type] circle:# 圆label shape[label]points shape[points]class_idx classes.index(label)txt_string f{class_idx} # 圆心a, b points[0]# 计算半径r pointer_distance(a, b, points[1][0], points[1][1])# 生成一些在圆上的点X np.linspace(a - r, a r - 1, 15)f lambda x: np.sqrt(r ** 2 - (x - a) ** 2) by1 f(X)y2 2 * b - y1c_points []for i, x in enumerate(X):c_points.append([x, y1[i]])c_points.append([x, y2[i]])for x, y in c_points:x / widthy / heighttxt_string f{x} {y} yolo_lines.append(txt_string.strip() \n)return yolo_linesdef convert_annotation(image_id, image_set):lines json_to_yolo(rmy_datas\%s\ANNOTATIONS\%s.json % (project_name, image_id))with open(rmy_datas\%s\%s\labels\%s.txt % (project_name, image_set, image_id), w) as out_file:out_file.writelines(lines)def del_all_file(path):for root, dirs, files in os.walk(path):for f in files:os.remove(os.path.join(root, f))del_all_file(fmy_datas\\{project_name}\\train\images) print(train\images delete success.) del_all_file(fmy_datas\\{project_name}\\train\labels) print(train\labels delete success.) del_all_file(fmy_datas\\{project_name}\\valid\images) print(valid\images delete success.) del_all_file(fmy_datas\\{project_name}\\valid\labels) print(valid\labels delete success.)for image_set in sets:image_files open(rmy_datas\%s\TXT_LABELS\%s.txt % (project_name, image_set)).read().strip().split()for image_file in tqdm(image_files):image_id os.path.basename(image_file)[:-4]convert_annotation(image_id, image_set)shutil.copyfile(image_file, rmy_datas\%s\%s\images\%s % (project_name,image_set, os.path.basename(image_file)))完整目录结构 至此用于深度学习所需的所有训练、验证数据已准备好下一篇开始基于Utralytics YOLO系列进行训练和预测。 【工业机器视觉】基于深度学习的仪表盘识读(读数识别)4-CSDN博客
文章转载自:
http://www.morning.trzmb.cn.gov.cn.trzmb.cn
http://www.morning.wjqbr.cn.gov.cn.wjqbr.cn
http://www.morning.hxbps.cn.gov.cn.hxbps.cn
http://www.morning.krrjb.cn.gov.cn.krrjb.cn
http://www.morning.rjnm.cn.gov.cn.rjnm.cn
http://www.morning.lflsq.cn.gov.cn.lflsq.cn
http://www.morning.cfocyfa.cn.gov.cn.cfocyfa.cn
http://www.morning.mqss.cn.gov.cn.mqss.cn
http://www.morning.xhgxd.cn.gov.cn.xhgxd.cn
http://www.morning.tgxrm.cn.gov.cn.tgxrm.cn
http://www.morning.rfzbm.cn.gov.cn.rfzbm.cn
http://www.morning.hpcpp.cn.gov.cn.hpcpp.cn
http://www.morning.ygwyt.cn.gov.cn.ygwyt.cn
http://www.morning.ggrzk.cn.gov.cn.ggrzk.cn
http://www.morning.grynb.cn.gov.cn.grynb.cn
http://www.morning.flxgx.cn.gov.cn.flxgx.cn
http://www.morning.lxjxl.cn.gov.cn.lxjxl.cn
http://www.morning.qyfqx.cn.gov.cn.qyfqx.cn
http://www.morning.lfgql.cn.gov.cn.lfgql.cn
http://www.morning.ltspm.cn.gov.cn.ltspm.cn
http://www.morning.wlxfj.cn.gov.cn.wlxfj.cn
http://www.morning.cpnlq.cn.gov.cn.cpnlq.cn
http://www.morning.tntqr.cn.gov.cn.tntqr.cn
http://www.morning.bwhcl.cn.gov.cn.bwhcl.cn
http://www.morning.jfqpc.cn.gov.cn.jfqpc.cn
http://www.morning.ykmg.cn.gov.cn.ykmg.cn
http://www.morning.kybpj.cn.gov.cn.kybpj.cn
http://www.morning.tblbr.cn.gov.cn.tblbr.cn
http://www.morning.ryxgk.cn.gov.cn.ryxgk.cn
http://www.morning.snlxb.cn.gov.cn.snlxb.cn
http://www.morning.qkxnw.cn.gov.cn.qkxnw.cn
http://www.morning.qwgct.cn.gov.cn.qwgct.cn
http://www.morning.nqxdg.cn.gov.cn.nqxdg.cn
http://www.morning.hmqmm.cn.gov.cn.hmqmm.cn
http://www.morning.pfbx.cn.gov.cn.pfbx.cn
http://www.morning.wknj.cn.gov.cn.wknj.cn
http://www.morning.wqbfd.cn.gov.cn.wqbfd.cn
http://www.morning.rfxw.cn.gov.cn.rfxw.cn
http://www.morning.cnhgc.cn.gov.cn.cnhgc.cn
http://www.morning.kqhlm.cn.gov.cn.kqhlm.cn
http://www.morning.pwwjs.cn.gov.cn.pwwjs.cn
http://www.morning.fqsxf.cn.gov.cn.fqsxf.cn
http://www.morning.fkflc.cn.gov.cn.fkflc.cn
http://www.morning.ydxwj.cn.gov.cn.ydxwj.cn
http://www.morning.skmpj.cn.gov.cn.skmpj.cn
http://www.morning.rwfj.cn.gov.cn.rwfj.cn
http://www.morning.c7510.cn.gov.cn.c7510.cn
http://www.morning.bpmmq.cn.gov.cn.bpmmq.cn
http://www.morning.nkddq.cn.gov.cn.nkddq.cn
http://www.morning.jqkjr.cn.gov.cn.jqkjr.cn
http://www.morning.clpdm.cn.gov.cn.clpdm.cn
http://www.morning.qnrpj.cn.gov.cn.qnrpj.cn
http://www.morning.ymhjb.cn.gov.cn.ymhjb.cn
http://www.morning.lwjlj.cn.gov.cn.lwjlj.cn
http://www.morning.egmux.cn.gov.cn.egmux.cn
http://www.morning.zrlms.cn.gov.cn.zrlms.cn
http://www.morning.rjmg.cn.gov.cn.rjmg.cn
http://www.morning.krxzl.cn.gov.cn.krxzl.cn
http://www.morning.bnlch.cn.gov.cn.bnlch.cn
http://www.morning.jcxzq.cn.gov.cn.jcxzq.cn
http://www.morning.wtcd.cn.gov.cn.wtcd.cn
http://www.morning.drggr.cn.gov.cn.drggr.cn
http://www.morning.xxwl1.com.gov.cn.xxwl1.com
http://www.morning.ghwtn.cn.gov.cn.ghwtn.cn
http://www.morning.glnfn.cn.gov.cn.glnfn.cn
http://www.morning.mstbbs.com.gov.cn.mstbbs.com
http://www.morning.jtybl.cn.gov.cn.jtybl.cn
http://www.morning.lnmby.cn.gov.cn.lnmby.cn
http://www.morning.dwmtk.cn.gov.cn.dwmtk.cn
http://www.morning.hbtarq.com.gov.cn.hbtarq.com
http://www.morning.qichetc.com.gov.cn.qichetc.com
http://www.morning.rqhn.cn.gov.cn.rqhn.cn
http://www.morning.mmqng.cn.gov.cn.mmqng.cn
http://www.morning.ljxps.cn.gov.cn.ljxps.cn
http://www.morning.lhwlp.cn.gov.cn.lhwlp.cn
http://www.morning.ctfh.cn.gov.cn.ctfh.cn
http://www.morning.jkpnm.cn.gov.cn.jkpnm.cn
http://www.morning.hkcjx.cn.gov.cn.hkcjx.cn
http://www.morning.knlgk.cn.gov.cn.knlgk.cn
http://www.morning.wyjpt.cn.gov.cn.wyjpt.cn
http://www.tj-hxxt.cn/news/244666.html

相关文章:

  • ip设计网站微信朋友圈推广方案
  • 上海模板建站软件腾讯视频创作平台
  • 手机电脑网站设计网站增加关键词
  • 网站建设与管理自考试题及答案比较好的网站建设平台
  • 东莞是什么网站建设展览公司
  • 购物网站建设源码福建省建设执业注册中心网站
  • 百度推广必须做手机网站吗网站开发毕业设计任务书范文
  • 烟台免费网站建站模板网站双线主机优势
  • 帮客户做网站的公司武穴建设网站
  • 网站建设 主机选择专业做淘宝网站推广
  • 中国纪检监察网站首页找网站推广
  • 域名备案网站建设方案书网站备案贵州电话
  • 餐饮网站欣赏影楼后期修图培训学校
  • 东莞网站设计建设阳东区网络问政平台
  • 网站资料要提供哪些成都建设网页公司
  • 上海网站排名优化怎么做网站建设与维护实训
  • 招聘网站哪个平台比较好免费申请qq邮箱
  • 建立网站需要什么硬件爱尚网站建设
  • 网站设计模板旅游景点11页唐河永琚建筑公司网站
  • 手机建网站免费域名空间wordpress 笑话站
  • 哪个地方旅游网站做的比较好怎么用h5做网站
  • 做什爱网站wordpress数据库改主机
  • 会计信息网站建设的意思wordpress流主题
  • 网站建设淘宝工信部网站备案查询官网
  • 免费浏览的网站北京网页设计公司兴田德润团队
  • 怎么确定网站关键词免费网站建设能做吗
  • 上海服装网站建设网站开发的硬件环境要求
  • 三五互联网站网站开发与应用 大作业作业
  • 怎样做网站背景花都建设局网站
  • 广州市专业网站建设html5手机网站开发教程