Comments (2)
Right now, if you run the test in the latest commit here, you should get an error that AugmentationSequences are not callable. Of course, this makes sense because they don’t have a __call__
method, but the existing pipeline seems to treat them as if they did. I’m pretty sure this is erroring because at some point I removed the direct dependency onAugmentation from AugmentationSequence, but sequences are not functions and should not be applied.
I started a proof of concept fork for moving probability out of individual augmentations and into the pipeline here. I still need to remove all of the force
parameters from every __call__
method, and the corresponding if (self.should_run or force=True)
checks, but I got distracted exploring a much deeper refactor, in a new “composability” branch.
I want to do more work before I put this other branch up for review, but basically it removes most of the object structure and treats Augmentations (remember, these are just matrix operations under the hood) as first-class functions. The pipeline phases are then just lists (AugmentationSequences already are!) of Augmentations, with the AugmentationPipeline just reducing each phase-list over the input image to produce the dictionary of AugmentationResults.
from augraphy.
After thinking hard about this all week and reading documentation and source from other libraries in this space, I'm retracting this proposal and closing this issue. Much of what I intended above would be too far-reaching for our goals, and mostly should now be ignored. Here are some responses to stuff above, in no particular order:
- We want a familiar interface for users of other augmentation libraries, like Albumentations and Imgaug. Those libraries (and ours) use pipelines declared as a list of augmentation constructors passed to a pipeline constructor. In contrast, the initial proposal here would change the pipeline to a simple list of functions sequentially applied to the input, removing the object structure from augmentations entirely and moving responsibility for their execution elsewhere. This would be a dramatic change for a casual user.
- We want a familiar codebase for contributors to other augmentation libraries. Currently, the architectural style of this project and the others is similar enough that contributing to both should be a low-friction experience. The original proposal here would introduce a very different structure, and increase the contribution overhead for developers coming from those libraries.
- Composition at the level of augmentations can be achieved by producing a wrapper augmentation which calls the two (or more) being composed. This has the benefit that, while it would reduce the amount of code written in the pipeline declaration, all component augmentations will produce separate AugmentationResults in the final execution, allowing for more granular inspection of the pipeline process. Composing augmentations via their
__call__
methods (i.e., definingAugmentation2(Augmentation1(image))
would require a significant architectural change already voided by points 1 and 2 above. - Pipelines are currently composable in one way: for two AugmentationPipelines named
pipeline1
andpipeline2
, the callpipeline2.augment((pipeline1.augment(img)["output"]))
is their sequential composition. There's another sense of composition in which the phases of each pipeline would be interleaved, allowing for the ink phase ofpipeline2
to run after the ink phase ofpipeline1
, but before the paper phase ofpipeline1
. Similar to the case of point 3 above, this form of composition should be expressible via a more generic class that accepts the component AugmentationPipelines in its constructor. - Other libraries set the probability of running an augmentation in the constructor of the augmentation, and not externally in the pipeline as I originally wanted. Again, for conceptual compatibility with the ecosystem, we should not factor probability out of augmentations.
from augraphy.
Related Issues (20)
- Callable pipeline HOT 2
- Develop Augmentations that Simulate Images Taken by Camera Phone HOT 1
- Add Pattern-based Distortion Generator HOT 6
- Add `InkShifter` Augmentation to Shift Ink Pixels Randomly and Follow Background Shadows
- Add Wrinkled, Crumpled Paper Augmentation HOT 1
- Create Utility Function for Exposing Underlying Pixel Colors
- Empty Pipeline lowers image quality HOT 12
- Add Augmentation for Shadows Cast onto Camera-Sourced Document Images HOT 1
- Create Baseline Performance Benchmark; Apply Initial Optimizations Using Numba HOT 2
- Create Example Using Dataloader for PyTorch and TensorFlow HOT 1
- Add Python 3.11 Support, Drop Python 3.7 HOT 2
- Images Broken in PyPI Listing HOT 2
- Reflected Light from Camera Flash or other Bright Sources HOT 1
- Add Color Shifting / 3D Blur Effect HOT 4
- Improve PageBorder effect HOT 1
- Add support for bounding box, keypoints and mask. HOT 1
- Add `InkColorSwap` to Replace the Color Used for Lettering in a Document HOT 1
- Add `InkMottling` Augmentation to Ensure Ink is Non-Uniform HOT 1
- Add support for image with alpha layer. HOT 1
- Color range in InkBleed is not working 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 augraphy.