当前位置:网站首页>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
边栏推荐
- Slf4j + logback logging framework
- MATLAB signal processing [Q & a notes-1]
- leetcode 650. 2 keys keyboard with only two keys (medium)
- MFC文件操作
- Chapter 3 of getting started with MySQL: database creation and operation
- Master the development of facial expression recognition based on deep learning (based on paddlepaddle)
- sysdig分析容器系统调用
- 教育学大佬是怎么找外文参考文献的?
- yolov5train. py
- Digital collection trading website domestic digital collection trading platform
猜你喜欢

Where can I find the English literature of the thesis (except HowNet)?

How much do you know about synchronized?

Difference between NVIDIA n card and amda card

TypeError: Cannot read properties of undefined (reading ***)

容器运行时分析

附加:token;(没写完,别看…)

秒杀系统设计

Pytorch里面多任务Loss是加起来还是分别backward?

Open source | Wenxin big model Ernie tiny lightweight technology, which is accurate and fast, and the effect is fully open

Flexible combination of applications is a false proposition that has existed for 40 years
随机推荐
What website can you find English literature on?
leetcode 650. 2 Keys Keyboard 只有两个键的键盘(中等)
130 pages of PPT from the brick boss introduces the new features of Apache spark 3.2 & 3.3 in depth
What is the standard format of a 2000-3000 word essay for college students' classroom homework?
Monitor container runtime tool Falco
Maybe you read a fake Tianlong eight
CADD课程学习(4)-- 获取没有晶体结构的蛋白(SWISS-Model)
Leetcode skimming - game 280
Use of cocospods
洛谷_P1149 [NOIP2008 提高组] 火柴棒等式_枚举打表
sysdig分析容器系统调用
Container runtime analysis
Digital collection trading website domestic digital collection trading platform
Interpretation of new plug-ins | how to enhance authentication capability with forward auth
CADD course learning (4) -- obtaining proteins without crystal structure (Swiss model)
Returns the size of the largest binary search subtree in a binary tree
SQL query statement parameters are written successfully
How to apply for company email when registering in company email format?
TypeError: Cannot read properties of undefined (reading ***)
Returns the maximum distance between two nodes of a binary tree