-
Notifications
You must be signed in to change notification settings - Fork 45
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
ConvertEltype(Gray)
not working as expect anymore
#17
Comments
Seems to only be an issue if followed by a SplitChannel(). I suspect the issue is somewhere upstream with |
Augmentor.jl/src/operations/convert.jl Lines 54 to 60 in 6055db7
A simple decision could be: if storage type Update: This would cause type-instability so it doesn't work. |
I guess it's no longer an issue now. @Evizero does this look good to you? julia> @inferred(augment(img, ConvertEltype(Gray))) |> summary # Gray{Any}
"300×400 Array{Gray{Any},2} with eltype Gray"
julia> pl = SplitChannels() |> ConvertEltype(Gray)
2-step Augmentor.ImmutablePipeline:
1.) Split colorant into its color channels
2.) Convert eltype to Gray{Any}
julia> @inferred(augment(img, pl)) |> summary # Gray{N0f8}
"4×300×400 Array{Gray{N0f8},3} with eltype Gray{Normed{UInt8,8}}" |
Just a brief comment, instead of |
As suggested by @timholy in Evizero#17, this commit changes `mappedarray(c->convert(T,c), img)` to `of_eltype(T, img)`. It results into `MappedArray` instead of `ReadonlyMappedArray`, and it is more descriptive too. This commit does not deal with Evizero#17, but I can confirm that the issue seems to be fixed already (which @johnnychen94 noticed before) and can be closed: ```julia julia> using Augmentor, Test julia> img = testpattern(); julia> @inferred(augment(img, ConvertEltype(Gray))) |> summary # Gray{Any} "300×400 Array{Gray,2} with eltype Gray" julia> pl = SplitChannels() |> ConvertEltype(Gray) 2-step Augmentor.ImmutablePipeline: 1.) Split colorant into its color channels 2.) Convert eltype to Gray julia> @inferred(augment(img, pl)) |> summary # Gray{N0f8} "4×300×400 Array{Gray{N0f8},3} with eltype Gray{FixedPointNumbers.N0f8}" ```
As suggested by @timholy in Evizero#17, this commit changes `mappedarray(c->convert(T,c), img)` to `of_eltype(T, img)`. It results into `MappedArray` instead of `ReadonlyMappedArray`, and it is more descriptive too. This commit does not deal with Evizero#17, but I can confirm that the issue seems to be fixed already (which @johnnychen94 noticed before) and can be closed: ```julia julia> using Augmentor, Test julia> img = testpattern(); julia> @inferred(augment(img, ConvertEltype(Gray))) |> summary # Gray{Any} "300×400 Array{Gray,2} with eltype Gray" julia> pl = SplitChannels() |> ConvertEltype(Gray) 2-step Augmentor.ImmutablePipeline: 1.) Split colorant into its color channels 2.) Convert eltype to Gray julia> @inferred(augment(img, pl)) |> summary # Gray{N0f8} "4×300×400 Array{Gray{N0f8},3} with eltype Gray{FixedPointNumbers.N0f8}" ```
As suggested by @timholy in Evizero#17, this commit changes `mappedarray(c->convert(T,c), img)` to `of_eltype(T, img)`. It results into `MappedArray` instead of `ReadonlyMappedArray`, and it is more descriptive too. This commit does not deal with Evizero#17, but I can confirm that the issue seems to be fixed already (which @johnnychen94 noticed before) and can be closed: ```julia julia> using Augmentor, Test julia> img = testpattern(); julia> @inferred(augment(img, ConvertEltype(Gray))) |> summary # Gray{Any} "300×400 Array{Gray,2} with eltype Gray" julia> pl = SplitChannels() |> ConvertEltype(Gray) 2-step Augmentor.ImmutablePipeline: 1.) Split colorant into its color channels 2.) Convert eltype to Gray julia> @inferred(augment(img, pl)) |> summary # Gray{N0f8} "4×300×400 Array{Gray{N0f8},3} with eltype Gray{FixedPointNumbers.N0f8}" ```
I confirm that the issue is gone. See #95, which implements a few test cases for this. |
It seems that for some reason or another, leaving the inner type open for
Gray
now causes fatal issues with inference. Will either have to force user to be specific withConvertEltype(Gray{INNER})
or see if I can fix this.The text was updated successfully, but these errors were encountered: