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

顺德建设行政主管部门网站小俊哥网站建设

顺德建设行政主管部门网站,小俊哥网站建设,wordpress超简洁主题,国外可以做自媒体的网站1. LetterBox增强 当输入图片的尺寸和模型实际接收的尺寸可能不一致时,通常需要使用LetterBox增强技术。具体步骤是先将图片按比例缩放,将较长的边缩放到设定的尺寸以后,再将较短的边进行填充,最终短边的长度为stride的倍数即可。…

1. LetterBox增强

当输入图片的尺寸和模型实际接收的尺寸可能不一致时,通常需要使用LetterBox增强技术。具体步骤是先将图片按比例缩放,将较长的边缩放到设定的尺寸以后,再将较短的边进行填充,最终短边的长度为stride的倍数即可。这种方法可以保留原始图像的纵横比,同时还可以使图像更加适合目标检测算法的输入。
在YOLOv8代码中,ultralytics/data/augment.pyclass LetterBox类别实现了该功能。

import cv2
import numpy as npclass LetterBox:"""Resize image and padding for detection, instance segmentation, pose."""def __init__(self, new_shape=(640, 640), auto=False, scaleFill=False, scaleup=True, center=True, stride=32):"""Initialize LetterBox object with specific parameters."""self.new_shape = new_shapeself.auto = autoself.scaleFill = scaleFillself.scaleup = scaleupself.stride = strideself.center = center  # Put the image in the middle or top-leftdef __call__(self, labels=None, image=None):"""Return updated labels and image with added border."""if labels is None:labels = {}img = labels.get("img") if image is None else imageshape = img.shape[:2]  # current shape [height, width]new_shape = labels.pop("rect_shape", self.new_shape)if isinstance(new_shape, int):new_shape = (new_shape, new_shape)# Scale ratio (new / old)r = min(new_shape[0] / shape[0], new_shape[1] / shape[1])if not self.scaleup:  # only scale down, do not scale up (for better val mAP)r = min(r, 1.0)# Compute paddingratio = r, r  # width, height ratiosnew_unpad = int(round(shape[1] * r)), int(round(shape[0] * r))dw, dh = new_shape[1] - new_unpad[0], new_shape[0] - new_unpad[1]  # wh paddingif self.auto:  # minimum rectangledw, dh = np.mod(dw, self.stride), np.mod(dh, self.stride)  # wh paddingelif self.scaleFill:  # stretchdw, dh = 0.0, 0.0new_unpad = (new_shape[1], new_shape[0])ratio = new_shape[1] / shape[1], new_shape[0] / shape[0]  # width, height ratiosif self.center:dw /= 2  # divide padding into 2 sidesdh /= 2if shape[::-1] != new_unpad:  # resizeimg = cv2.resize(img, new_unpad, interpolation=cv2.INTER_LINEAR)top, bottom = int(round(dh - 0.1)) if self.center else 0, int(round(dh + 0.1))left, right = int(round(dw - 0.1)) if self.center else 0, int(round(dw + 0.1))img = cv2.copyMakeBorder(img, top, bottom, left, right, cv2.BORDER_CONSTANT, value=(114, 114, 114))  # add borderif labels.get("ratio_pad"):labels["ratio_pad"] = (labels["ratio_pad"], (left, top))  # for evaluationif len(labels):labels = self._update_labels(labels, ratio, dw, dh)labels["img"] = imglabels["resized_shape"] = new_shapereturn labelselse:return imgnew_shape=(640, 640)
aug = LetterBox(new_shape,center=True)labels=None
img = cv2.imread("./2.png",-1)lettered_img = aug(labels,img)cv2.imshow('v8 letter_box',lettered_img)
cv2.waitKey(0)

center=True
在这里插入图片描述

center=False
在这里插入图片描述

2 Mosaic增强

3 Mixup增强

http://www.yayakq.cn/news/544241/

相关文章:

  • 中文域名解析网站wordpress为静态页面
  • 网站建设工程设计图深圳网页设计兴田德润放心
  • 淘宝网站的建设内容正规网站有哪些
  • 建筑公司网站作用湖北省建设安全管理协会网站
  • 佛山专业做网站公司有哪些wordpress浏览图片失败
  • 网站空间流量wordpress 手机端打开速度慢
  • 梧州网页设计师招聘怎么优化网站关键词排名
  • 万维网包括哪些网站网站 蓝色
  • 上海市住房和城乡建设管理局网站做外贸没有网站可以吗
  • 怀化市网站建设怎么做可以访问网站连接加密
  • 绍兴网站建设网站有哪些企业公司
  • 电子商务网站建设实验心得排名seo软件
  • 二手车网站模版网站集约化建设进度报告
  • 上海营销型网站建站网站后台开发步骤
  • 有阿里空间怎么做网站帮人做网站的推广
  • 网站模板怎么做的网站建设与策划试卷
  • 无锡网站建设原则名片设计模板
  • wordpress会员制网站win10搭建wordpress
  • 网站建设开发设计营销公司山东wordpress侧边栏
  • 一个空间怎么做两个网站中煤第一建设公司网站
  • 做的好的响应式网站有哪些手机网址导航主页哪个好
  • 东莞手机网站价格便宜昆明百度推广开户
  • 购物商场网站开发过程详细说明怎么样制作自己的网站
  • 送给做网站的锦旗语用wordpress写公司官网
  • 公司开发设计推荐上海seo顾问推推蛙
  • 沧州建设厅官方网站郑州专业网站建设搭建公司
  • wordpress 慢长治seo顾问
  • 自建网站百度成都网站建设 四川冠辰科技
  • 网站开发的工具建立网站第一步怎么做
  • 芜湖市建设办网站专做网页的网站