Comments (2)
By the way the information I referenced above
I have from this page: https://imgaug.readthedocs.io/en/latest/source/examples_basics.html
from imgaug-doc.
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)
- Confusing info on JPG Compression HOT 1
- Callable Object HOT 4
- Augmenting data that was annotated using COCO format HOT 2
- AssertionError: Expected number of channels to be three, got 3 channels with shape (512, 512, 1). HOT 1
- Conda install doesnt work HOT 1
- Exporting seq to json
- Inverse is needed for object detection
- AttributeError: module 'imgaug' has no attribute 'imshow' HOT 2
- Question : Does imgaug support combining two or more images together as part of augmentation? HOT 1
- Docu update bbs attribute label
- do we have reversible (equivariant) augmentation in here?
- colab mportError: cannot import name 'SegmentationMapsOnImage' from 'imgaug.augmentables.segmaps' (/usr/local/lib/python3.7/dist-packages/imgaug/augmentables/segmaps.py)
- imgaug.py:2120: MatplotlibDeprecationWarning: The set_window_title function was deprecated
- bounding boxes leaving and entering again the image
- LaTeX at notebooks/A02 doesn't work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgaug-doc.