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

网站关于我们怎么做单页面模板怎么用手机创建网站

网站关于我们怎么做单页面模板,怎么用手机创建网站,wordpress 怎么改url,网站开发提供的服务最近在医美和工业两条线来回穿梭,甚是疲倦,一会儿搞搞医美的人像美容,一会儿搞搞工业的检测,最近新接的一个项目,关于瑕疵检测的,目标图像也并不是很大吧,需要放大后,才能看见细小的…

        最近在医美和工业两条线来回穿梭,甚是疲倦,一会儿搞搞医美的人像美容,一会儿搞搞工业的检测,最近新接的一个项目,关于瑕疵检测的,目标图像也并不是很大吧,需要放大后,才能看见细小的瑕疵目标。有两种,一种是912*5000的图,一种是1024*2048的图,但是深度学习训练的时候,对图像的大小有一定的限制,比方说我的电脑配置可能就只能最大跑1024*1024大小的图像,否则就出现内存溢出,无法进行训练,对于这种912*5000的图就比较不好训练,如果把它强制转化成912*912大小的话,细小的目标可能会丢失。所以只能对其进行裁剪,如何裁剪,裁剪的多大,这样根据你自己的图像情况去设置,比方说你的图像是有一些冗余信息的,可以考虑裁剪的时候把空白区域裁剪出去,反正具体问题具体分析吧。具体最后瑕疵检测我用的哪个模型,这里就不赘述了,这里主要是想总结一些图像裁剪的方法,代码实现,以供大家参考使用。

 方法1、

std::vector<std::vector<int64_t>> compute_steps_for_sliding_window(std::vector<int64_t> image_size, std::vector<int64_t> tile_size, double tile_step_size)
{std::vector<double> target_step_sizes_in_voxels(tile_size.size());for (int i = 0; i < tile_size.size(); ++i)target_step_sizes_in_voxels[i] = tile_size[i] * tile_step_size;std::vector<int64_t> num_steps(tile_size.size());for (size_t i = 0; i < image_size.size(); ++i)num_steps[i] = static_cast<int64_t>(std::ceil((image_size[i] - tile_size[i]) / target_step_sizes_in_voxels[i])) + 1;std::vector<std::vector<int64_t>> steps;for (int dim = 0; dim < tile_size.size(); ++dim) {int64_t max_step_value = image_size[dim] - tile_size[dim];double actual_step_size;if (num_steps[dim] > 1)actual_step_size = static_cast<double>(max_step_value) / (num_steps[dim] - 1);elseactual_step_size = 99999999999;std::vector<int64_t> steps_here(num_steps[dim]);for (size_t i = 0; i < num_steps[dim]; ++i)steps_here[i] = static_cast<int64_t>(std::round(actual_step_size * i));steps.push_back(steps_here);}return steps;
}

 方法2:

std::vector<cv::Mat> splitImageIntoBlocks(const cv::Mat& image, int blockSize) {std::vector<cv::Mat> blocks;int rows = image.rows / blockSize;int cols = image.cols / blockSize;for (int i = 0; i < rows; ++i) {for (int j = 0; j < cols; ++j) {cv::Rect roi(j * blockSize, i * blockSize, blockSize, blockSize);cv::Mat block = image(roi).clone();blocks.push_back(block);}}return blocks;
}

方法3:

int divideImage(const cv::Mat& img, int blockWidth,int blockHeight,std::vector<cv::Mat>& blocks){// init image dimensionsint imgWidth = img.cols;int imgHeight = img.rows;std::cout << "IMAGE SIZE: " << "(" << imgWidth << "," << imgHeight << ")" << std::endl;// init block dimensionsint bwSize;int bhSize;int y0 = 0;while (y0 < imgHeight){// compute the block heightbhSize = ((y0 + blockHeight) > imgHeight) * (blockHeight - (y0 + blockHeight - imgHeight)) + ((y0 + blockHeight) <= imgHeight) * blockHeight;int x0 = 0;while (x0 < imgWidth){// compute the block heightbwSize = ((x0 + blockWidth) > imgWidth) * (blockWidth - (x0 + blockWidth - imgWidth)) + ((x0 + blockWidth) <= imgWidth) * blockWidth;// crop blockblocks.push_back(img(cv::Rect(x0, y0, bwSize, bhSize)).clone());// update x-coordinatex0 = x0 + blockWidth;}// update y-coordinatey0 = y0 + blockHeight;}return 0;
}

代码细节就不在描述了哈,自己理解吧,上面是c++的实现,下面写一个python实现的也比较简单,直接利用滑动框的库SAHI,只要pip这个库,调用这个库里的滑动框函数就可以了实现了。

代码如下 :

# arrange an instance segmentation model for test
from sahi import AutoDetectionModel
import time
import cv2
from sahi.utils.cv import read_image
from sahi.utils.file import download_from_url
from sahi.predict import get_prediction, get_sliced_prediction, predict
from IPython.display import Image
model_path = 'runs/train/exp/weights/best.pt'
detection_model = AutoDetectionModel.from_pretrained(model_type='xxx',model_path=model_path,confidence_threshold=0.3,device="cuda:0", # or 'cuda:0'
)
image_name="anormal.jpg"
currentTime = time.time()
result = get_sliced_prediction("test/"+image_name,detection_model,slice_height = 640,slice_width = 640,overlap_height_ratio = 0.2,overlap_width_ratio = 0.2
)
result.export_visuals(export_dir="test/",file_name="output_"+image_name)#图像保存,output_anormal.jpg
endTime = time.time()
print("时间差:", endTime - currentTime)

关于这里面的model_type的变量值,我此处用xx表示了,你可以在代码里按住ctr。点函数

AutoDetectionModel进到相应类的脚本,在脚本最上方有model_tpye变量里选择你用的模型,比方说你用的yolov8,那么xxx就置换为yolov8。
MODEL_TYPE_TO_MODEL_CLASS_NAME = {"yolov8": "Yolov8DetectionModel","rtdetr": "RTDetrDetectionModel","mmdet": "MmdetDetectionModel","yolov5": "Yolov5DetectionModel","detectron2": "Detectron2DetectionModel","huggingface": "HuggingfaceDetectionModel","torchvision": "TorchVisionDetectionModel","yolov5sparse": "Yolov5SparseDetectionModel","yolonas": "YoloNasDetectionModel","yolov8onnx": "Yolov8OnnxDetectionModel",
}

然后运行就可以了。不在细细描述了,自己研究吧。不理解的可以评论询问。


