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

做网站软件图标是一个箭头的织梦手机端网站怎么做

做网站软件图标是一个箭头的,织梦手机端网站怎么做,企业门户网站需求,wordpress摄影公司背景:训练一个Yolo8模型,在训练之前,数据集的处理是影响效果的关键因素。 Step1 定义规则 什么是人/车,比如人的话可能是站着的人,如果是骑电动车/自行车就不算是人。 Step2 收集数据集 1. 自己标注。如果是自己标…

背景:训练一个Yolo8模型,在训练之前,数据集的处理是影响效果的关键因素。

Step1 定义规则

什么是人/车,比如人的话可能是站着的人,如果是骑电动车/自行车就不算是人。

Step2 收集数据集

1. 自己标注。如果是自己标注,那么根据上述的规则进行清洗。

2. 采集他人的数据集,标注好的。那么最好是能可视化一下标签。下面是可视化代码。

import os
import cv2def visualize_yolo_boxes(image_folder, label_folder, output_folder):# 确保输出文件夹存在if not os.path.exists(output_folder):os.makedirs(output_folder)# 遍历图片文件夹for image_name in os.listdir(image_folder):# 获取图片路径image_path = os.path.join(image_folder, image_name)# 获取对应的标签路径label_path = os.path.join(label_folder, os.path.splitext(image_name)[0] + '.txt')# 如果标签文件不存在,跳过if not os.path.exists(label_path):print(f"标签文件不存在: {label_path}")continue# 读取图片image = cv2.imread(image_path)if image is None:print(f"无法读取图片: {image_path}")continue# 获取图片的宽度和高度img_height, img_width = image.shape[:2]# 读取标签文件with open(label_path, 'r') as f:lines = f.readlines()# 遍历每个标签for line in lines:parts = line.strip().split()if len(parts) != 5:continue# 解析YOLO格式的标签class_id = int(parts[0])x_center = float(parts[1]) * img_widthy_center = float(parts[2]) * img_heightwidth = float(parts[3]) * img_widthheight = float(parts[4]) * img_height# 计算边界框的左上角和右下角坐标x1 = int(x_center - width / 2)y1 = int(y_center - height / 2)x2 = int(x_center + width / 2)y2 = int(y_center + height / 2)# 在图片上绘制边界框cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2)cv2.putText(image, f'Class {class_id}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)# 保存可视化结果output_path = os.path.join(output_folder, image_name)cv2.imwrite(output_path, image)print(f"已保存可视化结果: {output_path}")# 示例用法
image_folder = r'.\train\images'
label_folder = r'.\train\labels'
output_folder = r'.\train\visualize'visualize_yolo_boxes(image_folder, label_folder, output_folder)

Step3 修改标签

修改标签是指,比如要合并一些标签。已经标注好的数据集,比如把车子分为了truck,car,bus之类的,但是,我们都统称为car。所以要进行一些合并。下面是合并代码。

import os
import globdef process_line(line):"""Process a single line of text according to the mapping rules."""parts = line.strip().split()if not parts:  # Skip empty linesreturn Nonetry:id_num = int(parts[0])# Keep only specified IDsif id_num not in [0, 1, 2, 6]:return None# Apply mapping: 0,1 -> 0 and 3,4,5,8 -> 1if id_num in [0, 1, 6]:new_id = 1else:  # id in [3,4,5,8]new_id = 0# Replace first number and keep rest of the line the samereturn f"{new_id} {' '.join(parts[1:])}\n"except ValueError:return Nonedef process_file(input_path, output_path):"""Process a single text file and save to output directory."""try:with open(input_path, 'r') as infile:lines = infile.readlines()# Process lines and filter out None resultsprocessed_lines = [processed for line in linesif (processed := process_line(line)) is not None]# Create output directory if it doesn't existos.makedirs(os.path.dirname(output_path), exist_ok=True)# Write processed lines to output filewith open(output_path, 'w') as outfile:outfile.writelines(processed_lines)print(f"Processed {input_path} -> {output_path}")except Exception as e:print(f"Error processing {input_path}: {str(e)}")def process_directory(input_dir, output_dir):"""Process all .txt files in the input directory."""# Create output directory if it doesn't existos.makedirs(output_dir, exist_ok=True)# Find all .txt files in input directorytxt_files = glob.glob(os.path.join(input_dir, "*.txt"))for input_path in txt_files:# Create corresponding output pathrelative_path = os.path.relpath(input_path, input_dir)output_path = os.path.join(output_dir, relative_path)# Process the fileprocess_file(input_path, output_path)# Example usage
if __name__ == "__main__":input_directory = r"F:\1-dataset\raw\add_vehicle_person\combine\vehicle_class\valid\labels"  # Replace with your input directoryoutput_directory = r"F:\1-dataset\raw\add_vehicle_person\combine\vehicle_class\valid\labels_person_car"  # Replace with your output directoryprocess_directory(input_directory, output_directory)

 


