rua
Equalize
¶
Bases: NumpyOp
Equalize the image histogram.
This is a wrapper for functionality provided by the PIL library: https://github.com/python-pillow/Pillow/tree/master/src/PIL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
Union[str, Iterable[str]]
|
Key(s) of images to be modified. |
required |
outputs |
Union[str, Iterable[str]]
|
Key(s) into which to write the modified images. |
required |
mode |
Union[None, str, Iterable[str]]
|
What mode(s) to execute this Op in. For example, "train", "eval", "test", or "infer". To execute regardless of mode, pass None. To execute in all modes except for a particular one, you can pass an argument like "!infer" or "!train". |
None
|
ds_id |
Union[None, str, Iterable[str]]
|
What dataset id(s) to execute this Op in. To execute regardless of ds_id, pass None. To execute in all ds_ids except for a particular one, you can pass an argument like "!ds1". |
None
|
Image types
uint8
Source code in fastestimator/fastestimator/op/numpyop/univariate/rua.py
set_rua_level
¶
A method which will be invoked by the RUA Op to adjust the augmentation intensity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
magnitude_coef |
float
|
The desired augmentation intensity (range [0-1]). |
required |
Source code in fastestimator/fastestimator/op/numpyop/univariate/rua.py
Identity
¶
Bases: NumpyOp
Pass the input as-is.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
Union[str, Iterable[str]]
|
Key(s) of images. |
required |
outputs |
Union[str, Iterable[str]]
|
Key(s) into which to write the images. |
required |
mode |
Union[None, str, Iterable[str]]
|
What mode(s) to execute this Op in. For example, "train", "eval", "test", or "infer". To execute regardless of mode, pass None. To execute in all modes except for a particular one, you can pass an argument like "!infer" or "!train". |
None
|
ds_id |
Union[None, str, Iterable[str]]
|
What dataset id(s) to execute this Op in. To execute regardless of ds_id, pass None. To execute in all ds_ids except for a particular one, you can pass an argument like "!ds1". |
None
|
Source code in fastestimator/fastestimator/op/numpyop/univariate/rua.py
set_rua_level
¶
A method which will be invoked by the RUA Op to adjust the augmentation intensity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
magnitude_coef |
float
|
The desired augmentation intensity (range [0-1]). |
required |
Source code in fastestimator/fastestimator/op/numpyop/univariate/rua.py
OneOfMultiVar
¶
Bases: OneOf
Perform one of several possible NumpyOps.
Note that OneOfMultiVar accepts both univariate and multivariate ops and allows the list of passed NumpyOps to have different input and output keys. OneOfMultiVar should not be used to wrap an op whose output key(s) do not already exist in the data dictionary. This would result in a problem when future ops / traces attempt to reference the output key, but OneOfMultiVar declined to generate it. If you want to create a default value for a new key, simply use a LambdaOp before invoking the OneOfMultiVar.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*numpy_ops |
NumpyOp
|
A list of ops to choose between with uniform probability. |
()
|
Source code in fastestimator/fastestimator/op/numpyop/univariate/rua.py
Posterize
¶
Bases: Posterize
Reduce the number of bits for the image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
Union[str, Iterable[str]]
|
Key(s) of images to be modified. |
required |
outputs |
Union[str, Iterable[str]]
|
Key(s) into which to write the modified images. |
required |
mode |
Union[None, str, Iterable[str]]
|
What mode(s) to execute this Op in. For example, "train", "eval", "test", or "infer". To execute regardless of mode, pass None. To execute in all modes except for a particular one, you can pass an argument like "!infer" or "!train". |
None
|
ds_id |
Union[None, str, Iterable[str]]
|
What dataset id(s) to execute this Op in. To execute regardless of ds_id, pass None. To execute in all ds_ids except for a particular one, you can pass an argument like "!ds1". |
None
|
num_bits |
Union[int, Tuple[int, int], Tuple[int, int, int], Tuple[Tuple[int, int], Tuple[int, int], Tuple[int, int]]]
|
Number of high bits. If num_bits is a single value, the range will be [num_bits, num_bits]. A triplet of ints will be interpreted as [r, g, b], and a triplet of pairs as [[r1, r1], [g1, g2], [b1, b2]]. Must be in the range [0, 8]. |
7
|
Image types
uint8
Source code in fastestimator/fastestimator/op/numpyop/univariate/rua.py
set_rua_level
¶
Set the augmentation intensity based on the magnitude_coef.
This method is specifically designed to be invoked by the RUA Op.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
magnitude_coef |
float
|
The desired augmentation intensity (range [0-1]). |
required |
Source code in fastestimator/fastestimator/op/numpyop/univariate/rua.py
RUA
¶
Bases: NumpyOp
Apply RUA augmentation strategy.
Note that all augmentation ops passed to RUA should have a set_rua_level method to modify their strength based on
the level. Custom NumpyOps can be passed to the choices
argument along with names of augmentations to add. Passing
'defaults' adds the default list of augmentations along with any custom NumpyOps specified by the user.
The default augmentations are: 'Rotate', 'Identity', 'AutoContrast', 'Equalize', 'Posterize', 'Solarize',
'Sharpness', 'Contrast', 'Color', 'Brightness', 'ShearX', 'ShearY', 'TranslateX' and 'TranslateY'.
To add specific augmentations from the default list, their names can be passed. Ex: 'Rotate'.
To remove specific augmentations from the list, you can negate their names. Ex: '!Rotate' will load all the
augmentations except 'Rotate'.
Example combinations which are not allowed: choices = ['defaults', 'Rotate'] # augmentations from the default list are redundant with 'defaults'. choices = ['defaults', '!Rotate'] # negated augmentations automatically load the default list. choices = ['!Solarize', 'Rotate'] # Cannot mix negated and normal augmentations.
RUA should not have augmentation ops whose output key(s) do not already exist in the data dictionary. This would result in a problem when future ops / traces attempt to reference the output key, but RUA declined to generate it. If you want to create a default value for a new key, simply use a LambdaOp before invoking RUA.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
Union[str, Iterable[str]]
|
Key(s) of images to be modified. |
required |
outputs |
Union[str, Iterable[str]]
|
Key(s) into which to write the modified images. |
required |
mode |
Union[None, str, Iterable[str]]
|
What mode(s) to execute this Op in. For example, "train", "eval", "test", or "infer". To execute regardless of mode, pass None. To execute in all modes except for a particular one, you can pass an argument like "!infer" or "!train". |
None
|
ds_id |
Union[None, str, Iterable[str]]
|
What dataset id(s) to execute this Op in. To execute regardless of ds_id, pass None. To execute in all ds_ids except for a particular one, you can pass an argument like "!ds1". |
None
|
choices |
Union[str, NumpyOp, List[Union[str, NumpyOp]]]
|
List of augmentations to apply. |
'defaults'
|
level |
Union[int, float]
|
Factor to set the range for magnitude of augmentation. Must be in the range [0, 30]. |
18
|
Image types
uint8
Source code in fastestimator/fastestimator/op/numpyop/univariate/rua.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
|
Rotate
¶
Bases: NumpyOp
Rotate the input by an angle selected randomly.
This is a wrapper for functionality provided by the PIL library: https://github.com/python-pillow/Pillow/tree/master/src/PIL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
Union[str, Iterable[str]]
|
Key(s) of images to be modified. |
required |
outputs |
Union[str, Iterable[str]]
|
Key(s) into which to write the modified images. |
required |
mode |
Union[None, str, Iterable[str]]
|
What mode(s) to execute this Op in. For example, "train", "eval", "test", or "infer". To execute regardless of mode, pass None. To execute in all modes except for a particular one, you can pass an argument like "!infer" or "!train". |
None
|
ds_id |
Union[None, str, Iterable[str]]
|
What dataset id(s) to execute this Op in. To execute regardless of ds_id, pass None. To execute in all ds_ids except for a particular one, you can pass an argument like "!ds1". |
None
|
limit |
Union[int, Tuple[int, int]]
|
Range from which the angle can be picked. If limit is a single int the range is considered from (0, limit). |
30
|
Image types
uint8
Source code in fastestimator/fastestimator/op/numpyop/univariate/rua.py
set_rua_level
¶
Set the augmentation intensity based on the magnitude_coef.
This method is specifically designed to be invoked by the RUA Op.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
magnitude_coef |
float
|
The desired augmentation intensity (range [0-1]). |
required |
Source code in fastestimator/fastestimator/op/numpyop/univariate/rua.py
Solarize
¶
Bases: NumpyOp
Invert all pixel values above a threshold.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
Union[str, Iterable[str]]
|
Key(s) of images to be modified. |
required |
outputs |
Union[str, Iterable[str]]
|
Key(s) into which to write the modified images. |
required |
mode |
Union[None, str, Iterable[str]]
|
What mode(s) to execute this Op in. For example, "train", "eval", "test", or "infer". To execute regardless of mode, pass None. To execute in all modes except for a particular one, you can pass an argument like "!infer" or "!train". |
None
|
ds_id |
Union[None, str, Iterable[str]]
|
What dataset id(s) to execute this Op in. To execute regardless of ds_id, pass None. To execute in all ds_ids except for a particular one, you can pass an argument like "!ds1". |
None
|
threshold |
Union[int, Tuple[int, int], float, Tuple[float, float]]
|
Range for the solarizing threshold. If threshold is a single value 't', the range will be [0, t]. |
256
|
Image types
uint8
Source code in fastestimator/fastestimator/op/numpyop/univariate/rua.py
set_rua_level
¶
Set the augmentation intensity based on the magnitude_coef.
This method is specifically designed to be invoked by the RUA Op.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
magnitude_coef |
Union[int, float]
|
The desired augmentation intensity (range [0-1]). |
required |