Skip to content

Error in reproducing the "Data containers" tutorial: "key :nothing not found" #209

Description

@ShuhuaGao

I run the following code in Data containers in a Jupyter notebook in VS code.

using FastAI
import FastAI: Image
data, _ = loaddataset("imagenette2-160", (Image, Label))

image, class = obs = getobs(data, 1)
@show class
image

The image cannot be displayed properly with the error info below.

KeyError: key :nothing not found

Stacktrace:
  [1] getindex(h::Dict{Symbol, Int64}, key::Symbol)
    @ Base ./dict.jl:481
  [2] _parse_color
    @ ~/.julia/packages/Crayons/u3AH8/src/crayon.jl:143 [inlined]
  [3] #Crayon#1
    @ ~/.julia/packages/Crayons/u3AH8/src/crayon.jl:171 [inlined]
  [4] encodeimg(::ImageInTerminal.SmallBlocks, colordepth::ImageInTerminal.TermColor256, img::PermutedDimsArray{RGB{FixedPointNumbers.N0f8}, 2, (2, 1), (2, 1), Matrix{RGB{FixedPointNumbers.N0f8}}}, maxheight::Int64, maxwidth::Int64)
    @ ImageInTerminal ~/.julia/packages/ImageInTerminal/aJGpm/src/encodeimg.jl:65
  [5] imshow(io::IOContext{IOBuffer}, img::PermutedDimsArray{RGB{FixedPointNumbers.N0f8}, 2, (2, 1), (2, 1), Matrix{RGB{FixedPointNumbers.N0f8}}}, colordepth::ImageInTerminal.TermColor256, maxsize::Tuple{Int64, Int64})
    @ ImageInTerminal ~/.julia/packages/ImageInTerminal/aJGpm/src/imshow.jl:31
  [6] imshow(io::IOContext{IOBuffer}, img::PermutedDimsArray{RGB{FixedPointNumbers.N0f8}, 2, (2, 1), (2, 1), Matrix{RGB{FixedPointNumbers.N0f8}}}, colordepth::ImageInTerminal.TermColor256)
    @ ImageInTerminal ~/.julia/packages/ImageInTerminal/aJGpm/src/imshow.jl:26
  [7] show(io::IOContext{IOBuffer}, mime::MIME{Symbol("text/plain")}, img::PermutedDimsArray{RGB{FixedPointNumbers.N0f8}, 2, (2, 1), (2, 1), Matrix{RGB{FixedPointNumbers.N0f8}}})
    @ ImageInTerminal ~/.julia/packages/ImageInTerminal/aJGpm/src/ImageInTerminal.jl:67
  [8] limitstringmime(mime::MIME{Symbol("text/plain")}, x::PermutedDimsArray{RGB{FixedPointNumbers.N0f8}, 2, (2, 1), (2, 1), Matrix{RGB{FixedPointNumbers.N0f8}}})
    @ IJulia ~/.julia/packages/IJulia/e8kqU/src/inline.jl:43
  [9] display_mimestring
    @ ~/.julia/packages/IJulia/e8kqU/src/display.jl:71 [inlined]
 [10] display_dict(x::PermutedDimsArray{RGB{FixedPointNumbers.N0f8}, 2, (2, 1), (2, 1), Matrix{RGB{FixedPointNumbers.N0f8}}})
    @ IJulia ~/.julia/packages/IJulia/e8kqU/src/display.jl:102
 [11] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [12] invokelatest
    @ ./essentials.jl:714 [inlined]
 [13] execute_request(socket::ZMQ.Socket, msg::IJulia.Msg)
    @ IJulia ~/.julia/packages/IJulia/e8kqU/src/execute_request.jl:112
 [14] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [15] invokelatest
    @ ./essentials.jl:714 [inlined]
 [16] eventloop(socket::ZMQ.Socket)
    @ IJulia ~/.julia/packages/IJulia/e8kqU/src/eventloop.jl:8
 [17] (::IJulia.var"#15#18")()
    @ IJulia ./task.jl:423

Note that I can display a normal color matrix (i.e., an image) successfully like rand(RGB{Colors.N0f8}, 3, 3).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions