Why convolutions always use odd-numbers as filter_size
原文地址:https://datascience.stackexchange.com/questions/23183/why-convolutions-always-use-odd-numbers-as-filter-size
The convolution operation, simply put, is combination of element-wise product of two matrices. So long as these two matrices agree in dimensions, there shouldn't be a problem, and so I can understand the motivation behind your query.
A.1. However, the intent of convolution is to encode source data matrix (entire image) in terms of a filter or kernel. More specifically, we are trying to encode the pixels in the neighborhood of anchor/source pixels. Have a look at the figure below: Typically, we consider every pixel of the source image as anchor/source pixel, but we are not constrained to do this. In fact, it is not uncommon to include a stride, where in we anchor/source pixels are separated by a specific number of pixels.
Okay, so what is the source pixel? It is the anchor point at which the kernel is centered and we are encoding all the neighboring pixels, including the anchor/source pixel. Since, the kernel is symmetrically shaped (not symmetric in kernel values), there are equal number (n) of pixel on all sides (4- connectivity) of the anchor pixel. Therefore, whatever this number of pixels maybe, the length of each side of our symmetrically shaped kernel is 2*n+1 (each side of the anchor + the anchor pixel), and therefore filter/kernels are always odd sized.
What if we decided to break with 'tradition' and used asymmetric kernels? You'd suffer aliasing errors, and so we don't do it. We consider the pixel to be the smallest entity, i.e. there is no sub-pixel concept here.
A.2 The boundary problem is dealt with using different approaches: some ignore it, some zero pad it, some mirror reflect it. If you are not going to compute an inverse operation, i.e. deconvolution, and are not interested in perfect reconstruction of original image, then you don't care about either loss of information or injection of noise due to the boundary problem. Typically, the pooling operation (average pooling or max pooling) will remove your boundary artifacts anyway. So, feel free to ignore part of your 'input field', your pooling operation will do so for you.
--
Zen of convolution:
In the old-school signal processing domain, when an input signal was convolved or passed through a filter, there was no way of judging a-prior which components of the convolved/filtered response were relevant/informative and which were not. Consequently, the aim was to preserve signal components (all of it) in these transformations.
These signal components are information. Some components are more informative than others. The only reason for this is that we are interested in extracting higher-level information; Information pertinent towards some semantic classes. Accordingly, those signal components that do not provide the information we are specifically interested in can be pruned out. Therefore, unlike old-school dogmas about convolution/filtering, we are free to pool/prune the convolution response as we feel like. The way we feel like doing so is to rigorously remove all data components that are not contributing towards improving our statistical model.
Why convolutions always use odd-numbers as filter_size的更多相关文章
- Spoj-ODDDIV Odd Numbers of Divisors
Given a positive odd integer K and two positive integers low and high, determine how many integers b ...
- Odd Numbers of Divisors
给出一个正奇数K,两个正整数low,high. 有多少整数属于[low, high],且包含K个因子. 数据 C(0 < C < 1e5),测试样例数. (1 < K < 10 ...
- Sum of odd and even elements
Given an integer N, you have to print the sum of odd numbers and even numbers form 1 to N Input:Firs ...
- VK Cup 2016 - Qualification Round 2 A. Home Numbers 水题
A. Home Numbers 题目连接: http://www.codeforces.com/contest/638/problem/A Description The main street of ...
- P2955 [USACO09OCT]奇数偶数Even? Odd?
题目描述 Bessie's cruel second grade teacher has assigned a list of N (1 <= N <= 100) positive int ...
- LightOJ 1300 Odd Personality
Odd Personality Time Limit: 2000ms Memory Limit: 32768KB This problem will be judged on LightOJ. Ori ...
- [LeetCode]1252. Cells with Odd Values in a Matrix
Given n and m which are the dimensions of a matrix initialized by zeros and given an array indices w ...
- 【leetcode】1252. Cells with Odd Values in a Matrix
题目如下: Given n and m which are the dimensions of a matrix initialized by zeros and given an array ind ...
- 洛谷 P2955 [USACO09OCT]奇数偶数Even? Odd?【字符串/易错】
题目描述 Bessie's cruel second grade teacher has assigned a list of N (1 <= N <= 100) positive int ...
- PHP的学习--新特性
最近做的项目使用了 php7,但感觉有很多新特性没有用起来.就想总结一下,一些可能会用到的新特性.之前使用的环境是 php5.4,所有也会有 php5.5 和 php5.6 的特性总结进来,这里只列出 ...
随机推荐
- TCP中异常关闭的情况记录
1.当TCP连接的对端进程已经关闭了Socket的情况下,本端进程再发送数据时,第一包可以发送成功(但会导致对端发送一个RST包过来):之后如果再继续发送数据会失败,错误码为“10053: An es ...
- 网络初级篇之STP(实验验证)
一.根桥的选举. 1.优先级相等时. (图1-1) (图1-2) 在上面1-1图中,已经标出桥的mac地址,桥的优先级为默认优先级(缺省:32768).任意一端口抓包,查看STP数据包内包含的信息,根 ...
- visio的形状默认是蓝色的填充色,怎么设置为白色为默认色?
如图所示: 设计->主题->选黑白那个 效果如下:
- 在Python中,如何用一行代码去判定整数二进制中的连续 1
利用字节位操作如何判断一个整数的二进制是否含有至少两个连续的1 的方法有多种,大家第一反应应该想到的是以下的第一种方法. 方法一:从头到尾遍历一遍每一位即可找出是否有连续的1存在 这个方法是最普遍的. ...
- 解决Zabbix某台主机突然频繁告警"Zabbix agent on xxxxxx is unreachable for x minutes"
一.某台主机突然某一天频繁告警zabbix agent不可达 查看zabbix agent日志没有发现异常 二.查看zabbix server日志发现这台主机的日志有大量报错信息"first ...
- Hdu 2147 巴什博弈 PN图
P:先手必输 N:先手必胜 PN图规则:如果一个点能转换到的所有点都是N,那么此点状态为P.若能转化到一个P,即使对手面临必输状态,此点为N. 然后找规律就行 #include<bits/s ...
- JAVA NIO 内存映射(转载)
原文地址:http://blog.csdn.net/fcbayernmunchen/article/details/8635427 Java类库中的NIO包相对于IO 包来说有一个新功能是内存 ...
- 初始Ajax学习笔记
前端: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <!--引入 ...
- 小程序生成海报 canvas
前言 微信小程序需要生成海报进行朋友圈分享,但是不同的手机会有问题, 然后首先是图片的问题 图片 在模拟器上没有报错,可是真机测试却什么也没画出来. canvas.drawImage 是不支持网络图片 ...
- Binding使用的属性、DataContext上下文绑定必须使用的情况
RelativeSource属性 https://blog.csdn.net/yangwenxue1989/article/details/81624240 Binding时,如果明确知道数据源的Na ...