Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageToTensor doesn't support RGBA #83

Closed
oluwandabira opened this issue Oct 3, 2023 · 1 comment
Closed

ImageToTensor doesn't support RGBA #83

oluwandabira opened this issue Oct 3, 2023 · 1 comment

Comments

@oluwandabira
Copy link

Minimal example:

using DataAugmentation, Images

image = Image(rand(RGBA, 50, 50))
tfm = ImageToTensor()
apply(tfm, image)

which results in

ERROR: LoadError: MethodError: no method matching imagetotensor(::Matrix{RGBA{Float64}}, ::Type{Float32})

Closest candidates are:
  imagetotensor(::AbstractArray{C, N}, ::Any) where {C<:Color, N}

Pkg.status():

[88a5189c] DataAugmentation v0.2.11
[916415d5] Images v0.26.0
@paulnovo
Copy link
Collaborator

paulnovo commented Oct 25, 2024

@oluwandabira I think this has already been fixed by relaxing the type from Color to Colorant in imagetotensor.

With DataAugmentation v0.3.2:

julia> using DataAugmentation, Colors, Images

julia> RGBA<:Color
false

julia> RGBA<:Colorant
true

julia> image = Image(rand(RGBA, 50, 50))
Image{2, RGBA{Float64}}() with bounds Bounds(1:50×1:50)

julia> tfm = ImageToTensor()
ImageToTensor{Float32}()

julia> apply(tfm, image)
ArrayItem{3, Float32}() of size (50, 50, 4)

@paulnovo paulnovo closed this as completed Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants