From 2941113df55c8aae343139d9142dd4ee8a867a76 Mon Sep 17 00:00:00 2001 From: ton Date: Mon, 17 Apr 2023 01:35:43 +0700 Subject: [PATCH] comment out image augment in getindex --- src/ANNUtils.jl | 2 +- src/interface.jl | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ANNUtils.jl b/src/ANNUtils.jl index 4c3b5e7..5ab7cbe 100644 --- a/src/ANNUtils.jl +++ b/src/ANNUtils.jl @@ -1,6 +1,6 @@ module ANNUtils -export fileDataset +export filecontainer include("interface.jl") using .interface diff --git a/src/interface.jl b/src/interface.jl index 93a71c1..3fb8b7d 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -1,6 +1,6 @@ module interface -export fileDataset +export filecontainer using FileIO, Images @@ -22,21 +22,21 @@ using FileIO, Images # return DataLoader(data, batchsize, buffer, partial, shuffle, parallel, collate, rng) # end -struct fileContainer{T<:Vector{String}} +struct filecontainer filelist::Vector{String} # a vector of each filename - classIdLabel::Dict{Symbol, String} # Dict(:n03085219 => "computer_monitor") - classIdOrder::Dict{Symbol, Number} # Dict(:n03085219=> 7) + classIdLabel::Dict{Symbol, Any} # Dict(:n03085219 => "computer_monitor") + classIdOrder::Dict{Symbol, Any} # Dict(:n03085219=> 7) end -length(container::fileContainer) = length(container.filelist) +Base.length(container::filecontainer) = length(container.filelist) -function getindex(container::fileContainer, idx::Int) +function Base.getindex(container::filecontainer, idx::Int) path = container.filelist[idx] - classId = split(path, ".")[1] + classId = split(path, "_")[1] _img = Images.load(path) - _img = itemdata(apply(tfm, Image(_img))) + # _img = apply(tfm, Image(_img)) # augment an image img = collect(channelview(float32.(RGB.(_img)))) # img = (img .- mean(img)) ./ std(img) # normalize the image img = permutedims(img, (3, 2, 1))