当前位置:网站首页>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
边栏推荐
- JVM foundation review
- Open Source | Wenxin Big Model Ernie Tiny Lightweight Technology, Accurate and Fast, full Open Effect
- 判断二叉树是否为满二叉树
- Request and response
- 67页新型智慧城市整体规划建设方案(附下载)
- Pytorch里面多任务Loss是加起来还是分别backward?
- 返回二叉树两个节点间的最大距离
- 67 page overall planning and construction plan for a new smart city (download attached)
- JDBC練習案例
- Interface automation coverage statistics - used by Jacobo
猜你喜欢

Request and response

The privatization deployment of SaaS services is the most efficient | cloud efficiency engineer points north

Dishes launcher small green program and directory management (efficiency tool)

Happy Lantern Festival, how many of these technical lantern riddles can you guess correctly?

How do educators find foreign language references?

List of major chip Enterprises

Flexible combination of applications is a false proposition that has existed for 40 years

Talk with the interviewer about the pit of MySQL sorting (including: duplicate data problem in order by limit page)

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

Architecture: database architecture design
随机推荐
有哪些比较推荐的论文翻译软件?
ArrayList分析2 :Itr、ListIterator以及SubList中的坑
MFC file operation
35页危化品安全管理平台解决方案2022版
返回二叉树中最大的二叉搜索子树的根节点
Matlab 信号处理【问答笔记-1】
JDBC practice cases
Additional: token; (don't read until you finish writing...)
Monitor container runtime tool Falco
JS interviewer wants to know how much you understand call, apply, bind no regrets series
Mapper agent development
Slf4j + Logback日志框架
S12. Verify multi host SSH mutual access script based on key
返回二叉树两个节点间的最大距离
Where can I check the foreign literature of economics?
SQL query statement parameters are written successfully
Dishes launcher small green program and directory management (efficiency tool)
Happy Lantern Festival, how many of these technical lantern riddles can you guess correctly?
Bigder:32/100 测试发现的bug开发认为不是bug怎么处理
Program analysis and Optimization - 9 appendix XLA buffer assignment