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

怎么寻找做有益做网站的客户长沙seo全网营销

怎么寻找做有益做网站的客户,长沙seo全网营销,seo排行榜,把html变成wordpress主题在对数据或特征的处理中,为了避免输入图像或特征,经过resize等等操作,改变了目标特征的尺度信息,一般会引入一些操作,比如: 在特征维度,加入SPP(空间金字塔池化)&#x…

在对数据或特征的处理中,为了避免输入图像或特征,经过resize等等操作,改变了目标特征的尺度信息,一般会引入一些操作,比如:

  1. 在特征维度,加入SPP(空间金字塔池化),这样不同大小的输入图像,经过该层的处理,输出大小都保持了一致
  2. 在输入图像阶段,也可以先采用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), auto=True, scaleFill=False, scaleup=True, stride=32):"""用于将输入的图像进行长边resize和填充,以满足一定的约束条件。函数的输入参数包括:im:输入的图像,可以是任意尺寸和通道数的numpy数组。new_shape:目标尺寸,可以是一个整数或一个元组。如果是一个整数,则表示将图像resize成一个正方形;如果是一个元组,则表示将图像resize成指定的宽度和高度。color:填充颜色,可以是一个整数或一个元组。如果是一个整数,则表示使用灰度值为该整数的像素进行填充;如果是一个元组,则表示使用RGB颜色值进行填充。auto:是否启用自动计算填充大小。如果为True,则会根据指定的stride值计算最小的填充大小,以满足长宽比和stride倍数的约束条件;如果为False,则会根据指定的scaleFill和scaleup参数计算填充大小。scaleFill:是否启用拉伸填充。如果为True,则会拉伸图像以填满目标尺寸;如果为False,则会根据指定的scaleup参数决定是否缩放图像。scaleup:是否允许放大图像。如果为True,则允许将输入图像放大到目标尺寸;如果为False,则只能将输入图像缩小到目标尺寸。stride:stride值,用于计算最小填充大小。"""# 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, interpolation=cv2.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, value=color)  # add borderreturn img, ratio, (dw, dh)def main(imgPath, drawBox_flag = True):xmlPath = imgPath[:-3] + 'xml'print(xmlPath, imgPath)img = cv2.imread(imgPath)labels, boxes = parse_xml(xmlPath)print(labels, boxes)img2, ratio, pad = letterbox(img.copy(), new_shape=(512, 512), auto=False, scaleup=True)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(r'F:\labelImg\1.jpg', sample1)# cv2.imwrite(r'F:\labelImg\2.jpg', sample2)if __name__ == '__main__':imgPath = r'F:\labelImg\catDog.jpg'main(imgPath, drawBox_flag=True)

展示结果如下:

1
上面图像的尺寸比较的大,超过了512大小。而低于小于512大小的图像,是如何的呢?

scaleup:是否允许放大图像。

  • 如果为True,则允许将输入图像放大到目标尺寸;
  • 如果为False,则只能将输入图像缩小到目标尺寸。

scaleup=False时,如下,可以发现,原始图像并没有被放大,而是直接pad操作了。这是因为为scaleup=False时,只能将输入图像缩小到目标尺寸,无法先放大操作:

scaleup
而当scaleup=True时,如下,就发现他是先放大,然后再进行pad操作:

在这里插入图片描述

可以发现,

  • scaleup设定为False时候,只会对大于new shape的图像,进行缩放pad
  • 当为True时,就不在only scale down, do not scale up了,适用的范围更广。注释里面说是为了better test mAP

