-
Notifications
You must be signed in to change notification settings - Fork 21
Update to ImageCore 0.9 #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
My first impression of # a slightly different implementation
function my_findlocalmaxima(X)
mask = mapwindow(CartesianIndices(X), (3, 3)) do Rp
p = X[Rp[OffsetArrays.center(Rp)...]]
all(q->p >= q, view(X, Rp))
end
out = CartesianIndices(X)[mask]
end |
Move in progress. I do think we want to keep these since they have some advantages: julia> img = rand(100,100);
julia> @btime findlocalmaxima($img);
378.800 μs (10013 allocations: 377.05 KiB)
julia> @btime my_findlocalmaxima($img);
3.532 ms (76365 allocations: 2.39 MiB) (EDIT: and fixing an inferrability problem revealed by this demo reduces the time by more than another factor of 2.) Aside from speed, What to do about |
I'll make a new implementation in ImageNoise. JuliaImages/Images.jl#755 years later I think I'm ready to make a fastest implementation :) |
ae47f03
to
7c62698
Compare
7c62698
to
a3b35b1
Compare
Here's a question: the package only requires ImageFiltering 0.6 or higher, but the tests require ImageFiltering 0.7. How should we handle the |
Pkg resolver will automatically use the latest version, right? Or are you worried about the tests on ImageFiltering v0.6? I think this is an issue of all packages; IIUC Julia doesn't have a test tool to run thorough compatibility tests. |
Right, as long as there's no blocker then it will use the latest and pass the tests, which is why I left the Should I add a comment at the top of the watershed test file? Or are we good with interpreting the problem and should just keep as-is? |
Instead of leaving a comment, we should mark them as conditional test groups using if branch. That if we ever have the chance to bring a comprehensive compatibility test, we don't see a failure there. But this isn't something important right now IMHO |
Sounds good. Ready to merge and tag a new release? |
It's your call 😄 |
😆 I will go through the examples in the docs and make sure they all still work... |
Yep! Small differences for felzenswalb and perhaps others (mostly likely because of the division by 3 in |
Hmm, it occurs to me that the division by 3 is effectively breaking for older scripts. The transition to ImageCore 0.9 (and specifically, the new consistency in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the next release be a 2.0 release? In which case we want to wait until we make more breaking API changes.
This depends on how quickly we want to bump the entire JuliaImages to ImageCore v0.9. If you can wait for more time until other PRs are done then it's totally okay to me. Another solution is to still use the mapreducec(v->float(v)^2, +, 0, c)
definition, which unblocks ImageSegmentation release pipeline.
accum_type(val) = isa(val, Type) ? throw_accum_type(val) : convert(accum_type(typeof(val)), val) | ||
throw_accum_type(T) = error("type $T not supported in `accum_type`") | ||
|
||
_abs2(c::MathTypes) = c ⋅ c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe stick to the old usage for now?
_abs2(c::MathTypes) = c ⋅ c | |
_abs2(c::MathTypes) = mapreducec(v->float(v)^2, +, 0, c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems to fix things, by and large. The few differences:
- the horse demo with
felzenszwalb(img, 100)
merges grass and sky, resulting in a dull gray used for both. That's true here (with your suggested change) and on the released version of the package. Both also give 43 segments, making me think that this probably changed some time ago but the image in the docs hasn't been updated.felzenszwalb(img, 10)
produces the result shown in the image. - There's now an off-by-one in the number of segments in https://juliaimages.org/stable/pkgs/segmentation/#Fast-Scanning (2539 instead of 2538, and 64 instead of 65). There is no visible change in the quality of the result, so to me that seems acceptable.
- New Julia releases change the order of random numbers for a given seed, and hence the coloration of images for the demos using
get_random_color
.
This drops Images entirely, but doesn't pass tests. There are three issues, all in the watershed test:
magnitude_phase
, which AFAICT is mostly to generate a box. I've prepared a substitute.TODO:findlocalminima
is still needed from Images. I'm tempted to move nearly everything out of Images and make it a pure meta-package. If people like that, I can think of two places, ImageBase and ImageFiltering. Thoughts?closes #71