当前位置:网站首页>pytorch中的双线性插值上采样(Bilinear Upsampling)、F.upsample_bilinear
pytorch中的双线性插值上采样(Bilinear Upsampling)、F.upsample_bilinear
2022-07-01 03:15:00 【是七叔呀】
在Fully Convolutional Networks for Semantic Segmentation这篇文章中,介绍到Bilinear Upsampling这种上采样的方式,虽然文章最后用的是deconvolution,给出的理由就是不希望upsampling filter是固定的= =!
因为以前用的upsampling的方式是很简单的,比如放大两倍,就是把一个像素点复制一下变成四个。这样的做法会导致图像变得模糊。
线性插值
在介绍双线性插值前,先介绍一下线性插值。
其实说白了就很简单,就是两点确定一条线,然后在这条线上知道了x,自然可以推出y。同样的,已知y的话,自然也可以推导出x。
双线性插值
在图像中,我们面对的往往是两维,甚至三维(包含channel)的图像,那么,在进行upsampling的时候我们就要用到双线性插值和三线性插值。
所谓双线性插值,原理和线性插值相同,并且也是通过使用三次线性插值实现的。首先看图。

双线性插值的效果
参考博客:二次线性插值原理+代码详解【python】
双线型内插值算法就是一种比较好的图像缩放算法,它充分的利用了源图中虚拟点四周的四个真实存在的像素值来共同决定目标图中的一个像素值,因此缩放效果比简单的最邻近插值要好很多。由于图像双线性插值只会用相邻的4个点,因此以下公式的分母都是1。

F.upsample_bilinear
如果在pytorch的项目中使用到了F.upsample_bilinear函数,会出现如下警告(表明此函数已经过时了,推荐使用nn.functional.interpolate来代替)
UserWarning: nn.functional.upsample_bilinear is deprecated. Use nn.functional.interpolate instead.
warnings.warn("nn.functional.upsample_bilinear is deprecated. Use nn.functional.interpolate instead.")
边栏推荐
- [reading notes] copywriting realization -- four golden steps for writing effective copywriting
- Force buckle - sum of two numbers
- Let's just say I can use thousands of expression packs
- Introduction to the core functions of webrtc -- an article to understand peerconnectionfactoryinterface rtcconfiguration peerconnectioninterface
- HTB-Lame
- Completely solve the lost connection to MySQL server at 'reading initial communication packet
- Error accessing URL 404
- XXL job User Guide
- C language EXECL function
- JS daily development tips (continuous update)
猜你喜欢
随机推荐
Cookie&Session
Nacos
Md5sum operation
别再说不会解决 “跨域“ 问题啦
Hello World generation
Force buckle - sum of two numbers
【读书笔记】《文案变现》——写出有效文案的四个黄金步骤
MySQL index --01--- design principle of index
Edge Drawing: A combined real-time edge and segment detector 翻译
数组的includes( )
File upload and download
go实现命令行的工具cli
Error accessing URL 404
So easy 将程序部署到服务器
Subnet division and subnet summary
Huawei operator level router configuration example | configuration optionA mode cross domain LDP VPLS example
Feign remote call and getaway gateway
gcc使用、Makefile总结
Avalanche problem and the use of sentinel
[daily training] 1175 Prime permutation









