when i read the trained parameter of vgg16, there occurs some problem.
julia> function getWeights(file)
layers=get(file,"layers","")
meta=get(file,"meta","")
weights=Dict()
weights["par"]=16
for la in layers
name=SubString(get(la,"name",""),1,4)
layerth=SubString(get(la,"name",""),5,5)
lastsyn=SubString(get(la,"name",""),5)
if name=="conv"
weights[string("w",lastsyn)]=la["weights"][1]
weights[string("b",lastsyn)]=la["weights"][2]
elseif name=="fc6"
weights["w6"]=la["weights"][1]
weights["b6"]=la["weights"][2]
return weights
end
# println(la["name"])
end
end
getWeights (generic function with 1 method)
julia> weight=getWeights(file);
ERROR: BoundsError: attempt to access "fc6"
at index [1:4]
Stacktrace:
[1] checkbounds at ./strings/basic.jl:193 [inlined]
[2] Type at ./strings/substring.jl:30 [inlined]
[3] SubString(::String, ::Int64, ::Int64) at ./strings/substring.jl:38
[4] getWeights(::Dict{String,Any}) at ./REPL[249]:7
[5] top-level scope at none:0