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

社交网站制作怎样提高网站的权重

社交网站制作,怎样提高网站的权重,惠州网站建设公司哪家好,吉林网站建设吉林在对数据或特征的处理中#xff0c;为了避免输入图像或特征#xff0c;经过resize等等操作#xff0c;改变了目标特征的尺度信息#xff0c;一般会引入一些操作#xff0c;比如#xff1a; 在特征维度#xff0c;加入SPP#xff08;空间金字塔池化#xff09;#x…在对数据或特征的处理中为了避免输入图像或特征经过resize等等操作改变了目标特征的尺度信息一般会引入一些操作比如 在特征维度加入SPP空间金字塔池化这样不同大小的输入图像经过该层的处理输出大小都保持了一致在输入图像阶段也可以先采用pad的操作补齐输入图像避免变形 本文就是借鉴yolo系列对输入图像前处理的一个操作对不同大小的图像先经过长边等比例resize后pad到一样大小的尺寸。 具体的操作代码如下 import cv2 import numpy as np import matplotlib.pyplot as plt import xml.etree.ElementTree as ETdef parse_xml(path):tree ET.parse(path)root tree.findall(object)class_list []boxes_list []for sub in root:xmin float(sub.find(bndbox).find(xmin).text)xmax float(sub.find(bndbox).find(xmax).text)ymin float(sub.find(bndbox).find(ymin).text)ymax float(sub.find(bndbox).find(ymax).text)boxes_list.append([xmin, ymin, xmax, ymax])class_list.append(sub.find(name).text)return class_list, np.array(boxes_list).astype(np.int32)def letterbox(img, new_shape(640, 640), color(114, 114, 114), autoTrue, scaleFillFalse, scaleupTrue, stride32):用于将输入的图像进行长边resize和填充以满足一定的约束条件。函数的输入参数包括im输入的图像可以是任意尺寸和通道数的numpy数组。new_shape目标尺寸可以是一个整数或一个元组。如果是一个整数则表示将图像resize成一个正方形如果是一个元组则表示将图像resize成指定的宽度和高度。color填充颜色可以是一个整数或一个元组。如果是一个整数则表示使用灰度值为该整数的像素进行填充如果是一个元组则表示使用RGB颜色值进行填充。auto是否启用自动计算填充大小。如果为True则会根据指定的stride值计算最小的填充大小以满足长宽比和stride倍数的约束条件如果为False则会根据指定的scaleFill和scaleup参数计算填充大小。scaleFill是否启用拉伸填充。如果为True则会拉伸图像以填满目标尺寸如果为False则会根据指定的scaleup参数决定是否缩放图像。scaleup是否允许放大图像。如果为True则允许将输入图像放大到目标尺寸如果为False则只能将输入图像缩小到目标尺寸。stridestride值用于计算最小填充大小。# Resize image to a 32-pixel-multiple rectangle https://github.com/ultralytics/yolov3/issues/232shape img.shape[:2] # current shape [height, width]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]) # 短边ratioif not scaleup: # only scale down, do not scale up (for better test 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 auto: # minimum rectangledw, dh np.mod(dw, 64), np.mod(dh, 64) # wh paddingelif 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 ratiosdw / 2 # divide padding into 2 sidesdh / 2if shape[::-1] ! new_unpad: # resizeimg cv2.resize(img, new_unpad, interpolationcv2.INTER_LINEAR)top, bottom int(round(dh - 0.1)), int(round(dh 0.1))left, right int(round(dw - 0.1)), int(round(dw 0.1))img cv2.copyMakeBorder(img, top, bottom, left, right, cv2.BORDER_CONSTANT, valuecolor) # add borderreturn img, ratio, (dw, dh)def main(imgPath, drawBox_flag True):xmlPath imgPath[:-3] xmlprint(xmlPath, imgPath)img cv2.imread(imgPath)labels, boxes parse_xml(xmlPath)print(labels, boxes)img2, ratio, pad letterbox(img.copy(), new_shape(512, 512), autoFalse, scaleupTrue)sample1 img.copy() # origin imagesample2 img2.copy() # after letterbox imageprint(sample1.shape, sample2.shape)if drawBox_flag:new_boxes np.zeros_like(boxes)new_boxes[:, 0] ratio[0] * boxes[:, 0] pad[0] # pad widthnew_boxes[:, 1] ratio[1] * boxes[:, 1] pad[1] # pad heightnew_boxes[:, 2] ratio[0] * boxes[:, 2] pad[0]new_boxes[:, 3] ratio[1] * boxes[:, 3] pad[1]print(new_boxes)for box in boxes:cv2.rectangle(sample1, (box[0], box[1]), (box[2], box[3]), (255, 0, 0), 1)for box_n in new_boxes:cv2.rectangle(sample2, (box_n[0], box_n[1]), (box_n[2], box_n[3]), (0, 255, 0), 1)plt.subplot(121)plt.imshow(sample1)plt.subplot(122)plt.imshow(sample2)plt.show()# cv2.imwrite(rF:\labelImg\1.jpg, sample1)# cv2.imwrite(rF:\labelImg\2.jpg, sample2)if __name__ __main__:imgPath rF:\labelImg\catDog.jpgmain(imgPath, drawBox_flagTrue)展示结果如下 上面图像的尺寸比较的大超过了512大小。而低于小于512大小的图像是如何的呢 scaleup是否允许放大图像。 如果为True则允许将输入图像放大到目标尺寸如果为False则只能将输入图像缩小到目标尺寸。 当scaleupFalse时如下可以发现原始图像并没有被放大而是直接pad操作了。这是因为为scaleupFalse时只能将输入图像缩小到目标尺寸无法先放大操作 而当scaleupTrue时如下就发现他是先放大然后再进行pad操作 可以发现 scaleup设定为False时候只会对大于new shape的图像进行缩放pad当为True时就不在only scale down, do not scale up了适用的范围更广。注释里面说是为了better test mAP。
http://www.hkea.cn/news/14314144/