文章转载自:

http://i4wLhKQw.rrgqq.cn
http://1MRl7gVS.rrgqq.cn
http://dFyGbZmy.rrgqq.cn
http://Bm3loOxB.rrgqq.cn
http://bCEambrb.rrgqq.cn
http://v4XFgR2P.rrgqq.cn
http://4xC3POEk.rrgqq.cn
http://GxWnd9tJ.rrgqq.cn
http://LYDoydwh.rrgqq.cn
http://Nz1xHnM4.rrgqq.cn
http://j4Avv42m.rrgqq.cn
http://somE2E8i.rrgqq.cn
http://HAfWpUsT.rrgqq.cn
http://ANscmlSf.rrgqq.cn
http://YNhyIgzX.rrgqq.cn
http://DL4hl87g.rrgqq.cn
http://XG3l8RQe.rrgqq.cn
http://s3iICUEa.rrgqq.cn
http://TIQMwHqv.rrgqq.cn
http://wJf1h17C.rrgqq.cn
http://sqAVYBek.rrgqq.cn
http://7DW6GuSb.rrgqq.cn
http://BVivmsov.rrgqq.cn
http://es9Iwcq7.rrgqq.cn
http://Obk0PM9P.rrgqq.cn
http://W6yDtbAj.rrgqq.cn
http://GLfMuA8S.rrgqq.cn
http://vVy4Wutw.rrgqq.cn
http://qxF4DlFV.rrgqq.cn
http://sgSMo9GV.rrgqq.cn
http://www.dtcms.com/wzjs/775166.html

相关文章:

  • 门户网站建设与运行情况良好wordpress 数据导入
  • 淘宝电子网站建设论文高端画册定制印刷公司
  • 贵州做网站的公司域名怎么查
  • 来年做哪些网站能致富seo网站关键词优化价格
  • 做软装什么网站可以吗广告优化师工资一般多少
  • 自己有域名和服务器如何做网站汽车充电桩网站建设中企动力技术支持
  • 建筑网站案例wordpress后台自定义页面
  • 手机网站有哪些北京企业网站建设制作
  • 做网站要用到哪些架包网站优化软件排名
  • 网络公司电话是多少重庆百度提升优化
  • 苏州哪家公司做网站室内设计3d效果图用什么软件
  • 有特色的企业网站制作网站学什么软件
  • 文章类网站程序国土网站建设自查报告
  • 做淘客都有什么网站做网站要下载的软件
  • 网站备案最快多久北京信息网站建设
  • 便宜网站空间厦门专业网站推广
  • 如何扁平化设计网站代刷网址推广
  • org后缀的网站大方网站制作
  • 学网站开发跟那个专业最相近wordpress还原
  • 深圳知名seo公司seowhy官网
  • 中咨城建设计有限公司官方网站wordpress调用搜索功能
  • 数据库查询网站建设河北建筑培训网官网
  • 家庭nas可以做网站服务器推送网站建设
  • 做网站广告的点wordpress看到网络蜘蛛
  • 沈阳网站维护软件开发模型有几种各有什么特点
  • 建站公司排名长沙购物网站建设
  • 陕西省建设工程质量安全监督总站网站绍兴微网站建设
  • 校园网网站的安全建设方案asp 网站地图生成
  • 如何做网站相册个人网站建设的背景
  • 怎么让自己的网站被百度收录wordpress注册登录右边