Giter Club home page Giter Club logo

Comments (2)

pokecheater avatar pokecheater commented on June 19, 2024

By the way the information I referenced above
I have from this page: https://imgaug.readthedocs.io/en/latest/source/examples_basics.html
image

from imgaug-doc.

pokecheater avatar pokecheater commented on June 19, 2024

To overcome problem number 2: I found an non intuitive workaround.
The solution is to interpret the first dimension also as channels. To do so I move the frames into the channel dimension:

This is done by moveaxis followed by a reshape (wheras the moved frame dimension will be combined with the given channel dimension)

image = np.moveaxis(image_origin, 0, -1)
image = image.reshape(
    image.shape[0],
    image.shape[1],
    image.shape[2] * image.shape[3]
)

For example:
if my image had the shape [3, 1024, 1024, 1] (3 Frames, height and width both 1024 pixel, and 1 channel) this lead first to [1024, 1024, 1, 3] and afterward to [1024, 1024, 3].

Since my frames are now inside the channel dimension the applied augmention over all channels are done with the same augmention values and my frames are all transformed at the same rate.
image_aug, polygons_aug = augmentation_flow(images=[image], polygons=polygons)

Afterwards, all I have to do is to revert that frames transformation (lucky as I am I stored the PIL image information in an img_meta dictionary).

  image_aug = image_aug[0].reshape(
      img_meta["size"][0],
      img_meta["size"][1],
      img_meta["channels"],
      img_meta["frames"],
  )

  image_aug = np.moveaxis(image_aug, -1, 0)

Works like a charm so far. :)

But the first problem with the different dtypes still persists. I am using uint16 images and the condition that all iamges must have numpy's dtype uint8 violates that. So why is it necessary to use uint8? I can not see any logical reason for this.

Thx in Advance :)

from imgaug-doc.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.