Skip to content

DataAugmentation error with masks #104

@cirobr

Description

@cirobr

Cheers,

I’m receiving an error when augmenting masks prior to training a model for semantic segmentation. Consider img as RGB image matrix. Consider mask as a matrix with integer elements from 1 to 11. Code is as follows:

item1 = Image(img)
item2 = MaskMulti(mask)

tfm = Maybe(FlipX{2}()) |> Rotate(15) |> Zoom((1.0, 1.2)) |>
      AdjustBrightness(0.3) |> AdjustContrast(0.3) |>
      CenterCrop((256,256))
img_tf = apply(tfm, (item1, item2))

Error message as follows:

ERROR: MethodError: no method matching length(::DataAugmentation.MaskMulti{2, Int64, Int64})
The function `length` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  length(::LLVM.ArrayType)
   @ LLVM ~/.julia/packages/LLVM/iza6e/src/core/type.jl:343
  length(::DataStructures.EnumerateAll)
   @ DataStructures ~/.julia/packages/DataStructures/IrAJn/src/multi_dict.jl:96
  length(::LLVM.ConstantArray)
   @ LLVM ~/.julia/packages/LLVM/iza6e/src/core/value/constant.jl:421
  ...

The error disappears in the following conditions:

  1. If the transformation is restricted to the image only.
  2. If the transformation is applied to image and mask, but the command line corresponding to AdjustBrightness and AdjustContrast is commented out.

Thanks for advising.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions