You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Julia version 1.3.0-rc3 and ImageSegmentation v1.2.0 on Ubuntu 18.04.3 LTS.
Error message:
ArgumentError: PriorityQueue keys must be unique
Stacktrace:
[1] enqueue!(::DataStructures.PriorityQueue{DataStructures.Queue{CartesianIndex{2}},Float64,Base.Order.ForwardOrdering}, ::Pair{DataStructures.Queue{CartesianIndex{2}},Float64}) at /home/miriam/.julia/packages/DataStructures/RbN5c/src/priorityqueue.jl:236
[2] enqueue! at /home/miriam/.julia/packages/DataStructures/RbN5c/src/priorityqueue.jl:251 [inlined]
[3] seeded_region_growing(::Array{Gray{Normed{UInt8,8}},2}, ::Array{Tuple{CartesianIndex{2},Int64},1}, ::ImageSegmentation.var"#18#22"{CartesianIndex{2}}, ::typeof(ImageSegmentation.default_diff_fn)) at /home/miriam/.julia/packages/ImageSegmentation/KDHwp/src/region_growing.jl:142
[4] seeded_region_growing(::Array{Gray{Normed{UInt8,8}},2}, ::Array{Tuple{CartesianIndex{2},Int64},1}, ::Tuple{Int64,Int64}, ::Function) at /home/miriam/.julia/packages/ImageSegmentation/KDHwp/src/region_growing.jl:64
[5] seeded_region_growing at /home/miriam/.julia/packages/ImageSegmentation/KDHwp/src/region_growing.jl:57 [inlined] (repeats 2 times)
[6] top-level scope at In[23]:2
Analysis:
It can happen that nhq is exactly the same for several iterations. If the region means get updated in between the iterations, then in line 142 of region_growing.jl the same queue is tried to be enqueued into the priority queue again, which is not allowed.
Solution: use pq[q]=\delta instead of enqueue!(pq,q,\delta)
The priority queue allows for efficient updates of priorities for elements in the queue by using pq[q]=\delta instead of enqueue!(pq,q,\delta). This also renders checking the dictionary qdict redundant. With this functionality it also makes more sense to insert the pixels itself rather than queues of pixels into the priority queue. The priority queue becomes shorter this way and one avoids looping through a lot of already processed / labelled pixels again. Parallel processing of pixels with the same priority can still be achieved by looping through the priority queue until the lowest priority changes.
Pull request to resolve the issue is forthcoming.
The text was updated successfully, but these errors were encountered:
MiriamHinzen
pushed a commit
to MiriamHinzen/ImageSegmentation.jl
that referenced
this issue
Oct 20, 2019
Updates priorities for elements in pq instead of enqueuing again.
Enqueues pixels instead of queues of pixels into pq.
Removes now redundant dictionary qdict.
Adds test.
Updates priorities for elements in pq instead of enqueuing again.
Enqueues pixels instead of queues of pixels into pq.
Removes now redundant dictionary qdict.
Adds test.
...when the function is called for
using Julia version 1.3.0-rc3 and ImageSegmentation v1.2.0 on Ubuntu 18.04.3 LTS.
Error message:
Analysis:
It can happen that
nhq
is exactly the same for several iterations. If the region means get updated in between the iterations, then in line 142 of region_growing.jl the same queue is tried to be enqueued into the priority queue again, which is not allowed.Solution: use
pq[q]=\delta
instead ofenqueue!(pq,q,\delta)
The priority queue allows for efficient updates of priorities for elements in the queue by using
pq[q]=\delta
instead ofenqueue!(pq,q,\delta)
. This also renders checking the dictionaryqdict
redundant. With this functionality it also makes more sense to insert the pixels itself rather than queues of pixels into the priority queue. The priority queue becomes shorter this way and one avoids looping through a lot of already processed / labelled pixels again. Parallel processing of pixels with the same priority can still be achieved by looping through the priority queue until the lowest priority changes.Pull request to resolve the issue is forthcoming.
The text was updated successfully, but these errors were encountered: