I tried this code snippet from the book (…springboard to machine learning for all ages):
using Metalhead: VGG19, preprocess, load, labels using Flux: onecold model = VGG19() class_labels = labels(model) print("Enter the name of your file: ") user_image = preprocess(load(readline())) model_prediction = model(user_image) top_class = onecold(model_prediction) class_name = labels[top_class] println("I think this is $(class_name)")
But then I got this error message:
julia> include("test09.jl") Enter the name of your file: mouse.jpg ERROR: LoadError: MethodError: no method matching getindex(::typeof(labels), ::Int64) Stacktrace:  top-level scope at C:\julia\julia-1.3.1\examples\test09.jl:11  include at .\boot.jl:328 [inlined]  include_relative(::Module, ::String) at .\loading.jl:1105  include(::Module, ::String) at .\Base.jl:31  include(::String) at .\client.jl:424  top-level scope at none:0 in expression starting at C:\julia\julia-1.3.1\examples\test09.jl:11
Unfortunately I could not resolve this issue.
It would be great, if someone could give me some help on this problem. I really got stuck.