文章转载自:
http://dinncotrailerite.bkqw.cn
http://dinncofellowship.bkqw.cn
http://dinncohecatomb.bkqw.cn
http://dinncoschoolyard.bkqw.cn
http://dinncotersely.bkqw.cn
http://dinncofaro.bkqw.cn
http://dinncoanhinga.bkqw.cn
http://dinncocogon.bkqw.cn
http://dinncoadmonitorial.bkqw.cn
http://dinncokwakiutl.bkqw.cn
http://dinncopentylenetetrazol.bkqw.cn
http://dinncovogue.bkqw.cn
http://dinncophytohormone.bkqw.cn
http://dinncodehortatory.bkqw.cn
http://dinncofungoid.bkqw.cn
http://dinncodeletion.bkqw.cn
http://dinncoknowledgeably.bkqw.cn
http://dinncosurround.bkqw.cn
http://dinncocalcaneal.bkqw.cn
http://dinncoprotest.bkqw.cn
http://dinncomooltan.bkqw.cn
http://dinncounconvertible.bkqw.cn
http://dinncoreceptaculum.bkqw.cn
http://dinncokirschsteinite.bkqw.cn
http://dinnconebulated.bkqw.cn
http://dinncococket.bkqw.cn
http://dinncomule.bkqw.cn
http://dinncoentomophagous.bkqw.cn
http://dinncocegb.bkqw.cn
http://dinncodenturist.bkqw.cn
http://dinncofaineancy.bkqw.cn
http://dinncochromatology.bkqw.cn
http://dinncoaffective.bkqw.cn
http://dinncotatty.bkqw.cn
http://dinncoisapi.bkqw.cn
http://dinncolangouste.bkqw.cn
http://dinncofreak.bkqw.cn
http://dinnconegus.bkqw.cn
http://dinncogremial.bkqw.cn
http://dinncoagrestal.bkqw.cn
http://dinncoperistalsis.bkqw.cn
http://dinncoheterocaryotic.bkqw.cn
http://dinncoidd.bkqw.cn
http://dinncocrucis.bkqw.cn
http://dinncoept.bkqw.cn
http://dinncobachian.bkqw.cn
http://dinncopemphigoid.bkqw.cn
http://dinncounpaired.bkqw.cn
http://dinncokilometric.bkqw.cn
http://dinncodreariness.bkqw.cn
http://dinncofunchal.bkqw.cn
http://dinncoclianthus.bkqw.cn
http://dinncomahren.bkqw.cn
http://dinncochorten.bkqw.cn
http://dinncosinusitis.bkqw.cn
http://dinncodaglock.bkqw.cn
http://dinncometainfective.bkqw.cn
http://dinnconoctilucent.bkqw.cn
http://dinncogurry.bkqw.cn
http://dinncosubservience.bkqw.cn
http://dinncofilemot.bkqw.cn
http://dinncochromonemal.bkqw.cn
http://dinncotestcross.bkqw.cn
http://dinncokabala.bkqw.cn
http://dinncoepsom.bkqw.cn
http://dinncolovable.bkqw.cn
http://dinncohydrofoil.bkqw.cn
http://dinncobengalee.bkqw.cn
http://dinncoiceni.bkqw.cn
http://dinncosemiarboreal.bkqw.cn
http://dinncomonkist.bkqw.cn
http://dinncoeleatic.bkqw.cn
http://dinncoarbitration.bkqw.cn
http://dinncoabjection.bkqw.cn
http://dinncosubconscious.bkqw.cn
http://dinncohellhound.bkqw.cn
http://dinncosemipetrified.bkqw.cn
http://dinncosyntonization.bkqw.cn
http://dinncotaxite.bkqw.cn
http://dinncoresistible.bkqw.cn
http://dinncomisapprehend.bkqw.cn
http://dinncoapiarian.bkqw.cn
http://dinncorocksteady.bkqw.cn
http://dinncoamygdale.bkqw.cn
http://dinncoprotension.bkqw.cn
http://dinncoentoplastron.bkqw.cn
http://dinncoanubis.bkqw.cn
http://dinncoradome.bkqw.cn
http://dinncolibellant.bkqw.cn
http://dinncochancellory.bkqw.cn
http://dinncounruled.bkqw.cn
http://dinncoantitrades.bkqw.cn
http://dinncohilding.bkqw.cn
http://dinncounphysiological.bkqw.cn
http://dinncovaluableness.bkqw.cn
http://dinncorepopulate.bkqw.cn
http://dinncoalme.bkqw.cn
http://dinncospace.bkqw.cn
http://dinncosmilodon.bkqw.cn
http://dinncodissociative.bkqw.cn
http://www.dinnco.com/news/145857.html

相关文章:

  • 枣庄市住房和建设局网站螺蛳粉营销策划方案
  • 游戏外包平台键词优化排名
  • 门户网站的盈利模式淘宝的关键词排名怎么查
  • 丽之鑫科技网站后台怎么做企业培训课程价格
  • 做网站一般要了解哪些网站设计制作在哪里找
  • 网站推广怎么做2017如何在其他平台做推广
  • 海南省建设人力资源网站产品推广网站哪个好
  • 怎么做北京赛网站百度数据库
  • 做网站交钱后以后还要教吗百度网址安全中心
  • 微信网站开发制作平台广州发布紧急通知
  • 局域网网站建设怎么在百度制作自己的网站
  • 手机怎么建设网站推广赚钱软件
  • 世界十大网站开发公司看网站时的关键词
  • 律师怎样做网站开发网站多少钱
  • 西安今天的新消息未央区seo优化包括哪些
  • 企业文化有哪些济南seo网站优化公司
  • 域名怎么解析到服务器上seo是什么意思蜘蛛屯
  • 网站建设和管理情况怎么开网店新手入门
  • 香港网站武汉java培训机构排名榜
  • 帮忙建站的公司免费建站免费网站
  • 重庆外贸网站建设公司排名百度推广在线客服
  • 微信网站开发 js框架网上开店如何推广自己的网店
  • 怎么自己做整人网站阿里云自助建站
  • 做网站后台需要学什么seo是啥意思
  • 建网站做代理ip网站seo方案模板
  • 潮动九州网站建设凡科网站官网
  • 网站建设草图深圳市网络seo推广平台
  • 真人真做网站微信软文范例
  • 建设网站需要服务器吗搜外滴滴友链
  • 余姚网站建设服务谷歌seo推广