aamini / fastconv.jl Goto Github PK
View Code? Open in Web Editor NEWFast Convolutions in Julia
Home Page: https://arxiv.org/abs/1612.08825
License: Other
Fast Convolutions in Julia
Home Page: https://arxiv.org/abs/1612.08825
License: Other
Thanks for making this code available. I wonder whether the "FastConv" name is promising too much, though.
I did some benchmarks against MATLAB. Julia seems comparable in 1D but MATLAB seems quite a bit faster in 2D. Presumably MATLAB is calling MKL?
julia> w = rand(5,5);
julia> s = rand(32,32);
julia> @time for iter=1:1000;convn(s,w);end
0.424601 seconds (204.00 k allocations: 178.574 MB, 2.38% gc time)
julia> @time for iter=1:1000;convn(s,w);end
0.491745 seconds (204.00 k allocations: 178.574 MB, 2.24% gc time)
julia> w = rand(3,3);
julia> @time for iter=1:1000;convn(s,w);end
0.047446 seconds (8.00 k allocations: 9.415 MB)
julia> @time for iter=1:1000;convn(s,w);end
0.048083 seconds (8.00 k allocations: 9.415 MB, 3.62% gc time)
>> s = rand(32,32);
>> w = rand(5,5);
>> tic;for iter=1:1000;conv2(s,w);end;toc
Elapsed time is 0.102509 seconds.
>> tic;for iter=1:1000;conv2(s,w);end;toc
Elapsed time is 0.027208 seconds.
>> w = rand(3,3);
>> tic;for iter=1:1000;conv2(s,w);end;toc
Elapsed time is 0.019014 seconds.
>> tic;for iter=1:1000;conv2(s,w);end;toc
Elapsed time is 0.018701 seconds.
First, let me say this looks like a useful package. But when I attempted to add this package via ] add FastConv
, and it wasn't found. Do you intend to publish this to the common repository? I have been informed that to publish there, one needs to make use of the attobot.
Running Julia 0.7 on Windows 7 I get the following:
julia> using FastConv
[ Info: Recompiling stale cache file C:\Users\louis.kaplan\.julia\compiled\v0.7\FastConv\S3Jhd.ji for FastConv [d7899f00-a588-5e12-9855-37624a64ff9a]
┌ Warning: Deprecated syntax `parametric method syntax convn{T, N}(E::Array{T, N}, k::Array{T, N})` around C:\Users\louis.kaplan\.julia\packages\FastConv\SESra\src\utils.jl:10.
│ Use `convn(E::Array{T, N}, k::Array{T, N}) where {T, N}` instead.
└ @ C:\Users\louis.kaplan\.julia\packages\FastConv\SESra\src\utils.jl:10
┌ Warning: Deprecated syntax `parametric method syntax fastconv{T, N}(E::Array{T, N}, k::Array{T, N})` around C:\Users\louis.kaplan\.julia\packages\FastConv\SESra\src\utils.jl:32.
│ Use `fastconv(E::Array{T, N}, k::Array{T, N}) where {T, N}` instead.
└ @ C:\Users\louis.kaplan\.julia\packages\FastConv\SESra\src\utils.jl:32
┌ Warning: Deprecated syntax `parametric method syntax convn!{T, N}(out::Array{T}, E::Array{T, N}, k::Array{T, N})` around C:\Users\louis.kaplan\.julia\packages\FastConv\SESra\src\utils.jl:47.
│ Use `convn!(out::Array{T}, E::Array{T, N}, k::Array{T, N}) where {T, N}` instead.
└ @ C:\Users\louis.kaplan\.julia\packages\FastConv\SESra\src\utils.jl:47
Edit: Planning to put in a PR over the next few days to fix this
Thank you for this work!
I understand convolution in math and CV, but the result of running this code surprises me:
...
EX = convn(stack, sobel3_x/2);
ET = convn(stack, prewitt2_t/2);
println(size(stack))
println(size(sobel3_x/2))
println(size(EX))
println(size(prewitt2_t/2))
println(size(ET))
Output:
(4,4,2)
(3,3,2)
(6,6,3) <-- How the output has this dimension?
(2,2,2)
(5,5,3) <-- How the output has this dimension?
The convs I saw has output the same size as the input image. I am new to Julia so not clear about your codes... Could you explain how the codes get this result?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.