JuliaImages/ImageEdgeDetection.jl

detect_edges() BoundsError: attempt to access 16-element Vector{Matrix{Float64}} at index [17]

Opened this issue · 3 comments

Hello,

I encountered an error while attempting to use the detect_edges() function on FashionMNIST images.

Here's a test case:

using MLDatasets: FashionMNIST
using ImageEdgeDetection: Canny, detect_edges


x_train = [xy.features for xy in FashionMNIST(:train)]

for x in x_train
    println(size(x))
    detect_edges(x, Canny(spatial_scale=3))
end

The result:

(28, 28)
(28, 28)
(28, 28)
ERROR: LoadError: TaskFailedException

    nested task error: BoundsError: attempt to access 16-element Vector{Matrix{Float64}} at index [17]

Thank you, I'll try to look into this in the coming days.

I can't reproduce your error. Running the code snippet you posted works just fine, regardless of whether I launch Julia with a single or multiple threads.

Can you confirm you are getting this error for the exact same snippet you just posted? I'm surprised you are getting a TaskFailedException when you are not spawning a task.

Please could you post your Julia version (via versioninfo()), the number of threads you started Julia with (by typing using Base.Threads followed by nthreads() as well as the output of ] st in the Julia environment in which you are running into this error.

Well, you a right. It looks like problem in interactive threads:

$ julia --project=. -O3 -t 32,1 test.jl
Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 32 × AMD Ryzen 9 7950X3D 16-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
Threads: 32 default, 1 interactive, 16 GC (on 32 virtual cores)
nothing
(28, 28)
(28, 28)
(28, 28)
(28, 28)
(28, 28)
(28, 28)
(28, 28)
(28, 28)
(28, 28)
(28, 28)
(28, 28)
(28, 28)
ERROR: LoadError: TaskFailedException

    nested task error: BoundsError: attempt to access 32-element Vector{Matrix{Float64}} at index [33]
    Stacktrace:

However,

julia --project=. -O3 -t 32 test.jl

works fine.