Closed johnnychen94 closed 5 years ago
Thank you Johnny for the improvements. Just make sure that hausdorff supports N dimensional images. It is not restricted to 2D.
Best,
On Sat, May 4, 2019, 08:55 Johnny Chen notifications@github.com wrote:
The following distances supports Color3 image input:
- SqEuclidean
- Euclidean
- Cityblock
- Minkowski
- Hamming
- TotalVariation
By default, each pixel is treated as a 3d point. If we want to calculate the channelwise distances, we can channelview(a) first.
- Hausdorff distance supports Gray2dimage{Bool}
- CIEDE distance for AbstractArray{<:Number} type inputs is restricted to 2d array, which is regarded as Gray image.
You can view, comment on, or merge this pull request online at:
https://github.com/JuliaImages/ImageDistances.jl/pull/19 Commit Summary
- rename gray image test references
- add Color support
File Changes
- M src/ImageDistances.jl https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-0 (5)
- M src/ciede2000.jl https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-1 (15)
- M src/generic.jl https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-2 (11)
- M src/metrics.jl https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-3 (24)
- M test/ciede2000.jl https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-4 (30)
- M test/hausdorff.jl https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-5 (54)
- M test/metrics.jl https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-6 (27)
- D test/references/CIEDE2000.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-7 (1)
- A test/references/CIEDE2000_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-8 (1)
- A test/references/CIEDE2000_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-9 (1)
- R test/references/Cityblock_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-10 (0)
- A test/references/Cityblock_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-11 (1)
- A test/references/Cityblock_channelwise_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-12 (1)
- R test/references/Euclidean_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-13 (0)
- A test/references/Euclidean_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-14 (1)
- A test/references/Euclidean_channelwise_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-15 (1)
- R test/references/Hamming_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-16 (0)
- A test/references/Hamming_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-17 (1)
- A test/references/Hamming_channelwise_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-18 (1)
- R test/references/Hausdorff_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-19 (0)
- R test/references/MeanAbsDeviation_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-20 (0)
- R test/references/MeanSqDeviation_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-21 (0)
- R test/references/Minkowski{Float64}_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-22 (0)
- A test/references/Minkowski{Float64}_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-23 (1)
- A test/references/Minkowski{Float64}_channelwise_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-24 (1)
- R test/references/ModifiedHausdorff_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-25 (0)
- R test/references/NormRMSDeviation_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-26 (0)
- R test/references/RMSDeviation_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-27 (0)
- R test/references/SqEuclidean_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-28 (0)
- A test/references/SqEuclidean_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-29 (1)
- A test/references/SqEuclidean_channelwise_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-30 (1)
- R test/references/TotalVariation_Color1.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-31 (0)
- A test/references/TotalVariation_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-32 (1)
- A test/references/TotalVariation_channelwise_Color3.txt https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-33 (1)
- M test/testutils.jl https://github.com/JuliaImages/ImageDistances.jl/pull/19/files#diff-34 (6)
Patch Links:
- https://github.com/JuliaImages/ImageDistances.jl/pull/19.patch
- https://github.com/JuliaImages/ImageDistances.jl/pull/19.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JuliaImages/ImageDistances.jl/pull/19, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZQW3OYSIUPPGAUEMJGLP3PTV2TLANCNFSM4HKYXNZA .
Merging #19 into master will decrease coverage by
1.71%
. The diff coverage is52.94%
.
@@ Coverage Diff @@
## master #19 +/- ##
==========================================
- Coverage 65.26% 63.55% -1.72%
==========================================
Files 5 5
Lines 95 107 +12
==========================================
+ Hits 62 68 +6
- Misses 33 39 +6
Impacted Files | Coverage Δ | |
---|---|---|
src/ImageDistances.jl | 50% <ø> (ø) |
:arrow_up: |
src/generic.jl | 87.8% <0%> (-6.94%) |
:arrow_down: |
src/ciede2000.jl | 90% <100%> (+18.57%) |
:arrow_up: |
src/metrics.jl | 55.55% <50%> (-44.45%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update ebb962d...0f68eff. Read the comment docs.
Hausdorff
distance is quite generic as a distance between sets, but will that makes sense to images? My question is: how do we interpret 3d Gray{Bool} Images?
It is defined for point sets in N dimensions. In 2D the points are the black pixels. In 3D the points are the black voxels. Makes sense?
On Sat, May 4, 2019, 09:11 Johnny Chen notifications@github.com wrote:
Hausdorff distance is quite generic as a distance between sets, but will that makes sense to images? My question is: how do we interpret 3d Gray{Bool} Images?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JuliaImages/ImageDistances.jl/pull/19#issuecomment-489321452, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZQW3MUV6MQ7UQ3ETXYF2LPTV4NTANCNFSM4HKYXNZA .
If you are asking about the image type then we need to use a type that supports the idea of 3 axes and then each entry is a bool value. I'm not up to date with the image types at the moment.
On Sat, May 4, 2019, 09:22 Júlio Hoffimann julio.hoffimann@gmail.com wrote:
It is defined for point sets in N dimensions. In 2D the points are the black pixels. In 3D the points are the black voxels. Makes sense?
On Sat, May 4, 2019, 09:11 Johnny Chen notifications@github.com wrote:
Hausdorff distance is quite generic as a distance between sets, but will that makes sense to images? My question is: how do we interpret 3d Gray{Bool} Images?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JuliaImages/ImageDistances.jl/pull/19#issuecomment-489321452, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZQW3MUV6MQ7UQ3ETXYF2LPTV4NTANCNFSM4HKYXNZA .
my concern is that the third channel of AbstractArray{Gray{Bool}, 3}
can have any of the following meanings:
Hausdorff
Vector{Array{Bool, 2}}
So I think it's better to let potential 3D-image-processing packages to do this job. How do you think?
I need hausdorff in 3D in my use cases. Please do not constrain the algorithm at this point. If there is an issue regarding the image types we need to fix it first. I don't see how the semantics would affect the application of the distance. The user will know when it makes sense to call a distance on a 3D image. If any of the axes means something different that is not a spatial coordinate he/she should not call the distance at this point.
On Sat, May 4, 2019, 09:36 Johnny Chen notifications@github.com wrote:
my concern is that the third channel of AbstractArray{Gray{Bool}, 3} can have any of the following meanings:
- time
- literally 3D image of 3D object -- Only this makes sense to Hausdorff
- sample: Vector{Array{Bool, 2}}
So I think it's better to let potential 3D-image-processing packages to do this job. How do you think?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JuliaImages/ImageDistances.jl/pull/19#issuecomment-489323178, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZQW3IMYDVSPLWISDP6SC3PTV7NLANCNFSM4HKYXNZA .
Good point. Other distances have the same issues.
Bad news is these restrictions are made in the last redesign PR (not this one), and it's already tagged a release (v0.2.2
)
I'll fix it later and bump a release.
Thank you. For future reference, it is always a good idea to ask before removing features. I've noticed that you are cleaning up the code which is great. But sometimes it is good to check to see if people need the feature before committing changes.
Cheers
On Sat, May 4, 2019, 09:47 Johnny Chen notifications@github.com wrote:
Good point. Other distances have the same issues.
Bad news is these restrictions are made in the last redesign PR (not this one), and it's already tagged a release (v0.2.2)
I'll fix it later and bump a release.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JuliaImages/ImageDistances.jl/pull/19#issuecomment-489323961, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZQW3PRLKCOLGTS2XKDGADPTWAW7ANCNFSM4HKYXNZA .
Sorry for bringing the trouble, didn't notice it.
Another big change is the removal of ImagePreMetric
, ImageSemiMetric
and ImageMetric
.
my concern is that the third channel of AbstractArray{Gray{Bool}, 3} can have any of the following meanings:
We have mechanisms in place for this already:
view(img, Axis{:time}(15))
Just Work to collect a time-slice no matter how many spatial dimensions img
has. We do this routinely in my lab's work. (And it is one of the ways that, for certain things, JuliaImages is way ahead of the competition...) Vector{Array{Bool, 2}}
: not sure what you mean here. In that case it's not an AbstractArray{Bool, 3}
, no?Thanks for the explanation,
Vector{Array{Bool, 2}}
is just a random collection(batch) of Array{Bool,2}
images. Most deep learning frameworks interpret 4-D array with WHCB
(width, height, channel, batch) convention.
I'd like to merge this PR if there's no further feedback since the numerical test says it's good. Then fixes the 3D problem in the next PR.
Vector{Array{Bool, 2}} is just a random collection(batch) of Array{Bool,2} images.
Right. Just saying, that's not really ambiguous because as far as Julia is concerned it's not the same as a 3d array.
Most deep learning frameworks interpret 4-D array with WHCB (width, height, channel, batch) convention.
It would be fine to have a whcb(img)
function which puts it in this form, but hard-coded interpretations for specific dimensionalities (or dimensions with particular sizes, as in Matlab's "anything of size 3 must be a color dimension") feels like a 1980s-era hack. GPU programming---which drives deep learning frameworks---is still pretty much using 1980s-era constructs (e.g., native 4D arrays on the GPU, anyone?), though it has improved a lot lately.
The following distances supports
Color3
image input:SqEuclidean
Euclidean
Cityblock
Minkowski
Hamming
TotalVariation
By default, each pixel is treated as a 3d point. If we want to calculate the channelwise distances, we can
channelview(a)
first.As for other distances:
Hausdorff
distance supportsGray2dimage{Bool}
onlyCIEDE2000
distance forAbstractArray{<:Number}
type inputs is restricted to 2d array, which is regarded as Gray image.