question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`MaybeApply` high order abstraction

See original GitHub issue

We should consider an implementation for a MaybeApply layer:

maybe_solarize = MaybeApply(Solarization(), rate=0.5)
# maybe_solarize solarizes half of the images passed to it

https://github.com/chjort/chambers/blob/b796f507b7353fb141b5c8b026b811a023d303e6/chambers/augmentations/image_augmentations.py#L514

Notes:

  • we can rely on this in RandomAugmentationPipeline
  • this must be element-wise, not batch wise!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
LukeWoodcommented, May 12, 2022

Got it, please let me know if you decide.

Personally I wouldn’t mind an option to create custom random layers.

It seems to me this is such a common pattern that we should include it.

I’ve seen:

if tf.random.uniform() > 0.5:
    # apply some augmentation

many times in my life, and this is actually incorrect if you are performing batched augmentation. By providing a proper implementation that does this on an element-wise basis, we are providing some value. I’m fairly sure we want this, let me confirm one more time tomorrow, but I am 90% sure this is an abstraction we want.

0reactions
LukeWoodcommented, May 14, 2022

FYI @sebastian-sz I’ve tagged this contribution welcome.

These high order components that take other components are a nice pattern.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Higher-order abstract syntax - Wikipedia
In computer science, higher-order abstract syntax (abbreviated HOAS) is a technique for the representation of abstract syntax trees for languages with ...
Read more >
Higher-Level versus Higher-Order Abstraction
Calculus is a higher-order abstraction that algebra. In fact, abstractions similar to the ones built with calculus are what I mean when I...
Read more >
Untitled
High -level API to access Play global features. Source: Play.scala ... def maybeApplication: Option[Application]. Optionally returns the current running ...
Read more >
Higher‐Order Abstraction Principles - Mount - 2015 - Thought
Cook demonstrated that the satisfiability of certain higher-order analogues of Hume's Principle is independent of ZFC. I show that similar ...
Read more >
Sendmail X: Functional Specification - Sendmail Open Source
This chapter describes the external functionality as well as the internal interfaces of sendmail X as much as required, i.e., for an implementation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found