# HG changeset patch # User Tuomo Valkonen # Date 1598353446 -10800 # Node ID 492a57594b8865faf143af9f362db15ea0ae4c95 # Parent cfd989fa71c3953b466a6141131b46e7467da00f Make denoise test script a proper project so it can be run easily. diff -r cfd989fa71c3 -r 492a57594b88 DenoiseTest/Manifest.toml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DenoiseTest/Manifest.toml Tue Aug 25 14:04:06 2020 +0300 @@ -0,0 +1,304 @@ +# This file is machine-generated - editing it directly is not advised + +[[AlgTools]] +deps = ["DelimitedFiles", "Printf"] +path = "../../AlgTools" +uuid = "c46e2e78-5339-41fd-a966-983ff60ab8e7" +version = "0.1.0" + +[[AxisArrays]] +deps = ["Dates", "IntervalSets", "IterTools", "RangeArrays"] +git-tree-sha1 = "f31f50712cbdf40ee8287f0443b57503e34122ef" +uuid = "39de3d68-74b9-583c-8d2d-e117c070f3a9" +version = "0.4.3" + +[[Base64]] +uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" + +[[ColorTypes]] +deps = ["FixedPointNumbers", "Random"] +git-tree-sha1 = "607c0ea16cb32af49ea2976f90c0c5acbca37d21" +uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" +version = "0.10.8" + +[[ColorVectorSpace]] +deps = ["ColorTypes", "Colors", "FixedPointNumbers", "LinearAlgebra", "SpecialFunctions", "Statistics", "StatsBase"] +git-tree-sha1 = "bd0c0c81a39923bc03f9c3b61d89ad816e741002" +uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4" +version = "0.8.5" + +[[Colors]] +deps = ["ColorTypes", "FixedPointNumbers", "InteractiveUtils", "Reexport"] +git-tree-sha1 = "008d6bc68dea6beb6303fdc37188cb557391ebf2" +uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" +version = "0.12.4" + +[[CompilerSupportLibraries_jll]] +deps = ["Libdl", "Pkg"] +git-tree-sha1 = "7c4f882c41faa72118841185afc58a2eb00ef612" +uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" +version = "0.3.3+0" + +[[ConstructionBase]] +git-tree-sha1 = "a2a6a5fea4d6f730ec4c18a76d27ec10e8ec1c50" +uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" +version = "1.0.0" + +[[DataAPI]] +git-tree-sha1 = "176e23402d80e7743fc26c19c681bfb11246af32" +uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" +version = "1.3.0" + +[[DataStructures]] +deps = ["InteractiveUtils", "OrderedCollections"] +git-tree-sha1 = "88d48e133e6d3dd68183309877eac74393daa7eb" +uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" +version = "0.17.20" + +[[Dates]] +deps = ["Printf"] +uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" + +[[DelimitedFiles]] +deps = ["Mmap"] +uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" + +[[Distances]] +deps = ["LinearAlgebra", "Statistics"] +git-tree-sha1 = "bed62cc5afcff16de797a9f38fb358b74071f785" +uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" +version = "0.9.0" + +[[Distributed]] +deps = ["Random", "Serialization", "Sockets"] +uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" + +[[EllipsisNotation]] +git-tree-sha1 = "65dad386e877850e6fce4fc77f60fe75a468ce9d" +uuid = "da5c29d0-fa7d-589e-88eb-ea29b0a81949" +version = "0.4.0" + +[[FileIO]] +deps = ["Pkg"] +git-tree-sha1 = "1e7e88a949b52e6f7f589041bd60928322414997" +uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" +version = "1.4.1" + +[[FixedPointNumbers]] +deps = ["Statistics"] +git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc" +uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" +version = "0.8.4" + +[[Future]] +deps = ["Random"] +uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" + +[[GR]] +deps = ["Base64", "DelimitedFiles", "HTTP", "JSON", "LinearAlgebra", "Printf", "Random", "Serialization", "Sockets", "Test", "UUIDs"] +git-tree-sha1 = "e26c513329675092535de20cc4bb9c579c8f85a0" +uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71" +version = "0.51.0" + +[[HTTP]] +deps = ["Base64", "Dates", "IniFile", "MbedTLS", "Sockets"] +git-tree-sha1 = "2ac03263ce44be4222342bca1c51c36ce7566161" +uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" +version = "0.8.17" + +[[ImageTools]] +deps = ["AlgTools", "ColorTypes", "ColorVectorSpace", "FileIO", "GR", "OffsetArrays", "Printf", "Setfield", "TestImages"] +path = ".." +uuid = "b548cc0d-4ade-417e-bf62-0e39f9d2eee9" +version = "0.1.0" + +[[IniFile]] +deps = ["Test"] +git-tree-sha1 = "098e4d2c533924c921f9f9847274f2ad89e018b8" +uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f" +version = "0.5.0" + +[[InteractiveUtils]] +deps = ["Markdown"] +uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" + +[[IntervalSets]] +deps = ["Dates", "EllipsisNotation", "Statistics"] +git-tree-sha1 = "3b1cef135bc532b3c3401b309e1b8a2a2ba26af5" +uuid = "8197267c-284f-5f27-9208-e0e47529a953" +version = "0.5.1" + +[[IterTools]] +git-tree-sha1 = "05110a2ab1fc5f932622ffea2a003221f4782c18" +uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" +version = "1.3.0" + +[[JSON]] +deps = ["Dates", "Mmap", "Parsers", "Unicode"] +git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e" +uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +version = "0.21.0" + +[[LibGit2]] +deps = ["Printf"] +uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" + +[[Libdl]] +uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" + +[[LinearAlgebra]] +deps = ["Libdl"] +uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" + +[[Logging]] +uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" + +[[MacroTools]] +deps = ["Markdown", "Random"] +git-tree-sha1 = "f7d2e3f654af75f01ec49be82c231c382214223a" +uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" +version = "0.5.5" + +[[Markdown]] +deps = ["Base64"] +uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" + +[[MbedTLS]] +deps = ["Dates", "MbedTLS_jll", "Random", "Sockets"] +git-tree-sha1 = "426a6978b03a97ceb7ead77775a1da066343ec6e" +uuid = "739be429-bea8-5141-9913-cc70e7f3736d" +version = "1.0.2" + +[[MbedTLS_jll]] +deps = ["Libdl", "Pkg"] +git-tree-sha1 = "a0cb0d489819fa7ea5f9fa84c7e7eba19d8073af" +uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" +version = "2.16.6+1" + +[[Missings]] +deps = ["DataAPI"] +git-tree-sha1 = "de0a5ce9e5289f27df672ffabef4d1e5861247d5" +uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28" +version = "0.4.3" + +[[Mmap]] +uuid = "a63ad114-7e13-5084-954f-fe012c677804" + +[[OffsetArrays]] +git-tree-sha1 = "2066e16af994955287f2e03ba1d9e890eb43b0dd" +uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" +version = "1.1.2" + +[[OpenSpecFun_jll]] +deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"] +git-tree-sha1 = "d51c416559217d974a1113522d5919235ae67a87" +uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" +version = "0.5.3+3" + +[[OrderedCollections]] +git-tree-sha1 = "293b70ac1780f9584c89268a6e2a560d938a7065" +uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" +version = "1.3.0" + +[[Parsers]] +deps = ["Dates", "Test"] +git-tree-sha1 = "8077624b3c450b15c087944363606a6ba12f925e" +uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" +version = "1.0.10" + +[[Pkg]] +deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] +uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" + +[[Printf]] +deps = ["Unicode"] +uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" + +[[REPL]] +deps = ["InteractiveUtils", "Markdown", "Sockets"] +uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" + +[[Random]] +deps = ["Serialization"] +uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" + +[[RangeArrays]] +git-tree-sha1 = "b9039e93773ddcfc828f12aadf7115b4b4d225f5" +uuid = "b3c3ace0-ae52-54e7-9d0b-2c1406fd6b9d" +version = "0.3.2" + +[[Reexport]] +deps = ["Pkg"] +git-tree-sha1 = "7b1d07f411bc8ddb7977ec7f377b97b158514fe0" +uuid = "189a3867-3050-52da-a836-e630ba90ab69" +version = "0.2.0" + +[[Requires]] +deps = ["UUIDs"] +git-tree-sha1 = "d37400976e98018ee840e0ca4f9d20baa231dc6b" +uuid = "ae029012-a4dd-5104-9daa-d747884805df" +version = "1.0.1" + +[[SHA]] +uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" + +[[Serialization]] +uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" + +[[Setfield]] +deps = ["ConstructionBase", "Future", "MacroTools", "Requires"] +git-tree-sha1 = "d5640fc570fb1b6c54512f0bd3853866bd298b3e" +uuid = "efcf1570-3423-57d1-acb7-fd33fddbac46" +version = "0.7.0" + +[[Sockets]] +uuid = "6462fe0b-24de-5631-8697-dd941f90decc" + +[[SortingAlgorithms]] +deps = ["DataStructures", "Random", "Test"] +git-tree-sha1 = "03f5898c9959f8115e30bc7226ada7d0df554ddd" +uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" +version = "0.3.1" + +[[SparseArrays]] +deps = ["LinearAlgebra", "Random"] +uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" + +[[SpecialFunctions]] +deps = ["OpenSpecFun_jll"] +git-tree-sha1 = "d8d8b8a9f4119829410ecd706da4cc8594a1e020" +uuid = "276daf66-3868-5448-9aa4-cd146d93841b" +version = "0.10.3" + +[[Statistics]] +deps = ["LinearAlgebra", "SparseArrays"] +uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" + +[[StatsBase]] +deps = ["DataAPI", "DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics"] +git-tree-sha1 = "a6102b1f364befdb05746f386b67c6b7e3262c45" +uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" +version = "0.33.0" + +[[StringDistances]] +deps = ["Distances"] +git-tree-sha1 = "b0ea34b18ba9da7abc79acabda8a473cd63c1254" +uuid = "88034a9c-02f8-509d-84a9-84ec65e18404" +version = "0.8.0" + +[[Test]] +deps = ["Distributed", "InteractiveUtils", "Logging", "Random"] +uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[[TestImages]] +deps = ["AxisArrays", "ColorTypes", "FileIO", "Pkg", "StringDistances"] +git-tree-sha1 = "31367bfceb3a3874f5e0ba2c144e6b862b3557d8" +uuid = "5e47fb64-e119-507b-a336-dd2b206d9990" +version = "1.2.1" + +[[UUIDs]] +deps = ["Random", "SHA"] +uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" + +[[Unicode]] +uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" diff -r cfd989fa71c3 -r 492a57594b88 DenoiseTest/Project.toml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DenoiseTest/Project.toml Tue Aug 25 14:04:06 2020 +0300 @@ -0,0 +1,12 @@ +name = "DenoiseTest" +authors = ["Tuomo Valkonen "] +version = "0.1.0" + +[deps] +AlgTools = "c46e2e78-5339-41fd-a966-983ff60ab8e7" +ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" +ColorVectorSpace = "c3611d14-8923-5661-9e6a-0046d554d3a4" +FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" +ImageTools = "b548cc0d-4ade-417e-bf62-0e39f9d2eee9" +Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" +TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990" diff -r cfd989fa71c3 -r 492a57594b88 DenoiseTest/src/DenoiseTest.jl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DenoiseTest/src/DenoiseTest.jl Tue Aug 25 14:04:06 2020 +0300 @@ -0,0 +1,82 @@ +################## +# Denoise testing +################## + +module DenoiseTest + +# Our exports +export test_denoise, default_params + +# Dependencies +using Printf +using FileIO +using ColorTypes: Gray +# ColorVectorSpace is only needed to ensure that conversions +# between different ColorTypes are defined. +import ColorVectorSpace +import TestImages + +using AlgTools.Util +using AlgTools.LinkedLists +using ImageTools.Denoise +using ImageTools.Visualise + +# Parameters +const default_save_prefix="denoise_result_" + +const default_params = ( + α = 1, + # PDPS + # τ₀ = 5, + # σ₀ = 0.99/5, + # FISTA + τ₀ = 0.9, + ρ = 0, + accel = true, + noise_level = 0.5, + verbose_iter = 10, + maxiter = 1000, + save_results = false, + image_name = "lighthouse", + save_iterations = false +) + +####################### +# Main testing routine +####################### + +function test_denoise(; + visualise=true, + save_prefix=default_save_prefix, + kwargs...) + + + # Parameters for this experiment + params = default_params ⬿ kwargs + params = params ⬿ (save_prefix = save_prefix * params.image_name,) + + # Load image and add noise + b = Float64.(Gray{Float64}.(TestImages.testimage(params.image_name))) + b_noisy = b .+ params.noise_level.*randn(size(b)...) + + # Launch (background) visualiser + st, iterate = initialise_visualisation(visualise) + + # Run algorithm + x, y, st = denoise_fista(b_noisy; iterate=iterate, params=params) + + if params.save_results + perffile = params.save_prefix * ".txt" + println("Saving " * perffile) + write_log(perffile, st.log, "# params = $(params)\n") + fn = (t, ext) -> "$(params.save_prefix)_$(t).$(ext)" + save(File(format"PNG", fn("true", "png")), grayimg(b)) + save(File(format"PNG", fn("data", "png")), grayimg(b_noisy)) + save(File(format"PNG", fn("reco", "png")), grayimg(x)) + end + + # Exit background visualiser + finalise_visualisation(st) +end + +end diff -r cfd989fa71c3 -r 492a57594b88 Manifest.toml --- a/Manifest.toml Tue Aug 25 13:53:17 2020 +0300 +++ b/Manifest.toml Tue Aug 25 14:04:06 2020 +0300 @@ -6,6 +6,12 @@ uuid = "c46e2e78-5339-41fd-a966-983ff60ab8e7" version = "0.1.0" +[[AxisArrays]] +deps = ["Dates", "IntervalSets", "IterTools", "RangeArrays"] +git-tree-sha1 = "f31f50712cbdf40ee8287f0443b57503e34122ef" +uuid = "39de3d68-74b9-583c-8d2d-e117c070f3a9" +version = "0.4.3" + [[Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" @@ -15,11 +21,34 @@ uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" version = "0.9.0" +[[ColorVectorSpace]] +deps = ["ColorTypes", "Colors", "FixedPointNumbers", "LinearAlgebra", "SpecialFunctions", "Statistics", "StatsBase"] +git-tree-sha1 = "bd0c0c81a39923bc03f9c3b61d89ad816e741002" +uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4" +version = "0.8.5" + +[[Colors]] +deps = ["ColorTypes", "FixedPointNumbers", "InteractiveUtils", "Printf", "Reexport"] +git-tree-sha1 = "177d8b959d3c103a6d57574c38ee79c81059c31b" +uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" +version = "0.11.2" + +[[CompilerSupportLibraries_jll]] +deps = ["Libdl", "Pkg"] +git-tree-sha1 = "7c4f882c41faa72118841185afc58a2eb00ef612" +uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" +version = "0.3.3+0" + [[ConstructionBase]] git-tree-sha1 = "a2a6a5fea4d6f730ec4c18a76d27ec10e8ec1c50" uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" version = "1.0.0" +[[DataAPI]] +git-tree-sha1 = "176e23402d80e7743fc26c19c681bfb11246af32" +uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" +version = "1.3.0" + [[DataStructures]] deps = ["InteractiveUtils", "OrderedCollections"] git-tree-sha1 = "a1b652fb77ae8ca7ea328fa7ba5aa151036e5c10" @@ -34,10 +63,21 @@ deps = ["Mmap"] uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" +[[Distances]] +deps = ["LinearAlgebra", "Statistics"] +git-tree-sha1 = "bed62cc5afcff16de797a9f38fb358b74071f785" +uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" +version = "0.9.0" + [[Distributed]] deps = ["Random", "Serialization", "Sockets"] uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" +[[EllipsisNotation]] +git-tree-sha1 = "65dad386e877850e6fce4fc77f60fe75a468ce9d" +uuid = "da5c29d0-fa7d-589e-88eb-ea29b0a81949" +version = "0.4.0" + [[FileIO]] deps = ["Pkg"] git-tree-sha1 = "80c17c711c41416eb0ac68347dc036be68b37682" @@ -63,7 +103,19 @@ deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +[[IntervalSets]] +deps = ["Dates", "EllipsisNotation", "Statistics"] +git-tree-sha1 = "3b1cef135bc532b3c3401b309e1b8a2a2ba26af5" +uuid = "8197267c-284f-5f27-9208-e0e47529a953" +version = "0.5.1" + +[[IterTools]] +git-tree-sha1 = "05110a2ab1fc5f932622ffea2a003221f4782c18" +uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" +version = "1.3.0" + [[LibGit2]] +deps = ["Printf"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" [[Libdl]] @@ -86,6 +138,12 @@ deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" +[[Missings]] +deps = ["DataAPI"] +git-tree-sha1 = "de0a5ce9e5289f27df672ffabef4d1e5861247d5" +uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28" +version = "0.4.3" + [[Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" @@ -94,6 +152,12 @@ uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" version = "0.11.4" +[[OpenSpecFun_jll]] +deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"] +git-tree-sha1 = "d51c416559217d974a1113522d5919235ae67a87" +uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" +version = "0.5.3+3" + [[OrderedCollections]] deps = ["Random", "Serialization", "Test"] git-tree-sha1 = "c4c13474d23c60d20a67b217f1d7f22a40edf8f1" @@ -116,6 +180,17 @@ deps = ["Serialization"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +[[RangeArrays]] +git-tree-sha1 = "b9039e93773ddcfc828f12aadf7115b4b4d225f5" +uuid = "b3c3ace0-ae52-54e7-9d0b-2c1406fd6b9d" +version = "0.3.2" + +[[Reexport]] +deps = ["Pkg"] +git-tree-sha1 = "7b1d07f411bc8ddb7977ec7f377b97b158514fe0" +uuid = "189a3867-3050-52da-a836-e630ba90ab69" +version = "0.2.0" + [[Requires]] deps = ["UUIDs"] git-tree-sha1 = "999513b7dea8ac17359ed50ae8ea089e4464e35e" @@ -137,10 +212,48 @@ [[Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" +[[SortingAlgorithms]] +deps = ["DataStructures", "Random", "Test"] +git-tree-sha1 = "03f5898c9959f8115e30bc7226ada7d0df554ddd" +uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" +version = "0.3.1" + +[[SparseArrays]] +deps = ["LinearAlgebra", "Random"] +uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" + +[[SpecialFunctions]] +deps = ["OpenSpecFun_jll"] +git-tree-sha1 = "d8d8b8a9f4119829410ecd706da4cc8594a1e020" +uuid = "276daf66-3868-5448-9aa4-cd146d93841b" +version = "0.10.3" + +[[Statistics]] +deps = ["LinearAlgebra", "SparseArrays"] +uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" + +[[StatsBase]] +deps = ["DataAPI", "DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics"] +git-tree-sha1 = "a6102b1f364befdb05746f386b67c6b7e3262c45" +uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" +version = "0.33.0" + +[[StringDistances]] +deps = ["Distances"] +git-tree-sha1 = "b0ea34b18ba9da7abc79acabda8a473cd63c1254" +uuid = "88034a9c-02f8-509d-84a9-84ec65e18404" +version = "0.8.0" + [[Test]] deps = ["Distributed", "InteractiveUtils", "Logging", "Random"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +[[TestImages]] +deps = ["AxisArrays", "ColorTypes", "FileIO", "Pkg", "StringDistances"] +git-tree-sha1 = "31367bfceb3a3874f5e0ba2c144e6b862b3557d8" +uuid = "5e47fb64-e119-507b-a336-dd2b206d9990" +version = "1.2.1" + [[UUIDs]] deps = ["Random", "SHA"] uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" diff -r cfd989fa71c3 -r 492a57594b88 Project.toml --- a/Project.toml Tue Aug 25 13:53:17 2020 +0300 +++ b/Project.toml Tue Aug 25 14:04:06 2020 +0300 @@ -6,8 +6,10 @@ [deps] AlgTools = "c46e2e78-5339-41fd-a966-983ff60ab8e7" ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" +ColorVectorSpace = "c3611d14-8923-5661-9e6a-0046d554d3a4" FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46" +TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990" diff -r cfd989fa71c3 -r 492a57594b88 README.md --- a/README.md Tue Aug 25 13:53:17 2020 +0300 +++ b/README.md Tue Aug 25 14:04:06 2020 +0300 @@ -40,7 +40,14 @@ This package is not and is not planned to be available via `Pkg.add` as it is based on the worst and must unusable version control system ever invented: Git. - [AlgTools]: https://tuomov.iki.fi/software/AlgTools/ +## Testing + +To run a simple denoising test using FISTA, use +```console +$ julia --project=DenoiseTest +julia> using DenoiseTest +julia> test_denoise() +``` - + [AlgTools]: https://tuomov.iki.fi/software/AlgTools/ diff -r cfd989fa71c3 -r 492a57594b88 test/denoise.jl --- a/test/denoise.jl Tue Aug 25 13:53:17 2020 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -################## -# Denoise testing -################## - -__precompile__() - -using Printf -using FileIO -using ColorTypes: Gray -# ColorVectorSpace is only needed to ensure that conversions -# between different ColorTypes are defined. -import ColorVectorSpace -import TestImages - -using AlgTools.Util -using AlgTools.LinkedLists -using ImageTools.Denoise -using ImageTools.Visualise - -const default_save_prefix="denoise_result_" - -const default_params = ( - α = 1, - # PDPS - # τ₀ = 5, - # σ₀ = 0.99/5, - # FISTA - τ₀ = 0.9, - ρ = 0, - accel = true, - noise_level = 0.5, - verbose_iter = 10, - maxiter = 1000, - save_results = false, - image_name = "lighthouse", - save_iterations = false -) - -####################### -# Main testing routine -####################### - -function test_denoise(; - visualise=true, - save_prefix=default_save_prefix, - kwargs...) - - - # Parameters for this experiment - params = default_params ⬿ kwargs - params = params ⬿ (save_prefix = save_prefix * params.image_name,) - - # Load image and add noise - b = Float64.(Gray{Float64}.(TestImages.testimage(params.image_name))) - b_noisy = b .+ params.noise_level.*randn(size(b)...) - - # Launch (background) visualiser - st, iterate = initialise_visualisation(visualise) - - # Run algorithm - x, y, st = denoise_fista(b_noisy; iterate=iterate, params=params) - - if params.save_results - perffile = params.save_prefix * ".txt" - println("Saving " * perffile) - write_log(perffile, st.log, "# params = $(params)\n") - fn = (t, ext) -> "$(params.save_prefix)_$(t).$(ext)" - save(File(format"PNG", fn("true", "png")), grayimg(b)) - save(File(format"PNG", fn("data", "png")), grayimg(b_noisy)) - save(File(format"PNG", fn("reco", "png")), grayimg(x)) - end - - # Exit background visualiser - finalise_visualisation(st) -end