I am trying to implement a convolutional neural netwrok and I don't understand why using im2col operation is more efficient. It basically stores the input to be multiplied by filter in separate columns. But why shouldn't loops be used directly to calculate convolution instead of first performing im2col ?
How is using im2col operation in convolutional nets more efficient?
10k views Asked by Ayush Chaurasia At
1
There are 1 answers
Related Questions in NEURAL-NETWORK
- Load js files from the web or serve them yourself?
- libpd library Low latency support for video?
- Save to 3 firebase locations with a slow internet connection
- Webservice client high latency, faster through ssh tunnel
- add latency with tc without restricting bandwidth
- High latency in urlfetch with google app engine
- How to utilize all available bandwidth with real-time data?
- What exactly does ALSA's snd_pcm_delay() return?
- Amazon EC2 Instances seem to have different RDS Latency
- Instruction execution latencies for A53
Related Questions in CONV-NEURAL-NETWORK
- Load js files from the web or serve them yourself?
- libpd library Low latency support for video?
- Save to 3 firebase locations with a slow internet connection
- Webservice client high latency, faster through ssh tunnel
- add latency with tc without restricting bandwidth
- High latency in urlfetch with google app engine
- How to utilize all available bandwidth with real-time data?
- What exactly does ALSA's snd_pcm_delay() return?
- Amazon EC2 Instances seem to have different RDS Latency
- Instruction execution latencies for A53
Related Questions in CORRELATION
- Load js files from the web or serve them yourself?
- libpd library Low latency support for video?
- Save to 3 firebase locations with a slow internet connection
- Webservice client high latency, faster through ssh tunnel
- add latency with tc without restricting bandwidth
- High latency in urlfetch with google app engine
- How to utilize all available bandwidth with real-time data?
- What exactly does ALSA's snd_pcm_delay() return?
- Amazon EC2 Instances seem to have different RDS Latency
- Instruction execution latencies for A53
Related Questions in CONVOLUTION
- Load js files from the web or serve them yourself?
- libpd library Low latency support for video?
- Save to 3 firebase locations with a slow internet connection
- Webservice client high latency, faster through ssh tunnel
- add latency with tc without restricting bandwidth
- High latency in urlfetch with google app engine
- How to utilize all available bandwidth with real-time data?
- What exactly does ALSA's snd_pcm_delay() return?
- Amazon EC2 Instances seem to have different RDS Latency
- Instruction execution latencies for A53
Related Questions in DECONVOLUTION
- Load js files from the web or serve them yourself?
- libpd library Low latency support for video?
- Save to 3 firebase locations with a slow internet connection
- Webservice client high latency, faster through ssh tunnel
- add latency with tc without restricting bandwidth
- High latency in urlfetch with google app engine
- How to utilize all available bandwidth with real-time data?
- What exactly does ALSA's snd_pcm_delay() return?
- Amazon EC2 Instances seem to have different RDS Latency
- Instruction execution latencies for A53
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Well, you are thinking in the right way, In Alex Net almost 95% of the GPU time and 89% on CPU time is spent on the Convolutional Layer and Fully Connected Layer.
The Convolutional Layer and Fully Connected Layer are implemented using GEMM that stands for General Matrix to Matrix Multiplication.
So basically in GEMM, we convert the convolution operation to a Matrix Multiplication operation by using a function called
im2col()
which arranges the data in a way that the convolution output can be achieved by Matrix Multiplication.Now, you may have a question instead of directly doing element wise convolution, why are we adding a step in between to arrange the data in a different way and then use GEMM.
The answer to this is, scientific programmers, have spent decades optimizing code to perform large matrix to matrix multiplications, and the benefits from the very regular patterns of memory access outweigh any other losses. We have an optimized CUDA GEMM API in cuBLAS library, Intel MKL has an optimized CPU GEMM while ciBLAS's GEMM API can be used for devices supporting OpenCL.
Element wise convolution performs badly because of the irregular memory accesses involved in it.
In turn,
Im2col()
arranges the data in a way that the memory accesses are regular for Matrix Multiplication.Im2col()
function adds a lot of data redundancy though, but the performance benefit of using Gemm outweigh this data redundancy.This is the reason for using
Im2col()
operation in Neural Nets.This link explains how
Im2col()
arranges the data for GEMM: https://petewarden.com/2015/04/20/why-gemm-is-at-the-heart-of-deep-learning/