comment out image augment in getindex
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
module ANNUtils
|
module ANNUtils
|
||||||
|
|
||||||
export fileDataset
|
export filecontainer
|
||||||
|
|
||||||
include("interface.jl")
|
include("interface.jl")
|
||||||
using .interface
|
using .interface
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module interface
|
module interface
|
||||||
|
|
||||||
export fileDataset
|
export filecontainer
|
||||||
|
|
||||||
using FileIO, Images
|
using FileIO, Images
|
||||||
|
|
||||||
@@ -22,21 +22,21 @@ using FileIO, Images
|
|||||||
# return DataLoader(data, batchsize, buffer, partial, shuffle, parallel, collate, rng)
|
# return DataLoader(data, batchsize, buffer, partial, shuffle, parallel, collate, rng)
|
||||||
# end
|
# end
|
||||||
|
|
||||||
struct fileContainer{T<:Vector{String}}
|
struct filecontainer
|
||||||
filelist::Vector{String} # a vector of each filename
|
filelist::Vector{String} # a vector of each filename
|
||||||
classIdLabel::Dict{Symbol, String} # Dict(:n03085219 => "computer_monitor")
|
classIdLabel::Dict{Symbol, Any} # Dict(:n03085219 => "computer_monitor")
|
||||||
classIdOrder::Dict{Symbol, Number} # Dict(:n03085219=> 7)
|
classIdOrder::Dict{Symbol, Any} # Dict(:n03085219=> 7)
|
||||||
end
|
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]
|
path = container.filelist[idx]
|
||||||
classId = split(path, ".")[1]
|
classId = split(path, "_")[1]
|
||||||
|
|
||||||
_img = Images.load(path)
|
_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 = collect(channelview(float32.(RGB.(_img))))
|
||||||
# img = (img .- mean(img)) ./ std(img) # normalize the image
|
# img = (img .- mean(img)) ./ std(img) # normalize the image
|
||||||
img = permutedims(img, (3, 2, 1))
|
img = permutedims(img, (3, 2, 1))
|
||||||
|
|||||||
Reference in New Issue
Block a user