当前位置:网站首页>Pytorch 20 realizes corrosion expansion based on pytorch
Pytorch 20 realizes corrosion expansion based on pytorch
2022-07-03 00:16:00 【Ten thousand miles and a bright future arrived in an instant】
In some image processing projects , Sometimes it is necessary to carry out corrosion expansion and various value processing on the image , introduce opencv After processing , Data cannot be processed quickly , Value range interception 、 Use mask、where Operation etc. . therefore , have access to torch Achieve corrosion expansion , So as to avoid the modification of data structure , At the same time, it ensures that all operations can be realized in one model .( Of course ,opencv It is also very convenient to intercept the value range in , For details, please refer to section 7 in the following link c++ On opencv Common array operations _a486259 The blog of -CSDN Blog )
however , be based on torch Achieved corrosion expansion , There are certain assumptions : All structural elements are square operators . After implementation, it can act on C++ Under the libtorch in , however ksize The size of can only be fixed , Unable to change input . In practical use , Whether the image is a binary graph , It won't affect the result . Only the element with the largest value in the corresponding region of the operator will be selected for replacement .
Core code :
#ksize Must be odd , Otherwise, the size of the pool will change . Besides ,stride=1, padding=int((ksize-1)/ 2) It's a must
ksize=21
max_pool = torch.nn.MaxPool2d(kernel_size=ksize, stride=1, padding=int((ksize-1)/ 2)) # Adjustable kernel_sizeExpansion operation
Inflation
边栏推荐
猜你喜欢

Interface difference test - diffy tool

CADD课程学习(4)-- 获取没有晶体结构的蛋白(SWISS-Model)

Chinatelecom has maintained a strong momentum in the mobile phone user market, but China Mobile has opened a new track

JSON data transfer parameters

Maybe you read a fake Tianlong eight

程序分析与优化 - 9 附录 XLA的缓冲区指派
![洛谷_P2010 [NOIP2016 普及组] 回文日期_折半枚举](/img/a3/55bb71d39801ceeee421a0c8ded333.png)
洛谷_P2010 [NOIP2016 普及组] 回文日期_折半枚举

监控容器运行时工具Falco

Is the multitasking loss in pytoch added up or backward separately?

Wechat applet basic learning (wxss)
随机推荐
Difference between NVIDIA n card and amda card
Returns the root node of the largest binary search subtree in a binary tree
SQL query statement parameters are written successfully
Create an interactive experience of popular games, and learn about the real-time voice of paileyun unity
Dishes launcher small green program and directory management (efficiency tool)
接口差异测试——Diffy工具
容器运行时分析
[shutter] shutter open source project reference
Digital collection trading website domestic digital collection trading platform
Maybe you read a fake Tianlong eight
JDBC practice cases
Container runtime analysis
Practical series - free commercial video material library
yolov5test. Py comment
Additional: token; (don't read until you finish writing...)
Where can I find the English literature of the thesis (except HowNet)?
zhvoice
开源了 | 文心大模型ERNIE-Tiny轻量化技术,又准又快,效果全开
Bigder:32/100 测试发现的bug开发认为不是bug怎么处理
洛谷_P1149 [NOIP2008 提高组] 火柴棒等式_枚举打表