相关文章:

  • 找建筑类工作哪个网站好电销系统多少钱一套
  • 商城网站项目策划书二级网站建设要求
  • 长春网站建设索q479185700免费咨询律师电话12345
  • 网站的用户体验主要有那些类型discuz建站教程
  • seo软件安卓版张家港网站设计优化
  • 长沙市制作网站模板网站 优帮云
  • seo批量建站方法建网站买什么主机
  • 代表网站开发的logo网站建设合同报价
  • 天猫网站什么时候建设网站导航字体
  • 网站建设的收获公司简介模板怎么做
  • 重庆网站的建设成都网站设计公
  • 网站项目开发流程有哪七步脱贫地区农副产品网络销售平台
  • 网站建设期间怎么关闭网站给公司创建网站
  • 南京百度seo公司梧州网站优化价格
  • 网站管理工具优化什么建立生育支持
  • 专业网站制作网站公司企业网站实名认证怎么做
  • 高端网站定制商用图片做公司网站可以吗
  • 素材网站哪个值得买公司建设电商型网站的作用
  • 网站开发研发合同网站开发制作阶段的说课稿
  • 企业网站策划案怎么写广州抖音seo
  • 闸北网站优化公司阿里云域名空间网站建设
  • 网页的网站建设在哪里腾讯云服务器可以退款吗
  • 音乐网站禁止做浅度链接学习网站后台维护
  • 贵阳有哪些可以制作网站的公司吗登陆建设银行wap网站
  • 网站怎样做链接网络营销是什么时候提出的
  • 建设银行网站登录没反应ui设计师是吃青春饭吗
  • 建设动漫网站的目的顺德建设网站公司
  • 室内设计软件免费下载新乡seo顾问
  • wordpress 哪些网站吗那个网站可以做攻略
  • jQuery EasyUI网站开发实战网站开发应注意哪些问题