diff options
| author | dpa <dobaipatakyattila@gmail.com> | 2026-11-19 16:58:07 +0200 |
|---|---|---|
| committer | dpa <dobaipatakyattila@gmail.com> | 2026-11-19 16:58:07 +0200 |
| commit | c8d109420c38fc47238a984c82eab9da3940f093 (patch) | |
| tree | 80484cef17e433ab31dc567e10cc0c38a0c6dd68 /conv-flux.jl | |
initial commit
Diffstat (limited to 'conv-flux.jl')
| -rw-r--r-- | conv-flux.jl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/conv-flux.jl b/conv-flux.jl new file mode 100644 index 0000000..de33910 --- /dev/null +++ b/conv-flux.jl @@ -0,0 +1,17 @@ +using Flux, Images, FileIO, ImageView + +img_gray = load("./cameraman.png") .|> Gray + +img_tensor = Float32.(channelview(img_gray)) +img_tensor = reshape(img_tensor, size(img_tensor)..., 1, 1) + +kernel = Float32[1 0 -1; 2 0 -2; 1 0 -1] + +weight = reshape(kernel, 3, 3, 1, 1) +conv_layer = Conv(weight, false) + +conv_result = conv_layer(img_tensor) + +result_img = colorview(Gray, conv_result[:, :, 1, 1]) + +imshow(result_img) |
