partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | AdditivePoissonNoise | Create an augmenter to add poisson noise to images.
Poisson noise is comparable to gaussian noise as in ``AdditiveGaussianNoise``, but the values are sampled from
a poisson distribution instead of a gaussian distribution. As poisson distributions produce only positive numbers,
the sign of the sampled value... | imgaug/augmenters/arithmetic.py | def AdditivePoissonNoise(lam=0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Create an augmenter to add poisson noise to images.
Poisson noise is comparable to gaussian noise as in ``AdditiveGaussianNoise``, but the values are sampled from
a poisson distribution instead of... | def AdditivePoissonNoise(lam=0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Create an augmenter to add poisson noise to images.
Poisson noise is comparable to gaussian noise as in ``AdditiveGaussianNoise``, but the values are sampled from
a poisson distribution instead of... | [
"Create",
"an",
"augmenter",
"to",
"add",
"poisson",
"noise",
"to",
"images",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/arithmetic.py#L546-L626 | [
"def",
"AdditivePoissonNoise",
"(",
"lam",
"=",
"0",
",",
"per_channel",
"=",
"False",
",",
"name",
"=",
"None",
",",
"deterministic",
"=",
"False",
",",
"random_state",
"=",
"None",
")",
":",
"lam2",
"=",
"iap",
".",
"handle_continuous_param",
"(",
"lam",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Dropout | Augmenter that sets a certain fraction of pixels in images to zero.
dtype support::
See ``imgaug.augmenters.arithmetic.MultiplyElementwise``.
Parameters
----------
p : float or tuple of float or imgaug.parameters.StochasticParameter, optional
The probability of any pixel being dropped... | imgaug/augmenters/arithmetic.py | def Dropout(p=0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Augmenter that sets a certain fraction of pixels in images to zero.
dtype support::
See ``imgaug.augmenters.arithmetic.MultiplyElementwise``.
Parameters
----------
p : float or tuple of float o... | def Dropout(p=0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Augmenter that sets a certain fraction of pixels in images to zero.
dtype support::
See ``imgaug.augmenters.arithmetic.MultiplyElementwise``.
Parameters
----------
p : float or tuple of float o... | [
"Augmenter",
"that",
"sets",
"a",
"certain",
"fraction",
"of",
"pixels",
"in",
"images",
"to",
"zero",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/arithmetic.py#L977-L1059 | [
"def",
"Dropout",
"(",
"p",
"=",
"0",
",",
"per_channel",
"=",
"False",
",",
"name",
"=",
"None",
",",
"deterministic",
"=",
"False",
",",
"random_state",
"=",
"None",
")",
":",
"if",
"ia",
".",
"is_single_number",
"(",
"p",
")",
":",
"p2",
"=",
"i... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | CoarseDropout | Augmenter that sets rectangular areas within images to zero.
In contrast to Dropout, these areas can have larger sizes.
(E.g. you might end up with three large black rectangles in an image.)
Note that the current implementation leads to correlated sizes,
so when there is one large area that is dropped,... | imgaug/augmenters/arithmetic.py | def CoarseDropout(p=0, size_px=None, size_percent=None, per_channel=False, min_size=4, name=None, deterministic=False,
random_state=None):
"""
Augmenter that sets rectangular areas within images to zero.
In contrast to Dropout, these areas can have larger sizes.
(E.g. you might end up... | def CoarseDropout(p=0, size_px=None, size_percent=None, per_channel=False, min_size=4, name=None, deterministic=False,
random_state=None):
"""
Augmenter that sets rectangular areas within images to zero.
In contrast to Dropout, these areas can have larger sizes.
(E.g. you might end up... | [
"Augmenter",
"that",
"sets",
"rectangular",
"areas",
"within",
"images",
"to",
"zero",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/arithmetic.py#L1062-L1201 | [
"def",
"CoarseDropout",
"(",
"p",
"=",
"0",
",",
"size_px",
"=",
"None",
",",
"size_percent",
"=",
"None",
",",
"per_channel",
"=",
"False",
",",
"min_size",
"=",
"4",
",",
"name",
"=",
"None",
",",
"deterministic",
"=",
"False",
",",
"random_state",
"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | ImpulseNoise | Creates an augmenter to apply impulse noise to an image.
This is identical to ``SaltAndPepper``, except that per_channel is always set to True.
dtype support::
See ``imgaug.augmenters.arithmetic.SaltAndPepper``. | imgaug/augmenters/arithmetic.py | def ImpulseNoise(p=0, name=None, deterministic=False, random_state=None):
"""
Creates an augmenter to apply impulse noise to an image.
This is identical to ``SaltAndPepper``, except that per_channel is always set to True.
dtype support::
See ``imgaug.augmenters.arithmetic.SaltAndPepper``.
... | def ImpulseNoise(p=0, name=None, deterministic=False, random_state=None):
"""
Creates an augmenter to apply impulse noise to an image.
This is identical to ``SaltAndPepper``, except that per_channel is always set to True.
dtype support::
See ``imgaug.augmenters.arithmetic.SaltAndPepper``.
... | [
"Creates",
"an",
"augmenter",
"to",
"apply",
"impulse",
"noise",
"to",
"an",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/arithmetic.py#L1360-L1371 | [
"def",
"ImpulseNoise",
"(",
"p",
"=",
"0",
",",
"name",
"=",
"None",
",",
"deterministic",
"=",
"False",
",",
"random_state",
"=",
"None",
")",
":",
"return",
"SaltAndPepper",
"(",
"p",
"=",
"p",
",",
"per_channel",
"=",
"True",
",",
"name",
"=",
"na... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | SaltAndPepper | Adds salt and pepper noise to an image, i.e. some white-ish and black-ish pixels.
dtype support::
See ``imgaug.augmenters.arithmetic.ReplaceElementwise``.
Parameters
----------
p : float or tuple of float or list of float or imgaug.parameters.StochasticParameter, optional
Probability ... | imgaug/augmenters/arithmetic.py | def SaltAndPepper(p=0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Adds salt and pepper noise to an image, i.e. some white-ish and black-ish pixels.
dtype support::
See ``imgaug.augmenters.arithmetic.ReplaceElementwise``.
Parameters
----------
p : float ... | def SaltAndPepper(p=0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Adds salt and pepper noise to an image, i.e. some white-ish and black-ish pixels.
dtype support::
See ``imgaug.augmenters.arithmetic.ReplaceElementwise``.
Parameters
----------
p : float ... | [
"Adds",
"salt",
"and",
"pepper",
"noise",
"to",
"an",
"image",
"i",
".",
"e",
".",
"some",
"white",
"-",
"ish",
"and",
"black",
"-",
"ish",
"pixels",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/arithmetic.py#L1374-L1430 | [
"def",
"SaltAndPepper",
"(",
"p",
"=",
"0",
",",
"per_channel",
"=",
"False",
",",
"name",
"=",
"None",
",",
"deterministic",
"=",
"False",
",",
"random_state",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"\"Unnamed%s\"",
"%",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Pepper | Adds pepper noise to an image, i.e. black-ish pixels.
This is similar to dropout, but slower and the black pixels are not uniformly black.
dtype support::
See ``imgaug.augmenters.arithmetic.ReplaceElementwise``.
Parameters
----------
p : float or tuple of float or list of float or imgaug... | imgaug/augmenters/arithmetic.py | def Pepper(p=0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Adds pepper noise to an image, i.e. black-ish pixels.
This is similar to dropout, but slower and the black pixels are not uniformly black.
dtype support::
See ``imgaug.augmenters.arithmetic.ReplaceEleme... | def Pepper(p=0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Adds pepper noise to an image, i.e. black-ish pixels.
This is similar to dropout, but slower and the black pixels are not uniformly black.
dtype support::
See ``imgaug.augmenters.arithmetic.ReplaceEleme... | [
"Adds",
"pepper",
"noise",
"to",
"an",
"image",
"i",
".",
"e",
".",
"black",
"-",
"ish",
"pixels",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/arithmetic.py#L1711-L1777 | [
"def",
"Pepper",
"(",
"p",
"=",
"0",
",",
"per_channel",
"=",
"False",
",",
"name",
"=",
"None",
",",
"deterministic",
"=",
"False",
",",
"random_state",
"=",
"None",
")",
":",
"replacement01",
"=",
"iap",
".",
"ForceSign",
"(",
"iap",
".",
"Beta",
"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | CoarsePepper | Adds coarse pepper noise to an image, i.e. rectangles that contain noisy black-ish pixels.
dtype support::
See ``imgaug.augmenters.arithmetic.ReplaceElementwise``.
Parameters
----------
p : float or tuple of float or list of float or imgaug.parameters.StochasticParameter, optional
Pro... | imgaug/augmenters/arithmetic.py | def CoarsePepper(p=0, size_px=None, size_percent=None, per_channel=False, min_size=4, name=None, deterministic=False,
random_state=None):
"""
Adds coarse pepper noise to an image, i.e. rectangles that contain noisy black-ish pixels.
dtype support::
See ``imgaug.augmenters.arithmet... | def CoarsePepper(p=0, size_px=None, size_percent=None, per_channel=False, min_size=4, name=None, deterministic=False,
random_state=None):
"""
Adds coarse pepper noise to an image, i.e. rectangles that contain noisy black-ish pixels.
dtype support::
See ``imgaug.augmenters.arithmet... | [
"Adds",
"coarse",
"pepper",
"noise",
"to",
"an",
"image",
"i",
".",
"e",
".",
"rectangles",
"that",
"contain",
"noisy",
"black",
"-",
"ish",
"pixels",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/arithmetic.py#L1780-L1890 | [
"def",
"CoarsePepper",
"(",
"p",
"=",
"0",
",",
"size_px",
"=",
"None",
",",
"size_percent",
"=",
"None",
",",
"per_channel",
"=",
"False",
",",
"min_size",
"=",
"4",
",",
"name",
"=",
"None",
",",
"deterministic",
"=",
"False",
",",
"random_state",
"=... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | ContrastNormalization | Augmenter that changes the contrast of images.
dtype support:
See ``imgaug.augmenters.contrast.LinearContrast``.
Parameters
----------
alpha : number or tuple of number or list of number or imgaug.parameters.StochasticParameter, optional
Strength of the contrast normalization. Higher ... | imgaug/augmenters/arithmetic.py | def ContrastNormalization(alpha=1.0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Augmenter that changes the contrast of images.
dtype support:
See ``imgaug.augmenters.contrast.LinearContrast``.
Parameters
----------
alpha : number or tuple of number or l... | def ContrastNormalization(alpha=1.0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Augmenter that changes the contrast of images.
dtype support:
See ``imgaug.augmenters.contrast.LinearContrast``.
Parameters
----------
alpha : number or tuple of number or l... | [
"Augmenter",
"that",
"changes",
"the",
"contrast",
"of",
"images",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/arithmetic.py#L2151-L2207 | [
"def",
"ContrastNormalization",
"(",
"alpha",
"=",
"1.0",
",",
"per_channel",
"=",
"False",
",",
"name",
"=",
"None",
",",
"deterministic",
"=",
"False",
",",
"random_state",
"=",
"None",
")",
":",
"# placed here to avoid cyclic dependency",
"from",
".",
"import... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | is_single_float | Checks whether a variable is a float.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a float. Otherwise False. | imgaug/imgaug.py | def is_single_float(val):
"""
Checks whether a variable is a float.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a float. Otherwise False.
"""
return isinstance(val, numbers.Real) and not is_single_integer(val) a... | def is_single_float(val):
"""
Checks whether a variable is a float.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a float. Otherwise False.
"""
return isinstance(val, numbers.Real) and not is_single_integer(val) a... | [
"Checks",
"whether",
"a",
"variable",
"is",
"a",
"float",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L94-L109 | [
"def",
"is_single_float",
"(",
"val",
")",
":",
"return",
"isinstance",
"(",
"val",
",",
"numbers",
".",
"Real",
")",
"and",
"not",
"is_single_integer",
"(",
"val",
")",
"and",
"not",
"isinstance",
"(",
"val",
",",
"bool",
")"
] | 786be74aa855513840113ea523c5df495dc6a8af |
valid | is_integer_array | Checks whether a variable is a numpy integer array.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a numpy integer array. Otherwise False. | imgaug/imgaug.py | def is_integer_array(val):
"""
Checks whether a variable is a numpy integer array.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a numpy integer array. Otherwise False.
"""
return is_np_array(val) and issubclass(v... | def is_integer_array(val):
"""
Checks whether a variable is a numpy integer array.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a numpy integer array. Otherwise False.
"""
return is_np_array(val) and issubclass(v... | [
"Checks",
"whether",
"a",
"variable",
"is",
"a",
"numpy",
"integer",
"array",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L185-L200 | [
"def",
"is_integer_array",
"(",
"val",
")",
":",
"return",
"is_np_array",
"(",
"val",
")",
"and",
"issubclass",
"(",
"val",
".",
"dtype",
".",
"type",
",",
"np",
".",
"integer",
")"
] | 786be74aa855513840113ea523c5df495dc6a8af |
valid | is_float_array | Checks whether a variable is a numpy float array.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a numpy float array. Otherwise False. | imgaug/imgaug.py | def is_float_array(val):
"""
Checks whether a variable is a numpy float array.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a numpy float array. Otherwise False.
"""
return is_np_array(val) and issubclass(val.dty... | def is_float_array(val):
"""
Checks whether a variable is a numpy float array.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a numpy float array. Otherwise False.
"""
return is_np_array(val) and issubclass(val.dty... | [
"Checks",
"whether",
"a",
"variable",
"is",
"a",
"numpy",
"float",
"array",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L203-L218 | [
"def",
"is_float_array",
"(",
"val",
")",
":",
"return",
"is_np_array",
"(",
"val",
")",
"and",
"issubclass",
"(",
"val",
".",
"dtype",
".",
"type",
",",
"np",
".",
"floating",
")"
] | 786be74aa855513840113ea523c5df495dc6a8af |
valid | is_callable | Checks whether a variable is a callable, e.g. a function.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a callable. Otherwise False. | imgaug/imgaug.py | def is_callable(val):
"""
Checks whether a variable is a callable, e.g. a function.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a callable. Otherwise False.
"""
# python 3.x with x <= 2 does not support callable... | def is_callable(val):
"""
Checks whether a variable is a callable, e.g. a function.
Parameters
----------
val
The variable to check.
Returns
-------
bool
True if the variable is a callable. Otherwise False.
"""
# python 3.x with x <= 2 does not support callable... | [
"Checks",
"whether",
"a",
"variable",
"is",
"a",
"callable",
"e",
".",
"g",
".",
"a",
"function",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L221-L240 | [
"def",
"is_callable",
"(",
"val",
")",
":",
"# python 3.x with x <= 2 does not support callable(), apparently",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
"==",
"3",
"and",
"sys",
".",
"version_info",
"[",
"1",
"]",
"<=",
"2",
":",
"return",
"hasattr",
"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | flatten | Flattens arbitrarily nested lists/tuples.
Code partially taken from https://stackoverflow.com/a/10824420.
Parameters
----------
nested_iterable
A list or tuple of arbitrarily nested values.
Yields
------
any
Non-list and non-tuple values in `nested_iterable`. | imgaug/imgaug.py | def flatten(nested_iterable):
"""
Flattens arbitrarily nested lists/tuples.
Code partially taken from https://stackoverflow.com/a/10824420.
Parameters
----------
nested_iterable
A list or tuple of arbitrarily nested values.
Yields
------
any
Non-list and non-tuple ... | def flatten(nested_iterable):
"""
Flattens arbitrarily nested lists/tuples.
Code partially taken from https://stackoverflow.com/a/10824420.
Parameters
----------
nested_iterable
A list or tuple of arbitrarily nested values.
Yields
------
any
Non-list and non-tuple ... | [
"Flattens",
"arbitrarily",
"nested",
"lists",
"/",
"tuples",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L261-L288 | [
"def",
"flatten",
"(",
"nested_iterable",
")",
":",
"# don't just check if something is iterable here, because then strings",
"# and arrays will be split into their characters and components",
"if",
"not",
"isinstance",
"(",
"nested_iterable",
",",
"(",
"list",
",",
"tuple",
")",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | new_random_state | Returns a new random state.
Parameters
----------
seed : None or int, optional
Optional seed value to use.
The same datatypes are allowed as for ``numpy.random.RandomState(seed)``.
fully_random : bool, optional
Whether to use numpy's random initialization for the
Random... | imgaug/imgaug.py | def new_random_state(seed=None, fully_random=False):
"""
Returns a new random state.
Parameters
----------
seed : None or int, optional
Optional seed value to use.
The same datatypes are allowed as for ``numpy.random.RandomState(seed)``.
fully_random : bool, optional
Wh... | def new_random_state(seed=None, fully_random=False):
"""
Returns a new random state.
Parameters
----------
seed : None or int, optional
Optional seed value to use.
The same datatypes are allowed as for ``numpy.random.RandomState(seed)``.
fully_random : bool, optional
Wh... | [
"Returns",
"a",
"new",
"random",
"state",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L336-L363 | [
"def",
"new_random_state",
"(",
"seed",
"=",
"None",
",",
"fully_random",
"=",
"False",
")",
":",
"if",
"seed",
"is",
"None",
":",
"if",
"not",
"fully_random",
":",
"# sample manually a seed instead of just RandomState(),",
"# because the latter one",
"# is way slower."... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | copy_random_state | Creates a copy of a random state.
Parameters
----------
random_state : numpy.random.RandomState
The random state to copy.
force_copy : bool, optional
If True, this function will always create a copy of every random
state. If False, it will not copy numpy's default random state,... | imgaug/imgaug.py | def copy_random_state(random_state, force_copy=False):
"""
Creates a copy of a random state.
Parameters
----------
random_state : numpy.random.RandomState
The random state to copy.
force_copy : bool, optional
If True, this function will always create a copy of every random
... | def copy_random_state(random_state, force_copy=False):
"""
Creates a copy of a random state.
Parameters
----------
random_state : numpy.random.RandomState
The random state to copy.
force_copy : bool, optional
If True, this function will always create a copy of every random
... | [
"Creates",
"a",
"copy",
"of",
"a",
"random",
"state",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L379-L405 | [
"def",
"copy_random_state",
"(",
"random_state",
",",
"force_copy",
"=",
"False",
")",
":",
"if",
"random_state",
"==",
"np",
".",
"random",
"and",
"not",
"force_copy",
":",
"return",
"random_state",
"else",
":",
"rs_copy",
"=",
"dummy_random_state",
"(",
")",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | derive_random_states | Create N new random states based on an existing random state or seed.
Parameters
----------
random_state : numpy.random.RandomState
Random state or seed from which to derive new random states.
n : int, optional
Number of random states to derive.
Returns
-------
list of num... | imgaug/imgaug.py | def derive_random_states(random_state, n=1):
"""
Create N new random states based on an existing random state or seed.
Parameters
----------
random_state : numpy.random.RandomState
Random state or seed from which to derive new random states.
n : int, optional
Number of random s... | def derive_random_states(random_state, n=1):
"""
Create N new random states based on an existing random state or seed.
Parameters
----------
random_state : numpy.random.RandomState
Random state or seed from which to derive new random states.
n : int, optional
Number of random s... | [
"Create",
"N",
"new",
"random",
"states",
"based",
"on",
"an",
"existing",
"random",
"state",
"or",
"seed",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L427-L446 | [
"def",
"derive_random_states",
"(",
"random_state",
",",
"n",
"=",
"1",
")",
":",
"seed_",
"=",
"random_state",
".",
"randint",
"(",
"SEED_MIN_VALUE",
",",
"SEED_MAX_VALUE",
",",
"1",
")",
"[",
"0",
"]",
"return",
"[",
"new_random_state",
"(",
"seed_",
"+"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | _quokka_normalize_extract | Generate a normalized rectangle to be extract from the standard quokka image.
Parameters
----------
extract : 'square' or tuple of number or imgaug.BoundingBox or imgaug.BoundingBoxesOnImage
Unnormalized representation of the image subarea to be extracted.
* If string ``square``, then ... | imgaug/imgaug.py | def _quokka_normalize_extract(extract):
"""
Generate a normalized rectangle to be extract from the standard quokka image.
Parameters
----------
extract : 'square' or tuple of number or imgaug.BoundingBox or imgaug.BoundingBoxesOnImage
Unnormalized representation of the image subarea to be e... | def _quokka_normalize_extract(extract):
"""
Generate a normalized rectangle to be extract from the standard quokka image.
Parameters
----------
extract : 'square' or tuple of number or imgaug.BoundingBox or imgaug.BoundingBoxesOnImage
Unnormalized representation of the image subarea to be e... | [
"Generate",
"a",
"normalized",
"rectangle",
"to",
"be",
"extract",
"from",
"the",
"standard",
"quokka",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L464-L506 | [
"def",
"_quokka_normalize_extract",
"(",
"extract",
")",
":",
"# TODO get rid of this deferred import",
"from",
"imgaug",
".",
"augmentables",
".",
"bbs",
"import",
"BoundingBox",
",",
"BoundingBoxesOnImage",
"if",
"extract",
"==",
"\"square\"",
":",
"bb",
"=",
"Bound... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | _compute_resized_shape | Computes the intended new shape of an image-like array after resizing.
Parameters
----------
from_shape : tuple or ndarray
Old shape of the array. Usually expected to be a tuple of form ``(H, W)`` or ``(H, W, C)`` or
alternatively an array with two or three dimensions.
to_shape : None ... | imgaug/imgaug.py | def _compute_resized_shape(from_shape, to_shape):
"""
Computes the intended new shape of an image-like array after resizing.
Parameters
----------
from_shape : tuple or ndarray
Old shape of the array. Usually expected to be a tuple of form ``(H, W)`` or ``(H, W, C)`` or
alternativel... | def _compute_resized_shape(from_shape, to_shape):
"""
Computes the intended new shape of an image-like array after resizing.
Parameters
----------
from_shape : tuple or ndarray
Old shape of the array. Usually expected to be a tuple of form ``(H, W)`` or ``(H, W, C)`` or
alternativel... | [
"Computes",
"the",
"intended",
"new",
"shape",
"of",
"an",
"image",
"-",
"like",
"array",
"after",
"resizing",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L509-L574 | [
"def",
"_compute_resized_shape",
"(",
"from_shape",
",",
"to_shape",
")",
":",
"if",
"is_np_array",
"(",
"from_shape",
")",
":",
"from_shape",
"=",
"from_shape",
".",
"shape",
"if",
"is_np_array",
"(",
"to_shape",
")",
":",
"to_shape",
"=",
"to_shape",
".",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | quokka | Returns an image of a quokka as a numpy array.
Parameters
----------
size : None or float or tuple of int, optional
Size of the output image. Input into :func:`imgaug.imgaug.imresize_single_image`.
Usually expected to be a tuple ``(H, W)``, where ``H`` is the desired height
and ``W`... | imgaug/imgaug.py | def quokka(size=None, extract=None):
"""
Returns an image of a quokka as a numpy array.
Parameters
----------
size : None or float or tuple of int, optional
Size of the output image. Input into :func:`imgaug.imgaug.imresize_single_image`.
Usually expected to be a tuple ``(H, W)``, w... | def quokka(size=None, extract=None):
"""
Returns an image of a quokka as a numpy array.
Parameters
----------
size : None or float or tuple of int, optional
Size of the output image. Input into :func:`imgaug.imgaug.imresize_single_image`.
Usually expected to be a tuple ``(H, W)``, w... | [
"Returns",
"an",
"image",
"of",
"a",
"quokka",
"as",
"a",
"numpy",
"array",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L577-L614 | [
"def",
"quokka",
"(",
"size",
"=",
"None",
",",
"extract",
"=",
"None",
")",
":",
"img",
"=",
"imageio",
".",
"imread",
"(",
"QUOKKA_FP",
",",
"pilmode",
"=",
"\"RGB\"",
")",
"if",
"extract",
"is",
"not",
"None",
":",
"bb",
"=",
"_quokka_normalize_extr... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | quokka_heatmap | Returns a heatmap (here: depth map) for the standard example quokka image.
Parameters
----------
size : None or float or tuple of int, optional
See :func:`imgaug.quokka`.
extract : None or 'square' or tuple of number or imgaug.BoundingBox or imgaug.BoundingBoxesOnImage
See :func:`imgau... | imgaug/imgaug.py | def quokka_heatmap(size=None, extract=None):
"""
Returns a heatmap (here: depth map) for the standard example quokka image.
Parameters
----------
size : None or float or tuple of int, optional
See :func:`imgaug.quokka`.
extract : None or 'square' or tuple of number or imgaug.BoundingBo... | def quokka_heatmap(size=None, extract=None):
"""
Returns a heatmap (here: depth map) for the standard example quokka image.
Parameters
----------
size : None or float or tuple of int, optional
See :func:`imgaug.quokka`.
extract : None or 'square' or tuple of number or imgaug.BoundingBo... | [
"Returns",
"a",
"heatmap",
"(",
"here",
":",
"depth",
"map",
")",
"for",
"the",
"standard",
"example",
"quokka",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L637-L675 | [
"def",
"quokka_heatmap",
"(",
"size",
"=",
"None",
",",
"extract",
"=",
"None",
")",
":",
"# TODO get rid of this deferred import",
"from",
"imgaug",
".",
"augmentables",
".",
"heatmaps",
"import",
"HeatmapsOnImage",
"img",
"=",
"imageio",
".",
"imread",
"(",
"Q... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | quokka_segmentation_map | Returns a segmentation map for the standard example quokka image.
Parameters
----------
size : None or float or tuple of int, optional
See :func:`imgaug.quokka`.
extract : None or 'square' or tuple of number or imgaug.BoundingBox or imgaug.BoundingBoxesOnImage
See :func:`imgaug.quokka`... | imgaug/imgaug.py | def quokka_segmentation_map(size=None, extract=None):
"""
Returns a segmentation map for the standard example quokka image.
Parameters
----------
size : None or float or tuple of int, optional
See :func:`imgaug.quokka`.
extract : None or 'square' or tuple of number or imgaug.BoundingBo... | def quokka_segmentation_map(size=None, extract=None):
"""
Returns a segmentation map for the standard example quokka image.
Parameters
----------
size : None or float or tuple of int, optional
See :func:`imgaug.quokka`.
extract : None or 'square' or tuple of number or imgaug.BoundingBo... | [
"Returns",
"a",
"segmentation",
"map",
"for",
"the",
"standard",
"example",
"quokka",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L678-L725 | [
"def",
"quokka_segmentation_map",
"(",
"size",
"=",
"None",
",",
"extract",
"=",
"None",
")",
":",
"# TODO get rid of this deferred import",
"from",
"imgaug",
".",
"augmentables",
".",
"segmaps",
"import",
"SegmentationMapOnImage",
"with",
"open",
"(",
"QUOKKA_ANNOTAT... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | quokka_keypoints | Returns example keypoints on the standard example quokke image.
The keypoints cover the eyes, ears, nose and paws.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
Size of the output image on which the keypoints are placed. If None, then the keypoints
... | imgaug/imgaug.py | def quokka_keypoints(size=None, extract=None):
"""
Returns example keypoints on the standard example quokke image.
The keypoints cover the eyes, ears, nose and paws.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
Size of the output image on which... | def quokka_keypoints(size=None, extract=None):
"""
Returns example keypoints on the standard example quokke image.
The keypoints cover the eyes, ears, nose and paws.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
Size of the output image on which... | [
"Returns",
"example",
"keypoints",
"on",
"the",
"standard",
"example",
"quokke",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L728-L771 | [
"def",
"quokka_keypoints",
"(",
"size",
"=",
"None",
",",
"extract",
"=",
"None",
")",
":",
"# TODO get rid of this deferred import",
"from",
"imgaug",
".",
"augmentables",
".",
"kps",
"import",
"Keypoint",
",",
"KeypointsOnImage",
"left",
",",
"top",
"=",
"0",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | quokka_bounding_boxes | Returns example bounding boxes on the standard example quokke image.
Currently only a single bounding box is returned that covers the quokka.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
Size of the output image on which the BBs are placed. If None, th... | imgaug/imgaug.py | def quokka_bounding_boxes(size=None, extract=None):
"""
Returns example bounding boxes on the standard example quokke image.
Currently only a single bounding box is returned that covers the quokka.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
S... | def quokka_bounding_boxes(size=None, extract=None):
"""
Returns example bounding boxes on the standard example quokke image.
Currently only a single bounding box is returned that covers the quokka.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
S... | [
"Returns",
"example",
"bounding",
"boxes",
"on",
"the",
"standard",
"example",
"quokke",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L774-L824 | [
"def",
"quokka_bounding_boxes",
"(",
"size",
"=",
"None",
",",
"extract",
"=",
"None",
")",
":",
"# TODO get rid of this deferred import",
"from",
"imgaug",
".",
"augmentables",
".",
"bbs",
"import",
"BoundingBox",
",",
"BoundingBoxesOnImage",
"left",
",",
"top",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | quokka_polygons | Returns example polygons on the standard example quokke image.
The result contains one polygon, covering the quokka's outline.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
Size of the output image on which the polygons are placed. If None,
then... | imgaug/imgaug.py | def quokka_polygons(size=None, extract=None):
"""
Returns example polygons on the standard example quokke image.
The result contains one polygon, covering the quokka's outline.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
Size of the output ima... | def quokka_polygons(size=None, extract=None):
"""
Returns example polygons on the standard example quokke image.
The result contains one polygon, covering the quokka's outline.
Parameters
----------
size : None or float or tuple of int or tuple of float, optional
Size of the output ima... | [
"Returns",
"example",
"polygons",
"on",
"the",
"standard",
"example",
"quokke",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L827-L875 | [
"def",
"quokka_polygons",
"(",
"size",
"=",
"None",
",",
"extract",
"=",
"None",
")",
":",
"# TODO get rid of this deferred import",
"from",
"imgaug",
".",
"augmentables",
".",
"polys",
"import",
"Polygon",
",",
"PolygonsOnImage",
"left",
",",
"top",
"=",
"0",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | angle_between_vectors | Returns the angle in radians between vectors `v1` and `v2`.
From http://stackoverflow.com/questions/2827393/angles-between-two-n-dimensional-vectors-in-python
Parameters
----------
v1 : (N,) ndarray
First vector.
v2 : (N,) ndarray
Second vector.
Returns
-------
out : ... | imgaug/imgaug.py | def angle_between_vectors(v1, v2):
"""
Returns the angle in radians between vectors `v1` and `v2`.
From http://stackoverflow.com/questions/2827393/angles-between-two-n-dimensional-vectors-in-python
Parameters
----------
v1 : (N,) ndarray
First vector.
v2 : (N,) ndarray
Sec... | def angle_between_vectors(v1, v2):
"""
Returns the angle in radians between vectors `v1` and `v2`.
From http://stackoverflow.com/questions/2827393/angles-between-two-n-dimensional-vectors-in-python
Parameters
----------
v1 : (N,) ndarray
First vector.
v2 : (N,) ndarray
Sec... | [
"Returns",
"the",
"angle",
"in",
"radians",
"between",
"vectors",
"v1",
"and",
"v2",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L878-L913 | [
"def",
"angle_between_vectors",
"(",
"v1",
",",
"v2",
")",
":",
"l1",
"=",
"np",
".",
"linalg",
".",
"norm",
"(",
"v1",
")",
"l2",
"=",
"np",
".",
"linalg",
".",
"norm",
"(",
"v2",
")",
"v1_u",
"=",
"(",
"v1",
"/",
"l1",
")",
"if",
"l1",
">",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | compute_line_intersection_point | Compute the intersection point of two lines.
Taken from https://stackoverflow.com/a/20679579 .
Parameters
----------
x1 : number
x coordinate of the first point on line 1. (The lines extends beyond this point.)
y1 : number
y coordinate of the first point on line 1. (The lines exte... | imgaug/imgaug.py | def compute_line_intersection_point(x1, y1, x2, y2, x3, y3, x4, y4):
"""
Compute the intersection point of two lines.
Taken from https://stackoverflow.com/a/20679579 .
Parameters
----------
x1 : number
x coordinate of the first point on line 1. (The lines extends beyond this point.)
... | def compute_line_intersection_point(x1, y1, x2, y2, x3, y3, x4, y4):
"""
Compute the intersection point of two lines.
Taken from https://stackoverflow.com/a/20679579 .
Parameters
----------
x1 : number
x coordinate of the first point on line 1. (The lines extends beyond this point.)
... | [
"Compute",
"the",
"intersection",
"point",
"of",
"two",
"lines",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L917-L973 | [
"def",
"compute_line_intersection_point",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"x3",
",",
"y3",
",",
"x4",
",",
"y4",
")",
":",
"def",
"_make_line",
"(",
"p1",
",",
"p2",
")",
":",
"A",
"=",
"(",
"p1",
"[",
"1",
"]",
"-",
"p2",
"[... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | draw_text | Draw text on an image.
This uses by default DejaVuSans as its font, which is included in this library.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: no
* ``uint32``: no
* ``uint64``: no
* ``int8``: no
* ``int16``: no
* ``int32``: no
... | imgaug/imgaug.py | def draw_text(img, y, x, text, color=(0, 255, 0), size=25):
"""
Draw text on an image.
This uses by default DejaVuSans as its font, which is included in this library.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: no
* ``uint32``: no
* ``uint64``: no
... | def draw_text(img, y, x, text, color=(0, 255, 0), size=25):
"""
Draw text on an image.
This uses by default DejaVuSans as its font, which is included in this library.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: no
* ``uint32``: no
* ``uint64``: no
... | [
"Draw",
"text",
"on",
"an",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L977-L1052 | [
"def",
"draw_text",
"(",
"img",
",",
"y",
",",
"x",
",",
"text",
",",
"color",
"=",
"(",
"0",
",",
"255",
",",
"0",
")",
",",
"size",
"=",
"25",
")",
":",
"do_assert",
"(",
"img",
".",
"dtype",
"in",
"[",
"np",
".",
"uint8",
",",
"np",
".",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | imresize_many_images | Resize many images to a specified size.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: yes; tested
* ``uint32``: no (1)
* ``uint64``: no (2)
* ``int8``: yes; tested (3)
* ``int16``: yes; tested
* ``int32``: limited; tested (4)
* ``int64... | imgaug/imgaug.py | def imresize_many_images(images, sizes=None, interpolation=None):
"""
Resize many images to a specified size.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: yes; tested
* ``uint32``: no (1)
* ``uint64``: no (2)
* ``int8``: yes; tested (3)
* ``i... | def imresize_many_images(images, sizes=None, interpolation=None):
"""
Resize many images to a specified size.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: yes; tested
* ``uint32``: no (1)
* ``uint64``: no (2)
* ``int8``: yes; tested (3)
* ``i... | [
"Resize",
"many",
"images",
"to",
"a",
"specified",
"size",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1056-L1254 | [
"def",
"imresize_many_images",
"(",
"images",
",",
"sizes",
"=",
"None",
",",
"interpolation",
"=",
"None",
")",
":",
"# we just do nothing if the input contains zero images",
"# one could also argue that an exception would be appropriate here",
"if",
"len",
"(",
"images",
")... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | imresize_single_image | Resizes a single image.
dtype support::
See :func:`imgaug.imgaug.imresize_many_images`.
Parameters
----------
image : (H,W,C) ndarray or (H,W) ndarray
Array of the image to resize.
Usually recommended to be of dtype uint8.
sizes : float or iterable of int or iterable of ... | imgaug/imgaug.py | def imresize_single_image(image, sizes, interpolation=None):
"""
Resizes a single image.
dtype support::
See :func:`imgaug.imgaug.imresize_many_images`.
Parameters
----------
image : (H,W,C) ndarray or (H,W) ndarray
Array of the image to resize.
Usually recommended to... | def imresize_single_image(image, sizes, interpolation=None):
"""
Resizes a single image.
dtype support::
See :func:`imgaug.imgaug.imresize_many_images`.
Parameters
----------
image : (H,W,C) ndarray or (H,W) ndarray
Array of the image to resize.
Usually recommended to... | [
"Resizes",
"a",
"single",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1257-L1293 | [
"def",
"imresize_single_image",
"(",
"image",
",",
"sizes",
",",
"interpolation",
"=",
"None",
")",
":",
"grayscale",
"=",
"False",
"if",
"image",
".",
"ndim",
"==",
"2",
":",
"grayscale",
"=",
"True",
"image",
"=",
"image",
"[",
":",
",",
":",
",",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | pad | Pad an image-like array on its top/right/bottom/left side.
This function is a wrapper around :func:`numpy.pad`.
dtype support::
* ``uint8``: yes; fully tested (1)
* ``uint16``: yes; fully tested (1)
* ``uint32``: yes; fully tested (2) (3)
* ``uint64``: yes; fully tested (2) (3... | imgaug/imgaug.py | def pad(arr, top=0, right=0, bottom=0, left=0, mode="constant", cval=0):
"""
Pad an image-like array on its top/right/bottom/left side.
This function is a wrapper around :func:`numpy.pad`.
dtype support::
* ``uint8``: yes; fully tested (1)
* ``uint16``: yes; fully tested (1)
*... | def pad(arr, top=0, right=0, bottom=0, left=0, mode="constant", cval=0):
"""
Pad an image-like array on its top/right/bottom/left side.
This function is a wrapper around :func:`numpy.pad`.
dtype support::
* ``uint8``: yes; fully tested (1)
* ``uint16``: yes; fully tested (1)
*... | [
"Pad",
"an",
"image",
"-",
"like",
"array",
"on",
"its",
"top",
"/",
"right",
"/",
"bottom",
"/",
"left",
"side",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1297-L1422 | [
"def",
"pad",
"(",
"arr",
",",
"top",
"=",
"0",
",",
"right",
"=",
"0",
",",
"bottom",
"=",
"0",
",",
"left",
"=",
"0",
",",
"mode",
"=",
"\"constant\"",
",",
"cval",
"=",
"0",
")",
":",
"do_assert",
"(",
"arr",
".",
"ndim",
"in",
"[",
"2",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | compute_paddings_for_aspect_ratio | Compute the amount of pixels by which an array has to be padded to fulfill an aspect ratio.
The aspect ratio is given as width/height.
Depending on which dimension is smaller (height or width), only the corresponding
sides (left/right or top/bottom) will be padded. In each case, both of the sides will
... | imgaug/imgaug.py | def compute_paddings_for_aspect_ratio(arr, aspect_ratio):
"""
Compute the amount of pixels by which an array has to be padded to fulfill an aspect ratio.
The aspect ratio is given as width/height.
Depending on which dimension is smaller (height or width), only the corresponding
sides (left/right or... | def compute_paddings_for_aspect_ratio(arr, aspect_ratio):
"""
Compute the amount of pixels by which an array has to be padded to fulfill an aspect ratio.
The aspect ratio is given as width/height.
Depending on which dimension is smaller (height or width), only the corresponding
sides (left/right or... | [
"Compute",
"the",
"amount",
"of",
"pixels",
"by",
"which",
"an",
"array",
"has",
"to",
"be",
"padded",
"to",
"fulfill",
"an",
"aspect",
"ratio",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1426-L1473 | [
"def",
"compute_paddings_for_aspect_ratio",
"(",
"arr",
",",
"aspect_ratio",
")",
":",
"do_assert",
"(",
"arr",
".",
"ndim",
"in",
"[",
"2",
",",
"3",
"]",
")",
"do_assert",
"(",
"aspect_ratio",
">",
"0",
")",
"height",
",",
"width",
"=",
"arr",
".",
"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | pad_to_aspect_ratio | Pad an image-like array on its sides so that it matches a target aspect ratio.
Depending on which dimension is smaller (height or width), only the corresponding
sides (left/right or top/bottom) will be padded. In each case, both of the sides will
be padded equally.
dtype support::
See :func:`... | imgaug/imgaug.py | def pad_to_aspect_ratio(arr, aspect_ratio, mode="constant", cval=0, return_pad_amounts=False):
"""
Pad an image-like array on its sides so that it matches a target aspect ratio.
Depending on which dimension is smaller (height or width), only the corresponding
sides (left/right or top/bottom) will be pa... | def pad_to_aspect_ratio(arr, aspect_ratio, mode="constant", cval=0, return_pad_amounts=False):
"""
Pad an image-like array on its sides so that it matches a target aspect ratio.
Depending on which dimension is smaller (height or width), only the corresponding
sides (left/right or top/bottom) will be pa... | [
"Pad",
"an",
"image",
"-",
"like",
"array",
"on",
"its",
"sides",
"so",
"that",
"it",
"matches",
"a",
"target",
"aspect",
"ratio",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1476-L1534 | [
"def",
"pad_to_aspect_ratio",
"(",
"arr",
",",
"aspect_ratio",
",",
"mode",
"=",
"\"constant\"",
",",
"cval",
"=",
"0",
",",
"return_pad_amounts",
"=",
"False",
")",
":",
"pad_top",
",",
"pad_right",
",",
"pad_bottom",
",",
"pad_left",
"=",
"compute_paddings_f... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | pool | Resize an array by pooling values within blocks.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: yes; tested
* ``uint32``: yes; tested (2)
* ``uint64``: no (1)
* ``int8``: yes; tested
* ``int16``: yes; tested
* ``int32``: yes; tested (2)
... | imgaug/imgaug.py | def pool(arr, block_size, func, cval=0, preserve_dtype=True):
"""
Resize an array by pooling values within blocks.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: yes; tested
* ``uint32``: yes; tested (2)
* ``uint64``: no (1)
* ``int8``: yes; tested
... | def pool(arr, block_size, func, cval=0, preserve_dtype=True):
"""
Resize an array by pooling values within blocks.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: yes; tested
* ``uint32``: yes; tested (2)
* ``uint64``: no (1)
* ``int8``: yes; tested
... | [
"Resize",
"an",
"array",
"by",
"pooling",
"values",
"within",
"blocks",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1537-L1616 | [
"def",
"pool",
"(",
"arr",
",",
"block_size",
",",
"func",
",",
"cval",
"=",
"0",
",",
"preserve_dtype",
"=",
"True",
")",
":",
"# TODO find better way to avoid circular import",
"from",
".",
"import",
"dtypes",
"as",
"iadt",
"iadt",
".",
"gate_dtypes",
"(",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | avg_pool | Resize an array using average pooling.
dtype support::
See :func:`imgaug.imgaug.pool`.
Parameters
----------
arr : (H,W) ndarray or (H,W,C) ndarray
Image-like array to pool. See :func:`imgaug.pool` for details.
block_size : int or tuple of int or tuple of int
Size of each... | imgaug/imgaug.py | def avg_pool(arr, block_size, cval=0, preserve_dtype=True):
"""
Resize an array using average pooling.
dtype support::
See :func:`imgaug.imgaug.pool`.
Parameters
----------
arr : (H,W) ndarray or (H,W,C) ndarray
Image-like array to pool. See :func:`imgaug.pool` for details.
... | def avg_pool(arr, block_size, cval=0, preserve_dtype=True):
"""
Resize an array using average pooling.
dtype support::
See :func:`imgaug.imgaug.pool`.
Parameters
----------
arr : (H,W) ndarray or (H,W,C) ndarray
Image-like array to pool. See :func:`imgaug.pool` for details.
... | [
"Resize",
"an",
"array",
"using",
"average",
"pooling",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1619-L1647 | [
"def",
"avg_pool",
"(",
"arr",
",",
"block_size",
",",
"cval",
"=",
"0",
",",
"preserve_dtype",
"=",
"True",
")",
":",
"return",
"pool",
"(",
"arr",
",",
"block_size",
",",
"np",
".",
"average",
",",
"cval",
"=",
"cval",
",",
"preserve_dtype",
"=",
"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | max_pool | Resize an array using max-pooling.
dtype support::
See :func:`imgaug.imgaug.pool`.
Parameters
----------
arr : (H,W) ndarray or (H,W,C) ndarray
Image-like array to pool. See :func:`imgaug.pool` for details.
block_size : int or tuple of int or tuple of int
Size of each blo... | imgaug/imgaug.py | def max_pool(arr, block_size, cval=0, preserve_dtype=True):
"""
Resize an array using max-pooling.
dtype support::
See :func:`imgaug.imgaug.pool`.
Parameters
----------
arr : (H,W) ndarray or (H,W,C) ndarray
Image-like array to pool. See :func:`imgaug.pool` for details.
b... | def max_pool(arr, block_size, cval=0, preserve_dtype=True):
"""
Resize an array using max-pooling.
dtype support::
See :func:`imgaug.imgaug.pool`.
Parameters
----------
arr : (H,W) ndarray or (H,W,C) ndarray
Image-like array to pool. See :func:`imgaug.pool` for details.
b... | [
"Resize",
"an",
"array",
"using",
"max",
"-",
"pooling",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1650-L1678 | [
"def",
"max_pool",
"(",
"arr",
",",
"block_size",
",",
"cval",
"=",
"0",
",",
"preserve_dtype",
"=",
"True",
")",
":",
"return",
"pool",
"(",
"arr",
",",
"block_size",
",",
"np",
".",
"max",
",",
"cval",
"=",
"cval",
",",
"preserve_dtype",
"=",
"pres... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | draw_grid | Converts multiple input images into a single image showing them in a grid.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: yes; fully tested
* ``uint32``: yes; fully tested
* ``uint64``: yes; fully tested
* ``int8``: yes; fully tested
* ``int16``: yes; ... | imgaug/imgaug.py | def draw_grid(images, rows=None, cols=None):
"""
Converts multiple input images into a single image showing them in a grid.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: yes; fully tested
* ``uint32``: yes; fully tested
* ``uint64``: yes; fully tested
... | def draw_grid(images, rows=None, cols=None):
"""
Converts multiple input images into a single image showing them in a grid.
dtype support::
* ``uint8``: yes; fully tested
* ``uint16``: yes; fully tested
* ``uint32``: yes; fully tested
* ``uint64``: yes; fully tested
... | [
"Converts",
"multiple",
"input",
"images",
"into",
"a",
"single",
"image",
"showing",
"them",
"in",
"a",
"grid",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1681-L1765 | [
"def",
"draw_grid",
"(",
"images",
",",
"rows",
"=",
"None",
",",
"cols",
"=",
"None",
")",
":",
"nb_images",
"=",
"len",
"(",
"images",
")",
"do_assert",
"(",
"nb_images",
">",
"0",
")",
"if",
"is_np_array",
"(",
"images",
")",
":",
"do_assert",
"("... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | show_grid | Converts the input images to a grid image and shows it in a new window.
dtype support::
minimum of (
:func:`imgaug.imgaug.draw_grid`,
:func:`imgaug.imgaug.imshow`
)
Parameters
----------
images : (N,H,W,3) ndarray or iterable of (H,W,3) array
See :func:... | imgaug/imgaug.py | def show_grid(images, rows=None, cols=None):
"""
Converts the input images to a grid image and shows it in a new window.
dtype support::
minimum of (
:func:`imgaug.imgaug.draw_grid`,
:func:`imgaug.imgaug.imshow`
)
Parameters
----------
images : (N,H,W,3... | def show_grid(images, rows=None, cols=None):
"""
Converts the input images to a grid image and shows it in a new window.
dtype support::
minimum of (
:func:`imgaug.imgaug.draw_grid`,
:func:`imgaug.imgaug.imshow`
)
Parameters
----------
images : (N,H,W,3... | [
"Converts",
"the",
"input",
"images",
"to",
"a",
"grid",
"image",
"and",
"shows",
"it",
"in",
"a",
"new",
"window",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1768-L1792 | [
"def",
"show_grid",
"(",
"images",
",",
"rows",
"=",
"None",
",",
"cols",
"=",
"None",
")",
":",
"grid",
"=",
"draw_grid",
"(",
"images",
",",
"rows",
"=",
"rows",
",",
"cols",
"=",
"cols",
")",
"imshow",
"(",
"grid",
")"
] | 786be74aa855513840113ea523c5df495dc6a8af |
valid | imshow | Shows an image in a window.
dtype support::
* ``uint8``: yes; not tested
* ``uint16``: ?
* ``uint32``: ?
* ``uint64``: ?
* ``int8``: ?
* ``int16``: ?
* ``int32``: ?
* ``int64``: ?
* ``float16``: ?
* ``float32``: ?
* ``float64`... | imgaug/imgaug.py | def imshow(image, backend=IMSHOW_BACKEND_DEFAULT):
"""
Shows an image in a window.
dtype support::
* ``uint8``: yes; not tested
* ``uint16``: ?
* ``uint32``: ?
* ``uint64``: ?
* ``int8``: ?
* ``int16``: ?
* ``int32``: ?
* ``int64``: ?
... | def imshow(image, backend=IMSHOW_BACKEND_DEFAULT):
"""
Shows an image in a window.
dtype support::
* ``uint8``: yes; not tested
* ``uint16``: ?
* ``uint32``: ?
* ``uint64``: ?
* ``int8``: ?
* ``int16``: ?
* ``int32``: ?
* ``int64``: ?
... | [
"Shows",
"an",
"image",
"in",
"a",
"window",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1795-L1847 | [
"def",
"imshow",
"(",
"image",
",",
"backend",
"=",
"IMSHOW_BACKEND_DEFAULT",
")",
":",
"do_assert",
"(",
"backend",
"in",
"[",
"\"matplotlib\"",
",",
"\"cv2\"",
"]",
",",
"\"Expected backend 'matplotlib' or 'cv2', got %s.\"",
"%",
"(",
"backend",
",",
")",
")",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | warn_deprecated | Generate a non-silent deprecation warning with stacktrace.
The used warning is ``imgaug.imgaug.DeprecationWarning``.
Parameters
----------
msg : str
The message of the warning.
stacklevel : int, optional
How many steps above this function to "jump" in the stacktrace for
th... | imgaug/imgaug.py | def warn_deprecated(msg, stacklevel=2):
"""Generate a non-silent deprecation warning with stacktrace.
The used warning is ``imgaug.imgaug.DeprecationWarning``.
Parameters
----------
msg : str
The message of the warning.
stacklevel : int, optional
How many steps above this func... | def warn_deprecated(msg, stacklevel=2):
"""Generate a non-silent deprecation warning with stacktrace.
The used warning is ``imgaug.imgaug.DeprecationWarning``.
Parameters
----------
msg : str
The message of the warning.
stacklevel : int, optional
How many steps above this func... | [
"Generate",
"a",
"non",
"-",
"silent",
"deprecation",
"warning",
"with",
"stacktrace",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L2046-L2065 | [
"def",
"warn_deprecated",
"(",
"msg",
",",
"stacklevel",
"=",
"2",
")",
":",
"import",
"warnings",
"warnings",
".",
"warn",
"(",
"msg",
",",
"category",
"=",
"DeprecationWarning",
",",
"stacklevel",
"=",
"stacklevel",
")"
] | 786be74aa855513840113ea523c5df495dc6a8af |
valid | HooksImages.is_activated | Returns whether an augmenter may be executed.
Returns
-------
bool
If True, the augmenter may be executed. If False, it may not be executed. | imgaug/imgaug.py | def is_activated(self, images, augmenter, parents, default):
"""
Returns whether an augmenter may be executed.
Returns
-------
bool
If True, the augmenter may be executed. If False, it may not be executed.
"""
if self.activator is None:
r... | def is_activated(self, images, augmenter, parents, default):
"""
Returns whether an augmenter may be executed.
Returns
-------
bool
If True, the augmenter may be executed. If False, it may not be executed.
"""
if self.activator is None:
r... | [
"Returns",
"whether",
"an",
"augmenter",
"may",
"be",
"executed",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1941-L1954 | [
"def",
"is_activated",
"(",
"self",
",",
"images",
",",
"augmenter",
",",
"parents",
",",
"default",
")",
":",
"if",
"self",
".",
"activator",
"is",
"None",
":",
"return",
"default",
"else",
":",
"return",
"self",
".",
"activator",
"(",
"images",
",",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | HooksImages.is_propagating | Returns whether an augmenter may call its children to augment an
image. This is independent of the augmenter itself possible changing
the image, without calling its children. (Most (all?) augmenters with
children currently dont perform any changes themselves.)
Returns
-------
... | imgaug/imgaug.py | def is_propagating(self, images, augmenter, parents, default):
"""
Returns whether an augmenter may call its children to augment an
image. This is independent of the augmenter itself possible changing
the image, without calling its children. (Most (all?) augmenters with
children ... | def is_propagating(self, images, augmenter, parents, default):
"""
Returns whether an augmenter may call its children to augment an
image. This is independent of the augmenter itself possible changing
the image, without calling its children. (Most (all?) augmenters with
children ... | [
"Returns",
"whether",
"an",
"augmenter",
"may",
"call",
"its",
"children",
"to",
"augment",
"an",
"image",
".",
"This",
"is",
"independent",
"of",
"the",
"augmenter",
"itself",
"possible",
"changing",
"the",
"image",
"without",
"calling",
"its",
"children",
".... | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1956-L1972 | [
"def",
"is_propagating",
"(",
"self",
",",
"images",
",",
"augmenter",
",",
"parents",
",",
"default",
")",
":",
"if",
"self",
".",
"propagator",
"is",
"None",
":",
"return",
"default",
"else",
":",
"return",
"self",
".",
"propagator",
"(",
"images",
","... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | HooksImages.preprocess | A function to be called before the augmentation of images starts (per augmenter).
Returns
-------
(N,H,W,C) ndarray or (N,H,W) ndarray or list of (H,W,C) ndarray or list of (H,W) ndarray
The input images, optionally modified. | imgaug/imgaug.py | def preprocess(self, images, augmenter, parents):
"""
A function to be called before the augmentation of images starts (per augmenter).
Returns
-------
(N,H,W,C) ndarray or (N,H,W) ndarray or list of (H,W,C) ndarray or list of (H,W) ndarray
The input images, optional... | def preprocess(self, images, augmenter, parents):
"""
A function to be called before the augmentation of images starts (per augmenter).
Returns
-------
(N,H,W,C) ndarray or (N,H,W) ndarray or list of (H,W,C) ndarray or list of (H,W) ndarray
The input images, optional... | [
"A",
"function",
"to",
"be",
"called",
"before",
"the",
"augmentation",
"of",
"images",
"starts",
"(",
"per",
"augmenter",
")",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1974-L1987 | [
"def",
"preprocess",
"(",
"self",
",",
"images",
",",
"augmenter",
",",
"parents",
")",
":",
"if",
"self",
".",
"preprocessor",
"is",
"None",
":",
"return",
"images",
"else",
":",
"return",
"self",
".",
"preprocessor",
"(",
"images",
",",
"augmenter",
",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | HooksImages.postprocess | A function to be called after the augmentation of images was
performed.
Returns
-------
(N,H,W,C) ndarray or (N,H,W) ndarray or list of (H,W,C) ndarray or list of (H,W) ndarray
The input images, optionally modified. | imgaug/imgaug.py | def postprocess(self, images, augmenter, parents):
"""
A function to be called after the augmentation of images was
performed.
Returns
-------
(N,H,W,C) ndarray or (N,H,W) ndarray or list of (H,W,C) ndarray or list of (H,W) ndarray
The input images, optionall... | def postprocess(self, images, augmenter, parents):
"""
A function to be called after the augmentation of images was
performed.
Returns
-------
(N,H,W,C) ndarray or (N,H,W) ndarray or list of (H,W,C) ndarray or list of (H,W) ndarray
The input images, optionall... | [
"A",
"function",
"to",
"be",
"called",
"after",
"the",
"augmentation",
"of",
"images",
"was",
"performed",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/imgaug.py#L1989-L2003 | [
"def",
"postprocess",
"(",
"self",
",",
"images",
",",
"augmenter",
",",
"parents",
")",
":",
"if",
"self",
".",
"postprocessor",
"is",
"None",
":",
"return",
"images",
"else",
":",
"return",
"self",
".",
"postprocessor",
"(",
"images",
",",
"augmenter",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Pool.pool | Return the multiprocessing.Pool instance or create it if not done yet.
Returns
-------
multiprocessing.Pool
The multiprocessing.Pool used internally by this imgaug.multicore.Pool. | imgaug/multicore.py | def pool(self):
"""Return the multiprocessing.Pool instance or create it if not done yet.
Returns
-------
multiprocessing.Pool
The multiprocessing.Pool used internally by this imgaug.multicore.Pool.
"""
if self._pool is None:
processes = self.pro... | def pool(self):
"""Return the multiprocessing.Pool instance or create it if not done yet.
Returns
-------
multiprocessing.Pool
The multiprocessing.Pool used internally by this imgaug.multicore.Pool.
"""
if self._pool is None:
processes = self.pro... | [
"Return",
"the",
"multiprocessing",
".",
"Pool",
"instance",
"or",
"create",
"it",
"if",
"not",
"done",
"yet",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L85-L108 | [
"def",
"pool",
"(",
"self",
")",
":",
"if",
"self",
".",
"_pool",
"is",
"None",
":",
"processes",
"=",
"self",
".",
"processes",
"if",
"processes",
"is",
"not",
"None",
"and",
"processes",
"<",
"0",
":",
"try",
":",
"# cpu count includes the hyperthreads, ... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Pool.map_batches | Augment batches.
Parameters
----------
batches : list of imgaug.augmentables.batches.Batch
The batches to augment.
chunksize : None or int, optional
Rough indicator of how many tasks should be sent to each worker. Increasing this number can improve
p... | imgaug/multicore.py | def map_batches(self, batches, chunksize=None):
"""
Augment batches.
Parameters
----------
batches : list of imgaug.augmentables.batches.Batch
The batches to augment.
chunksize : None or int, optional
Rough indicator of how many tasks should be s... | def map_batches(self, batches, chunksize=None):
"""
Augment batches.
Parameters
----------
batches : list of imgaug.augmentables.batches.Batch
The batches to augment.
chunksize : None or int, optional
Rough indicator of how many tasks should be s... | [
"Augment",
"batches",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L110-L131 | [
"def",
"map_batches",
"(",
"self",
",",
"batches",
",",
"chunksize",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"batches",
",",
"list",
")",
",",
"(",
"\"Expected to get a list as 'batches', got type %s. \"",
"+",
"\"Call imap_batches() if you use generators.\"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Pool.map_batches_async | Augment batches asynchonously.
Parameters
----------
batches : list of imgaug.augmentables.batches.Batch
The batches to augment.
chunksize : None or int, optional
Rough indicator of how many tasks should be sent to each worker. Increasing this number can improve... | imgaug/multicore.py | def map_batches_async(self, batches, chunksize=None, callback=None, error_callback=None):
"""
Augment batches asynchonously.
Parameters
----------
batches : list of imgaug.augmentables.batches.Batch
The batches to augment.
chunksize : None or int, optional
... | def map_batches_async(self, batches, chunksize=None, callback=None, error_callback=None):
"""
Augment batches asynchonously.
Parameters
----------
batches : list of imgaug.augmentables.batches.Batch
The batches to augment.
chunksize : None or int, optional
... | [
"Augment",
"batches",
"asynchonously",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L133-L161 | [
"def",
"map_batches_async",
"(",
"self",
",",
"batches",
",",
"chunksize",
"=",
"None",
",",
"callback",
"=",
"None",
",",
"error_callback",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"batches",
",",
"list",
")",
",",
"(",
"\"Expected to get a list ... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Pool.imap_batches | Augment batches from a generator.
Parameters
----------
batches : generator of imgaug.augmentables.batches.Batch
The batches to augment, provided as a generator. Each call to the generator should yield exactly one
batch.
chunksize : None or int, optional
... | imgaug/multicore.py | def imap_batches(self, batches, chunksize=1):
"""
Augment batches from a generator.
Parameters
----------
batches : generator of imgaug.augmentables.batches.Batch
The batches to augment, provided as a generator. Each call to the generator should yield exactly one
... | def imap_batches(self, batches, chunksize=1):
"""
Augment batches from a generator.
Parameters
----------
batches : generator of imgaug.augmentables.batches.Batch
The batches to augment, provided as a generator. Each call to the generator should yield exactly one
... | [
"Augment",
"batches",
"from",
"a",
"generator",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L163-L188 | [
"def",
"imap_batches",
"(",
"self",
",",
"batches",
",",
"chunksize",
"=",
"1",
")",
":",
"assert",
"ia",
".",
"is_generator",
"(",
"batches",
")",
",",
"(",
"\"Expected to get a generator as 'batches', got type %s. \"",
"+",
"\"Call map_batches() if you use lists.\"",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Pool.imap_batches_unordered | Augment batches from a generator in a way that does not guarantee to preserve order.
Parameters
----------
batches : generator of imgaug.augmentables.batches.Batch
The batches to augment, provided as a generator. Each call to the generator should yield exactly one
batch.... | imgaug/multicore.py | def imap_batches_unordered(self, batches, chunksize=1):
"""
Augment batches from a generator in a way that does not guarantee to preserve order.
Parameters
----------
batches : generator of imgaug.augmentables.batches.Batch
The batches to augment, provided as a gener... | def imap_batches_unordered(self, batches, chunksize=1):
"""
Augment batches from a generator in a way that does not guarantee to preserve order.
Parameters
----------
batches : generator of imgaug.augmentables.batches.Batch
The batches to augment, provided as a gener... | [
"Augment",
"batches",
"from",
"a",
"generator",
"in",
"a",
"way",
"that",
"does",
"not",
"guarantee",
"to",
"preserve",
"order",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L190-L215 | [
"def",
"imap_batches_unordered",
"(",
"self",
",",
"batches",
",",
"chunksize",
"=",
"1",
")",
":",
"assert",
"ia",
".",
"is_generator",
"(",
"batches",
")",
",",
"(",
"\"Expected to get a generator as 'batches', got type %s. \"",
"+",
"\"Call map_batches() if you use l... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Pool.terminate | Terminate the pool immediately. | imgaug/multicore.py | def terminate(self):
"""Terminate the pool immediately."""
if self._pool is not None:
self._pool.terminate()
self._pool.join()
self._pool = None | def terminate(self):
"""Terminate the pool immediately."""
if self._pool is not None:
self._pool.terminate()
self._pool.join()
self._pool = None | [
"Terminate",
"the",
"pool",
"immediately",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L233-L238 | [
"def",
"terminate",
"(",
"self",
")",
":",
"if",
"self",
".",
"_pool",
"is",
"not",
"None",
":",
"self",
".",
"_pool",
".",
"terminate",
"(",
")",
"self",
".",
"_pool",
".",
"join",
"(",
")",
"self",
".",
"_pool",
"=",
"None"
] | 786be74aa855513840113ea523c5df495dc6a8af |
valid | BatchLoader.terminate | Stop all workers. | imgaug/multicore.py | def terminate(self):
"""Stop all workers."""
if not self.join_signal.is_set():
self.join_signal.set()
# give minimal time to put generated batches in queue and gracefully shut down
time.sleep(0.01)
if self.main_worker_thread.is_alive():
self.main_worker_t... | def terminate(self):
"""Stop all workers."""
if not self.join_signal.is_set():
self.join_signal.set()
# give minimal time to put generated batches in queue and gracefully shut down
time.sleep(0.01)
if self.main_worker_thread.is_alive():
self.main_worker_t... | [
"Stop",
"all",
"workers",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L442-L485 | [
"def",
"terminate",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"join_signal",
".",
"is_set",
"(",
")",
":",
"self",
".",
"join_signal",
".",
"set",
"(",
")",
"# give minimal time to put generated batches in queue and gracefully shut down",
"time",
".",
"slee... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | BackgroundAugmenter.get_batch | Returns a batch from the queue of augmented batches.
If workers are still running and there are no batches in the queue,
it will automatically wait for the next batch.
Returns
-------
out : None or imgaug.Batch
One batch or None if all workers have finished. | imgaug/multicore.py | def get_batch(self):
"""
Returns a batch from the queue of augmented batches.
If workers are still running and there are no batches in the queue,
it will automatically wait for the next batch.
Returns
-------
out : None or imgaug.Batch
One batch or N... | def get_batch(self):
"""
Returns a batch from the queue of augmented batches.
If workers are still running and there are no batches in the queue,
it will automatically wait for the next batch.
Returns
-------
out : None or imgaug.Batch
One batch or N... | [
"Returns",
"a",
"batch",
"from",
"the",
"queue",
"of",
"augmented",
"batches",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L557-L586 | [
"def",
"get_batch",
"(",
"self",
")",
":",
"if",
"self",
".",
"all_finished",
"(",
")",
":",
"return",
"None",
"batch_str",
"=",
"self",
".",
"queue_result",
".",
"get",
"(",
")",
"batch",
"=",
"pickle",
".",
"loads",
"(",
"batch_str",
")",
"if",
"ba... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | BackgroundAugmenter._augment_images_worker | Augment endlessly images in the source queue.
This is a worker function for that endlessly queries the source queue (input batches),
augments batches in it and sends the result to the output queue. | imgaug/multicore.py | def _augment_images_worker(self, augseq, queue_source, queue_result, seedval):
"""
Augment endlessly images in the source queue.
This is a worker function for that endlessly queries the source queue (input batches),
augments batches in it and sends the result to the output queue.
... | def _augment_images_worker(self, augseq, queue_source, queue_result, seedval):
"""
Augment endlessly images in the source queue.
This is a worker function for that endlessly queries the source queue (input batches),
augments batches in it and sends the result to the output queue.
... | [
"Augment",
"endlessly",
"images",
"in",
"the",
"source",
"queue",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L588-L622 | [
"def",
"_augment_images_worker",
"(",
"self",
",",
"augseq",
",",
"queue_source",
",",
"queue_result",
",",
"seedval",
")",
":",
"np",
".",
"random",
".",
"seed",
"(",
"seedval",
")",
"random",
".",
"seed",
"(",
"seedval",
")",
"augseq",
".",
"reseed",
"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | BackgroundAugmenter.terminate | Terminates all background processes immediately.
This will also free their RAM. | imgaug/multicore.py | def terminate(self):
"""
Terminates all background processes immediately.
This will also free their RAM.
"""
for worker in self.workers:
if worker.is_alive():
worker.terminate()
self.nb_workers_finished = len(self.workers)
if not sel... | def terminate(self):
"""
Terminates all background processes immediately.
This will also free their RAM.
"""
for worker in self.workers:
if worker.is_alive():
worker.terminate()
self.nb_workers_finished = len(self.workers)
if not sel... | [
"Terminates",
"all",
"background",
"processes",
"immediately",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/multicore.py#L624-L638 | [
"def",
"terminate",
"(",
"self",
")",
":",
"for",
"worker",
"in",
"self",
".",
"workers",
":",
"if",
"worker",
".",
"is_alive",
"(",
")",
":",
"worker",
".",
"terminate",
"(",
")",
"self",
".",
"nb_workers_finished",
"=",
"len",
"(",
"self",
".",
"wo... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | UnnormalizedBatch.to_normalized_batch | Convert this unnormalized batch to an instance of Batch.
As this method is intended to be called before augmentation, it
assumes that none of the ``*_aug`` attributes is yet set.
It will produce an AssertionError otherwise.
The newly created Batch's ``*_unaug`` attributes will match th... | imgaug/augmentables/batches.py | def to_normalized_batch(self):
"""Convert this unnormalized batch to an instance of Batch.
As this method is intended to be called before augmentation, it
assumes that none of the ``*_aug`` attributes is yet set.
It will produce an AssertionError otherwise.
The newly created Ba... | def to_normalized_batch(self):
"""Convert this unnormalized batch to an instance of Batch.
As this method is intended to be called before augmentation, it
assumes that none of the ``*_aug`` attributes is yet set.
It will produce an AssertionError otherwise.
The newly created Ba... | [
"Convert",
"this",
"unnormalized",
"batch",
"to",
"an",
"instance",
"of",
"Batch",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/batches.py#L180-L223 | [
"def",
"to_normalized_batch",
"(",
"self",
")",
":",
"assert",
"all",
"(",
"[",
"attr",
"is",
"None",
"for",
"attr_name",
",",
"attr",
"in",
"self",
".",
"__dict__",
".",
"items",
"(",
")",
"if",
"attr_name",
".",
"endswith",
"(",
"\"_aug\"",
")",
"]",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | UnnormalizedBatch.fill_from_augmented_normalized_batch | Fill this batch with (normalized) augmentation results.
This method receives a (normalized) Batch instance, takes all
``*_aug`` attributes out if it and assigns them to this
batch *in unnormalized form*. Hence, the datatypes of all ``*_aug``
attributes will match the datatypes of the ``... | imgaug/augmentables/batches.py | def fill_from_augmented_normalized_batch(self, batch_aug_norm):
"""
Fill this batch with (normalized) augmentation results.
This method receives a (normalized) Batch instance, takes all
``*_aug`` attributes out if it and assigns them to this
batch *in unnormalized form*. Hence, ... | def fill_from_augmented_normalized_batch(self, batch_aug_norm):
"""
Fill this batch with (normalized) augmentation results.
This method receives a (normalized) Batch instance, takes all
``*_aug`` attributes out if it and assigns them to this
batch *in unnormalized form*. Hence, ... | [
"Fill",
"this",
"batch",
"with",
"(",
"normalized",
")",
"augmentation",
"results",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/batches.py#L225-L277 | [
"def",
"fill_from_augmented_normalized_batch",
"(",
"self",
",",
"batch_aug_norm",
")",
":",
"# we take here the .data from the normalized batch instead of from",
"# self for the rare case where one has decided to somehow change it",
"# during augmentation",
"batch",
"=",
"UnnormalizedBatc... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Positive | Converts another parameter's results to positive values.
Parameters
----------
other_param : imgaug.parameters.StochasticParameter
Other parameter which's sampled values are to be
modified.
mode : {'invert', 'reroll'}, optional
How to change the signs. Valid values are ``invert... | imgaug/parameters.py | def Positive(other_param, mode="invert", reroll_count_max=2):
"""
Converts another parameter's results to positive values.
Parameters
----------
other_param : imgaug.parameters.StochasticParameter
Other parameter which's sampled values are to be
modified.
mode : {'invert', 'rer... | def Positive(other_param, mode="invert", reroll_count_max=2):
"""
Converts another parameter's results to positive values.
Parameters
----------
other_param : imgaug.parameters.StochasticParameter
Other parameter which's sampled values are to be
modified.
mode : {'invert', 'rer... | [
"Converts",
"another",
"parameter",
"s",
"results",
"to",
"positive",
"values",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/parameters.py#L1919-L1954 | [
"def",
"Positive",
"(",
"other_param",
",",
"mode",
"=",
"\"invert\"",
",",
"reroll_count_max",
"=",
"2",
")",
":",
"return",
"ForceSign",
"(",
"other_param",
"=",
"other_param",
",",
"positive",
"=",
"True",
",",
"mode",
"=",
"mode",
",",
"reroll_count_max"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Negative | Converts another parameter's results to negative values.
Parameters
----------
other_param : imgaug.parameters.StochasticParameter
Other parameter which's sampled values are to be
modified.
mode : {'invert', 'reroll'}, optional
How to change the signs. Valid values are ``invert... | imgaug/parameters.py | def Negative(other_param, mode="invert", reroll_count_max=2):
"""
Converts another parameter's results to negative values.
Parameters
----------
other_param : imgaug.parameters.StochasticParameter
Other parameter which's sampled values are to be
modified.
mode : {'invert', 'rer... | def Negative(other_param, mode="invert", reroll_count_max=2):
"""
Converts another parameter's results to negative values.
Parameters
----------
other_param : imgaug.parameters.StochasticParameter
Other parameter which's sampled values are to be
modified.
mode : {'invert', 'rer... | [
"Converts",
"another",
"parameter",
"s",
"results",
"to",
"negative",
"values",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/parameters.py#L1957-L1992 | [
"def",
"Negative",
"(",
"other_param",
",",
"mode",
"=",
"\"invert\"",
",",
"reroll_count_max",
"=",
"2",
")",
":",
"return",
"ForceSign",
"(",
"other_param",
"=",
"other_param",
",",
"positive",
"=",
"False",
",",
"mode",
"=",
"mode",
",",
"reroll_count_max... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Sigmoid.create_for_noise | Creates a Sigmoid that is adjusted to be used with noise parameters,
i.e. with parameters which's output values are in the range [0.0, 1.0].
Parameters
----------
other_param : imgaug.parameters.StochasticParameter
See :func:`imgaug.parameters.Sigmoid.__init__`.
thr... | imgaug/parameters.py | def create_for_noise(other_param, threshold=(-10, 10), activated=True):
"""
Creates a Sigmoid that is adjusted to be used with noise parameters,
i.e. with parameters which's output values are in the range [0.0, 1.0].
Parameters
----------
other_param : imgaug.parameters.... | def create_for_noise(other_param, threshold=(-10, 10), activated=True):
"""
Creates a Sigmoid that is adjusted to be used with noise parameters,
i.e. with parameters which's output values are in the range [0.0, 1.0].
Parameters
----------
other_param : imgaug.parameters.... | [
"Creates",
"a",
"Sigmoid",
"that",
"is",
"adjusted",
"to",
"be",
"used",
"with",
"noise",
"parameters",
"i",
".",
"e",
".",
"with",
"parameters",
"which",
"s",
"output",
"values",
"are",
"in",
"the",
"range",
"[",
"0",
".",
"0",
"1",
".",
"0",
"]",
... | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/parameters.py#L2175-L2198 | [
"def",
"create_for_noise",
"(",
"other_param",
",",
"threshold",
"=",
"(",
"-",
"10",
",",
"10",
")",
",",
"activated",
"=",
"True",
")",
":",
"return",
"Sigmoid",
"(",
"other_param",
",",
"threshold",
",",
"activated",
",",
"mul",
"=",
"20",
",",
"add... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.area | Estimate the area of the polygon.
Returns
-------
number
Area of the polygon. | imgaug/augmentables/polys.py | def area(self):
"""
Estimate the area of the polygon.
Returns
-------
number
Area of the polygon.
"""
if len(self.exterior) < 3:
raise Exception("Cannot compute the polygon's area because it contains less than three points.")
poly... | def area(self):
"""
Estimate the area of the polygon.
Returns
-------
number
Area of the polygon.
"""
if len(self.exterior) < 3:
raise Exception("Cannot compute the polygon's area because it contains less than three points.")
poly... | [
"Estimate",
"the",
"area",
"of",
"the",
"polygon",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L148-L161 | [
"def",
"area",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"exterior",
")",
"<",
"3",
":",
"raise",
"Exception",
"(",
"\"Cannot compute the polygon's area because it contains less than three points.\"",
")",
"poly",
"=",
"self",
".",
"to_shapely_polygon",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.project | Project the polygon onto an image with different shape.
The relative coordinates of all points remain the same.
E.g. a point at (x=20, y=20) on an image (width=100, height=200) will be
projected on a new image (width=200, height=100) to (x=40, y=10).
This is intended for cases where th... | imgaug/augmentables/polys.py | def project(self, from_shape, to_shape):
"""
Project the polygon onto an image with different shape.
The relative coordinates of all points remain the same.
E.g. a point at (x=20, y=20) on an image (width=100, height=200) will be
projected on a new image (width=200, height=100) ... | def project(self, from_shape, to_shape):
"""
Project the polygon onto an image with different shape.
The relative coordinates of all points remain the same.
E.g. a point at (x=20, y=20) on an image (width=100, height=200) will be
projected on a new image (width=200, height=100) ... | [
"Project",
"the",
"polygon",
"onto",
"an",
"image",
"with",
"different",
"shape",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L191-L220 | [
"def",
"project",
"(",
"self",
",",
"from_shape",
",",
"to_shape",
")",
":",
"if",
"from_shape",
"[",
"0",
":",
"2",
"]",
"==",
"to_shape",
"[",
"0",
":",
"2",
"]",
":",
"return",
"self",
".",
"copy",
"(",
")",
"ls_proj",
"=",
"self",
".",
"to_li... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.find_closest_point_index | Find the index of the point within the exterior that is closest to the given coordinates.
"Closeness" is here defined based on euclidean distance.
This method will raise an AssertionError if the exterior contains no points.
Parameters
----------
x : number
X-coordin... | imgaug/augmentables/polys.py | def find_closest_point_index(self, x, y, return_distance=False):
"""
Find the index of the point within the exterior that is closest to the given coordinates.
"Closeness" is here defined based on euclidean distance.
This method will raise an AssertionError if the exterior contains no po... | def find_closest_point_index(self, x, y, return_distance=False):
"""
Find the index of the point within the exterior that is closest to the given coordinates.
"Closeness" is here defined based on euclidean distance.
This method will raise an AssertionError if the exterior contains no po... | [
"Find",
"the",
"index",
"of",
"the",
"point",
"within",
"the",
"exterior",
"that",
"is",
"closest",
"to",
"the",
"given",
"coordinates",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L222-L259 | [
"def",
"find_closest_point_index",
"(",
"self",
",",
"x",
",",
"y",
",",
"return_distance",
"=",
"False",
")",
":",
"ia",
".",
"do_assert",
"(",
"len",
"(",
"self",
".",
"exterior",
")",
">",
"0",
")",
"distances",
"=",
"[",
"]",
"for",
"x2",
",",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.is_fully_within_image | Estimate whether the polygon is fully inside the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
If an ndarray, its shape will be used.
If a tuple, it is assumed to represent the image shape and must contai... | imgaug/augmentables/polys.py | def is_fully_within_image(self, image):
"""
Estimate whether the polygon is fully inside the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
If an ndarray, its shape will be used.
If a tuple... | def is_fully_within_image(self, image):
"""
Estimate whether the polygon is fully inside the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
If an ndarray, its shape will be used.
If a tuple... | [
"Estimate",
"whether",
"the",
"polygon",
"is",
"fully",
"inside",
"the",
"image",
"area",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L262-L280 | [
"def",
"is_fully_within_image",
"(",
"self",
",",
"image",
")",
":",
"return",
"not",
"self",
".",
"is_out_of_image",
"(",
"image",
",",
"fully",
"=",
"True",
",",
"partly",
"=",
"True",
")"
] | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.is_partly_within_image | Estimate whether the polygon is at least partially inside the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
If an ndarray, its shape will be used.
If a tuple, it is assumed to represent the image shape an... | imgaug/augmentables/polys.py | def is_partly_within_image(self, image):
"""
Estimate whether the polygon is at least partially inside the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
If an ndarray, its shape will be used.
... | def is_partly_within_image(self, image):
"""
Estimate whether the polygon is at least partially inside the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
If an ndarray, its shape will be used.
... | [
"Estimate",
"whether",
"the",
"polygon",
"is",
"at",
"least",
"partially",
"inside",
"the",
"image",
"area",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L283-L301 | [
"def",
"is_partly_within_image",
"(",
"self",
",",
"image",
")",
":",
"return",
"not",
"self",
".",
"is_out_of_image",
"(",
"image",
",",
"fully",
"=",
"True",
",",
"partly",
"=",
"False",
")"
] | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.is_out_of_image | Estimate whether the polygon is partially or fully outside of the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
If an ndarray, its shape will be used.
If a tuple, it is assumed to represent the image shap... | imgaug/augmentables/polys.py | def is_out_of_image(self, image, fully=True, partly=False):
"""
Estimate whether the polygon is partially or fully outside of the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
If an ndarray, its shape... | def is_out_of_image(self, image, fully=True, partly=False):
"""
Estimate whether the polygon is partially or fully outside of the image area.
Parameters
----------
image : (H,W,...) ndarray or tuple of int
Image dimensions to use.
If an ndarray, its shape... | [
"Estimate",
"whether",
"the",
"polygon",
"is",
"partially",
"or",
"fully",
"outside",
"of",
"the",
"image",
"area",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L303-L332 | [
"def",
"is_out_of_image",
"(",
"self",
",",
"image",
",",
"fully",
"=",
"True",
",",
"partly",
"=",
"False",
")",
":",
"# TODO this is inconsistent with line strings, which return a default",
"# value in these cases",
"if",
"len",
"(",
"self",
".",
"exterior",
")... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.clip_out_of_image | Cut off all parts of the polygon that are outside of the image.
This operation may lead to new points being created.
As a single polygon may be split into multiple new polygons, the result
is always a list, which may contain more than one output polygon.
This operation will return an e... | imgaug/augmentables/polys.py | def clip_out_of_image(self, image):
"""
Cut off all parts of the polygon that are outside of the image.
This operation may lead to new points being created.
As a single polygon may be split into multiple new polygons, the result
is always a list, which may contain more than one ... | def clip_out_of_image(self, image):
"""
Cut off all parts of the polygon that are outside of the image.
This operation may lead to new points being created.
As a single polygon may be split into multiple new polygons, the result
is always a list, which may contain more than one ... | [
"Cut",
"off",
"all",
"parts",
"of",
"the",
"polygon",
"that",
"are",
"outside",
"of",
"the",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L342-L403 | [
"def",
"clip_out_of_image",
"(",
"self",
",",
"image",
")",
":",
"# load shapely lazily, which makes the dependency more optional",
"import",
"shapely",
".",
"geometry",
"# if fully out of image, clip everything away, nothing remaining",
"if",
"self",
".",
"is_out_of_image",
"(",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.shift | Shift the polygon from one or more image sides, i.e. move it on the x/y-axis.
Parameters
----------
top : None or int, optional
Amount of pixels by which to shift the polygon from the top.
right : None or int, optional
Amount of pixels by which to shift the poly... | imgaug/augmentables/polys.py | def shift(self, top=None, right=None, bottom=None, left=None):
"""
Shift the polygon from one or more image sides, i.e. move it on the x/y-axis.
Parameters
----------
top : None or int, optional
Amount of pixels by which to shift the polygon from the top.
ri... | def shift(self, top=None, right=None, bottom=None, left=None):
"""
Shift the polygon from one or more image sides, i.e. move it on the x/y-axis.
Parameters
----------
top : None or int, optional
Amount of pixels by which to shift the polygon from the top.
ri... | [
"Shift",
"the",
"polygon",
"from",
"one",
"or",
"more",
"image",
"sides",
"i",
".",
"e",
".",
"move",
"it",
"on",
"the",
"x",
"/",
"y",
"-",
"axis",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L405-L431 | [
"def",
"shift",
"(",
"self",
",",
"top",
"=",
"None",
",",
"right",
"=",
"None",
",",
"bottom",
"=",
"None",
",",
"left",
"=",
"None",
")",
":",
"ls_shifted",
"=",
"self",
".",
"to_line_string",
"(",
"closed",
"=",
"False",
")",
".",
"shift",
"(",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.draw_on_image | Draw the polygon on an image.
Parameters
----------
image : (H,W,C) ndarray
The image onto which to draw the polygon. Usually expected to be
of dtype ``uint8``, though other dtypes are also handled.
color : iterable of int, optional
The color to use ... | imgaug/augmentables/polys.py | def draw_on_image(self,
image,
color=(0, 255, 0), color_face=None,
color_lines=None, color_points=None,
alpha=1.0, alpha_face=None,
alpha_lines=None, alpha_points=None,
size=1, size_lines=... | def draw_on_image(self,
image,
color=(0, 255, 0), color_face=None,
color_lines=None, color_points=None,
alpha=1.0, alpha_face=None,
alpha_lines=None, alpha_points=None,
size=1, size_lines=... | [
"Draw",
"the",
"polygon",
"on",
"an",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L435-L591 | [
"def",
"draw_on_image",
"(",
"self",
",",
"image",
",",
"color",
"=",
"(",
"0",
",",
"255",
",",
"0",
")",
",",
"color_face",
"=",
"None",
",",
"color_lines",
"=",
"None",
",",
"color_points",
"=",
"None",
",",
"alpha",
"=",
"1.0",
",",
"alpha_face",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.extract_from_image | Extract the image pixels within the polygon.
This function will zero-pad the image if the polygon is partially/fully outside of
the image.
Parameters
----------
image : (H,W) ndarray or (H,W,C) ndarray
The image from which to extract the pixels within the polygon.
... | imgaug/augmentables/polys.py | def extract_from_image(self, image):
"""
Extract the image pixels within the polygon.
This function will zero-pad the image if the polygon is partially/fully outside of
the image.
Parameters
----------
image : (H,W) ndarray or (H,W,C) ndarray
The ima... | def extract_from_image(self, image):
"""
Extract the image pixels within the polygon.
This function will zero-pad the image if the polygon is partially/fully outside of
the image.
Parameters
----------
image : (H,W) ndarray or (H,W,C) ndarray
The ima... | [
"Extract",
"the",
"image",
"pixels",
"within",
"the",
"polygon",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L593-L636 | [
"def",
"extract_from_image",
"(",
"self",
",",
"image",
")",
":",
"ia",
".",
"do_assert",
"(",
"image",
".",
"ndim",
"in",
"[",
"2",
",",
"3",
"]",
")",
"if",
"len",
"(",
"self",
".",
"exterior",
")",
"<=",
"2",
":",
"raise",
"Exception",
"(",
"\... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.change_first_point_by_coords | Set the first point of the exterior to the given point based on its coordinates.
If multiple points are found, the closest one will be picked.
If no matching points are found, an exception is raised.
Note: This method does *not* work in-place.
Parameters
----------
x :... | imgaug/augmentables/polys.py | def change_first_point_by_coords(self, x, y, max_distance=1e-4,
raise_if_too_far_away=True):
"""
Set the first point of the exterior to the given point based on its coordinates.
If multiple points are found, the closest one will be picked.
If no matc... | def change_first_point_by_coords(self, x, y, max_distance=1e-4,
raise_if_too_far_away=True):
"""
Set the first point of the exterior to the given point based on its coordinates.
If multiple points are found, the closest one will be picked.
If no matc... | [
"Set",
"the",
"first",
"point",
"of",
"the",
"exterior",
"to",
"the",
"given",
"point",
"based",
"on",
"its",
"coordinates",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L638-L684 | [
"def",
"change_first_point_by_coords",
"(",
"self",
",",
"x",
",",
"y",
",",
"max_distance",
"=",
"1e-4",
",",
"raise_if_too_far_away",
"=",
"True",
")",
":",
"if",
"len",
"(",
"self",
".",
"exterior",
")",
"==",
"0",
":",
"raise",
"Exception",
"(",
"\"C... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.change_first_point_by_index | Set the first point of the exterior to the given point based on its index.
Note: This method does *not* work in-place.
Parameters
----------
point_idx : int
Index of the desired starting point.
Returns
-------
imgaug.Polygon
Copy of this... | imgaug/augmentables/polys.py | def change_first_point_by_index(self, point_idx):
"""
Set the first point of the exterior to the given point based on its index.
Note: This method does *not* work in-place.
Parameters
----------
point_idx : int
Index of the desired starting point.
R... | def change_first_point_by_index(self, point_idx):
"""
Set the first point of the exterior to the given point based on its index.
Note: This method does *not* work in-place.
Parameters
----------
point_idx : int
Index of the desired starting point.
R... | [
"Set",
"the",
"first",
"point",
"of",
"the",
"exterior",
"to",
"the",
"given",
"point",
"based",
"on",
"its",
"index",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L686-L710 | [
"def",
"change_first_point_by_index",
"(",
"self",
",",
"point_idx",
")",
":",
"ia",
".",
"do_assert",
"(",
"0",
"<=",
"point_idx",
"<",
"len",
"(",
"self",
".",
"exterior",
")",
")",
"if",
"point_idx",
"==",
"0",
":",
"return",
"self",
".",
"deepcopy",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.to_shapely_polygon | Convert this polygon to a Shapely polygon.
Returns
-------
shapely.geometry.Polygon
The Shapely polygon matching this polygon's exterior. | imgaug/augmentables/polys.py | def to_shapely_polygon(self):
"""
Convert this polygon to a Shapely polygon.
Returns
-------
shapely.geometry.Polygon
The Shapely polygon matching this polygon's exterior.
"""
# load shapely lazily, which makes the dependency more optional
im... | def to_shapely_polygon(self):
"""
Convert this polygon to a Shapely polygon.
Returns
-------
shapely.geometry.Polygon
The Shapely polygon matching this polygon's exterior.
"""
# load shapely lazily, which makes the dependency more optional
im... | [
"Convert",
"this",
"polygon",
"to",
"a",
"Shapely",
"polygon",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L712-L725 | [
"def",
"to_shapely_polygon",
"(",
"self",
")",
":",
"# load shapely lazily, which makes the dependency more optional",
"import",
"shapely",
".",
"geometry",
"return",
"shapely",
".",
"geometry",
".",
"Polygon",
"(",
"[",
"(",
"point",
"[",
"0",
"]",
",",
"point",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.to_shapely_line_string | Convert this polygon to a Shapely LineString object.
Parameters
----------
closed : bool, optional
Whether to return the line string with the last point being identical to the first point.
interpolate : int, optional
Number of points to interpolate between any p... | imgaug/augmentables/polys.py | def to_shapely_line_string(self, closed=False, interpolate=0):
"""
Convert this polygon to a Shapely LineString object.
Parameters
----------
closed : bool, optional
Whether to return the line string with the last point being identical to the first point.
in... | def to_shapely_line_string(self, closed=False, interpolate=0):
"""
Convert this polygon to a Shapely LineString object.
Parameters
----------
closed : bool, optional
Whether to return the line string with the last point being identical to the first point.
in... | [
"Convert",
"this",
"polygon",
"to",
"a",
"Shapely",
"LineString",
"object",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L727-L746 | [
"def",
"to_shapely_line_string",
"(",
"self",
",",
"closed",
"=",
"False",
",",
"interpolate",
"=",
"0",
")",
":",
"return",
"_convert_points_to_shapely_line_string",
"(",
"self",
".",
"exterior",
",",
"closed",
"=",
"closed",
",",
"interpolate",
"=",
"interpola... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.to_bounding_box | Convert this polygon to a bounding box tightly containing the whole polygon.
Returns
-------
imgaug.BoundingBox
Tight bounding box around the polygon. | imgaug/augmentables/polys.py | def to_bounding_box(self):
"""
Convert this polygon to a bounding box tightly containing the whole polygon.
Returns
-------
imgaug.BoundingBox
Tight bounding box around the polygon.
"""
# TODO get rid of this deferred import
from imgaug.augme... | def to_bounding_box(self):
"""
Convert this polygon to a bounding box tightly containing the whole polygon.
Returns
-------
imgaug.BoundingBox
Tight bounding box around the polygon.
"""
# TODO get rid of this deferred import
from imgaug.augme... | [
"Convert",
"this",
"polygon",
"to",
"a",
"bounding",
"box",
"tightly",
"containing",
"the",
"whole",
"polygon",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L748-L763 | [
"def",
"to_bounding_box",
"(",
"self",
")",
":",
"# TODO get rid of this deferred import",
"from",
"imgaug",
".",
"augmentables",
".",
"bbs",
"import",
"BoundingBox",
"xx",
"=",
"self",
".",
"xx",
"yy",
"=",
"self",
".",
"yy",
"return",
"BoundingBox",
"(",
"x1... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.to_keypoints | Convert this polygon's `exterior` to ``Keypoint`` instances.
Returns
-------
list of imgaug.Keypoint
Exterior vertices as ``Keypoint`` instances. | imgaug/augmentables/polys.py | def to_keypoints(self):
"""
Convert this polygon's `exterior` to ``Keypoint`` instances.
Returns
-------
list of imgaug.Keypoint
Exterior vertices as ``Keypoint`` instances.
"""
# TODO get rid of this deferred import
from imgaug.augmentables.... | def to_keypoints(self):
"""
Convert this polygon's `exterior` to ``Keypoint`` instances.
Returns
-------
list of imgaug.Keypoint
Exterior vertices as ``Keypoint`` instances.
"""
# TODO get rid of this deferred import
from imgaug.augmentables.... | [
"Convert",
"this",
"polygon",
"s",
"exterior",
"to",
"Keypoint",
"instances",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L765-L778 | [
"def",
"to_keypoints",
"(",
"self",
")",
":",
"# TODO get rid of this deferred import",
"from",
"imgaug",
".",
"augmentables",
".",
"kps",
"import",
"Keypoint",
"return",
"[",
"Keypoint",
"(",
"x",
"=",
"point",
"[",
"0",
"]",
",",
"y",
"=",
"point",
"[",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.to_line_string | Convert this polygon's `exterior` to a ``LineString`` instance.
Parameters
----------
closed : bool, optional
Whether to close the line string, i.e. to add the first point of
the `exterior` also as the last point at the end of the line string.
This has no eff... | imgaug/augmentables/polys.py | def to_line_string(self, closed=True):
"""
Convert this polygon's `exterior` to a ``LineString`` instance.
Parameters
----------
closed : bool, optional
Whether to close the line string, i.e. to add the first point of
the `exterior` also as the last point... | def to_line_string(self, closed=True):
"""
Convert this polygon's `exterior` to a ``LineString`` instance.
Parameters
----------
closed : bool, optional
Whether to close the line string, i.e. to add the first point of
the `exterior` also as the last point... | [
"Convert",
"this",
"polygon",
"s",
"exterior",
"to",
"a",
"LineString",
"instance",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L780-L803 | [
"def",
"to_line_string",
"(",
"self",
",",
"closed",
"=",
"True",
")",
":",
"from",
"imgaug",
".",
"augmentables",
".",
"lines",
"import",
"LineString",
"if",
"not",
"closed",
"or",
"len",
"(",
"self",
".",
"exterior",
")",
"<=",
"1",
":",
"return",
"L... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.from_shapely | Create a polygon from a Shapely polygon.
Note: This will remove any holes in the Shapely polygon.
Parameters
----------
polygon_shapely : shapely.geometry.Polygon
The shapely polygon.
label : None or str, optional
The label of the new polygon.
... | imgaug/augmentables/polys.py | def from_shapely(polygon_shapely, label=None):
"""
Create a polygon from a Shapely polygon.
Note: This will remove any holes in the Shapely polygon.
Parameters
----------
polygon_shapely : shapely.geometry.Polygon
The shapely polygon.
label : None ... | def from_shapely(polygon_shapely, label=None):
"""
Create a polygon from a Shapely polygon.
Note: This will remove any holes in the Shapely polygon.
Parameters
----------
polygon_shapely : shapely.geometry.Polygon
The shapely polygon.
label : None ... | [
"Create",
"a",
"polygon",
"from",
"a",
"Shapely",
"polygon",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L806-L834 | [
"def",
"from_shapely",
"(",
"polygon_shapely",
",",
"label",
"=",
"None",
")",
":",
"# load shapely lazily, which makes the dependency more optional",
"import",
"shapely",
".",
"geometry",
"ia",
".",
"do_assert",
"(",
"isinstance",
"(",
"polygon_shapely",
",",
"shapely"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.exterior_almost_equals | Estimate if this and other polygon's exterior are almost identical.
The two exteriors can have different numbers of points, but any point
randomly sampled on the exterior of one polygon should be close to the
closest point on the exterior of the other polygon.
Note that this method wor... | imgaug/augmentables/polys.py | def exterior_almost_equals(self, other, max_distance=1e-6, points_per_edge=8):
"""
Estimate if this and other polygon's exterior are almost identical.
The two exteriors can have different numbers of points, but any point
randomly sampled on the exterior of one polygon should be close to... | def exterior_almost_equals(self, other, max_distance=1e-6, points_per_edge=8):
"""
Estimate if this and other polygon's exterior are almost identical.
The two exteriors can have different numbers of points, but any point
randomly sampled on the exterior of one polygon should be close to... | [
"Estimate",
"if",
"this",
"and",
"other",
"polygon",
"s",
"exterior",
"are",
"almost",
"identical",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L836-L890 | [
"def",
"exterior_almost_equals",
"(",
"self",
",",
"other",
",",
"max_distance",
"=",
"1e-6",
",",
"points_per_edge",
"=",
"8",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"list",
")",
":",
"other",
"=",
"Polygon",
"(",
"np",
".",
"float32",
"(",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.almost_equals | Estimate if this polygon's and another's geometry/labels are similar.
This is the same as :func:`imgaug.Polygon.exterior_almost_equals` but
additionally compares the labels.
Parameters
----------
other
The object to compare against. If not a Polygon, then False will... | imgaug/augmentables/polys.py | def almost_equals(self, other, max_distance=1e-6, points_per_edge=8):
"""
Estimate if this polygon's and another's geometry/labels are similar.
This is the same as :func:`imgaug.Polygon.exterior_almost_equals` but
additionally compares the labels.
Parameters
----------
... | def almost_equals(self, other, max_distance=1e-6, points_per_edge=8):
"""
Estimate if this polygon's and another's geometry/labels are similar.
This is the same as :func:`imgaug.Polygon.exterior_almost_equals` but
additionally compares the labels.
Parameters
----------
... | [
"Estimate",
"if",
"this",
"polygon",
"s",
"and",
"another",
"s",
"geometry",
"/",
"labels",
"are",
"similar",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L892-L928 | [
"def",
"almost_equals",
"(",
"self",
",",
"other",
",",
"max_distance",
"=",
"1e-6",
",",
"points_per_edge",
"=",
"8",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Polygon",
")",
":",
"return",
"False",
"if",
"self",
".",
"label",
"is",
"no... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.copy | Create a shallow copy of the Polygon object.
Parameters
----------
exterior : list of imgaug.Keypoint or list of tuple or (N,2) ndarray, optional
List of points defining the polygon. See :func:`imgaug.Polygon.__init__` for details.
label : None or str, optional
... | imgaug/augmentables/polys.py | def copy(self, exterior=None, label=None):
"""
Create a shallow copy of the Polygon object.
Parameters
----------
exterior : list of imgaug.Keypoint or list of tuple or (N,2) ndarray, optional
List of points defining the polygon. See :func:`imgaug.Polygon.__init__` f... | def copy(self, exterior=None, label=None):
"""
Create a shallow copy of the Polygon object.
Parameters
----------
exterior : list of imgaug.Keypoint or list of tuple or (N,2) ndarray, optional
List of points defining the polygon. See :func:`imgaug.Polygon.__init__` f... | [
"Create",
"a",
"shallow",
"copy",
"of",
"the",
"Polygon",
"object",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L930-L948 | [
"def",
"copy",
"(",
"self",
",",
"exterior",
"=",
"None",
",",
"label",
"=",
"None",
")",
":",
"return",
"self",
".",
"deepcopy",
"(",
"exterior",
"=",
"exterior",
",",
"label",
"=",
"label",
")"
] | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Polygon.deepcopy | Create a deep copy of the Polygon object.
Parameters
----------
exterior : list of Keypoint or list of tuple or (N,2) ndarray, optional
List of points defining the polygon. See `imgaug.Polygon.__init__` for details.
label : None or str
If not None, then the labe... | imgaug/augmentables/polys.py | def deepcopy(self, exterior=None, label=None):
"""
Create a deep copy of the Polygon object.
Parameters
----------
exterior : list of Keypoint or list of tuple or (N,2) ndarray, optional
List of points defining the polygon. See `imgaug.Polygon.__init__` for details.
... | def deepcopy(self, exterior=None, label=None):
"""
Create a deep copy of the Polygon object.
Parameters
----------
exterior : list of Keypoint or list of tuple or (N,2) ndarray, optional
List of points defining the polygon. See `imgaug.Polygon.__init__` for details.
... | [
"Create",
"a",
"deep",
"copy",
"of",
"the",
"Polygon",
"object",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L950-L971 | [
"def",
"deepcopy",
"(",
"self",
",",
"exterior",
"=",
"None",
",",
"label",
"=",
"None",
")",
":",
"return",
"Polygon",
"(",
"exterior",
"=",
"np",
".",
"copy",
"(",
"self",
".",
"exterior",
")",
"if",
"exterior",
"is",
"None",
"else",
"exterior",
",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | PolygonsOnImage.on | Project polygons from one image to a new one.
Parameters
----------
image : ndarray or tuple of int
New image onto which the polygons are to be projected.
May also simply be that new image's shape tuple.
Returns
-------
imgaug.PolygonsOnImage
... | imgaug/augmentables/polys.py | def on(self, image):
"""
Project polygons from one image to a new one.
Parameters
----------
image : ndarray or tuple of int
New image onto which the polygons are to be projected.
May also simply be that new image's shape tuple.
Returns
-... | def on(self, image):
"""
Project polygons from one image to a new one.
Parameters
----------
image : ndarray or tuple of int
New image onto which the polygons are to be projected.
May also simply be that new image's shape tuple.
Returns
-... | [
"Project",
"polygons",
"from",
"one",
"image",
"to",
"a",
"new",
"one",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L1024-L1045 | [
"def",
"on",
"(",
"self",
",",
"image",
")",
":",
"shape",
"=",
"normalize_shape",
"(",
"image",
")",
"if",
"shape",
"[",
"0",
":",
"2",
"]",
"==",
"self",
".",
"shape",
"[",
"0",
":",
"2",
"]",
":",
"return",
"self",
".",
"deepcopy",
"(",
")",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | PolygonsOnImage.draw_on_image | Draw all polygons onto a given image.
Parameters
----------
image : (H,W,C) ndarray
The image onto which to draw the bounding boxes.
This image should usually have the same shape as set in
``PolygonsOnImage.shape``.
color : iterable of int, optional
... | imgaug/augmentables/polys.py | def draw_on_image(self,
image,
color=(0, 255, 0), color_face=None,
color_lines=None, color_points=None,
alpha=1.0, alpha_face=None,
alpha_lines=None, alpha_points=None,
size=1, size_lines=... | def draw_on_image(self,
image,
color=(0, 255, 0), color_face=None,
color_lines=None, color_points=None,
alpha=1.0, alpha_face=None,
alpha_lines=None, alpha_points=None,
size=1, size_lines=... | [
"Draw",
"all",
"polygons",
"onto",
"a",
"given",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L1047-L1156 | [
"def",
"draw_on_image",
"(",
"self",
",",
"image",
",",
"color",
"=",
"(",
"0",
",",
"255",
",",
"0",
")",
",",
"color_face",
"=",
"None",
",",
"color_lines",
"=",
"None",
",",
"color_points",
"=",
"None",
",",
"alpha",
"=",
"1.0",
",",
"alpha_face",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | PolygonsOnImage.remove_out_of_image | Remove all polygons that are fully or partially outside of the image.
Parameters
----------
fully : bool, optional
Whether to remove polygons that are fully outside of the image.
partly : bool, optional
Whether to remove polygons that are partially outside of th... | imgaug/augmentables/polys.py | def remove_out_of_image(self, fully=True, partly=False):
"""
Remove all polygons that are fully or partially outside of the image.
Parameters
----------
fully : bool, optional
Whether to remove polygons that are fully outside of the image.
partly : bool, opt... | def remove_out_of_image(self, fully=True, partly=False):
"""
Remove all polygons that are fully or partially outside of the image.
Parameters
----------
fully : bool, optional
Whether to remove polygons that are fully outside of the image.
partly : bool, opt... | [
"Remove",
"all",
"polygons",
"that",
"are",
"fully",
"or",
"partially",
"outside",
"of",
"the",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L1158-L1182 | [
"def",
"remove_out_of_image",
"(",
"self",
",",
"fully",
"=",
"True",
",",
"partly",
"=",
"False",
")",
":",
"polys_clean",
"=",
"[",
"poly",
"for",
"poly",
"in",
"self",
".",
"polygons",
"if",
"not",
"poly",
".",
"is_out_of_image",
"(",
"self",
".",
"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | PolygonsOnImage.clip_out_of_image | Clip off all parts from all polygons that are outside of the image.
NOTE: The result can contain less polygons than the input did. That
happens when a polygon is fully outside of the image plane.
NOTE: The result can also contain *more* polygons than the input
did. That happens when di... | imgaug/augmentables/polys.py | def clip_out_of_image(self):
"""
Clip off all parts from all polygons that are outside of the image.
NOTE: The result can contain less polygons than the input did. That
happens when a polygon is fully outside of the image plane.
NOTE: The result can also contain *more* polygons... | def clip_out_of_image(self):
"""
Clip off all parts from all polygons that are outside of the image.
NOTE: The result can contain less polygons than the input did. That
happens when a polygon is fully outside of the image plane.
NOTE: The result can also contain *more* polygons... | [
"Clip",
"off",
"all",
"parts",
"from",
"all",
"polygons",
"that",
"are",
"outside",
"of",
"the",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L1184-L1212 | [
"def",
"clip_out_of_image",
"(",
"self",
")",
":",
"polys_cut",
"=",
"[",
"poly",
".",
"clip_out_of_image",
"(",
"self",
".",
"shape",
")",
"for",
"poly",
"in",
"self",
".",
"polygons",
"if",
"poly",
".",
"is_partly_within_image",
"(",
"self",
".",
"shape"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | PolygonsOnImage.shift | Shift all polygons from one or more image sides, i.e. move them on the x/y-axis.
Parameters
----------
top : None or int, optional
Amount of pixels by which to shift all polygons from the top.
right : None or int, optional
Amount of pixels by which to shift all ... | imgaug/augmentables/polys.py | def shift(self, top=None, right=None, bottom=None, left=None):
"""
Shift all polygons from one or more image sides, i.e. move them on the x/y-axis.
Parameters
----------
top : None or int, optional
Amount of pixels by which to shift all polygons from the top.
... | def shift(self, top=None, right=None, bottom=None, left=None):
"""
Shift all polygons from one or more image sides, i.e. move them on the x/y-axis.
Parameters
----------
top : None or int, optional
Amount of pixels by which to shift all polygons from the top.
... | [
"Shift",
"all",
"polygons",
"from",
"one",
"or",
"more",
"image",
"sides",
"i",
".",
"e",
".",
"move",
"them",
"on",
"the",
"x",
"/",
"y",
"-",
"axis",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L1214-L1243 | [
"def",
"shift",
"(",
"self",
",",
"top",
"=",
"None",
",",
"right",
"=",
"None",
",",
"bottom",
"=",
"None",
",",
"left",
"=",
"None",
")",
":",
"polys_new",
"=",
"[",
"poly",
".",
"shift",
"(",
"top",
"=",
"top",
",",
"right",
"=",
"right",
",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | PolygonsOnImage.deepcopy | Create a deep copy of the PolygonsOnImage object.
Returns
-------
imgaug.PolygonsOnImage
Deep copy. | imgaug/augmentables/polys.py | def deepcopy(self):
"""
Create a deep copy of the PolygonsOnImage object.
Returns
-------
imgaug.PolygonsOnImage
Deep copy.
"""
# Manual copy is far faster than deepcopy for PolygonsOnImage,
# so use manual copy here too
polys = [poly... | def deepcopy(self):
"""
Create a deep copy of the PolygonsOnImage object.
Returns
-------
imgaug.PolygonsOnImage
Deep copy.
"""
# Manual copy is far faster than deepcopy for PolygonsOnImage,
# so use manual copy here too
polys = [poly... | [
"Create",
"a",
"deep",
"copy",
"of",
"the",
"PolygonsOnImage",
"object",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L1257-L1270 | [
"def",
"deepcopy",
"(",
"self",
")",
":",
"# Manual copy is far faster than deepcopy for PolygonsOnImage,",
"# so use manual copy here too",
"polys",
"=",
"[",
"poly",
".",
"deepcopy",
"(",
")",
"for",
"poly",
"in",
"self",
".",
"polygons",
"]",
"return",
"PolygonsOnI... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | MultiPolygon.from_shapely | Create a MultiPolygon from a Shapely MultiPolygon, a Shapely Polygon or a Shapely GeometryCollection.
This also creates all necessary Polygons contained by this MultiPolygon.
Parameters
----------
geometry : shapely.geometry.MultiPolygon or shapely.geometry.Polygon\
... | imgaug/augmentables/polys.py | def from_shapely(geometry, label=None):
"""
Create a MultiPolygon from a Shapely MultiPolygon, a Shapely Polygon or a Shapely GeometryCollection.
This also creates all necessary Polygons contained by this MultiPolygon.
Parameters
----------
geometry : shapely.geometry.M... | def from_shapely(geometry, label=None):
"""
Create a MultiPolygon from a Shapely MultiPolygon, a Shapely Polygon or a Shapely GeometryCollection.
This also creates all necessary Polygons contained by this MultiPolygon.
Parameters
----------
geometry : shapely.geometry.M... | [
"Create",
"a",
"MultiPolygon",
"from",
"a",
"Shapely",
"MultiPolygon",
"a",
"Shapely",
"Polygon",
"or",
"a",
"Shapely",
"GeometryCollection",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L1776-L1810 | [
"def",
"from_shapely",
"(",
"geometry",
",",
"label",
"=",
"None",
")",
":",
"# load shapely lazily, which makes the dependency more optional",
"import",
"shapely",
".",
"geometry",
"if",
"isinstance",
"(",
"geometry",
",",
"shapely",
".",
"geometry",
".",
"MultiPolyg... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Pad | Augmenter that pads images, i.e. adds columns/rows to them.
dtype support::
See ``imgaug.augmenters.size.CropAndPad``.
Parameters
----------
px : None or int or imgaug.parameters.StochasticParameter or tuple, optional
The number of pixels to pad on each side of the image.
Eith... | imgaug/augmenters/size.py | def Pad(px=None, percent=None, pad_mode="constant", pad_cval=0, keep_size=True, sample_independently=True,
name=None, deterministic=False, random_state=None):
"""
Augmenter that pads images, i.e. adds columns/rows to them.
dtype support::
See ``imgaug.augmenters.size.CropAndPad``.
Par... | def Pad(px=None, percent=None, pad_mode="constant", pad_cval=0, keep_size=True, sample_independently=True,
name=None, deterministic=False, random_state=None):
"""
Augmenter that pads images, i.e. adds columns/rows to them.
dtype support::
See ``imgaug.augmenters.size.CropAndPad``.
Par... | [
"Augmenter",
"that",
"pads",
"images",
"i",
".",
"e",
".",
"adds",
"columns",
"/",
"rows",
"to",
"them",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/size.py#L958-L1154 | [
"def",
"Pad",
"(",
"px",
"=",
"None",
",",
"percent",
"=",
"None",
",",
"pad_mode",
"=",
"\"constant\"",
",",
"pad_cval",
"=",
"0",
",",
"keep_size",
"=",
"True",
",",
"sample_independently",
"=",
"True",
",",
"name",
"=",
"None",
",",
"deterministic",
... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | Crop | Augmenter that crops/cuts away pixels at the sides of the image.
That allows to cut out subimages from given (full) input images.
The number of pixels to cut off may be defined in absolute values or
percent of the image sizes.
dtype support::
See ``imgaug.augmenters.size.CropAndPad``.
Pa... | imgaug/augmenters/size.py | def Crop(px=None, percent=None, keep_size=True, sample_independently=True,
name=None, deterministic=False, random_state=None):
"""
Augmenter that crops/cuts away pixels at the sides of the image.
That allows to cut out subimages from given (full) input images.
The number of pixels to cut off m... | def Crop(px=None, percent=None, keep_size=True, sample_independently=True,
name=None, deterministic=False, random_state=None):
"""
Augmenter that crops/cuts away pixels at the sides of the image.
That allows to cut out subimages from given (full) input images.
The number of pixels to cut off m... | [
"Augmenter",
"that",
"crops",
"/",
"cuts",
"away",
"pixels",
"at",
"the",
"sides",
"of",
"the",
"image",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/size.py#L1157-L1303 | [
"def",
"Crop",
"(",
"px",
"=",
"None",
",",
"percent",
"=",
"None",
",",
"keep_size",
"=",
"True",
",",
"sample_independently",
"=",
"True",
",",
"name",
"=",
"None",
",",
"deterministic",
"=",
"False",
",",
"random_state",
"=",
"None",
")",
":",
"def"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | isect_segments__naive | Brute force O(n2) version of ``isect_segments`` for test validation. | imgaug/external/poly_point_isect_py2py3.py | def isect_segments__naive(segments):
"""
Brute force O(n2) version of ``isect_segments`` for test validation.
"""
isect = []
# order points left -> right
if Real is float:
segments = [
(s[0], s[1]) if s[0][X] <= s[1][X] else
(s[1], s[0])
for s in segm... | def isect_segments__naive(segments):
"""
Brute force O(n2) version of ``isect_segments`` for test validation.
"""
isect = []
# order points left -> right
if Real is float:
segments = [
(s[0], s[1]) if s[0][X] <= s[1][X] else
(s[1], s[0])
for s in segm... | [
"Brute",
"force",
"O",
"(",
"n2",
")",
"version",
"of",
"isect_segments",
"for",
"test",
"validation",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L685-L721 | [
"def",
"isect_segments__naive",
"(",
"segments",
")",
":",
"isect",
"=",
"[",
"]",
"# order points left -> right",
"if",
"Real",
"is",
"float",
":",
"segments",
"=",
"[",
"(",
"s",
"[",
"0",
"]",
",",
"s",
"[",
"1",
"]",
")",
"if",
"s",
"[",
"0",
"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | isect_polygon__naive | Brute force O(n2) version of ``isect_polygon`` for test validation. | imgaug/external/poly_point_isect_py2py3.py | def isect_polygon__naive(points):
"""
Brute force O(n2) version of ``isect_polygon`` for test validation.
"""
isect = []
n = len(points)
if Real is float:
pass
else:
points = [(Real(p[0]), Real(p[1])) for p in points]
for i in range(n):
a0, a1 = points[i], poi... | def isect_polygon__naive(points):
"""
Brute force O(n2) version of ``isect_polygon`` for test validation.
"""
isect = []
n = len(points)
if Real is float:
pass
else:
points = [(Real(p[0]), Real(p[1])) for p in points]
for i in range(n):
a0, a1 = points[i], poi... | [
"Brute",
"force",
"O",
"(",
"n2",
")",
"version",
"of",
"isect_polygon",
"for",
"test",
"validation",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L724-L755 | [
"def",
"isect_polygon__naive",
"(",
"points",
")",
":",
"isect",
"=",
"[",
"]",
"n",
"=",
"len",
"(",
"points",
")",
"if",
"Real",
"is",
"float",
":",
"pass",
"else",
":",
"points",
"=",
"[",
"(",
"Real",
"(",
"p",
"[",
"0",
"]",
")",
",",
"Rea... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | SweepLine.get_intersections | Return a list of unordered intersection points. | imgaug/external/poly_point_isect_py2py3.py | def get_intersections(self):
"""
Return a list of unordered intersection points.
"""
if Real is float:
return list(self.intersections.keys())
else:
return [(float(p[0]), float(p[1])) for p in self.intersections.keys()] | def get_intersections(self):
"""
Return a list of unordered intersection points.
"""
if Real is float:
return list(self.intersections.keys())
else:
return [(float(p[0]), float(p[1])) for p in self.intersections.keys()] | [
"Return",
"a",
"list",
"of",
"unordered",
"intersection",
"points",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L237-L244 | [
"def",
"get_intersections",
"(",
"self",
")",
":",
"if",
"Real",
"is",
"float",
":",
"return",
"list",
"(",
"self",
".",
"intersections",
".",
"keys",
"(",
")",
")",
"else",
":",
"return",
"[",
"(",
"float",
"(",
"p",
"[",
"0",
"]",
")",
",",
"fl... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | SweepLine.get_intersections_with_segments | Return a list of unordered intersection '(point, segment)' pairs,
where segments may contain 2 or more values. | imgaug/external/poly_point_isect_py2py3.py | def get_intersections_with_segments(self):
"""
Return a list of unordered intersection '(point, segment)' pairs,
where segments may contain 2 or more values.
"""
if Real is float:
return [
(p, [event.segment for event in event_set])
for... | def get_intersections_with_segments(self):
"""
Return a list of unordered intersection '(point, segment)' pairs,
where segments may contain 2 or more values.
"""
if Real is float:
return [
(p, [event.segment for event in event_set])
for... | [
"Return",
"a",
"list",
"of",
"unordered",
"intersection",
"(",
"point",
"segment",
")",
"pairs",
"where",
"segments",
"may",
"contain",
"2",
"or",
"more",
"values",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L247-L266 | [
"def",
"get_intersections_with_segments",
"(",
"self",
")",
":",
"if",
"Real",
"is",
"float",
":",
"return",
"[",
"(",
"p",
",",
"[",
"event",
".",
"segment",
"for",
"event",
"in",
"event_set",
"]",
")",
"for",
"p",
",",
"event_set",
"in",
"self",
".",... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | EventQueue.poll | Get, and remove, the first (lowest) item from this queue.
:return: the first (lowest) item from this queue.
:rtype: Point, Event pair. | imgaug/external/poly_point_isect_py2py3.py | def poll(self):
"""
Get, and remove, the first (lowest) item from this queue.
:return: the first (lowest) item from this queue.
:rtype: Point, Event pair.
"""
assert(len(self.events_scan) != 0)
p, events_current = self.events_scan.pop_min()
return p, even... | def poll(self):
"""
Get, and remove, the first (lowest) item from this queue.
:return: the first (lowest) item from this queue.
:rtype: Point, Event pair.
"""
assert(len(self.events_scan) != 0)
p, events_current = self.events_scan.pop_min()
return p, even... | [
"Get",
"and",
"remove",
"the",
"first",
"(",
"lowest",
")",
"item",
"from",
"this",
"queue",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L532-L541 | [
"def",
"poll",
"(",
"self",
")",
":",
"assert",
"(",
"len",
"(",
"self",
".",
"events_scan",
")",
"!=",
"0",
")",
"p",
",",
"events_current",
"=",
"self",
".",
"events_scan",
".",
"pop_min",
"(",
")",
"return",
"p",
",",
"events_current"
] | 786be74aa855513840113ea523c5df495dc6a8af |
valid | _ABCTree.clear | T.clear() -> None. Remove all items from T. | imgaug/external/poly_point_isect_py2py3.py | def clear(self):
"""T.clear() -> None. Remove all items from T."""
def _clear(node):
if node is not None:
_clear(node.left)
_clear(node.right)
node.free()
_clear(self._root)
self._count = 0
self._root = None | def clear(self):
"""T.clear() -> None. Remove all items from T."""
def _clear(node):
if node is not None:
_clear(node.left)
_clear(node.right)
node.free()
_clear(self._root)
self._count = 0
self._root = None | [
"T",
".",
"clear",
"()",
"-",
">",
"None",
".",
"Remove",
"all",
"items",
"from",
"T",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L796-L805 | [
"def",
"clear",
"(",
"self",
")",
":",
"def",
"_clear",
"(",
"node",
")",
":",
"if",
"node",
"is",
"not",
"None",
":",
"_clear",
"(",
"node",
".",
"left",
")",
"_clear",
"(",
"node",
".",
"right",
")",
"node",
".",
"free",
"(",
")",
"_clear",
"... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | _ABCTree.pop_item | T.pop_item() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if T is empty. | imgaug/external/poly_point_isect_py2py3.py | def pop_item(self):
"""T.pop_item() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if T is empty.
"""
if self.is_empty():
raise KeyError("pop_item(): tree is empty")
node = self._root
while True:
if node.left i... | def pop_item(self):
"""T.pop_item() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if T is empty.
"""
if self.is_empty():
raise KeyError("pop_item(): tree is empty")
node = self._root
while True:
if node.left i... | [
"T",
".",
"pop_item",
"()",
"-",
">",
"(",
"k",
"v",
")",
"remove",
"and",
"return",
"some",
"(",
"key",
"value",
")",
"pair",
"as",
"a",
"2",
"-",
"tuple",
";",
"but",
"raise",
"KeyError",
"if",
"T",
"is",
"empty",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L824-L841 | [
"def",
"pop_item",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_empty",
"(",
")",
":",
"raise",
"KeyError",
"(",
"\"pop_item(): tree is empty\"",
")",
"node",
"=",
"self",
".",
"_root",
"while",
"True",
":",
"if",
"node",
".",
"left",
"is",
"not",
"No... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | _ABCTree.min_item | Get item with min key of tree, raises ValueError if tree is empty. | imgaug/external/poly_point_isect_py2py3.py | def min_item(self):
"""Get item with min key of tree, raises ValueError if tree is empty."""
if self.is_empty():
raise ValueError("Tree is empty")
node = self._root
while node.left is not None:
node = node.left
return node.key, node.value | def min_item(self):
"""Get item with min key of tree, raises ValueError if tree is empty."""
if self.is_empty():
raise ValueError("Tree is empty")
node = self._root
while node.left is not None:
node = node.left
return node.key, node.value | [
"Get",
"item",
"with",
"min",
"key",
"of",
"tree",
"raises",
"ValueError",
"if",
"tree",
"is",
"empty",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L844-L851 | [
"def",
"min_item",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_empty",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Tree is empty\"",
")",
"node",
"=",
"self",
".",
"_root",
"while",
"node",
".",
"left",
"is",
"not",
"None",
":",
"node",
"=",
"nod... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | _ABCTree.max_item | Get item with max key of tree, raises ValueError if tree is empty. | imgaug/external/poly_point_isect_py2py3.py | def max_item(self):
"""Get item with max key of tree, raises ValueError if tree is empty."""
if self.is_empty():
raise ValueError("Tree is empty")
node = self._root
while node.right is not None:
node = node.right
return node.key, node.value | def max_item(self):
"""Get item with max key of tree, raises ValueError if tree is empty."""
if self.is_empty():
raise ValueError("Tree is empty")
node = self._root
while node.right is not None:
node = node.right
return node.key, node.value | [
"Get",
"item",
"with",
"max",
"key",
"of",
"tree",
"raises",
"ValueError",
"if",
"tree",
"is",
"empty",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L853-L860 | [
"def",
"max_item",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_empty",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Tree is empty\"",
")",
"node",
"=",
"self",
".",
"_root",
"while",
"node",
".",
"right",
"is",
"not",
"None",
":",
"node",
"=",
"no... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | _ABCTree.succ_item | Get successor (k,v) pair of key, raises KeyError if key is max key
or key does not exist. optimized for pypy. | imgaug/external/poly_point_isect_py2py3.py | def succ_item(self, key, default=_sentinel):
"""Get successor (k,v) pair of key, raises KeyError if key is max key
or key does not exist. optimized for pypy.
"""
# removed graingets version, because it was little slower on CPython and much slower on pypy
# this version runs about... | def succ_item(self, key, default=_sentinel):
"""Get successor (k,v) pair of key, raises KeyError if key is max key
or key does not exist. optimized for pypy.
"""
# removed graingets version, because it was little slower on CPython and much slower on pypy
# this version runs about... | [
"Get",
"successor",
"(",
"k",
"v",
")",
"pair",
"of",
"key",
"raises",
"KeyError",
"if",
"key",
"is",
"max",
"key",
"or",
"key",
"does",
"not",
"exist",
".",
"optimized",
"for",
"pypy",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L862-L900 | [
"def",
"succ_item",
"(",
"self",
",",
"key",
",",
"default",
"=",
"_sentinel",
")",
":",
"# removed graingets version, because it was little slower on CPython and much slower on pypy",
"# this version runs about 4x faster with pypy than the Cython version",
"# Note: Code sharing of succ_... | 786be74aa855513840113ea523c5df495dc6a8af |
valid | _ABCTree.prev_item | Get predecessor (k,v) pair of key, raises KeyError if key is min key
or key does not exist. optimized for pypy. | imgaug/external/poly_point_isect_py2py3.py | def prev_item(self, key, default=_sentinel):
"""Get predecessor (k,v) pair of key, raises KeyError if key is min key
or key does not exist. optimized for pypy.
"""
# removed graingets version, because it was little slower on CPython and much slower on pypy
# this version runs abo... | def prev_item(self, key, default=_sentinel):
"""Get predecessor (k,v) pair of key, raises KeyError if key is min key
or key does not exist. optimized for pypy.
"""
# removed graingets version, because it was little slower on CPython and much slower on pypy
# this version runs abo... | [
"Get",
"predecessor",
"(",
"k",
"v",
")",
"pair",
"of",
"key",
"raises",
"KeyError",
"if",
"key",
"is",
"min",
"key",
"or",
"key",
"does",
"not",
"exist",
".",
"optimized",
"for",
"pypy",
"."
] | aleju/imgaug | python | https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect_py2py3.py#L902-L941 | [
"def",
"prev_item",
"(",
"self",
",",
"key",
",",
"default",
"=",
"_sentinel",
")",
":",
"# removed graingets version, because it was little slower on CPython and much slower on pypy",
"# this version runs about 4x faster with pypy than the Cython version",
"# Note: Code sharing of prev_... | 786be74aa855513840113ea523c5df495dc6a8af |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.