comment out image augment in getindex

This commit is contained in:
ton
2023-04-17 01:35:43 +07:00
parent e33117c3c6
commit 2941113df5
2 changed files with 9 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
module ANNUtils
export fileDataset
export filecontainer
include("interface.jl")
using .interface

View File

@@ -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))