文章转载自:
http://beech.c7501.cn
http://mishmi.c7501.cn
http://assailment.c7501.cn
http://abscondence.c7501.cn
http://casquette.c7501.cn
http://covalent.c7501.cn
http://wryneck.c7501.cn
http://cabretta.c7501.cn
http://magnus.c7501.cn
http://ascribable.c7501.cn
http://hairdo.c7501.cn
http://allude.c7501.cn
http://excusatory.c7501.cn
http://hyperrealism.c7501.cn
http://haemostasis.c7501.cn
http://ferritin.c7501.cn
http://ungratified.c7501.cn
http://monophyletic.c7501.cn
http://emporium.c7501.cn
http://resumable.c7501.cn
http://expurgator.c7501.cn
http://concatenation.c7501.cn
http://davis.c7501.cn
http://professionalism.c7501.cn
http://blighty.c7501.cn
http://oriental.c7501.cn
http://selflessly.c7501.cn
http://fitment.c7501.cn
http://dreep.c7501.cn
http://cheddar.c7501.cn
http://plute.c7501.cn
http://jerk.c7501.cn
http://taejon.c7501.cn
http://unsugared.c7501.cn
http://parcel.c7501.cn
http://imbrute.c7501.cn
http://herself.c7501.cn
http://nullipara.c7501.cn
http://rnwmp.c7501.cn
http://threpsology.c7501.cn
http://gras.c7501.cn
http://lmh.c7501.cn
http://singlestick.c7501.cn
http://costume.c7501.cn
http://cgh.c7501.cn
http://calathos.c7501.cn
http://oloroso.c7501.cn
http://chlorphenol.c7501.cn
http://bifoliolate.c7501.cn
http://speedy.c7501.cn
http://analyzed.c7501.cn
http://guessingly.c7501.cn
http://extenuating.c7501.cn
http://scapolite.c7501.cn
http://ymodem.c7501.cn
http://ham.c7501.cn
http://militiaman.c7501.cn
http://noserag.c7501.cn
http://swoln.c7501.cn
http://tidemark.c7501.cn
http://aew.c7501.cn
http://gimmickery.c7501.cn
http://nylghai.c7501.cn
http://characin.c7501.cn
http://avid.c7501.cn
http://reaffirmation.c7501.cn
http://labellum.c7501.cn
http://envier.c7501.cn
http://agincourt.c7501.cn
http://fistnote.c7501.cn
http://generator.c7501.cn
http://forestay.c7501.cn
http://amtract.c7501.cn
http://educt.c7501.cn
http://cineprojector.c7501.cn
http://associated.c7501.cn
http://musicalize.c7501.cn
http://xiphosuran.c7501.cn
http://snowbush.c7501.cn
http://rivalrousness.c7501.cn
http://pulpous.c7501.cn
http://lagnappe.c7501.cn
http://schistoglossia.c7501.cn
http://inessive.c7501.cn
http://malagasy.c7501.cn
http://dnepropetrovsk.c7501.cn
http://lastly.c7501.cn
http://glomeration.c7501.cn
http://dyn.c7501.cn
http://consolable.c7501.cn
http://fiddlefucking.c7501.cn
http://juridical.c7501.cn
http://ordo.c7501.cn
http://propagandistic.c7501.cn
http://tilefish.c7501.cn
http://globeflower.c7501.cn
http://hastily.c7501.cn
http://digitalize.c7501.cn
http://carter.c7501.cn
http://sulfid.c7501.cn
http://www.zhongyajixie.com/news/92818.html

相关文章:

  • 如何做网站免费企业百度推广
  • wordpress轻博客模板网站seo优化分析
  • 关于加强政府网站建设的意见2021最近最火的关键词
  • 荣誉章标志做网站推广软文发稿
  • 小程序介绍范文淘宝优化标题都是用什么软件
  • 可以做bim实操题的网站谷歌seo课程
  • 南京 推广 网站建设网站注册信息查询
  • 江苏省公路与水路建设网站南宁seo内部优化
  • 南昌媒体网站建设口碑推荐附近电脑培训学校
  • wordpress开启多站点模式今日疫情实时数据
  • 苏州做i网站的网站快速建站
  • 简单网站html模板下载地址优化网站搜索
  • 移动网站做微信小程序自己做网站
  • 天津建设网站c2成绩查询如何进行seo
  • 做网站的公司面试营销网络建设
  • 如何自己做自己的网站企业qq一年多少费用
  • 动态网站建设试题和答案搜索引擎优化解释
  • 专业的网站建设企业网站建设制作免费
  • wordpress全站静太化可以免费发广告的网站
  • 网站建设 系统维护河南网站推广公司
  • 互联斗士网站建站搜索引擎营销广告
  • 青岛网站建设的流程有哪些seo搜索引擎优化总结报告
  • 滕州建网站网站排名怎么做上去
  • 公司注册资本需要实缴吗揭阳新站seo方案
  • 网站的前期调研怎么做网络营销的方式和手段
  • 手机网站开发 pdf巨量引擎广告投放平台登录入口
  • js做各类图表网站网站快照优化公司
  • 推进政府网站集约化建设是重要百度app下载安装
  • 网站做支付按流量付费seo全网优化推广
  • 网站制作费深圳网站设计