chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:46:08 +08:00
commit 478d954c2a
294 changed files with 166295 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
exclude_paths:
- test/*
- test/augmenters/*
- test/augmentables/*
- checks/*
- imgaug/external/*
- old_version/*
- generate_documentation_images.py
- generate_example_images.py
+112
View File
@@ -0,0 +1,112 @@
# This action generates wheel files for python 2 and 3.
name: build wheels
on:
push:
branches:
- 'master'
jobs:
build:
# There were errors on Mac that would lead to non-stop printing of
# error messages forever instead of the job crashing. To prevent this,
# a timeout is placed here (default value is otherwise 360min).
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# see supported versions at
# https://raw.githubusercontent.com/actions/python-versions/master/versions-manifest.json
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
exclude:
- os: windows-latest
python-version: 2.7 # causes a Shapely install error
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
# ----------------
# Install python and base packages
# ----------------
- name: Set up python ${{ matrix.python-version }} on ${{ runner.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display python version
run: |
python -c "import sys; print(sys.version)"
- name: Display system information
run : |
python -c "import sys; print(sys.maxsize);"
python -c "import platform; print(platform.uname());"
python -c "import platform; print(platform.platform());"
python -c "import platform; print(platform.architecture());"
python -c "import platform; print(platform.processor());"
python -c "import platform; print(platform.python_compiler());"
- name: Upgrade basic packages
run: |
python -m pip install --upgrade pip setuptools wheel
# ----------------
# Set up pip cache
# ----------------
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- uses: actions/cache@v1
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v1
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v1
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# ----------------
# Install dependencies
# ----------------
- name: Install dependencies
run: |
pip install -r requirements.txt
# ----------------
# Generate wheels
# ----------------
- name: Generate wheels
run: |
python setup.py sdist
python setup.py bdist_wheel
# ----------------
# Upload artifacts
# ----------------
- uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-py${{ matrix.python-version }}-dist
path: dist/
+155
View File
@@ -0,0 +1,155 @@
# This is effectively identical to pr_or_push.yml, with the exceptions of:
# (1) This is only executed upon pushes to master
# (2) This executes tests for more different python versions
name: test master
on:
push:
branches:
- 'master'
jobs:
build:
# There were errors on Mac that would lead to non-stop printing of
# error messages forever instead of the job crashing. To prevent this,
# a timeout is placed here (default value is otherwise 360min).
# Usually, jobs currently run through in around 10min.
timeout-minutes: 60
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# see supported versions at
# https://raw.githubusercontent.com/actions/python-versions/master/versions-manifest.json
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
exclude:
- os: windows-latest
python-version: 2.7 # causes a Shapely install error
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
# ----------------
# Install python and base packages
# ----------------
- name: Set up Python ${{ matrix.python-version }} on ${{ runner.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display python version
run: |
python -c "import sys; print(sys.version)"
- name: Display system information
run : |
python -c "import sys; print(sys.maxsize);"
python -c "import platform; print(platform.uname());"
python -c "import platform; print(platform.platform());"
python -c "import platform; print(platform.architecture());"
python -c "import platform; print(platform.processor());"
python -c "import platform; print(platform.python_compiler());"
- name: Upgrade basic packages
run: |
python -m pip install --upgrade pip setuptools wheel
# ----------------
# Set up pip cache
# ----------------
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- uses: actions/cache@v1
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v1
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v1
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# ----------------
# Install dependencies
# ----------------
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Install test dependencies
run: |
pip install --upgrade -r test/requirements.txt
- name: Install further test tools
run: |
pip install coverage pytest-cov flake8
# ----------------
# Install library
# ----------------
- name: Install library
run: |
pip install .
# ----------------
# Run checks and tests
# ----------------
- name: Run flake8
run: |
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude=".svn,CVS,.bzr,.hg,.git,__pycache__,poly_point_isect.py"
- name: Run tests
run: |
python -m pytest --verbose --xdoctest-modules -s --durations=50 -Walways
# ----------------
# Code coverage reports
# ----------------
# Add 'coverage html -d out_foldername' to add html reports
# Dont deactivate -Walways here, otherwise some tests fail as warnings
# are no longer produced.
- name: Generate code coverage report
run: |
coverage run --source imgaug -m pytest --verbose -Walways
coverage xml
coverage report
#- name: Upload coverage report to codacy
# uses: codacy/codacy-coverage-reporter-action@master
# with:
# project-token: ${{ secrets.CODACY_TOKEN }}
# coverage-reports: coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
# right now the env_vars argument causes a warning, see
# https://github.com/codecov/codecov-action/issues/80
#env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
+167
View File
@@ -0,0 +1,167 @@
name: test pull requests
on:
push:
branches:
- '!master'
pull_request:
jobs:
build:
# There were errors on Mac that would lead to non-stop printing of
# error messages forever instead of the job crashing. To prevent this,
# a timeout is placed here (default value is otherwise 360min).
# Usually, jobs currently run through in around 10min.
timeout-minutes: 45
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# see supported versions at
# https://raw.githubusercontent.com/actions/python-versions/master/versions-manifest.json
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
# test only 2.7 and the latest 3.x on mac
# test only the latest 3.x on windows
exclude:
- os: macos-latest
python-version: 3.5
- os: macos-latest
python-version: 3.6
- os: macos-latest
python-version: 3.7
- os: windows-latest
python-version: 2.7 # causes a Shapely install error
- os: windows-latest
python-version: 3.5
- os: windows-latest
python-version: 3.6
- os: windows-latest
python-version: 3.7
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v2
# ----------------
# Install python and base packages
# ----------------
- name: Set up Python ${{ matrix.python-version }} on ${{ runner.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display python version
run: |
python -c "import sys; print(sys.version)"
- name: Display system information
run : |
python -c "import sys; print(sys.maxsize);"
python -c "import platform; print(platform.uname());"
python -c "import platform; print(platform.platform());"
python -c "import platform; print(platform.architecture());"
python -c "import platform; print(platform.processor());"
python -c "import platform; print(platform.python_compiler());"
- name: Upgrade basic packages
run: |
python -m pip install --upgrade pip setuptools wheel
# ----------------
# Set up pip cache
# ----------------
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- uses: actions/cache@v1
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v1
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v1
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# ----------------
# Install dependencies
# ----------------
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Install test dependencies
run: |
pip install --upgrade -r test/requirements.txt
- name: Install further test tools
run: |
pip install coverage pytest-cov flake8
# ----------------
# Install library
# ----------------
- name: Install library
run: |
pip install .
# ----------------
# Run checks and tests
# ----------------
- name: Run flake8
run: |
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude=".svn,CVS,.bzr,.hg,.git,__pycache__,poly_point_isect.py"
- name: Run tests
run: |
python -m pytest --verbose --xdoctest-modules -s --durations=50 -Walways
# ----------------
# Code coverage reports
# ----------------
# Add 'coverage html -d out_foldername' to add html reports
# Dont deactivate -Walways here, otherwise some tests fail as warnings
# are no longer produced.
- name: Generate code coverage report
run: |
coverage run --source imgaug -m pytest --verbose -Walways
coverage xml
coverage report
#- name: Upload coverage report to codacy
# uses: codacy/codacy-coverage-reporter-action@master
# with:
# project-token: ${{ secrets.CODACY_TOKEN }}
# coverage-reports: coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
# right now the env_vars argument causes a warning, see
# https://github.com/codecov/codecov-action/issues/80
#env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
+78
View File
@@ -0,0 +1,78 @@
*.py~
*.rst~
*.md~
*.bak
*.lprof
reinstall.sh
reinstall_conda.sh
todo.txt
pypi-install-guide.txt
checks/bb_aug.jpg
checks/elastic_transformations.jpg
imgaug/parameters-testcode.py
imgaug/bak/*
imgaug/quokka_depth_map.xcf
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# PyCHarm
.idea/
# virtualenv
venv/
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
+646
View File
@@ -0,0 +1,646 @@
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=cv2,
scipy,
scipy.spatial,
numpy,
numpy.random,
numpy.random.bit_generator,
PIL,
PIL.Image,
PIL.ImageOps,
skimage,
skimage.feature,
skimage.transform,
skimage.segmentation
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
ignore-patterns=opensimplex\.py,
poly_point_isect_py2py3\.py
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use.
jobs=1
# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
# complex, nested conditions.
limit-inference-results=100
# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
load-plugins=
# Pickle collected data for later comparisons.
persistent=yes
# Specify a configuration file.
#rcfile=
# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
confidence=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once). You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape,
# ------------- non-standard for imgaug -------------
fixme, # no warnings for TODOs
line-too-long, # required for type definitions in docstrings
too-many-lines, # currently unfulfillable
useless-object-inheritance, # pylint complains that Foo(object) shouldn't be used anymore in py3+, but is required for py2.7
import-outside-toplevel, # necessary e.g. for optional dependencies
too-many-arguments,
too-many-branches,
too-many-locals,
too-many-instance-attributes,
too-few-public-methods,
too-many-public-methods,
too-many-return-statements,
too-many-statements,
too-many-ancestors,
len-as-condition, # more annoying than useful warning, suggestion doesn't even work with np arrays
unused-argument, # without this pylint complains about almost every _augment_batch() implementation not using 'parents' and 'hooks'; due to inheritance we can't do anything about that
no-self-use, # without this pylint complains about every get_parameters() implementation that returns only []; due to inheritance we can't do anything about that
protected-access, # we use plenty of calls of functions that are only marked private to discourage calls of them from outside of the library, but not from within the library
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=c-extension-no-member
[REPORTS]
# Python expression which should return a score less than or equal to 10. You
# have access to the variables 'error', 'warning', 'refactor', and 'convention'
# which contain the number of messages in each category, as well as 'statement'
# which is the total number of statements analyzed. This score is used by the
# global evaluation report (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details.
#msg-template=
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio). You can also give a reporter class, e.g.
# mypackage.mymodule.MyReporterClass.
output-format=text
# Tells whether to display a full report or only the messages.
reports=no
# Activate the evaluation score.
score=yes
[REFACTORING]
# Maximum number of nested blocks for function / method body
max-nested-blocks=5
# Complete name of functions that never returns. When checking for
# inconsistent-return-statements if a never returning function is called then
# it will be considered as an explicit return statement and no message will be
# printed.
never-returning-functions=sys.exit
[FORMAT]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format=
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Maximum number of characters on a single line.
max-line-length=100
# Maximum number of lines in a module.
max-module-lines=1000
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[LOGGING]
# Format style used to check logging format string. `old` means using %
# formatting, `new` is for `{}` formatting,and `fstr` is for f-strings.
logging-format-style=old
# Logging modules to check that the string format arguments are in logging
# function parameter format.
logging-modules=logging
[SIMILARITIES]
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=no
# Minimum lines number of a similarity.
min-similarity-lines=8
[TYPECHECK]
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# Tells whether to warn about missing members when the owner of the attribute
# is inferred to be None.
ignore-none=yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis). It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices=1
# List of decorators that change the signature of a decorated function.
signature-mutators=
[BASIC]
# Naming style matching correct argument names.
argument-naming-style=snake_case
# Regular expression matching correct argument names. Overrides argument-
# naming-style.
#argument-rgx=
# Naming style matching correct attribute names.
attr-naming-style=snake_case
# Regular expression matching correct attribute names. Overrides attr-naming-
# style.
#attr-rgx=
# Bad variable names which should always be refused, separated by a comma.
bad-names=foo,
bar,
baz,
toto,
tutu,
tata
# Naming style matching correct class attribute names.
class-attribute-naming-style=any
# Regular expression matching correct class attribute names. Overrides class-
# attribute-naming-style.
#class-attribute-rgx=
# Naming style matching correct class names.
class-naming-style=PascalCase
# Regular expression matching correct class names. Overrides class-naming-
# style.
#class-rgx=
# Naming style matching correct constant names.
const-naming-style=UPPER_CASE
# Regular expression matching correct constant names. Overrides const-naming-
# style.
#const-rgx=
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1
# Naming style matching correct function names.
function-naming-style=snake_case
# Regular expression matching correct function names. Overrides function-
# naming-style.
#function-rgx=
# Good variable names which should always be accepted, separated by a comma.
good-names=i,
j,
k,
ex,
Run,
_,
# ------- imgaug-specific settings -------
n, # number
h, # height
w, # width
c, # channel index
x, # x-coordinate
y, # y-coordinate
z, # z-coordinate
xy, # xy-coordinate pair
xx, # x-coordinates
yy, # y-coordinates
zz, # z-coordinates
dx, # some difference/shift in x
dy,
dz,
x1, # bounding box top left x-coordinate
x2, # bounding box bottom right x-coordinate
x3,
x4,
y1, # bounding box top left y-coordinate
y2, # bounding box bottom right x-coordinate
y3,
y4,
p, # probability
bb, # bounding box
bbs, # bounding boxes
kp, # keypoint
kps, # keypoints
ls, # line string
lss, # line strings
rs, # random state
ax, # matplotlib axis
f # file handle for 'open(...) as f:'
# Include a hint for the correct naming format with invalid-name.
include-naming-hint=no
# Naming style matching correct inline iteration names.
inlinevar-naming-style=any
# Regular expression matching correct inline iteration names. Overrides
# inlinevar-naming-style.
#inlinevar-rgx=
# Naming style matching correct method names.
method-naming-style=snake_case
# Regular expression matching correct method names. Overrides method-naming-
# style.
#method-rgx=
# Naming style matching correct module names.
module-naming-style=snake_case
# Regular expression matching correct module names. Overrides module-naming-
# style.
#module-rgx=
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
# These decorators are taken in consideration only for invalid-name.
property-classes=abc.abstractproperty
# Naming style matching correct variable names.
variable-naming-style=snake_case
# Regular expression matching correct variable names. Overrides variable-
# naming-style.
#variable-rgx=
[VARIABLES]
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid defining new builtins when possible.
additional-builtins=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,
_cb
# A regular expression matching the name of dummy variables (i.e. expected to
# not be used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
# Argument names that match this expression will be ignored. Default to name
# with leading underscore.
ignored-argument-names=_.*|^ignored_|^unused_
# Tells whether we should check for unused import in __init__ files.
init-import=no
# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
notes=FIXME,
XXX,
TODO
[SPELLING]
# Limits count of emitted suggestions for spelling mistakes.
max-spelling-suggestions=4
# Spelling dictionary name. Available dictionaries: none. To make it work,
# install the python-enchant package.
spelling-dict=
# List of comma separated words that should not be checked.
spelling-ignore-words=
# A path to a file that contains the private dictionary; one word per line.
spelling-private-dict-file=
# Tells whether to store unknown words to the private dictionary (see the
# --spelling-private-dict-file option) instead of raising a message.
spelling-store-unknown-words=no
[STRING]
# This flag controls whether the implicit-str-concat-in-sequence should
# generate a warning on implicit string concatenation in sequences defined over
# several lines.
check-str-concat-over-line-jumps=no
[DESIGN]
# Maximum number of arguments for function / method.
max-args=5
# Maximum number of attributes for a class (see R0902).
max-attributes=7
# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5
# Maximum number of branch for function / method body.
max-branches=12
# Maximum number of locals for function / method body.
max-locals=15
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
# Maximum number of return / yield for function / method body.
max-returns=6
# Maximum number of statements in function / method body.
max-statements=50
# Minimum number of public methods for a class (see R0903).
min-public-methods=2
[IMPORTS]
# List of modules that can be imported at any level, not just the top level
# one.
allow-any-import-level=
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no
# Deprecated modules which should not be used, separated by a comma.
deprecated-modules=optparse,tkinter.tix
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled).
ext-import-graph=
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled).
import-graph=
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled).
int-import-graph=
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
# Couples of modules and preferred modules, separated by a comma.
preferred-modules=
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,
__new__,
setUp,
__post_init__
# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,
_fields,
_replace,
_source,
_make
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=cls
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
+68
View File
@@ -0,0 +1,68 @@
sudo: required
dist: trusty
language:
- python
- cpp
env:
global:
- CODACY_PROJECT_TOKEN=1370ce38e99e40af842d47a8dd721444
cache:
directories:
- $HOME/.cache/pip
python:
- "2.7"
# - "3.2" # downloads np 1.17 on travis (?!), which doesn't support 3.2
# - "3.3" # downloads np 1.17 on travis (?!), which doesn't support 3.3
- "3.4"
- "3.5"
- "3.6"
# - "3.7" # python version cannot be installed on travis
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq -y python-virtualenv
# otherwise imagecodecs fails to build on py3.6,
# see https://github.com/scikit-image/scikit-image/issues/4673
- pip install --upgrade pip
install:
# TODO why was this deactivated?
# - virtualenv venv
# - . venv/bin/activate
- pip install -r requirements.txt
# Added --upgrade, because at least pytest already came from some other
# install command and so version was never checked
- pip install --upgrade -r test/requirements.txt
- pip install coverage codecov pytest-cov codacy-coverage
- pip install .
before_script:
- pip install flake8
# Stop the build if there are Python syntax errors or undefined names.
#
# We exclude poly_point_isect.py because it is incompatible with python2
# and poly_point_isect_py2py3.py is actually used instead. The incompatible
# file exists in the repo only for comparison. There are some other patterns
# added to --exclude, which are the default values for flake8's exclude
# option.
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude=".svn,CVS,.bzr,.hg,.git,__pycache__,poly_point_isect.py"
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# currently deactivated as style guidelines are not yet kept in the project
# TODO change this
#- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
script:
- python -m pytest --verbose --xdoctest-modules --ignore="test/run_all.py" -s --durations=50 -Walways
- coverage run --source imgaug -m pytest --verbose --xdoctest-modules --ignore="test/run_all.py" -Walways
# some steps are now done in github action
after_success:
# - codecov -t feeff9b2-3750-4246-befb-8cde60dc28aa
- coverage xml
- python-codacy-coverage -r coverage.xml
# - coverage report
+2
View File
@@ -0,0 +1,2 @@
This file is no longer used.
See `changelogs/` for all current and previous changelogs.
+22
View File
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 aleju
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+8
View File
@@ -0,0 +1,8 @@
include setup.py
include setup.cfg
include LICENSE
include MANIFEST.in
include README.md
include requirements.txt
recursive-include imgaug *.py *.jpg *.ttf *.png *.json
prune test
+1251
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
# WeHub 来源说明
- 原始项目:`aleju/imgaug`
- 原始仓库:https://github.com/aleju/imgaug
- 导入方式:上游默认分支的最新快照
- 原作者、版权和许可证信息以原始仓库及本仓库 LICENSE 为准
- 本文件仅用于记录来源,不代表 WeHub 是原项目作者
+7
View File
@@ -0,0 +1,7 @@
skips: [
'B101',
'B301', # "Pickle and modules that wrap it can be unsafe when used to
# deserialize untrusted data, possible security issue."
'B403' # "Consider possible security implications associated with pickle
# module."
]
+778
View File
@@ -0,0 +1,778 @@
# 0.3.0 Cleaned Up Log Of Changes
## Improved Segmentation Map Augmentation #302
Augmentation of Segmentation Maps is now faster and more memory efficient.
This required some breaking changes to `SegmentationMapOnImage`.
To adapt to the new version, the following steps should be sufficient for most
users:
* Rename all calls of `SegmentationMapOnImage` to `SegmentationMapsOnImage`
(Map -> Maps).
* Rename all calls of `SegmentationMapsOnImage.get_arr_int()` to
`SegmentationMapsOnImage.get_arr()`.
* Remove the argument `nb_classes` from all calls of `SegmentationMapsOnImage`.
* Remove the arguments `background_id` and `background_threshold` from all
calls as these are no longer supported.
* Ensure that the input array to `SegmentationMapsOnImage` is always an
int-like (int, uint or bool).
Float arrays are no longer accepted.
* Adapt all calls `SegmentationMapsOnImage.draw()` and
`SegmentationMapsOnImage.draw_on_image()`, as both of these now return a
list of drawn images instead of a single array. (For a segmentation map
array of shape `(H,W,C)` they return `C` drawn images. In most cases `C=1`,
so simply call `draw()[0]` or `draw_on_image()[0]`.)
* Ensure that if `SegmentationMapsOnImage.arr` is accessed anywhere, the
respective code can handle the new `int32` `(H,W,#maps)` array form.
Previously it was `float32` and the channel-axis had the same size as the
max class id (+1) that could appear in the map.
Changes:
- Changes to class `SegmentationMapOnImage`:
- Renamed `SegmentationMapOnImage` to plural `SegmentationMapsOnImage`
and deprecated the old name.
This was changed due to the input array now being allowed to contain
several channels, with each such channel containing one full segmentation
map.
- Changed `SegmentationMapsOnImage.__init__` to produce a deprecation
warning for float arrays as `arr` argument.
- **[breaking]** Changed `SegmentationMapsOnImage.__init__` to no longer
accept `uint32` and larger itemsizes as `arr` argument, only `uint16`
and below is accepted. For `int` the allowed maximum is `int32`.
- Changed `SegmentationMapsOnImage.__init__` to always accept `(H,W,C)`
`arr` arguments.
- **[breaking]** Changed `SegmentationMapsOnImage.arr` to always be
`int32` `(H,W,#maps)` (previously: `float32` `(H,W,#nb_classes)`).
- Deprecated `nb_classes` argument in `SegmentationMapsOnImage.__init__`.
The argument is now ignored.
- Added `SegmentationMapsOnImage.get_arr()`, which always returns a
segmentation map array with similar dtype and number of dimensions as
was originally input when creating a class instance.
- Deprecated `SegmentationMapsOnImage.get_arr_int()`.
The method is now an alias for `get_arr()`.
- `SegmentationMapsOnImage.draw()`:
- **[breaking]** Removed argument `return_foreground_mask` and
corresponding optional output. To generate a foreground mask
for the `c`-th segmentation map on a given image (usually `c=0`),
use `segmentation_map.arr[:, :, c] != 0`, assuming that `0` is
the integer index of your background class.
- **[breaking]** Changed output of drawn image to be a list of arrays
instead of a single array (one per `C` in input array `(H,W,C)`).
- Refactored to be a wrapper around
`SegmentationMapsOnImage.draw_on_image()`.
- The `size` argument may now be any of: A single `None` (keep shape),
a single integer (use as height and width), a single float (relative
change to shape) or a tuple of these values. ("shape" here denotes
the value of the `.shape` attribute.)
- `SegmentationMapsOnImage.draw_on_image()`:
- **[breaking]** The argument `background_threshold` is now deprecated
and ignored. Providing it will lead to a deprecation warning.
- **[breaking]** Changed output of drawn image to be a list of arrays
instead of a single array (one per `C` in input array `(H,W,C)`).
- Changed `SegmentationMapsOnImage.resize()` to use nearest neighbour
interpolation by default.
- **[rarely breaking]** Changed `SegmentationMapsOnImage.copy()` to create
a shallow copy instead of being an alias for `deepcopy()`.
- Added optional arguments `arr` and `shape` to
`SegmentationMapsOnImage.copy()`.
- Added optional arguments `arr` and `shape` to
`SegmentationMapsOnImage.deepcopy()`.
- Refactored `SegmentationMapsOnImage.pad()`,
`SegmentationMapsOnImage.pad_to_aspect_ratio()` and
`SegmentationMapsOnImage.resize()` to generate new object instances via
`SegmentationMapsOnImage.deepcopy()`.
- **[rarely breaking]** Renamed `SegmentationMapsOnImage.input_was` to
`SegmentationMapsOnImage._input_was`.
- **[rarely breaking]** Changed `SegmentationMapsOnImage._input_was` to
always save `(input array dtype, input array ndim)` instead of mixtures
of strings/ints that varied by dtype kind.
- **[rarely breaking]** Restrict `shape` argument in
`SegmentationMapsOnImage.__init__` to tuples instead of accepting all
iterables.
- **[breaking]** Removed `SegmentationMapsOnImage.to_heatmaps()` as the
new segmentation map class is too different to sustain the old heatmap
conversion methods.
- **[breaking]** Removed `SegmentationMapsOnImage.from_heatmaps()` as the
new segmentation map class is too different to sustain the old heatmap
conversion methods.
- Changes to class `Augmenter`:
- **[breaking]** Automatic segmentation map normalization from arrays or
lists of arrays now expects a single `(N,H,W,C)` array (before:
`(N,H,W)`) or a list of `(H,W,C)` arrays (before: `(H,W)`).
This affects valid segmentation map inputs for `Augmenter.augment()`
and its alias `Augmenter.__call__()`,
`imgaug.augmentables.batches.UnnormalizedBatch()` and
`imgaug.augmentables.normalization.normalize_segmentation_maps()`.
- Added `Augmenter._augment_segmentation_maps()`.
- Changed `Augmenter.augment_segmentation_maps()` to no longer be a
wrapper around `Augmenter.augment_heatmaps()` and instead call
`Augmenter._augment_segmentation_maps()`.
- Added special segmentation map handling to all augmenters that modified
segmentation maps
(`Sequential`, `SomeOf`, `Sometimes`, `WithChannels`,
`Lambda`, `AssertLambda`, `AssertShape`,
`Alpha`, `AlphaElementwise`, `WithColorspace`, `Fliplr`, `Flipud`, `Affine`,
`AffineCv2`, `PiecewiseAffine`, `PerspectiveTransform`, `ElasticTransformation`,
`Rot90`, `Resize`, `CropAndPad`, `PadToFixedSize`, `CropToFixedSize`,
`KeepSizeByResize`).
- **[rarely breaking]** This changes the order of arguments in
`Lambda.__init__()`, `AssertLambda.__init__()`, `AssertShape.__init__()`
and hence breaks if one relied on that order.
## New RNG handling #375
* Adapted library to automatically use the new `numpy.random` classes of
numpy 1.17 -- if they are available. If they are not available (i.e. numpy
version is <=1.16), the library automatically falls back to the old
interface (i.e. `numpy.random.RandomState`).
* Added module `imgaug.random`.
* Added class `imgaug.random.RNG`. This is now the preferred way to represent
RNG states (previously: `numpy.random.RandomState`). Instantiate it
via e.g. `RNG(1052912236)`, where `1052912236` is a seed.
* Added `imgaug.random.supports_new_rng_style()`.
* Added `imgaug.random.get_global_rng()`.
* Added `imgaug.random.seed()`.
* Added `imgaug.random.normalize_generator()`.
* Added `imgaug.random.normalize_generator_()`.
* Added `imgaug.random.convert_seed_to_generator()`.
* Added `imgaug.random.convert_seed_sequence_to_generator()`.
* Added `imgaug.random.create_pseudo_random_generator_()`.
* Added `imgaug.random.create_fully_random_generator()`.
* Added `imgaug.random.generate_seed_()`.
* Added `imgaug.random.generate_seeds_()`.
* Added `imgaug.random.copy_generator()`.
* Added `imgaug.random.copy_generator_unless_global_generator()`.
* Added `imgaug.random.reset_generator_cache_()`.
* Added `imgaug.random.derive_generator_()`.
* Added `imgaug.random.derive_generators_()`.
* Added `imgaug.random.get_generator_state()`.
* Added `imgaug.random.set_generator_state_()`.
* Added `imgaug.random.is_generator_equal_to()`.
* Added `imgaug.random.advance_generator_()`.
* Added `imgaug.random.polyfill_integers()`.
* Added `imgaug.random.polyfill_random()`.
* Refactored all arguments related to random state handling to also accept
`imgaug.random.RNG`, as well as the new numpy random classes. This
particularly affects `imgaug.augmenters.meta.Augmenter` and
`imgaug.parameters.StochasticParameter` (argument `random_state` for both).
* Marked old RNG related functions in `imgaug.imgaug` as deprecated.
They will now produce warnings and redirect towards corresponding functions
in `imgaug.random`. This does not yet affect `imgaug.imgaug.seed()`.
It does affect the functions listed below.
* `imgaug.imgaug.normalize_random_state()`.
* `imgaug.imgaug.current_random_state()`.
* `imgaug.imgaug.new_random_state()`.
* `imgaug.imgaug.dummy_random_state()`.
* `imgaug.imgaug.copy_random_state()`.
* `imgaug.imgaug.derive_random_state()`.
* `imgaug.imgaug.derive_random_states()`.
* `imgaug.imgaug.forward_random_state()`.
* [rarely breaking] Removed `imgaug.imgaug.CURRENT_RANDOM_STATE`.
Use `imgaug.random.get_global_rng()` instead.
* [rarely breaking] Removed `imgaug.imgaug.SEED_MIN_VALUE`.
Use `imgaug.random.SEED_MIN_VALUE` instead or sample seeds via
`imgaug.random.generate_seeds_()`.
* [rarely breaking] Removed `imgaug.imgaug.SEED_MAX_VALUE`.
Use `imgaug.random.SEED_MAX_VALUE` instead or sample seeds via
`imgaug.random.generate_seeds_()`.
* Optimized RNG handling throughout all augmenters to minimize the number of
RNG copies. RNGs are now re-used as often as possible. This improves
performance, but has the disadvantage that adding images to a batch will now
often affect the samples of the other images in the same batch. E.g.
previously for a batch of images `A,B,C` and seed `1`, the samples of `A,B,C`
would remain unchanged if the batch was changed to `A,B,C,D` (provided the
seed stayed the same). Now, if `D` is added the samples of `A,B,C` may
change.
* [breaking] The above listed changes will lead to different values being
sampled for the same seeds (compared to past versions of the library).
* [breaking] The seed for `imgaug`'s global random number generator is now
sampled from numpy's default random number generator. That means, that every
run of a program using `imgaug` will by default use a different seed and
hence result in different samples. Previously, a fixed seed was used,
resulting in the same samples for each run (unless the seed was manually
changed to a fixed one). It also means that seeding numpy will automatically
also seed imgaug (not guarantueed that this behaviour will be kept in
future releases). The change from fixed to random seed was done, because the
old (fixed) behaviour didn't match the common practice (and especially not
numpy's standard behaviour) and hence led to confusion. #408
## Adaptations to numpy 1.17
* [rarely breaking] Deactivated support for `int64` in
`imgaug.dtypes.clip_()`. This is due to numpy 1.17 turning `int64` to
`float64` in `numpy.clip()` (possible that this happened in some way
before 1.17 too). #302
* [rarely breaking] Changed `imgaug.dtypes.clip()` to never clip `int32`
in-place, as `numpy.clip()` turns it into `float64` since 1.17 (possible
that this happend in some way before 1.17 too).
* [rarely breaking] Deactivated support for `int64` in
`ReplaceElementwise`. See `clip` issue above. #302
* [rarely breaking] Changed `parameters.DiscreteUniform` to always return
arrays of dtype `int32`. Previously it would automatically return
`int64`. #302
* [rarely breaking] Changed `parameters.Deterministic` to always return
`int32` for integers and always `float32` for floats. #302
* [rarely breaking] Changed `parameters.Choice` to limit integer
dtypes to `int32` or lower, uints to `uint32` or lower and floats
to `float32` or lower. #302
* [rarely breaking] Changed `parameters.Binomial` and `parameters.Poisson`
to always return `int32`. #302
* [rarely breaking] Changed `parameters.Normal`,
`parameters.TruncatedNormal`, `parameters.Laplace`,
`parameters.ChiSquare`, `parameters.Weibull`, `parameters.Uniform` and
`parameters.Beta` to always return `float32`. #302
* [rarely breaking] Changed `augmenters.arithmetic.Add`,
`augmenters.arithmetic.AddElementwise`, `augmenters.arithmetic.Multiply`
and `augmenters.arithmetic.MultiplyElementwise` to no longer internally
increase itemsize of dtypes by a factor of 2 for
dtypes `uint16`, `int8` and `uint16`. For `Multiply*` this also
covers `float16` and `float32`. This protects against crashes due to
clipping `int64` or `uint64` data. In rare cases this can lead to
overflows if `image + random samples` or `image * random samples`
exceeds the value range of `int32` or `uint32`. This change may affect
various other augmenters that are wrappers around the mentioned ones,
e.g. `AdditiveGaussianNoise`. #302
* [rarely breaking] Decreased support of dtypes `uint16`, `int8`,
`int16`, `float16`, `float32` and `bool` in `augmenters.arithmetic.Add`,
`AddElementwise`, `Multiply` and `MultiplyElementwise` from "yes" to
"limited". #302
* [rarely breaking] Decreased support of dtype `int64` in
`augmenters.arithmetic.ReplaceElementwise` from "yes" to "no". This also
affects all `*Noise` augmenters (e.g. `AdditiveGaussianNoise`,
`ImpulseNoise`), all `Dropout` augmenters, all `Salt` augmenters and
all `Pepper` augmenters. #302
* [rarely breaking] Changed `augmenters.contrast.adjust_contrast_log`
and thereby `LogContrast` to no longer support dtypes `uint32`, `uint64`,
`int32` and `int64`. #302
## New Augmenters
* Added `augmenters.edges.Canny`, which applies canny edge detection with alpha
blending and random coloring to images. #316
* Added `augmenters.pooling.AveragePooling`. #317
* Added `augmenters.pooling.MaxPooling`. #317
* Added `augmenters.pooling.MinPooling`. #317
* Added `augmenters.pooling.MedianPooling`. #317
* Added `augmenters.color.AddToHue`, a shortcut for
`AddToHueAndSaturation(value_hue=...)`. #319
* Added `augmenters.color.AddToSaturation`, a shortcut for
`AddToHueAndSaturation(value_saturation=...)`. #319
* Added `augmenters.color.WithHueAndSaturation`. #319
* Added `augmenters.color.MultiplyHueAndSaturation`. #319
* Added `augmenters.color.MultiplyHue`. #319
* Added `augmenters.color.MultiplySaturation`. #319
* Added `augmenters.color.KMeansColorQuantization` and corresponding
`augmenters.color.quantize_colors_kmeans()`. Both deal with quantizing
similar colors using k-Means clustering. #347
* Added a check script for `KMeansColorQuantization` under
`checks/check_kmeans_color_quantization.py`. #347
* Added `augmenters.color.UniformColorQuantization` and corresponding
`augmenters.color.quantize_colors_uniform()`. Both deal with quantizing
similar colors using k-Means clustering. #347
* Added `imgaug.augmenters.segmentation.Voronoi`. An augmenter that converts
an image to a voronoi image. #348
* Added `imgaug.augmenters.segmentation.UniformVoronoi`, a shortcut for
`Voronoi(UniformPointsSamper)`. #348
* Added `imgaug.augmenters.segmentation.RegularGridVoronoi`, a shortcut for
`Voronoi(DropoutPointsSampler(RegularGridPointsSampler))`. #348
* Added `imgaug.augmenters.segmentation.RelativeRegularGridVoronoi`, a shortcut
for `Voronoi(DropoutPointsSampler(RelativeRegularGridPointsSampler))`. #348
## New Modules
* Added module `imgaug.augmenters.edges`. #316
* Added module `imgaug.augmenters.pooling`. #317
* Added module `imgaug.validation`. The module is intended for functions
related to the validation of input arguments. #413
## output_buffer_size
* Added argument `output_buffer_size` to `multicore.Pool.imap_batches()`
and `multicore.Pool.imap_batches_unordered()` to control the maximum number
of batches in the background augmentation pipeline (allows to limit
maximum RAM demands). #305
* Changed default `output_buffer_size` in `Augmenter.augment_batches()` from
"unlimited" to `10*C`, where `C` is the number of logical CPU cores. #417
## Other New Classes
* Added interface `augmenters.edges.BinaryImageColorizerIf`, which
contains the interface for classes used to convert binary images to RGB
images. #316
* Added `augmenters.pooling._AbstractPoolingBase`. #317
* Added `augmenters.edges.RandomColorsBinaryImageColorizer`, which
converts binary images to RGB images by sampling uniformly RGB colors for
`True` and `False` values. #316
* Added `augmenters.color._AbstractColorQuantization`. #347
* Added `imgaug.augmenters.segmentation.PointsSamplerIf`. An interface for
classes used for sampling (usually random) coordinate arrays on images. #348
* Added `imgaug.augmenters.segmentation.RegularGridPointsSampler`. A class
used to generate regular grids of `rows x columns` points on images. #348
* Added `imgaug.augmenters.segmentation.RelativeRegularGridPointsSampler`.
Similar to `RegularGridPointsSampler`, but number of rows/columns is set
as fractions of image sizes, leading to more rows/columns for larger
images. #348
* Added `imgaug.augmenters.segmentation.DropoutPointsSampler`. A class
used to randomly drop `p` percent of all coordinates sampled by another
another points sampler. #348
* Added `imgaug.augmenters.segmentation.UniformPointsSampler`. A class used
to sample `N` points on each image with y-/x-coordinates uniformly sampled
using the corresponding image height/width. #348
* Added `imgaug.augmenters.segmentation.SubsamplingPointsSampler`. A class
that ensures that another points sampler does not produce more than
`N` points by subsampling a random subset of the produced points if `N`
is exceeded. #348
* Added `imgaug.testutils.ArgCopyingMagicMock`. #413
## Other New Functions
* Added `imgaug.is_np_scalar()`, analogous to `imgaug.is_np_array()`. #366
* Added `dtypes.normalize_dtypes()`. #366
* Added `dtypes.normalize_dtype()`. #366
* Added `dtypes.change_dtypes_()`. #366
* Added `dtypes.change_dtype_()`. #366
* Added `dtypes.increase_itemsize_of_dtype()`. #366
* Added `imgaug.warn()` function. #367
* Added `imgaug.min_pool()`. #369
* Added `imgaug.median_pool()`. #369
* Added `imgaug.compute_paddings_to_reach_multiples_of()`. #369
* Added `imgaug.pad_to_multiples_of()`. #369
* Added `imgaug.imgaug.normalize_random_state()`. #348
* Added `imgaug.augmenters.segmentation._ensure_image_max_size()`. #348
* Added `imgaug.augmenters.segmentation._verify_sample_points_images()`. #348
* Added `imgaug.augmenters.segmentation.segment_voronoi()`, a function that
converts an image into a voronoi image, i.e. averages the colors within
voronoi cells placed on the image. #348
* Added `_match_pixels_with_voronoi_cells()`. #348
* Added `_generate_pixel_coords()`. #348
* Added `_compute_avg_segment_colors()`. #348
* Added `_render_segments()`. #348
* Added `augmentables.utils.copy_augmentables`. #410
* Added `augmenters.flip.fliplr()`. #385
* Added `augmenters.flip.flipud()`. #385
* Added `augmenters.color.change_colorspace_()`. #409
* Added `augmenters.color.change_colorspace_batch_()`. #409
* Added `augmenters.arithmetic.add_scalar()`. #411
* Added `augmenters.arithmetic.add_elementwise()`. #411
* Added `augmenters.arithmetic.replace_elementwise_()`. #411
* Added `augmenters.arithmetic.compress_jpg()`. #411
* Added `validation.convert_iterable_to_string_of_types()`. #413
* Added `validation.is_iterable_of()`. #413
* Added `validation.assert_is_iterable_of()`. #413
## Other New Constants
* Added to `imgaug.augmenters.color` the constants `CSPACE_RGB`,
`CSPACE_BGR`, `CSPACE_GRAY`, `CSPACE_CIE`, `CSPACE_YCrCb`, `CSPACE_HSV`,
`CSPACE_HLS`, `CSPACE_Lab`, `CSPACE_Luv`, `CSPACE_YUV`, `CSPACE_ALL`. #409
## Other New Arguments
* [rarely breaking] Added a `pad_mode` argument to `imgaug.pool()`,
`imgaug.avg_pool()`, `imgaug.max_pool()`, `imgaug.min_pool()` and
`imgaug.median_pool()`. This breaks code relying on the order of the
functions arguments. #369
* Added to argument `size` of `Resize` the optional keys `short-side` and
`longer-side`. This adds the ability to resize the shorter and longer sides
of images (instead of only height/width). #349
* [rarely breaking] Added `value_hue` and `value_saturation` arguments,
which allow to set individual parameters for hue and saturation
instead of having to use one parameter for both (they may not be set
if `value` is already set).
This changes the order of arguments of the augmenter and code that relied
on that order will now break.
This also changes the output of
`AddToHueAndSaturation.get_parameters()`. #319
* [rarely breaking] Added argument `polygon_recoverer` to
`augmenters.geometric.PerspectiveTransform`. This changes the order of
arguments of the augmenter and code that relied on that order will now
break. #338
* Added attribute `from_colorspace` to `AddToHueAndSaturation`. #409
## Other Removed Concepts
* [rarely breaking] Removed `dtypes.get_minimal_dtype_for_values()`. The
function was not used anywhere in the library. #366
* [rarely breaking] Removed `dtypes.get_minimal_dtype_by_value_range()`. The
function was not used anywhere in the library. #366
* [rarely breaking] Removed `Affine.VALID_DTYPES_CV2_ORDER_0`. #407
* [rarely breaking] Removed `Affine.VALID_DTYPES_CV2_ORDER_NOT_0`. #407
* [rarely breaking] Removed `Affine.order_map_skimage_cv2`. #407
* [rarely breaking] Removed `Affine.mode_map_skimage_cv2`. #407
* [rarely breaking] Removed attributes `colorspace_changer` and
`colorspace_changer_inv` from `AddToHueAndSaturation`. #409
* [rarely breaking] Removed class constant `ALLOW_DTYPES_CUSTOM_MINMAX`
from `Invert`. #411
* [rarely breaking] Removed attribute `dtype_kind_to_invert_func` from
`Invert`. #411
* [rarely breaking] Removed attribute `maximum_quality` from
`JpegCompression`. #411
* [rarely breaking] Removed attribute `minimum_quality` from
`JpegCompression`. #411
* [rarely breaking] Removed argument `affects` from
`dtypes.promote_array_dtypes_()` as it was unnecessary and not used anywhere
in the library. #366
* [rarely breaking] Removed method
`ElasticTransformation.generate_shift_maps()`. Use
`ElasticTransformation._generate_shift_maps()` instead. #413
* [rarely breaking] Removed method `ElasticTransformation.map_coordinates()`.
Use `ElasticTransformation._map_coordinates()` instead. #413
## Performance
* Replaced all calls of `imgaug.do_assert` with ordinary `assert`
statements. This is a bit less secure, but should overall improve
performance. #387
* Improved performance of `augmenters.flip.Fliplr`. #385
* Improved performance of `augmenters.flip.Flipud`. #385
## Deprecation
* Marked the following functions as deprecated (#398):
* `imgaug.augmenters.meta.clip_augmented_image_`
* `imgaug.augmenters.meta.clip_augmented_image`
* `imgaug.augmenters.meta.clip_augmented_images_`
* `imgaug.augmenters.meta.clip_augmented_images`
* Marked `imgaug.augmenters.arithmetic.ContrastNormalization` as deprecated.
Use `imgaug.augmenters.contrast.LinearContrast` instead. #396
* Marked argument `X` of `imgaug.augmentables.kps.compute_geometric_median()`
as deprecated. Use argument `points` instead. #402
* Marked `cval` in `imgaug.pool()`, `imgaug.avg_pool()` and `imgaug.max_pool()`
as deprecated. Use `pad_cval` instead. #369
## Refactorings
* Refactored `augmenters.arithmetic` to improve code quality and
docstrings. #328
* Refactored `augmenters.segmentation` to improve code quality and
docstrings. #334
* Refactored `augmenters/convolutional.py` to improve code quality and
docstrings. #335
* Refactored `augmenters/weather.py` to improve code quality and
docstrings. #336
* Refactored `multicore` to improve code quality and
docstrings. #367
* Improved error messages in `multicore`.
* Refactored `imgaug.pool()` to use `imgaug.pad()` for image padding. #369
* Refactored `augmenters.pooling.MedianPooling` to use
`imgaug.median_pool()`. #369
* Refactored `augmenters.pooling.MinPooling` to use `imgaug.min_pool()`. #369
* Improved code style and documentation of (#389, #402):
* `imgaug.augmentables.bbs`.
* `imgaug.augmentables.heatmaps`.
* `imgaug.augmentables.kps`.
* `imgaug.augmentables.lines`.
* `imgaug.augmentables.normalization`.
* `imgaug.augmentables.polys`.
* `imgaug.augmentables.segmaps`.
* `imgaug.augmentables.utils`.
* `imgaug.imgaug`.
* `imgaug.parameters`.
* `imgaug.augmenters.weather`.
* `imgaug.augmenters.size`.
* `imgaug.augmenters.segmentation`.
* `imgaug.augmenters.meta`.
* `imgaug.augmenters.geometric`.
* `imgaug.augmenters.flip`.
* `imgaug.augmenters.contrast`.
* `imgaug.augmenters.blur`.
* `imgaug.augmenters.blend`.
* `imgaug.augmenters.weather`.
* Refactored all calls of `warnings.warn()` to use `imgaug.imgaug.warn()
instead. #401
* [rarely breaking] Refactored most of the augmenters from functions to
classes. Previously, some augmenters were functions that returned an
instance of another augmenter (with adjusted hyperparameters) when being
called. Aside from a few corner cases, these have been switched to classes
inheriting from the augmenters that were previously returned. This should
make some outputs less confusing (e.g. `print(A())` does no longer lead to
class `B` being printed). All arguments stayed the same and this is not
expected to affect any user code negatively. The augmenters listed below are
affected by this change. #396
* `imgaug.augmenters.arithmetic.AdditiveGaussianNoise`
* `imgaug.augmenters.arithmetic.AdditiveLaplaceNoise`
* `imgaug.augmenters.arithmetic.AdditivePoissonNoise`
* `imgaug.augmenters.arithmetic.Dropout`
* `imgaug.augmenters.arithmetic.CoarseDropout`
* `imgaug.augmenters.arithmetic.ImpulseNoise`
* `imgaug.augmenters.arithmetic.SaltAndPepper`
* `imgaug.augmenters.arithmetic.CoarseSaltAndPepper`
* `imgaug.augmenters.arithmetic.Salt`
* `imgaug.augmenters.arithmetic.CoarseSalt`
* `imgaug.augmenters.arithmetic.Pepper`
* `imgaug.augmenters.arithmetic.CoarsePepper`
* `imgaug.augmenters.blend.SimplexNoiseAlpha`
* `imgaug.augmenters.blend.FrequencyNoiseAlpha`
* `imgaug.augmenters.blur.MotionBlur`
* `imgaug.augmenters.contrast.MultiplyHueAndSaturation`
* `imgaug.augmenters.contrast.MultiplyHue`
* `imgaug.augmenters.contrast.MultiplySaturation`
* `imgaug.augmenters.contrast.AddToHue`
* `imgaug.augmenters.contrast.AddToSaturation`
* `imgaug.augmenters.contrast.Grayscale`
* `imgaug.augmenters.contrast.GammaContrast`
* `imgaug.augmenters.contrast.SigmoidContrast`
* `imgaug.augmenters.contrast.LogContrast`
* `imgaug.augmenters.contrast.LinearContrast`
* `imgaug.augmenters.convolutional.Sharpen`
* `imgaug.augmenters.convolutional.Emboss`
* `imgaug.augmenters.convolutional.EdgeDetect`
* `imgaug.augmenters.convolutional.DirectedEdgeDetect`
* `imgaug.augmenters.meta.OneOf`
* `imgaug.augmenters.meta.AssertLambda`
* `imgaug.augmenters.meta.AssertShape`
* `imgaug.augmenters.size.Pad`
* `imgaug.augmenters.size.Crop`
* `imgaug.augmenters.weather.Clouds`
* `imgaug.augmenters.weather.Fog`
* `imgaug.augmenters.weather.Snowflakes`
* Refactored `Affine` to improve code quality and minimize code
duplication. #407
* Refactored `CropAndPad` to improve code quality and minimize code
duplication. #407
* Refactored module `size` to decrease code duplication between different
augmenters. #407
* Moved matrix generation logic of augmenters in module `convolutional`
to classes, one per augmenter (i.e. one per category of convolutional
matrix). This should avoid errors related to pickling of functions. #407
* Refactored color augmenters to use `change_colorspace_()` and
`change_colorspace_batch_()`. #409
* Refactored `Alpha` to decrease code duplication. #410
* Refactored `AlphaElementwise` to decrease code duplication. #410
* Refactored `Add` to use `imgaug.augmenters.arithmetic.add_scalar()`. #411
* Refactored `AddElementwise` to use
`imgaug.augmenters.arithmetic.add_elementwise()`. #411
* Refactored `ReplaceElementwise` to use
`imgaug.augmenters.arithmetic.replace_elementwise_()`. #411
* Refactored `JpegCompression` to use
`imgaug.augmenters.arithmetic.compress_jpg()`. #411
* Refactored `AddToHueAndSaturation` to decrease code duplication and improve
code quality. #319
* Refactored `Affine` to improve code quality and decrease code
duplication. #413
* Refactored `PiecewiseAffine` to improve code quality and decrease code
duplication. #413
* Refactored `PerspectiveTransform` to improve code quality and decrease code
duplication. #413
* Refactored `ElasticTransformation` to improve code quality and decrease code
duplication. #413
* Refactored `Rot90` to improve code quality and decrease code
duplication. #413
* Refactored `Augmenter.augment_images()`, `Augmenter.augment_heatmaps()`,
`Augmenter.augment_segmentation_maps()`, `Augmenter.augment_polygons()`,
`Augmenter.augment_line_strings()` and `Augmenter._augment_coord_augables()`
to improve code quality and remove redundancies. #413
* Refactored `imgaug.imgaug.imresize_single_image()`. #413
* Refactored `Sequential` to reduce code duplication. #413
* Refactored `SomeOf` to improve code quality. #413
* Refactored `Sometimes` to reduce code duplication. #413
* Refactored `AssertShape` to reduce code duplication. #413
* Refactored `ChannelShuffle` to improve code quality. #413
* Refactored `dtypes.py` to improve code quality. #366
* Refactored `dtypes.promote_array_dtypes_()` to use
`dtypes.change_dtypes_()`. #366
* Refactored `dtypes.get_minimal_dtype()` to use
`dtypes.increase_itemsize_of_dtype()`. #366
* Renamed `dtypes.restore_dtypes_()` to `dtypes.change_dtypes_()`. (Old name
still exists too and redirects to new name. Not yet marked as
deprecated.) #366
## Other Changes
* [rarely breaking] Changed colorspace transformations throughout the
library to fail if the input image does not have three channels. #409
* Changed colorspace transformations throughout the library to also
support `YUV` colorspace. #409
* [rarely breaking] Changed `AlphaElementwise` to verify for keypoint
and line string augmentation that the number of coordinates before/after
augmentation does not change. Previously this was allowed. This also
affects `SigmoidNoiseAlpha` and `FrequenceNoiseAlpha`. #410
* [rarely breaking] Changed `AlphaElementwise` to use for keypoint,
line string and bounding box augmentation a pointwise approach, where
per coordinate a decision is made whether the new coordinate from the
first branch's (augmented) results or the second branch's (augmented)
results are used. The decision is based on the average alpha mask value
at the xy-location of the coordinate. For polygons, the old mode is
still used where either all coordinates from the first branch's results
or the second branch's results are used. This also affects
`SigmoidNoiseAlpha` and `FrequenceNoiseAlpha`. #410
* Improved error messages of `dtypes.restore_dtypes_()`. #366
## Other Minor Changes
* Increased `max_distance` thresholds for `almost_equals()`,
`exterior_almost_equals()` and `coords_almost_equals()` in `Polygon` and
`LineString` from `1e-6` to `1e-4`. This should fix false-negative problems
related to float inaccuracies.
* Changed `_ConcavePolygonRecoverer` to not search for segment intersection
points in polygons with very large absolute coordinate values.
This prevents rare errors due to floating point inaccuracies. #338
* Changed `_ConcavePolygonRecoverer` to raise warnings instead of throwing
exceptions when the underlying search for segment intersection points
crashes. #338
* Added check to `dtypes.gate_dtypes()` verifying that arguments `allowed`
and `disallowed` have no intersection. #346
* Changed `dtypes.get_value_range_of_dtype()` to return a float as the center
value of `uint` dtypes. #366
* Changed `multicore.Pool` to produce a warning if it cannot find or call the
function `multiprocessing.cpu_count()` instead of silently failing.
(In both cases it falls back to a default value.) #367
* Changed the default `pad_mode` of `avg_pool` from `constant` (`cval=128`)
to `reflect`. #369
* Changed the default `pad_mode` of `max_pool` from `constant` (`cval=0`)
to `edge`. #369
* Changed the default `pad_mode` of `min_pool` from `constant` (`cval=255`)
to `edge`. #369
* Changed the default `pad_mode` of `median_pool` from `constant`
(`cval=128`) to `reflect`. #369
* Changed `imgaug.imgaug.pad` to automatically clip the `cval` argument
to the value range of the array to be padded. #407
* [rarely breaking] Changed `KeypointsOnImage.from_keypoints_image()` to
return `(x+0.5, y+0.5)` instead of `(x, y)` where `(x, y)` denotes the
coordinates of the pixel in which a maximum was found. This change matches
the standard that all pixels are given with subpixel accuracy and therefore
any whole pixel with a maximum should denote the coordinates of that
pixel's center. #413
* Removed image-channel check for cv2-based warp in `Affine`. Images with any
channel number can now be warped using the cv2 backend (previously: only
`<=4`, others would be warped via skimage). #381
* [rarely breaking] The `value` parameter in
`augmenters.color.AddToHueAndSaturation` is now interpreted by the
augmenter to return first the hue and then the saturation value to add,
instead of the other way round. (This isn't expected to affect
anybody.) #319
* Added output `from_colorspace` to
`AddToHueAndSaturation.get_parameters()`. #409
* Added dtype gating to `dtypes.clip_()`.
* Changed all dtype-related functions to accept also dtypes given as
string names, numpy arrays, numpy scalars or dtype functions. #366
* Changed `dtypes.restore_dtypes_()` so that if `images` is a list of length
`N` and `dtypes` is a list of length `M` and `N!=M`, the function now raises
an `AssertionError`. #366
* Changed `dtypes.restore_dtypes_()` to ignore the argument `round` if the
input array does not have a float dtype. #366
* Removed restrictions of `value` parameter in `AddElementwise`.
The value range is now no longer limited to `[-255, 255]` and floats
are now allowed. #411
## New Scripts
* Added a check script for `UniformColorQuantization` in
`checks/check_uniform_color_quantization.py`. #347
* Added a check script for `Voronoi` in `checks/check_voronoi.py`. #348
* Added a check script for flip performance measurments under
`checks/check_flip_performance.py`. #385
## Other
* Added the library to `conda-forge` so it can now be installed via
`conda install imgaug` (provided the conda-forge channel was added
before that). #320 #339
* Changed dependency `opencv-python` to `opencv-python-headless`.
This should improve support for some system without GUIs.
* Added dependency `pytest-subtests` for the library's unittests. #366
* Improved the docstrings of most augmenters and added code examples. #302
* Added error messages to `assert` statements throughout the library. #387
* Removed the requirement to implement `_augment_keypoints()` and
`_augment_heatmaps()` in augmenters. The methods now default to doing
nothing. Also removed all such noop-implementations of these methods from
all augmenters. #380
* Increased minimum version requirement for `scikit-image` to
`0.14.2`. #377, #399
* Renamed `imgaug/external/poly_point_isect.py` to
`imgaug/external/poly_point_isect_py3.py.bak`.
The file is in the library only for completeness and contains python3 syntax.
`poly_point_isect_py2py3.py` is actually used.
## Fixes
* Fixed an issue with `Polygon.clip_out_of_image()`,
which would lead to exceptions if a polygon had overlap with an image,
but not a single one of its points was inside that image plane.
* Fixed `multicore` methods falsely not accepting
`augmentables.batches.UnnormalizedBatch`.
* `Rot90` now uses subpixel-based coordinate remapping.
I.e. any coordinate `(x, y)` will be mapped to `(H-y, x)` for a rotation by
90deg.
Previously, an integer-based remapping to `(H-y-1, x)` was used.
Coordinates are e.g. used by keypoints, bounding boxes or polygons.
* `augmenters.arithmetic.Invert`
* [rarely breaking] If `min_value` and/or `max_value` arguments were
set, `uint64` is no longer a valid input array dtype for `Invert`.
This is due to a conversion to `float64` resulting in loss of resolution.
* Fixed `Invert` in rare cases restoring dtypes improperly.
* Fixed `dtypes.gate_dtypes()` crashing if the input was one or more numpy
scalars instead of numpy arrays or dtypes.
* Fixed `augmenters.geometric.PerspectiveTransform` producing invalid
polygons (more often with higher `scale` values). #338
* Fixed errors caused by `external/poly_point_isect_py2py3.py` related to
floating point inaccuracies (changed an epsilon from `1e-10` to `1e-4`,
rounded some floats). #338
* Fixed `Superpixels` breaking when a sampled `n_segments` was `<=0`.
`n_segments` is now treated as `1` in these cases.
* Fixed `ReplaceElementwise` both allowing and disallowing dtype `int64`. #346
* Fixed `BoundingBox.deepcopy()` creating only shallow copies of labels. #356
* Fixed `dtypes.change_dtypes_()` #366
* Fixed argument `round` being ignored if input images were a list.
* Fixed failure if input images were a list and dtypes a single numpy
dtype function.
* Fixed `dtypes.get_minimal_dtype()` failing if argument `arrays` contained
not *exactly* two items. #366
* Fixed calls of `CloudLayer.get_parameters()` resulting in errors. #309
* Fixed `SimplexNoiseAlpha` and `FrequencyNoiseAlpha` not handling
`sigmoid` argument correctly. #343
* Fixed `SnowflakesLayer` crashing for grayscale images. #345
* Fixed `Affine` heatmap augmentation crashing for arrays with more than
four channels and `order!=0`. #381
* Fixed an outdated error message in `Affine`. #381
* Fixed `Polygon.clip_out_of_image()` crashing if the intersection between
polygon and image plane was an edge or point. #382
* Fixed `Polygon.clip_out_of_image()` potentially failing for polygons
containing two or fewer points. #382
* Fixed `Polygon.is_out_of_image()` returning wrong values if the image plane
was fully contained inside the polygon with no intersection between the
image plane and the polygon edge. #382
* Fixed `Fliplr` and `Flipud` using for coordinate-based inputs and image-like
inputs slightly different conditions for when to actually apply
augmentations. #385
* Fixed `Convolve` using an overly restrictive check when validating inputs
for `matrix` w.r.t. whether they are callables. The check should now also
support class methods (and possibly various other callables). #407
* Fixed `CropAndPad`, `Pad` and `PadToFixedSize` still clipping `cval` samples
to the `uint8`. They now clip to the input array's dtype's value range. #407
* Fixed `WithColorspace` not propagating polygons to child augmenters. #409
* Fixed `WithHueAndSaturation` not propagating segmentation maps and polygons
to child augmenters. #409
* Fixed `AlphaElementwise` to blend coordinates (for keypoints, polygons,
line strings) on a point-by-point basis following the image's average
alpha value in the sampled alpha mask of the point's coordinate.
Previously, the average over the whole mask was used and then either all
points of the first branch or all of the second branch were used as the
augmentation output. This also affects `SimplexNoiseAlpha` and
`FrequencyNoiseAlpha`. #410
* Fixed many augmenters and helper functions producing errors if the height,
width and/or channels of input arrays were exactly `0` or the channels
were `>512`. #433
* Fixed `Rot90` not supporting `imgaug.ALL`. #434
* Fixed `PiecewiseAffine` possibly generating samples for non-image data
when using `absolute_scale=True` that were not well aligned with the
corresponding images. #437
+710
View File
@@ -0,0 +1,710 @@
# 0.3.0, Uncleaned Raw Log Of Changes
* Added argument `output_buffer_size` to `multicore.Pool.imap_batches()`
and `multicore.Pool.imap_batches_unordered()` to control the maximum number
of batches in the background augmentation pipeline (allows to limit
maximum RAM demands).
* Increased `max_distance` thresholds for `almost_equals()`,
`exterior_almost_equals()` and `coords_almost_equals()` in `Polygon` and
`LineString` from `1e-6` to `1e-4`.
This should fix false-negative problems related to float inaccuracies.
* Added module `imgaug.augmenters.edges`.
* Added interface `augmenters.edges.BinaryImageColorizerIf`, which
contains the interface for classes used to convert binary images to RGB
images.
* Added `augmenters.edges.RandomColorsBinaryImageColorizer`, which
converts binary images to RGB images by sampling uniformly RGB colors for
`True` and `False` values.
* Added `augmenters.edges.Canny`, which applies canny edge detection with alpha
blending and random coloring to images.
* Renamed `imgaug/external/poly_point_isect.py` to
`imgaug/external/poly_point_isect_py3.py.bak`.
The file is in the library only for completeness and contains python3 syntax.
`poly_point_isect_py2py3.py` is actually used.
* Added dtype gating to `dtypes.clip_()`.
* Added module `augmenters.pooling`. #317
* Added `augmenters.pooling._AbstractPoolingBase`. #317
* Added `augmenters.pooling.AveragePooling`. #317
* Added `augmenters.pooling.MaxPooling`. #317
* Added `augmenters.pooling.MinPooling`. #317
* Added `augmenters.pooling.MedianPooling`. #317
* `augmenters.color.AddToHueAndSaturation`
* [rarely breaking] Refactored `AddToHueAndSaturation` to clean it up.
Re-running old code with the same seeds will now produce different
images. #319
* [rarely breaking] The `value` parameter is now interpreted by the
augmenter to return first the hue and then the saturation value to add,
instead of the other way round.
(This shouldn't affect anybody.) #319
* [rarely breaking] Added `value_hue` and `value_saturation` arguments,
which allow to set individual parameters for hue and saturation
instead of having to use one parameter for both (they may not be set
if `value` is already set).
This changes the order of arguments of the augmenter and code that relied
on that order will now break.
This also changes the output of
`AddToHueAndSaturation.get_parameters()`. #319
* Added `augmenters.color.AddToHue`, a shortcut for
`AddToHueAndSaturation(value_hue=...)`. #319
* Added `augmenters.color.AddToSaturation`, a shortcut for
`AddToHueAndSaturation(value_saturation=...)`. #319
* Added `augmenters.color.WithHueAndSaturation`. #319
* Added `augmenters.color.MultiplyHueAndSaturation`. #319
* Added `augmenters.color.MultiplyHue`. #319
* Added `augmenters.color.MultiplySaturation`. #319
* Refactored `augmenters/weather.py` (general code and docstring cleanup). #336
* [rarely breaking] Refactored `augmenters/convolutional.py`
(general code and docstring cleanup).
This involved changing the random state handling.
Old seeds might now produce different result images for convolutional
augmenters (`Convolve`, `Sharpen`, `Emboss`, `EdgeDetect`,
`DirectedEdgeDetect`). #335
* [rarely breaking] Added argument `polygon_recoverer` to
`augmenters.geometric.PerspectiveTransform`. This changes the order of
arguments of the augmenter and code that relied on that order will now
break. #338
* Changed `_ConcavePolygonRecoverer` to not search for segment intersection
points in polygons with very large absolute coordinate values.
This prevents rare errors due to floating point inaccuracies. #338
* Changed `_ConcavePolygonRecoverer` to raise warnings instead of throwing
exceptions when the underlying search for segment intersection points
crashes. #338
* Added the library to `conda-forge` so it can now be installed via
`conda install imgaug` (provided the conda-forge channel was added
before that). #320 #339
* Changed dependency `opencv-python` to `opencv-python-headless`.
This should improve support for some system without GUIs.
* Refactored code in `augmenters.segmentation` (general code and docstring cleanup). #334
* Refactored code in `augmenters.arithmetic` (general code and docstring cleanup). #328
* Added check to `dtypes.gate_dtypes()` verifying that arguments `allowed`
and `disallowed` have no intersection. #346
* Added dependency `pytest-subtests` for the library's unittests. #366
* Added `imgaug.is_np_scalar()`, analogous to `imgaug.is_np_array()`. #366
* Reworked and refactored code in `dtypes.py` (general code cleanup). #366
* Added `dtypes.normalize_dtypes()`.
* Added `dtypes.normaliz_dtypes()`.
* Refactored `dtypes.promote_array_dtypes_()` to use
`dtypes.change_dtypes_()`.
* Reworked dtype normalization. All functions in the module that required
dtype inputs accept now dtypes, dtype functions, dtype names, ndarrays
or numpy scalars.
* [rarely breaking] `dtypes.restore_dtypes_()`
* Improved error messages.
* Changed so that if `images` is a list of length `N` and `dtypes` is a
list of length `M` and `N!=M`, the function now raises an
`AssertionError`.
* The argument `round` is now ignored if the input array does not have
a float dtype.
* Renamed `dtypes.restore_dtypes_()` to `dtypes.change_dtypes_()` (old name
still exists too and redirects to new name).
* Added `dtypes.change_dtype_()`, analogous to `dtypes.change_dtypes_()`.
* Added `dtypes.increase_itemsize_of_dtype()`.
* Refactored `dtypes.get_minimal_dtype()` to use that new function.
* [rarely breaking] Removed `dtypes.get_minimal_dtype_for_values()`. The
function was not used anywhere in the library.
* [rarely breaking] Removed `dtypes.get_minimal_dtype_by_value_range()`. The
function was not used anywhere in the library.
* Changed `dtypes.get_value_range_of_dtype()` to return a float as the center
value of `uint` dtypes.
* [rarely breaking] Removed argument `affects` from
`dtypes.promote_array_dtypes_()` as it was unnecessary and not used anywhere
in the library. #366
* Added `imgaug.warn()` function. #367
* Changed `multicore.Pool` to produce a warning if it cannot find or call the
function `multiprocessing.cpu_count()` instead of silently failing.
(In both cases it falls back to a default value.) #367
* Refactored code in `multicore` (general code and docstring cleanup). #367
* Improved error messages in `multicore`.
* Added `imgaug.min_pool()`. #369
* Refactored `augmenters.pooling.MinPooling` to use `imgaug.min_pool()`.
* Added `imgaug.median_pool()`. #369
* Refactored `augmenters.pooling.MedianPooling` to use
`imgaug.median_pool()`.
* Added `imgaug.compute_paddings_to_reach_multiples_of()`. #369
* Added `imgaug.pad_to_multiples_of()`. #369
* Refactored `imgaug.pool()` to use `imgaug.pad()` for image padding. #369
* [rarely breaking] Added a `pad_mode` argument to `imgaug.pool()`,
`imgaug.avg_pool()`, `imgaug.max_pool()`, `imgaug.min_pool()` and
`imgaug.median_pool()`. This breaks code relying on the order of the
functions arguments. #369
* Changed the default `pad_mode` of `avg_pool` from `constant` (`cval=128`)
to `reflect`.
* Changed the default `pad_mode` of `max_pool` from `constant` (`cval=0`)
to `edge`.
* Changed the default `pad_mode` of `min_pool` from `constant` (`cval=255`)
to `edge`.
* Changed the default `pad_mode` of `median_pool` from `constant`
(`cval=128`) to `reflect`.
* Renamed argument `cval` to `pad_cval` in `imgaug.pool()`,
`imgaug.avg_pool()` and `imgaug.max_pool()`. The old name `cval` is now
deprecated. #369
* Added `augmenters.color._AbstractColorQuantization`. #347
* Added `augmenters.color.KMeansColorQuantization` and corresponding
`augmenters.color.quantize_colors_kmeans()`. Both deal with quantizing
similar colors using k-Means clustering. #347
* Added a check script for `KMeansColorQuantization` under
`checks/check_kmeans_color_quantization.py`. #347
* Added `augmenters.color.UniformColorQuantization` and corresponding
`augmenters.color.quantize_colors_uniform()`. Both deal with quantizing
similar colors using k-Means clustering. #347
* Added a check script for `UniformColorQuantization` under
`checks/check_uniform_color_quantization.py`. #347
* Added `imgaug.imgaug.normalize_random_state()`. #348
* Added `imgaug.augmenters.segmentation._ensure_image_max_size()`. #348
* Added `imgaug.augmenters.segmentation.PointsSamplerIf`. An interface for
classes used for sampling (usually random) coordinate arrays on images.
* Added `imgaug.augmenters.segmentation._verify_sample_points_images()`. #348
* Added `imgaug.augmenters.segmentation.RegularGridPointsSampler`. A class
used to generate regular grids of `rows x columns` points on images. #348
* Added `imgaug.augmenters.segmentation.RelativeRegularGridPointsSampler`.
Similar to `RegularGridPointsSampler`, but number of rows/columns is set
as fractions of image sizes, leading to more rows/columns for larger
images. #348
* Added `imgaug.augmenters.segmentation.DropoutPointsSampler`. A class
used to randomly drop `p` percent of all coordinates sampled by another
another points sampler. #348
* Added `imgaug.augmenters.segmentation.UniformPointsSampler`. A class used
to sample `N` points on each image with y-/x-coordinates uniformly sampled
using the corresponding image height/width. #348
* Added `imgaug.augmenters.segmentation.SubsamplingPointsSampler`. A class
that ensures that another points sampler does not produce more than
`N` points by subsampling a random subset of the produced points if `N`
is exceeded. #348
* Added `imgaug.augmenters.segmentation.segment_voronoi()`. A function that
converts an image into a voronoi image, i.e. averages the colors within
voronoi cells placed on the image. #348
* Also added in the same module the functions
`_match_pixels_with_voronoi_cells()`, `_generate_pixel_coords()`,
`_compute_avg_segment_colors()`, `_render_segments()`.
* Added `imgaug.augmenters.segmentation.Voronoi`. An augmenter that converts
an image to a voronoi image. #348
* Added a check script for `Voronoi` in `checks/check_voronoi.py`.
* Added `imgaug.augmenters.segmentation.UniformVoronoi`, a shortcut for
`Voronoi(UniformPointsSamper)`. #348
* Added `imgaug.augmenters.segmentation.RegularGridVoronoi`, a shortcut for
`Voronoi(DropoutPointsSampler(RegularGridPointsSampler))`. #348
* Added `imgaug.augmenters.segmentation.RelativeRegularGridVoronoi`, a shortcut
for `Voronoi(DropoutPointsSampler(RelativeRegularGridPointsSampler))`. #348
* Add to `Resize` the ability to resize the shorter and longer sides of
images (instead of only height/width). #349
* Improved the docstrings of most augmenters and added code examples. #302
* Changes to support numpy 1.17 #302
* [rarely breaking] Deactivated support for `int64` in
`imgaug.dtypes.clip_()`. This is due to numpy 1.17 turning `int64` to
`float64` in `numpy.clip()` (possible that this happened in some way
before 1.17 too).
* [rarely breaking] Changed `imgaug.dtypes.clip()` to never clip `int32`
in-place, as `numpy.clip()` turns it into `float64` since 1.17 (possible
that this happend in some way before 1.17 too).
* [rarely breaking] Deactivated support for `int64` in
`ReplaceElementwise`. See `clip` issue above.
* [rarely breaking] Changed `parameters.DiscreteUniform` to always return
arrays of dtype `int32`. Previously it would automatically return
`int64`.
* [rarely breaking] Changed `parameters.Deterministic` to always return
`int32` for integers and always `float32` for floats.
* [rarely breaking] Changed `parameters.Choice` to limit integer
dtypes to `int32` or lower, uints to `uint32` or lower and floats
to `float32` or lower.
* [rarely breaking] Changed `parameters.Binomial` and `parameters.Poisson`
to always return `int32`.
* [rarely breaking] Changed `parameters.Normal`,
`parameters.TruncatedNormal`, `parameters.Laplace`,
`parameters.ChiSquare`, `parameters.Weibull`, `parameters.Uniform` and
`parameters.Beta` to always return `float32`.
* [rarely breaking] Changed `augmenters.arithmetic.Add`,
`augmenters.arithmetic.AddElementwise`, `augmenters.arithmetic.Multiply`
and `augmenters.arithmetic.MultiplyElementwise` to no longer internally
increase itemsize of dtypes by a factor of 2 for
dtypes `uint16`, `int8` and `uint16`. For `Multiply*` this also
covers `float16` and `float32`. This protects against crashes due to
clipping `int64` or `uint64` data. In rare cases this can lead to
overflows if `image + random samples` or `image * random samples`
exceeds the value range of `int32` or `uint32`. This change may affect
various other augmenters that are wrappers around the mentioned ones,
e.g. `AdditiveGaussianNoise`.
* [rarely breaking] Decreased support of dtypes `uint16`, `int8`,
`int16`, `float16`, `float32` and `bool` in `augmenters.arithmetic.Add`,
`AddElementwise`, `Multiply` and `MultiplyElementwise` from "yes" to
"limited".
* [rarely breaking] Decreased support of dtype `int64` in
`augmenters.arithmetic.ReplaceElementwise` from "yes" to "no". This also
affects all `*Noise` augmenters (e.g. `AdditiveGaussianNoise`,
`ImpulseNoise`), all `Dropout` augmenters, all `Salt` augmenters and
all `Pepper` augmenters.
* [rarely breaking] Changed `augmenters.contrast.adjust_contrast_log`
and thereby `LogContrast` to no longer support dtypes `uint32`, `uint64`,
`int32` and `int64`.
* Replaced all calls of `imgaug.imgaug.do_assert` by ordinary `assert`
statements. This is a bit less secure, but should overall improve
performance. #387
* Added error messages to `assert` statements throughout the library. #387
* Improved code style and documentation of (#389, #402):
* `imgaug.augmentables.bbs`.
* `imgaug.augmentables.heatmaps`.
* `imgaug.augmentables.kps`.
* `imgaug.augmentables.lines`.
* `imgaug.augmentables.normalization`.
* `imgaug.augmentables.polys`.
* `imgaug.augmentables.segmaps`.
* `imgaug.augmentables.utils`.
* `imgaug.imgaug`.
* `imgaug.parameters`.
* `imgaug.augmenters.weather`.
* `imgaug.augmenters.size`.
* `imgaug.augmenters.segmentation`.
* `imgaug.augmenters.meta`.
* `imgaug.augmenters.geometric`.
* `imgaug.augmenters.flip`.
* `imgaug.augmenters.contrast`.
* `imgaug.augmenters.blur`.
* `imgaug.augmenters.blend`.
* `imgaug.augmenters.weather`.
* Removed image-channel check for cv2-based warp in `Affine`. Images with any
channel number can now be warped using the cv2 backend (previously: only
`<=4`, others would be warped via skimage). #381
* Improved performance of `augmenters.flip.Fliplr`. #385
* Improved performance of `augmenters.flip.Flipud`. #385
* Added function `augmenters.flip.fliplr()`. #385
* Added function `augmenters.flip.flipud()`. #385
* Removed the requirement to implement `_augment_keypoints()` and
`_augment_heatmaps()` in augmenters. The methods now default to doing
nothing. Also removed all such noop-implementations of these methods from
all augmenters. #380
* Increased minimum version requirement for `scikit-image` to
`0.14.2`. #377, #399
* Marked the following functions as deprecated (#398):
* `imgaug.augmenters.meta.clip_augmented_image_`
* `imgaug.augmenters.meta.clip_augmented_image`
* `imgaug.augmenters.meta.clip_augmented_images_`
* `imgaug.augmenters.meta.clip_augmented_images`
* Refactored all calls of `warnings.warn()` to use `imgaug.imgaug.warn()
instead. #401
* [rarely breaking] Refactored most of the augmenters from functions to
classes. Previously, some augmenters were functions that returned an
instance of another augmenter (with adjusted hyperparameters) when being
called. Aside from a few corner cases, these have been switched to classes
inheriting from the augmenters that were previously returned. This should
make some outputs less confusing (ass `print(A())` does not lead to class
`B` being printed). All arguments stayed the same and this is not expected
to affect any user code negatively. The augmenters listed below are
affected by this change. #396
* `imgaug.augmenters.arithmetic.AdditiveGaussianNoise`
* `imgaug.augmenters.arithmetic.AdditiveLaplaceNoise`
* `imgaug.augmenters.arithmetic.AdditivePoissonNoise`
* `imgaug.augmenters.arithmetic.Dropout`
* `imgaug.augmenters.arithmetic.CoarseDropout`
* `imgaug.augmenters.arithmetic.ImpulseNoise`
* `imgaug.augmenters.arithmetic.SaltAndPepper`
* `imgaug.augmenters.arithmetic.CoarseSaltAndPepper`
* `imgaug.augmenters.arithmetic.Salt`
* `imgaug.augmenters.arithmetic.CoarseSalt`
* `imgaug.augmenters.arithmetic.Pepper`
* `imgaug.augmenters.arithmetic.CoarsePepper`
* `imgaug.augmenters.blend.SimplexNoiseAlpha`
* `imgaug.augmenters.blend.FrequencyNoiseAlpha`
* `imgaug.augmenters.blur.MotionBlur`
* `imgaug.augmenters.contrast.MultiplyHueAndSaturation`
* `imgaug.augmenters.contrast.MultiplyHue`
* `imgaug.augmenters.contrast.MultiplySaturation`
* `imgaug.augmenters.contrast.AddToHue`
* `imgaug.augmenters.contrast.AddToSaturation`
* `imgaug.augmenters.contrast.Grayscale`
* `imgaug.augmenters.contrast.GammaContrast`
* `imgaug.augmenters.contrast.SigmoidContrast`
* `imgaug.augmenters.contrast.LogContrast`
* `imgaug.augmenters.contrast.LinearContrast`
* `imgaug.augmenters.convolutional.Sharpen`
* `imgaug.augmenters.convolutional.Emboss`
* `imgaug.augmenters.convolutional.EdgeDetect`
* `imgaug.augmenters.convolutional.DirectedEdgeDetect`
* `imgaug.augmenters.meta.OneOf`
* `imgaug.augmenters.meta.AssertLambda`
* `imgaug.augmenters.meta.AssertShape`
* `imgaug.augmenters.size.Pad`
* `imgaug.augmenters.size.Crop`
* `imgaug.augmenters.weather.Clouds`
* `imgaug.augmenters.weather.Fog`
* `imgaug.augmenters.weather.Snowflakes`
* Marked `imgaug.augmenters.arithmetic.ContrastNormalization` as deprecated.
Use `imgaug.augmenters.contrast.LinearContrast` instead. #396
* Renamed argument `X` of `imgaug.augmentables.kps.compute_geometric_median()`
to `points`. The old argument is still accepted, but now deprecated. #402
* Refactored `Affine` to improve code quality and minimize code
duplication. #407
* [rarely breaking] Removed `Affine.VALID_DTYPES_CV2_ORDER_0`.
* [rarely breaking] Removed `Affine.VALID_DTYPES_CV2_ORDER_NOT_0`.
* [rarely breaking] Removed `Affine.order_map_skimage_cv2`.
* [rarely breaking] Removed `Affine.mode_map_skimage_cv2`.
* Refactored `CropAndPad` to improve code quality and minimize code
duplication. #407
* Refactored module `size` to decrease code duplication between different
augmenters. #407
* Changed `imgaug.imgaug.pad` to automatically clip the `cval` argument
to the value range of the array to be padded. #407
* Moved matrix generation logic of augmenters in module `convolutional`
to classes, one per augmenter (i.e. one per category of convolutional
matrix). This should avoid errors related to pickling of functions. #407
* Refactored `imgaug.augmenters.color` (#409):
* Added to `imgaug.augmenters.color` the constants `CSPACE_RGB`,
`CSPACE_BGR`, `CSPACE_GRAY`, `CSPACE_CIE`, `CSPACE_YCrCb`, `CSPACE_HSV`,
`CSPACE_HLS`, `CSPACE_Lab`, `CSPACE_Luv`, `CSPACE_YUV`, `CSPACE_ALL`.
* Added `imgaug.augmenters.color.change_colorspace_()`.
* Added `imgaug.augmenters.color.change_colorspace_batch_()`.
* Refactored color augmenters to use `change_colorspace_()` and
`change_colorspace_batch_()`.
* [rarely breaking] Removed attributes `colorspace_changer` and
`colorspace_changer_inv` from `AddToHueAndSaturation`.
* Added attribute `from_colorspace` to `AddToHueAndSaturation`. This also
affects `AddToHue` and `AddToSaturation`.
* Added output `from_colorspace` to
`AddToHueAndSaturation.get_parameters()`. This also affects `AddToHue`
and `AddToSaturation`.
* [rarely breaking] Changed colorspace transformations throughout the
library to fail if the input image does not have three channels.
* Changed colorspace transformations throughout the library to also
support `YUV` colorspace.
* Added function `imgaug.augmentables.utils.copy_augmentables`. #410
* Refactored `Alpha` to decrease code duplication. #410
* Refactored `AlphaElementwise` to decrease code duplication. #410
* [rarely breaking] Changed `AlphaElementwise` to verify for keypoint
and line string augmentation that the number of coordinates before/after
augmentation does not change. Previously this was allowed. This also
affects `SigmoidNoiseAlpha` and `FrequenceNoiseAlpha`.
* [rarely breaking] Changed `AlphaElementwise` to use for keypoint,
line string and bounding box augmentation a pointwise approach, where
per coordinate a decision is made whether the new coordinate from the
first branch's (augmented) results or the second branch's (augmented)
results are used. The decision is based on the average alpha mask value
at the xy-location of the coordinate. For polygons, the old mode is
still used where either all coordinates from the first branch's results
or the second branch's results are used. This also affects
`SigmoidNoiseAlpha` and `FrequenceNoiseAlpha`.
* Added function `imgaug.augmenters.arithmetic.add_scalar()`. #411
* Refactored `Add` to use that function.
* Added function `imgaug.augmenters.arithmetic.add_elementwise()`. #411
* Refactored `AddElementwise` to use that function.
* Removed restrictions of `value` parameter in `AddElementwise`.
The value range is now no longer limited to `[-255, 255]` and floats
are now allowed.
* Added function `imgaug.augmenters.arithmetic.replace_elementwise_()`. #411
* Refactored `ReplaceElementwise` to use that function.
* [rarely breaking] Removed class constant `ALLOW_DTYPES_CUSTOM_MINMAX`
from `Invert`.
* [rarely breaking] Removed attribute `dtype_kind_to_invert_func` from
`Invert`.
* Added function `imgaug.augmenters.arithmetic.compress_jpg()`. #411
* Refactored `JpegCompression` to use that function.
* [rarely breaking] Removed attribute `maximum_quality` from
`JpegCompression`.
* [rarely breaking] Removed attribute `minimum_quality` from
`JpegCompression`.
* Refactored `Affine` to improve code quality and decrease code
duplication. #413
* Refactored `PiecewiseAffine` to improve code quality and decrease code
duplication. #413
* Refactored `PerspectiveTransform` to improve code quality and decrease code
duplication. #413
* Refactored `ElasticTransformation` to improve code quality and decrease code
duplication. #413
* [rarely breaking] Renamed `ElasticTransformation.generate_shift_maps()` to
`ElasticTransformation._generate_shift_maps()`.
* [rarely breaking] Renamed `ElasticTransformation.map_coordinates()` to
`ElasticTransformation._map_coordinates()`.
* Refactored `Rot90` to improve code quality and decrease code
duplication. #413
* Added `imgaug.testutils.ArgCopyingMagicMock`. #413
* Refactored `Augmenter.augment_images()`, `Augmenter.augment_heatmaps()`,
`Augmenter.augment_segmentation_maps()`, `Augmenter.augment_polygons()`,
`Augmenter.augment_line_strings()` and `Augmenter._augment_coord_augables()`
to improve code quality and remove redundancies. #413
* Refactored `imgaug.imgaug.imresize_single_image()`. #413
* Added module `imgaug.validation`. #413
* Added `imgaug.validation.convert_iterable_to_string_of_types()`.
* Added `imgaug.validation.is_iterable_of()`.
* Added `imgaug.validation.assert_is_iterable_of()`.
* Refactored `Sequential` to reduce code duplication. #413
* Refactored `SomeOf` to improve code quality. #413
* Refactored `Sometimes` to reduce code duplication. #413
* Refactored `AssertShape` to reduce code duplication. #413
* Refactored `ChannelShuffle` to improve code quality. #413
* [rarely breaking] Changed `KeypointsOnImage.from_keypoints_image()` to
return `(x+0.5, y+0.5)` instead of `(x, y)` where `(x, y)` denotes the
coordinates of the pixel in which a maximum was found. This change matches
the standard that all pixels are given with subpixel accuracy and therefore
any whole pixel with a maximum should denote the coordinates of that
pixel's center. #413
* Changed default `output_buffer_size` in `Augmenter.augment_batches()` from
"unlimited" to `10*C`, where `C` is the number of logical CPU cores. #417
## Improved Segmentation Map Augmentation #302
Augmentation of Segmentation Maps is now faster and more memory efficient.
This required some breaking changes to `SegmentationMapOnImage`.
To adapt to the new version, the following steps should be sufficient for most
users:
* Rename all calls of `SegmentationMapOnImage` to `SegmentationMapsOnImage`
(Map -> Maps).
* Rename all calls of `SegmentationMapsOnImage.get_arr_int()` to
`SegmentationMapsOnImage.get_arr()`.
* Remove the argument `nb_classes` from all calls of `SegmentationMapsOnImage`.
* Remove the arguments `background_id` and `background_threshold` from all
calls as these are no longer supported.
* Ensure that the input array to `SegmentationMapsOnImage` is always an
int-like (int, uint or bool).
Float arrays are no longer accepted.
* Adapt all calls `SegmentationMapsOnImage.draw()` and
`SegmentationMapsOnImage.draw_on_image()`, as both of these now return a
list of drawn images instead of a single array. (For a segmentation map
array of shape `(H,W,C)` they return `C` drawn images. In most cases `C=1`,
so simply call `draw()[0]` or `draw_on_image()[0]`.)
* Ensure that if `SegmentationMapsOnImage.arr` is accessed anywhere, the
respective code can handle the new `int32` `(H,W,#maps)` array form.
Previously it was `float32` and the channel-axis had the same size as the
max class id (+1) that could appear in the map.
Changes:
- Changes to class `SegmentationMapOnImage`:
- Renamed `SegmentationMapOnImage` to plural `SegmentationMapsOnImage`
and deprecated the old name.
This was changed due to the input array now being allowed to contain
several channels, with each such channel containing one full segmentation
map.
- Changed `SegmentationMapsOnImage.__init__` to produce a deprecation
warning for float arrays as `arr` argument.
- **[breaking]** Changed `SegmentationMapsOnImage.__init__` to no longer
accept `uint32` and larger itemsizes as `arr` argument, only `uint16`
and below is accepted. For `int` the allowed maximum is `int32`.
- Changed `SegmentationMapsOnImage.__init__` to always accept `(H,W,C)`
`arr` arguments.
- **[breaking]** Changed `SegmentationMapsOnImage.arr` to always be
`int32` `(H,W,#maps)` (previously: `float32` `(H,W,#nb_classes)`).
- Deprecated `nb_classes` argument in `SegmentationMapsOnImage.__init__`.
The argument is now ignored.
- Added `SegmentationMapsOnImage.get_arr()`, which always returns a
segmentation map array with similar dtype and number of dimensions as
was originally input when creating a class instance.
- Deprecated `SegmentationMapsOnImage.get_arr_int()`.
The method is now an alias for `get_arr()`.
- `SegmentationMapsOnImage.draw()`:
- **[breaking]** Removed argument `return_foreground_mask` and
corresponding optional output. To generate a foreground mask
for the `c`-th segmentation map on a given image (usually `c=0`),
use `segmentation_map.arr[:, :, c] != 0`, assuming that `0` is
the integer index of your background class.
- **[breaking]** Changed output of drawn image to be a list of arrays
instead of a single array (one per `C` in input array `(H,W,C)`).
- Refactored to be a wrapper around
`SegmentationMapsOnImage.draw_on_image()`.
- The `size` argument may now be any of: A single `None` (keep shape),
a single integer (use as height and width), a single float (relative
change to shape) or a tuple of these values. ("shape" here denotes
the value of the `.shape` attribute.)
- `SegmentationMapsOnImage.draw_on_image()`:
- **[breaking]** The argument `background_threshold` is now deprecated
and ignored. Providing it will lead to a deprecation warning.
- **[breaking]** Changed output of drawn image to be a list of arrays
instead of a single array (one per `C` in input array `(H,W,C)`).
- Changed `SegmentationMapsOnImage.resize()` to use nearest neighbour
interpolation by default.
- **[rarely breaking]** Changed `SegmentationMapsOnImage.copy()` to create
a shallow copy instead of being an alias for `deepcopy()`.
- Added optional arguments `arr` and `shape` to
`SegmentationMapsOnImage.copy()`.
- Added optional arguments `arr` and `shape` to
`SegmentationMapsOnImage.deepcopy()`.
- Refactored `SegmentationMapsOnImage.pad()`,
`SegmentationMapsOnImage.pad_to_aspect_ratio()` and
`SegmentationMapsOnImage.resize()` to generate new object instances via
`SegmentationMapsOnImage.deepcopy()`.
- **[rarely breaking]** Renamed `SegmentationMapsOnImage.input_was` to
`SegmentationMapsOnImage._input_was`.
- **[rarely breaking]** Changed `SegmentationMapsOnImage._input_was` to
always save `(input array dtype, input array ndim)` instead of mixtures
of strings/ints that varied by dtype kind.
- **[rarely breaking]** Restrict `shape` argument in
`SegmentationMapsOnImage.__init__` to tuples instead of accepting all
iterables.
- **[breaking]** Removed `SegmentationMapsOnImage.to_heatmaps()` as the
new segmentation map class is too different to sustain the old heatmap
conversion methods.
- **[breaking]** Removed `SegmentationMapsOnImage.from_heatmaps()` as the
new segmentation map class is too different to sustain the old heatmap
conversion methods.
- Changes to class `Augmenter`:
- **[breaking]** Automatic segmentation map normalization from arrays or
lists of arrays now expects a single `(N,H,W,C)` array (before:
`(N,H,W)`) or a list of `(H,W,C)` arrays (before: `(H,W)`).
This affects valid segmentation map inputs for `Augmenter.augment()`
and its alias `Augmenter.__call__()`,
`imgaug.augmentables.batches.UnnormalizedBatch()` and
`imgaug.augmentables.normalization.normalize_segmentation_maps()`.
- Added `Augmenter._augment_segmentation_maps()`.
- Changed `Augmenter.augment_segmentation_maps()` to no longer be a
wrapper around `Augmenter.augment_heatmaps()` and instead call
`Augmenter._augment_segmentation_maps()`.
- Added special segmentation map handling to all augmenters that modified
segmentation maps
(`Sequential`, `SomeOf`, `Sometimes`, `WithChannels`,
`Lambda`, `AssertLambda`, `AssertShape`,
`Alpha`, `AlphaElementwise`, `WithColorspace`, `Fliplr`, `Flipud`, `Affine`,
`AffineCv2`, `PiecewiseAffine`, `PerspectiveTransform`, `ElasticTransformation`,
`Rot90`, `Resize`, `CropAndPad`, `PadToFixedSize`, `CropToFixedSize`,
`KeepSizeByResize`).
- **[rarely breaking]** This changes the order of arguments in
`Lambda.__init__()`, `AssertLambda.__init__()`, `AssertShape.__init__()`
and hence breaks if one relied on that order.
## New RNG handling #375
* Adapted library to automatically use the new `numpy.random` classes of
numpy 1.17 -- if they are available. If they are not available (i.e. numpy
version is <=1.16), the library automatically falls back to the old
interface (i.e. `numpy.random.RandomState`).
* Added module `imgaug.random`.
* Added class `imgaug.random.RNG`. This is now the preferred way to represent
RNG states (previously: `numpy.random.RandomState`). Instantiate it
via e.g. `RNG(1052912236)`, where `1052912236` is a seed.
* Added `imgaug.random.supports_new_rng_style()`.
* Added `imgaug.random.get_global_rng()`.
* Added `imgaug.random.seed()`.
* Added `imgaug.random.normalize_generator()`.
* Added `imgaug.random.normalize_generator_()`.
* Added `imgaug.random.convert_seed_to_generator()`.
* Added `imgaug.random.convert_seed_sequence_to_generator()`.
* Added `imgaug.random.create_pseudo_random_generator_()`.
* Added `imgaug.random.create_fully_random_generator()`.
* Added `imgaug.random.generate_seed_()`.
* Added `imgaug.random.generate_seeds_()`.
* Added `imgaug.random.copy_generator()`.
* Added `imgaug.random.copy_generator_unless_global_generator()`.
* Added `imgaug.random.reset_generator_cache_()`.
* Added `imgaug.random.derive_generator_()`.
* Added `imgaug.random.derive_generators_()`.
* Added `imgaug.random.get_generator_state()`.
* Added `imgaug.random.set_generator_state_()`.
* Added `imgaug.random.is_generator_equal_to()`.
* Added `imgaug.random.advance_generator_()`.
* Added `imgaug.random.polyfill_integers()`.
* Added `imgaug.random.polyfill_random()`.
* Refactored all arguments related to random state handling to also accept
`imgaug.random.RNG`, as well as the new numpy random classes. This
particularly affects `imgaug.augmenters.meta.Augmenter` and
`imgaug.parameters.StochasticParameter` (argument `random_state` for both).
* Marked old RNG related functions in `imgaug.imgaug` as deprecated.
They will now produce warnings and redirect towards corresponding functions
in `imgaug.random`. This does not yet affect `imgaug.imgaug.seed()`.
It does affect the functions listed below.
* `imgaug.imgaug.normalize_random_state()`.
* `imgaug.imgaug.current_random_state()`.
* `imgaug.imgaug.new_random_state()`.
* `imgaug.imgaug.dummy_random_state()`.
* `imgaug.imgaug.copy_random_state()`.
* `imgaug.imgaug.derive_random_state()`.
* `imgaug.imgaug.derive_random_states()`.
* `imgaug.imgaug.forward_random_state()`.
* [rarely breaking] Removed `imgaug.imgaug.CURRENT_RANDOM_STATE`.
Use `imgaug.random.get_global_rng()` instead.
* [rarely breaking] Removed `imgaug.imgaug.SEED_MIN_VALUE`.
Use `imgaug.random.SEED_MIN_VALUE` instead or sample seeds via
`imgaug.random.generate_seeds_()`.
* [rarely breaking] Removed `imgaug.imgaug.SEED_MAX_VALUE`.
Use `imgaug.random.SEED_MAX_VALUE` instead or sample seeds via
`imgaug.random.generate_seeds_()`.
* Optimized RNG handling throughout all augmenters to minimize the number of
RNG copies. RNGs are now re-used as often as possible. This improves
performance, but has the disadvantage that adding images to a batch will now
often affect the samples of the other images in the same batch. E.g.
previously for a batch of images `A,B,C` and seed `1`, the samples of `A,B,C`
would remain unchanged if the batch was changed to `A,B,C,D` (provided the
seed stayed the same). Now, if `D` is added the samples of `A,B,C` may
change.
* [breaking] The above listed changes will lead to different values being
sampled for the same seeds (compared to past versions of the library).
* [breaking] The seed for `imgaug`'s global random number generator is now
sampled from numpy's default random number generator. That means, that every
run of a program using `imgaug` will by default use a different seed and
hence result in different samples. Previously, a fixed seed was used,
resulting in the same samples for each run (unless the seed was manually
changed to a fixed one). It also means that seeding numpy will automatically
also seed imgaug (not guarantueed that this behaviour will be kept in
future releases). The change from fixed to random seed was done, because the
old (fixed) behaviour didn't match the common practice (and especially not
numpy's standard behaviour) and hence led to confusion. #408
## Fixes
* Fixed an issue with `Polygon.clip_out_of_image()`,
which would lead to exceptions if a polygon had overlap with an image,
but not a single one of its points was inside that image plane.
* Fixed `multicore` methods falsely not accepting
`augmentables.batches.UnnormalizedBatch`.
* `Rot90` now uses subpixel-based coordinate remapping.
I.e. any coordinate `(x, y)` will be mapped to `(H-y, x)` for a rotation by
90deg.
Previously, an integer-based remapping to `(H-y-1, x)` was used.
Coordinates are e.g. used by keypoints, bounding boxes or polygons.
* `augmenters.arithmetic.Invert`
* [rarely breaking] If `min_value` and/or `max_value` arguments were
set, `uint64` is no longer a valid input array dtype for `Invert`.
This is due to a conversion to `float64` resulting in loss of resolution.
* Fixed `Invert` in rare cases restoring dtypes improperly.
* Fixed `dtypes.gate_dtypes()` crashing if the input was one or more numpy
scalars instead of numpy arrays or dtypes.
* Fixed `augmenters.geometric.PerspectiveTransform` producing invalid
polygons (more often with higher `scale` values). #338
* Fixed errors caused by `external/poly_point_isect_py2py3.py` related to
floating point inaccuracies (changed an epsilon from `1e-10` to `1e-4`,
rounded some floats). #338
* Fixed `Superpixels` breaking when a sampled `n_segments` was `<=0`.
`n_segments` is now treated as `1` in these cases.
* Fixed `ReplaceElementwise` both allowing and disallowing dtype `int64`. #346
* Fixed `BoundingBox.deepcopy()` creating only shallow copies of labels. #356
* Fixed `dtypes.change_dtypes_()` #366
* Fixed argument `round` being ignored if input images were a list.
* Fixed failure if input images were a list and dtypes a single numpy
dtype function.
* Fixed `dtypes.get_minimal_dtype()` failing if argument `arrays` contained
not *exactly* two items. #366
* Fixed calls of `CloudLayer.get_parameters()` resulting in errors. #309
* Fixed `SimplexNoiseAlpha` and `FrequencyNoiseAlpha` not handling
`sigmoid` argument correctly. #343
* Fixed `SnowflakesLayer` crashing for grayscale images. #345
* Fixed `Affine` heatmap augmentation crashing for arrays with more than
four channels and `order!=0`. #381
* Fixed an outdated error message in `Affine`. #381
* Fixed `Polygon.clip_out_of_image()` crashing if the intersection between
polygon and image plane was an edge or point. #382
* Fixed `Polygon.clip_out_of_image()` potentially failing for polygons
containing two or fewer points. #382
* Fixed `Polygon.is_out_of_image()` returning wrong values if the image plane
was fully contained inside the polygon with no intersection between the
image plane and the polygon edge. #382
* Fixed `Fliplr` and `Flipud` using for coordinate-based inputs and image-like
inputs slightly different conditions for when to actually apply
augmentations. #385
* Fixed `Convolve` using an overly restrictive check when validating inputs
for `matrix` w.r.t. whether they are callables. The check should now also
support class methods (and possibly various other callables). #407
* Fixed `CropAndPad`, `Pad` and `PadToFixedSize` still clipping `cval` samples
to the `uint8`. They now clip to the input array's dtype's value range. #407
* Fixed `WithColorspace` not propagating polygons to child augmenters. #409
* Fixed `WithHueAndSaturation` not propagating segmentation maps and polygons
to child augmenters. #409
* Fixed `AlphaElementwise` to blend coordinates (for keypoints, polygons,
line strings) on a point-by-point basis following the image's average
alpha value in the sampled alpha mask of the point's coordinate.
Previously, the average over the whole mask was used and then either all
points of the first branch or all of the second branch were used as the
augmentation output. This also affects `SimplexNoiseAlpha` and
`FrequencyNoiseAlpha`. #410
* Fixed many augmenters and helper functions producing errors if the height,
width and/or channels of input arrays were exactly `0` or the channels
were `>512`. #433
* Fixed `Rot90` not supporting `imgaug.ALL`. #434
* Fixed `PiecewiseAffine` possibly generating samples for non-image data
when using `absolute_scale=True` that were not well aligned with the
corresponding images. #437
@@ -0,0 +1,125 @@
# Reworked Augmentation Methods #451 #566
* Added method `to_normalized_batch()` to `imgaug.augmentables.batches.Batch`
to have the same interface in `Batch` and `UnnormalizedBatch`.
* Added method `get_augmentable()` to
`imgaug.augmentables.batches.Batch` and
`imgaug.augmentables.batches.UnnormalizedBatch`.
* Added method `get_augmentable_names()` to
`imgaug.augmentables.batches.Batch` and
`imgaug.augmentables.batches.UnnormalizedBatch`.
* Added method `to_batch_in_augmentation()` to
`imgaug.augmentables.batches.Batch`.
* Added method `fill_from_batch_in_augmentation_()` to
`imgaug.augmentables.batches.Batch`.
* Added method `fill_from_augmented_normalized_batch_()` to
`imgaug.augmentables.batches.UnnormalizedBatch`.
* Added class `imgaug.augmentables.batches._BatchInAugmentation`.
* Added method `_augment_batch_()` in `imgaug.augmenters.meta.Augmenter`.
This method is now called from `augment_batch_()`.
* Changed `augment_images()` in `imgaug.augmenters.meta.Augmenter` to be
a thin wrapper around `augment_batch_()`.
* Changed `augment_heatmaps()` in `imgaug.augmenters.meta.Augmenter` to be
a thin wrapper around `augment_batch_()`.
* Changed `augment_segmentation_maps()` in `imgaug.augmenters.meta.Augmenter`
to be a thin wrapper around `augment_batch_()`.
* Changed `augment_keypoints()` in `imgaug.augmenters.meta.Augmenter` to be
a thin wrapper around `augment_batch_()`.
* Changed `augment_bounding_boxes()` in `imgaug.augmenters.meta.Augmenter` to be
a thin wrapper around `augment_batch_()`.
* Changed `augment_polygons()` in `imgaug.augmenters.meta.Augmenter` to be
a thin wrapper around `augment_batch_()`.
* Changed `augment_line_strings()` in `imgaug.augmenters.meta.Augmenter` to be
a thin wrapper around `augment_batch_()`.
* Changed `augment_image()`, `augment_images()`, `augment_heatmaps()`,
`augment_segmentation_maps()`, `augment_keypoints()`,
`augment_bounding_boxes()`, `augment_polygons()` and `augment_line_strings()`
to return `None` inputs without change. Previously they resulted in an
exception. This is more consistent with the behaviour in the other
`augment_*` methods.
* Added method `imgaug.augmenters.meta.Augmenter.augment_batch_()`,
similar to `augment_batch()`, but explicitly works in-place and has a
`parent` parameter.
* Deprecated `imgaug.augmenters.meta.Augmenter.augment_batch()`.
Use `.augment_batch_()` instead.
* Changed `augment_images()` to no longer be abstract. It defaults
to not changing the input images.
* Refactored `Sequential` to use single `_augment_batch_()` method.
* Refactored `SomeOf` to use single `_augment_batch_()` method.
* Refactored `Sometimes` to use single `_augment_batch_()` method.
* Refactored `AveragePooling`, `MaxPooling`, `MinPooling`, `MedianPooling`
to use single `_augment_batch_()` method.
* Refactored `ElasticTransformation` to use single `_augment_batch_()` method.
* Refactored `Alpha` to use single `_augment_batch_()` method.
* Refactored `AlphaElementwise` to use single `_augment_batch_()` method.
* Refactored `WithColorspace` to use single `_augment_batch_()` method.
* Refactored `WithHueAndSaturation` to use single `_augment_batch_()` method.
* Refactored `Fliplr` to use single `_augment_batch_()` method.
* Refactored `Flipud` to use single `_augment_batch_()` method.
* Refactored `Affine` to use single `_augment_batch_()` method.
* Refactored `Rot90` to use single `_augment_batch_()` method.
* Refactored `Resize` to use single `_augment_batch_()` method.
* Refactored `CropAndPad` to use single `_augment_batch_()` method.
* Refactored `PadToFixedSize` to use single `_augment_batch_()` method.
* Refactored `CropToFixedSize` to use single `_augment_batch_()` method.
* Refactored `KeepSizeByResize` to use single `_augment_batch_()` method.
* Refactored `PiecewiseAffine` to use single `_augment_batch_()` method.
* Refactored `PerspectiveTransform` to use single `_augment_batch_()` method.
* Refactored `WithChannels` to use single `_augment_batch_()` method.
* Refactored `Add` to use single `_augment_batch_()` method.
* Refactored `AddElementwise` to use single `_augment_batch_()` method.
* Refactored `Multiply` to use single `_augment_batch_()` method.
* Refactored `MultiplyElementwise` to use single `_augment_batch_()` method.
* Refactored `ReplaceElementwise` to use single `_augment_batch_()` method.
* Refactored `Invert` to use single `_augment_batch_()` method.
* Refactored `JpegCompression` to use single `_augment_batch_()` method.
* Refactored `GaussianBlur` to use single `_augment_batch_()` method.
* Refactored `AverageBlur` to use single `_augment_batch_()` method.
* Refactored `MedianBlur` to use single `_augment_batch_()` method.
* Refactored `BilateralBlur` to use single `_augment_batch_()` method.
* Refactored `AddToHueAndSaturation` to use single `_augment_batch_()` method.
* Refactored `ChangeColorspace` to use single `_augment_batch_()` method.
* Refactored `_AbstractColorQuantization` to use single `_augment_batch_()`
method.
* Refactored `_ContrastFuncWrapper` to use single `_augment_batch_()` method.
* Refactored `AllChannelsCLAHE` to use single `_augment_batch_()` method.
* Refactored `CLAHE` to use single `_augment_batch_()` method.
* Refactored `AllChannelsHistogramEqualization` to use single
`_augment_batch_()` method.
* Refactored `HistogramEqualization` to use single `_augment_batch_()` method.
* Refactored `Convolve` to use single `_augment_batch_()` method.
* Refactored `Canny` to use single `_augment_batch_()` method.
* Refactored `ChannelShuffle` to use single `_augment_batch_()` method.
* Refactored `Superpixels` to use single `_augment_batch_()` method.
* Refactored `Voronoi` to use single `_augment_batch_()` method.
* Refactored `FastSnowyLandscape` to use single `_augment_batch_()` method.
* Refactored `CloudLayer` to use single `_augment_batch_()` method.
* Refactored `SnowflakesLayer` to use single `_augment_batch_()` method.
* Added validation of input arguments to `KeypointsOnImage.from_xy_array()`.
* Improved validation of input arguments to
`BoundingBoxesOnImage.from_xyxy_array()`.
* Added method `BoundingBoxesOnImage.to_keypoints_on_image()`.
* Added method `PolygonsOnImage.to_keypoints_on_image()`.
* Added method `LineStringsOnImage.to_keypoints_on_image()`.
* Added method `KeypointsOnImage.to_keypoints_on_image()`.
* Added method `BoundingBoxesOnImage.invert_to_keypoints_on_image_()`.
* Added method `PolygonsOnImage.invert_to_keypoints_on_image_()`.
* Added method `LineStringsOnImage.invert_to_keypoints_on_image_()`.
* Added method `KeypointsOnImage.invert_to_keypoints_on_image_()`.
* Added method `imgaug.augmentables.polys.recover_psois_()`.
* Added method `imgaug.augmentables.utils.convert_cbaois_to_kpsois()`.
* Added method `imgaug.augmentables.utils.invert_convert_cbaois_to_kpsois_()`.
* Added method `imgaug.augmentables.utils.deepcopy_fast()`.
* Added method `imgaug.augmentables.kps.BoundingBoxesOnImage.to_xy_array()`.
* Added method `imgaug.augmentables.kps.PolygonsOnImage.to_xy_array()`.
* Added method `imgaug.augmentables.kps.LineStringsOnImage.to_xy_array()`.
* Added method `imgaug.augmentables.kps.KeypointsOnImage.fill_from_xy_array_()`.
* Added method `imgaug.augmentables.kps.BoundingBoxesOnImage.fill_from_xy_array_()`.
* Added method `imgaug.augmentables.kps.PolygonsOnImage.fill_from_xy_array_()`.
* Added method `imgaug.augmentables.kps.LineStringsOnImage.fill_from_xy_array_()`.
* Added method `imgaug.augmentables.bbs.BoundingBoxesOnImage.fill_from_xyxy_array_()`.
* Added method `imgaug.augmentables.bbs.BoundingBox.from_point_soup()`.
* Added method `imgaug.augmentables.bbs.BoundingBoxesOnImages.from_point_soups()`.
* Changed `imgaug.augmentables.BoundingBoxesOnImage.from_xyxy_array()` to also
accept `(N, 2, 2)` arrays instead of only `(N, 4)`.
* Added context `imgaug.testutils.TemporaryDirectory`.
@@ -0,0 +1,11 @@
# Pooling Augmenters now affects Maps #457
Pooling augmenters were previously implemented so that they did not pool
the arrays of maps (i.e. heatmap arrays, segmentation map arrays). Only
the image shape saved within `HeatmapsOnImage.shape` and
`SegmentationMapsOnImage.shape` were updated. That was done because the library
can handle map arrays that are larger than the corresponding images and hence
no pooling was necessary for the augmentation to work correctly. This was now
changed and pooling augmenters will also pool map arrays
(if `keep_size=False`). The motiviation for this change is that the old
behaviour was unintuitive and inconsistent with other augmenters (e.g. `Crop`).
@@ -0,0 +1,25 @@
# Reworked Quantization #467
* Renamed `imgaug.augmenters.color.quantize_colors_uniform(image, n_colors)`
to `imgaug.augmenters.color.quantize_uniform(arr, nb_bins)`. The old name
is now deprecated.
* Renamed `imgaug.augmenters.color.quantize_colors_kmeans(image, n_colors)`
to `imgaug.augmenters.color.quantize_kmeans(arr, nb_clusters)`. The old name
is now deprecated.
* Improved performance of `quantize_uniform()` by roughly 10x (small images
around 64x64) to 100x (large images around 1024x1024). This also affects
`UniformColorQuantization`.
* Improved performance of `UniformColorQuantization` by using more in-place
functions.
* Added argument `to_bin_centers=True` to `quantize_uniform()`, controling
whether each bin `(a, b)` should be quantized to `a + (b-a)/2` or `a`.
* Added function `imgaug.augmenters.color.quantize_uniform_()`, the in-place
version of `quantize_uniform()`.
* Added function `imgaug.augmenters.color.quantize_uniform_to_n_bits()`.
* Added function `imgaug.augmenters.color.quantize_uniform_to_n_bits_()`.
* Added function `imgaug.augmenters.color.posterize()`, an alias of
`quantize_uniform_to_n_bits()` that produces the same outputs as
`PIL.ImageOps.posterize()`.
* Added augmenter `UniformColorQuantizationToNBits`.
* Added augmenter `Posterize` (alias of `UniformColorQuantizationToNBits`).
* Fixed `quantize_uniform()` producing wrong outputs for non-contiguous arrays.
@@ -0,0 +1,15 @@
# Improve Invert #469
* Improved performance of `imgaug.augmenters.arithmetic.invert()` and
`imgaug.augmenters.arithmetic.Invert` for `uint8` images.
* Added function `imgaug.augmenters.arithmetic.invert_()`, an in-place version
of `imgaug.augmenters.arithmetic.invert()`.
* Added parameters `threshold` and `invert_above_threshold` to
`imgaug.augmenters.arithmetic.invert()`
* Added parameters `threshold` and `invert_above_threshold` to
`imgaug.augmenters.arithmetic.Invert`.
* Added function `imgaug.augmenters.arithmetic.solarize()`, a wrapper around
`solarize_()`.
* Added function `imgaug.augmenters.arithmetic.solarize_()`, a wrapper around
`invert_()`.
* Added augmenter `imgaug.augmenters.Solarize`, a wrapper around `Invert`.
+10
View File
@@ -0,0 +1,10 @@
# All Augmenters Pickle-able #493 #575
Ensured that all augmenters can be pickled.
* Added function `imgaug.testutils.runtest_pickleable_uint8_img()`.
* Fixed `imgaug.augmenters.blur.MotionBlur` not being pickle-able.
* Fixed `imgaug.augmenters.meta.AssertLambda` not being pickle-able.
* Fixed `imgaug.augmenters.meta.AssertShape` not being pickle-able.
* Fixed `imgaug.augmenters.color.MultiplyHueAndSaturation` not supporting
all standard RNG datatypes for `random_state`.
@@ -0,0 +1,21 @@
# Simplified Access to Coordinates and Items in Augmentables #495 #541
* Added module `imgaug.augmentables.base`.
* Added interface `imgaug.augmentables.base.IAugmentable`, implemented by
`HeatmapsOnImage`, `SegmentationMapsOnImage`, `KeypointsOnImage`,
`BoundingBoxesOnImage`, `PolygonsOnImage` and `LineStringsOnImage`.
* Added ability to iterate over coordinate-based `*OnImage` instances
(keypoints, bounding boxes, polygons, line strings), e.g.
`bbsoi = BoundingBoxesOnImage(bbs, shape=...); for bb in bbsoi: ...`.
would iterate now over `bbs`.
* Added implementations of `__len__` methods to coordinate-based `*OnImage`
instances, e.g.
`bbsoi = BoundingBoxesOnImage(bbs, shape=...); print(len(bbsoi))`
would now print the number of bounding boxes in `bbsoi`.
* Added ability to iterate over coordinates of `BoundingBox` (top-left,
bottom-right), `Polygon` and `LineString` via `for xy in obj: ...`.
* Added ability to access coordinates of `BoundingBox`, `Polygon` and
`LineString` using indices or slices, e.g. `line_string[1:]` to get an
array of all coordinates except the first one.
* Added property `Keypoint.xy`.
* Added property `Keypoint.xy_int`.
+81
View File
@@ -0,0 +1,81 @@
# Changes to Crop and Pad augmenters #459
The following functions were moved. Their old names are now deprecated.
* Moved `imgaug.imgaug.pad` to `imgaug.augmenters.size.pad`
* Moved `imgaug.imgaug.pad_to_aspect_ratio` to
`imgaug.augmenters.size.pad_to_aspect_ratio`.
* Moved `imgaug.imgaug.pad_to_multiples_of` to
`imgaug.augmenters.size.pad_to_multiples_of`.
* Moved `imgaug.imgaug.compute_paddings_for_aspect_ratio` to
`imgaug.augmenters.size.compute_paddings_to_reach_aspect_ratio`.
* Moved `imgaug.imgaug.compute_paddings_to_reach_multiples_of`
to `imgaug.augmenters.size.compute_paddings_to_reach_multiples_of`.
The following augmenters were added:
* Added augmenter `CenterCropToFixedSize`.
* Added augmenter `CenterPadToFixedSize`.
* Added augmenter `CropToMultiplesOf`.
* Added augmenter `CenterCropToMultiplesOf`.
* Added augmenter `PadToMultiplesOf`.
* Added augmenter `CenterPadToMultiplesOf`.
* Added augmenter `CropToPowersOf`.
* Added augmenter `CenterCropToPowersOf`.
* Added augmenter `PadToPowersOf`.
* Added augmenter `CenterPadToPowersOf`.
* Added augmenter `CropToAspectRatio`.
* Added augmenter `CenterCropToAspectRatio`.
* Added augmenter `PadToAspectRatio`.
* Added augmenter `CenterPadToAspectRatio`.
* Added augmenter `PadToSquare`.
* Added augmenter `CenterPadToSquare`.
* Added augmenter `CropToSquare`.
* Added augmenter `CenterCropToSquare`.
All `Center<name>` augmenters are wrappers around `<name>` with parameter
`position="center"`.
Added functions:
* Added function
`imgaug.augmenters.size.compute_croppings_to_reach_aspect_ratio()`.
* Added function
`imgaug.augmenters.size.compute_croppings_to_reach_multiples_of()`.
* Added function
`imgaug.augmenters.size.compute_croppings_to_reach_powers_of()`.
* Added function
`imgaug.augmenters.size.compute_paddings_to_reach_powers_of()`.
Other changes:
* Extended augmenter `CropToFixedSize` to support `height` and/or `width`
parameters to be `None`, in which case the respective axis is not changed.
* Extended augmenter `PadToFixedSize` to support `height` and/or `width`
parameters to be `None`, in which case the respective axis is not changed.
* [rarely breaking] Changed `CropToFixedSize.get_parameters()` to also
return the `height` and `width` values.
* [rarely breaking] Changed `PadToFixedSize.get_parameters()` to also
return the `height` and `width` values.
* [rarely breaking] Changed the order of parameters returned by
`PadToFixedSize.get_parameters()` to match the order in
`PadToFixedSize.__init__()`
* Changed `PadToFixedSize` to prefer padding the right side over the left side
and the bottom side over the top side. E.g. if using a center pad and
`3` columns have to be padded, it will pad `1` on the left and `2` on the
right. Previously it was the other way round. This was changed to establish
more consistency with the various other pad and crop methods.
* Changed the projection of pad/crop values between images and non-images
to make the behaviour slightly more accurate in fringe cases.
* Improved behaviour of function
`imgaug.augmenters.size.compute_paddings_for_aspect_ratio()` for zero-sized
axes.
* Changed function `imgaug.augmenters.size.compute_paddings_for_aspect_ratio()`
to also support shape tuples instead of only ndarrays.
* Changed function
`imgaug.augmenters.size.compute_paddings_to_reach_multiples_of()`
to also support shape tuples instead of only ndarrays.
Fixes:
* Fixed a formatting error in an error message of
`compute_paddings_to_reach_multiples_of()`.
@@ -0,0 +1,7 @@
# Changes to PerspectiveTransform #452 #456
* [rarely breaking] PerspectiveTransform has now a `fit_output` parameter,
similar to `Affine`. This change may break code that relied on the order of
arguments to `__init__`.
* The sampling code of `PerspectiveTransform` was reworked and should now
be faster.
@@ -0,0 +1,96 @@
# More Choices for Image Blending #462 #556
The available augmenters for alpha-blending of images were
significantly extended. There are now new blending
augmenters available to alpha-blend acoording to:
* Some randomly chosen colors. (`BlendAlphaSomeColors`)
* Linear gradients. (`BlendAlphaHorizontalLinearGradient`,
`BlendAlphaVerticalLinearGradient`)
* Regular grids and checkerboard patterns. (`BlendAlphaRegularGrid`,
`BlendAlphaCheckerboard`)
* Only at locations that overlap with specific segmentation class
IDs (or the inverse of that). (`BlendAlphaSegMapClassIds`)
* Only within bounding boxes with specific labels (or the inverse
of that). (`BlendAlphaBoundingBoxes`)
This allows to e.g. randomly remove some colors while leaving
other colors unchanged (`BlendAlphaSomeColors(Grayscale(1.0))`),
to change the color of some objects
(`BlendAlphaSegMapClassIds(AddToHue((-256, 256)))`), to add
cloud-patterns only to the top of images
(`BlendAlphaVerticalLinearGradient(Clouds())`) or to apply
augmenters in some coarse rectangular areas (e.g.
`BlendAlphaRegularGrid(Multiply(0.0))` to achieve a similar
effect to `CoarseDropout` or
`BlendAlphaRegularGrid(AveragePooling(8))` to pool in equally
coarse image sub-regions).
Other mask-based alpha blending techniques can be achieved by
subclassing `IBatchwiseMaskGenerator` and providing an
instance of such a class to `BlendAlphaMask`.
This patch also changes the naming of the blending augmenters
as follows:
* `Alpha` -> `BlendAlpha`
* `AlphaElementwise` -> `BlendAlphaElementwise`
* `SimplexNoiseAlpha` -> `BlendAlphaSimplexNoise`
* `FrequencyNoiseAlpha` -> `BlendAlphaFrequencyNoise`
The old names are now deprecated.
Furthermore, the parameters `first` and `second`, which were
used by all blending augmenters, have now the names `foreground`
and `background`.
List of changes:
* Added `imgaug.augmenters.blend.BlendAlphaMask`, which uses
a mask generator instance to generate per batch alpha masks and
then alpha-blends using these masks.
* Added `imgaug.augmenters.blend.BlendAlphaSomeColors`.
* Added `imgaug.augmenters.blend.BlendAlphaHorizontalLinearGradient`.
* Added `imgaug.augmenters.blend.BlendAlphaVerticalLinearGradient`.
* Added `imgaug.augmenters.blend.BlendAlphaRegularGrid`.
* Added `imgaug.augmenters.blend.BlendAlphaCheckerboard`.
* Added `imgaug.augmenters.blend.BlendAlphaSegMapClassIds`.
* Added `imgaug.augmenters.blend.BlendAlphaBoundingBoxes`.
* Added `imgaug.augmenters.blend.IBatchwiseMaskGenerator`,
an interface for classes generating masks on a batch-by-batch
basis.
* Added `imgaug.augmenters.blend.StochasticParameterMaskGen`,
a helper to generate masks from `StochasticParameter` instances.
* Added `imgaug.augmenters.blend.SomeColorsMaskGen`, a generator
that produces masks marking randomly chosen colors in images.
* Added `imgaug.augmenters.blend.HorizontalLinearGradientMaskGen`,
a linear gradient mask generator.
* Added `imgaug.augmenters.blend.VerticalLinearGradientMaskGen`,
a linear gradient mask generator.
* Added `imgaug.augmenters.blend.RegularGridMaskGen`,
a checkerboard-like mask generator where every grid cell has
a random alpha value.
* Added `imgaug.augmenters.blend.CheckerboardMaskGen`,
a checkerboard-like mask generator where every grid cell has
the opposite alpha value of its 4-neighbours.
* Added `imgaug.augmenters.blend.SegMapClassIdsMaskGen`, a
segmentation map-based mask generator.
* Added `imgaug.augmenters.blend.BoundingBoxesMaskGen`, a bounding
box-based mask generator.
* Added `imgaug.augmenters.blend.InvertMaskGen`, an mask generator
that inverts masks produces by child generators.
* Changed `imgaug.parameters.SimplexNoise` and
`imgaug.parameters.FrequencyNoise` to also accept `(H, W, C)`
sampling shapes, instead of only `(H, W)`.
* Refactored `AlphaElementwise` to be a wrapper around
`BlendAlphaMask`.
* Renamed `Alpha` to `BlendAlpha`.
`Alpha` is now deprecated.
* Renamed `AlphaElementwise` to `BlendAlphaElementwise`.
`AlphaElementwise` is now deprecated.
* Renamed `SimplexNoiseAlpha` to `BlendAlphaSimplexNoise`.
`SimplexNoiseAlpha` is now deprecated.
* Renamed `FrequencyNoiseAlpha` to `BlendAlphaFrequencyNoise`.
`FrequencyNoiseAlpha` is now deprecated.
* Renamed arguments `first` and `second` to `foreground` and `background`
in `BlendAlpha`, `BlendAlphaElementwise`, `BlendAlphaSimplexNoise` and
`BlendAlphaFrequencyNoise`.
* Changed `imgaug.parameters.handle_categorical_string_param()` to allow
parameter `valid_values` to be `None`.
* Fixed a wrong error message in
`imgaug.augmenters.color.change_colorspace_()`.
+7
View File
@@ -0,0 +1,7 @@
# Support for Python 3.8 #600
The library is now tested in python 3.8 and compatible with that
version. The latest version of `Shapely` is required for that,
which can right now be installed via `pip install --pre Shapely`.
(Skipping the `--pre` currently leads to an older shapely version,
which causes an error during installation in python 3.8.)
@@ -0,0 +1,35 @@
# Unwrapped Bounding Box Augmentation #446 #599
* Added property `coords` to `BoundingBox`. The property returns an `(N,2)`
numpy array containing the coordinates of the top-left and bottom-right
bounding box corners.
* Added method `BoundingBox.coords_almost_equals(other)`.
* Added method `BoundingBox.almost_equals(other)`.
* Changed method `Polygon.almost_equals(other)` to no longer verify the
datatype. It is assumed now that the input is a Polygon.
* Added property `items` to `KeypointsOnImage`, `BoundingBoxesOnImage`,
`PolygonsOnImage`, `LineStringsOnImage`. The property returns the
keypoints/BBs/polygons/LineStrings contained by that instance.
* Added method `Polygon.coords_almost_equals(other)`. Alias for
`Polygon.exterior_almost_equals(other)`.
* Added property `Polygon.coords`. Alias for `Polygon.exterior`.
* Added property `Keypoint.coords`.
* Added method `Keypoint.coords_almost_equals(other)`.
* Added method `Keypoint.almost_equals(other)`.
* Added method `imgaug.testutils.assert_cbaois_equal()`.
* Added internal `_augment_bounding_boxes()` methods to various augmenters.
This allows to individually control how bounding boxes are supposed to
be augmented. Previously, the bounding box augmentation was a wrapper around
keypoint augmentation that did not allow such control.
* [breaking] Added parameter `parents` to `Augmenter.augment_bounding_boxes()`.
This breaks if `hooks` was used as a *positional* argument in connection with
that method.
* [rarely breaking] Added parameter `func_bounding_boxes` to `Lambda`.
This breaks if one relied on the order of the augmenter's parameters instead
of their names.
* [rarely breaking] Added parameter `func_bounding_boxes` to `AssertLambda`.
This breaks if one relied on the order of the augmenter's parameters instead
of their names.
* [rarely breaking] Added parameter `check_bounding_boxes` to `AssertShape`.
This breaks if one relied on the order of the augmenter's parameters instead
of their names.
@@ -0,0 +1,15 @@
# Unwrapped Line String Augmentation #450
* Added internal `_augment_line_strings()` methods to various augmenters.
This allows to individually control how line strings are supposed to
be augmented. Previously, the line string augmentation was a wrapper around
keypoint augmentation that did not allow such control.
* [rarely breaking] Added parameter `func_line_strings` to `Lambda`.
This breaks if one relied on the order of the augmenter's parameters instead
of their names.
* [rarely breaking] Added parameter `func_line_strings` to `AssertLambda`.
This breaks if one relied on the order of the augmenter's parameters instead
of their names.
* [rarely breaking] Added parameter `check_line_strings` to `AssertShape`.
This breaks if one relied on the order of the augmenter's parameters instead
of their names.
@@ -0,0 +1,5 @@
# New Augmenter ChangeColorTemperature #454
* Added augmenter `imgaug.augmenters.color.ChangeColorTemperature`.
* Added function `imgaug.augmenters.color.change_color_temperatures_()`.
* Added function `imgaug.augmenters.color.change_color_temperature_()`.
@@ -0,0 +1,9 @@
# New brightness augmenters #455
* Added augmenter `imgaug.augmenters.color.WithBrightnessChannels`.
* Added augmenter `imgaug.augmenters.color.MultiplyAndAddToBrightness`.
* Added augmenter `imgaug.augmenters.color.MultiplyBrightness`.
* Added augmenter `imgaug.augmenters.color.AddToBrightness`.
* Added method `imgaug.parameters.handle_categorical_string_param()`.
* Changed `change_colorspaces_()` to accept any iterable of `str` for
argument `to_colorspaces`, not just `list`.
@@ -0,0 +1,9 @@
# New Dropout Augmenters #458
* Added a new augmenter `Dropout2d`, which drops channels in images with
a defineable probability `p`. Dropped channels will be filled with zeros.
By default, the augmenter keeps at least one channel in each image
unaltered (i.e. not dropped).
* Added new augmenter `TotalDropout`, which sets all components to zero
for `p` percent of all images. The augmenter should be used in connection
with e.g. blend augmenters.
@@ -0,0 +1,4 @@
# Added `RemoveSaturation` #462
* Added `RemoveSaturation`, a shortcut for `MultiplySaturation((0.0, 1.0))`
with outputs similar to `Grayscale((0.0, 1.0))`.
@@ -0,0 +1,5 @@
# New Augmenter `Cartoon` #463
* Added module `imgaug.augmenters.artistic`.
* Added function `imgaug.augmenters.artistic.stylize_cartoon(image)`.
* Added augmenter `imgaug.augmenters.artistic.Cartoon`.
@@ -0,0 +1,4 @@
# Added Augmenter `MeanShiftBlur` #466
* Added function `imgaug.augmenters.blur.blur_mean_shift_(image)`.
* Added augmenter `imgaug.augmenters.blur.MeanShiftBlur`.
@@ -0,0 +1,5 @@
# Jigsaw Augmenter #476 #577
* Added function `imgaug.augmenters.geometric.apply_jigsaw()`.
* Added function `imgaug.augmenters.geometric.apply_jigsaw_to_coords()`.
* Added function `imgaug.augmenters.geometric.generate_jigsaw_destinations()`.
@@ -0,0 +1,5 @@
# Added DeterministicList #475
* Added `imgaug.parameters.DeterministicList`. Upon a request to generate
samples of shape `S`, this parameter will create a new array of shape `S`
and fill it by cycling over its list of values repeatedly.
@@ -0,0 +1,5 @@
# Autocontrast #479
* Added `imgaug.augmenters.pillike.autocontrast()`, a function with identical
inputs and outputs to `PIL.ImageOps.autocontrast`.
* Added `imgaug.augmenters.pillike.Autocontrast`.
@@ -0,0 +1,11 @@
# Affine Shear on the Y-Axis #482
* [rarely breaking] Extended `Affine` to also support shearing on the
y-axis (previously, only x-axis was possible). This feature can be used
via e.g. ``Affine(shear={"x": (-30, 30), "y": (-10, 10)})``. If instead
a single number is used (e.g. ``Affine(shear=15)``), shearing will be done
only on the x-axis. If a single ``tuple``, ``list`` or
``StochasticParameter`` is used, the generated samples will be used
identically for both the x-axis and y-axis (this is consistent with
translation and scaling). To get independent random samples per axis use
the dictionary form.
@@ -0,0 +1,6 @@
# Equalize #480
* Added `imgaug.augmenters.pillike.equalize`, similar to
`PIL.ImageOps.equalize`.
* Added `imgaug.augmenters.pillike.equalize_`.
* Added `imgaug.augmenters.pillike.Equalize`.
@@ -0,0 +1,9 @@
# Added Identity #481
* [rarely breaking] Added `imgaug.augmenters.meta.Identity`, an alias of
`Noop`. `Identity` is now the recommended augmenter for identity
transformations. This change can break code that explicitly relied on
exactly `Noop` being used, e.g. via `isinstance` checks.
* Renamed parameter `noop_if_topmost` to `identity_if_topmost` in
method `imgaug.augmenters.meta.Augmenter.remove_augmenters()`. The old name
is now deprecated.
@@ -0,0 +1,9 @@
# Added Wrappers around `Affine` #484
* Added `imgaug.augmenters.geometric.ScaleX`.
* Added `imgaug.augmenters.geometric.ScaleY`.
* Added `imgaug.augmenters.geometric.TranslateX`.
* Added `imgaug.augmenters.geometric.TranslateY`.
* Added `imgaug.augmenters.geometric.Rotate`.
* Added `imgaug.augmenters.geometric.ShearX`.
* Added `imgaug.augmenters.geometric.ShearY`.
@@ -0,0 +1,28 @@
# Removal of Coordinate-Based Augmentables Outside of the Image Plane #487
* Added `Keypoint.is_out_of_image()`.
* Added `BoundingBox.compute_out_of_image_area()`.
* Added `Polygon.compute_out_of_image_area()`.
* Added `Keypoint.compute_out_of_image_fraction()`
* Added `BoundingBox.compute_out_of_image_fraction()`.
* Added `Polygon.compute_out_of_image_fraction()`.
* Added `LineString.compute_out_of_image_fraction()`.
* Added `KeypointsOnImage.remove_out_of_image_fraction()`.
* Added `BoundingBoxesOnImage.remove_out_of_image_fraction()`.
* Added `PolygonsOnImage.remove_out_of_image_fraction()`.
* Added `LineStringsOnImage.remove_out_of_image_fraction()`.
* Added `KeypointsOnImage.clip_out_of_image()`.
* Added `imgaug.augmenters.meta.RemoveCBAsByOutOfImageFraction`.
Removes coordinate-based augmentables (e.g. BBs) that have at least a
specified fraction of their area outside of the image plane.
* Added `imgaug.augmenters.meta.ClipCBAsToImagePlanes`.
Clips off all parts from coordinate-based augmentables (e.g. BBs) that are
outside of the corresponding image.
* Changed `Polygon.area` to return `0.0` if the polygon contains less than
three points (previously: exception).
@@ -0,0 +1,5 @@
# Bounding Box to Polygon Conversion #489
* Added method `imgaug.augmentables.bbs.BoundingBox.to_polygon()`.
* Added method
`imgaug.augmentables.bbs.BoundingBoxesOnImage.to_polygons_on_image()`.
@@ -0,0 +1,6 @@
# Added Polygon Subdivision #489
* Added method `imgaug.augmentables.polys.Polygon.subdivide(N)`.
The method increases the polygon's corner point count by interpolating
`N` points on each edge with regular distance.
* Added method `imgaug.augmentables.polys.PolygonsOnImage.subdivide(N)`.
@@ -0,0 +1,5 @@
# Added `WithPolarWarping` #489
* Added augmenter `imgaug.augmenters.geometric.WithPolarWarping`, an
augmenter that applies child augmenters in a polar representation of the
image.
@@ -0,0 +1,13 @@
# Generate Debug Images #502
* Added module `imgaug.augmenters.debug`.
* Added function `imgaug.augmenters.debug.draw_debug_image()`. The function
draws an image containing debugging information for a provided set of
images and non-image data (e.g. segmentation maps, bounding boxes)
corresponding to a single batch. The debug image visualizes these
informations (e.g. bounding boxes drawn on images) and offers relevant
information (e.g. actual value ranges of images, labels of bounding
boxes and their counts, etc.).
* Added augmenter `imgaug.augmenters.debug.SaveDebugImageEveryNBatches`.
Augmenter corresponding to `draw_debug_image()`. Saves an image at every
n-th batch into a provided folder.
@@ -0,0 +1,4 @@
# Multi-Channel cvals in `pad()` #502
Improved `imgaug.augmenters.size.pad()` to support multi-channel values
for the `cval` parameter (e.g. RGB colors).
@@ -0,0 +1,62 @@
# Added Wrappers for `imagecorruptions` Package #530
Added wrappers around the functions from package
[bethgelab/imagecorruptions](https://github.com/bethgelab/imagecorruptions).
The functions in that package were used in some recent papers and are added
here for convenience.
The wrappers produce arrays containing values identical to the output
arrays from the corresponding `imagecorruptions` functions when called
via the `imagecorruptions.corrupt()` (verified via unittests).
The interfaces of the wrapper functions are identical to the
`imagecorruptions` functions, with the only difference of also supporting
`seed` parameters.
* Added module `imgaug.augmenters.imgcorruptlike`. The `like` signals that
the augmentation functions do not *have* to wrap `imagecorruptions`
internally. They merely have to produce the same outputs.
* Added the following functions to module `imgaug.augmenters.imgcorruptlike`:
* `apply_gaussian_noise()`
* `apply_shot_noise()`
* `apply_impulse_noise()`
* `apply_speckle_noise()`
* `apply_gaussian_blur()`
* `apply_glass_blur()` (improved performance over original function)
* `apply_defocus_blur()`
* `apply_motion_blur()`
* `apply_zoom_blur()`
* `apply_fog()`
* `apply_snow()`
* `apply_spatter()`
* `apply_contrast()`
* `apply_brightness()`
* `apply_saturate()`
* `apply_jpeg_compression()`
* `apply_pixelate()`
* `apply_elastic_transform()`
* Added function
`imgaug.augmenters.imgcorruptlike.get_corruption_names(subset)`.
Similar to `imagecorruptions.get_corruption_names(subset)`, but returns a
tuple
`(list of corruption method names, list of corruption method functions)`,
instead of only the names.
* Added the following augmenters to module `imgaug.augmenters.imgcorruptlike`:
* `GaussianNoise`
* `ShotNoise`
* `ImpulseNoise`
* `SpeckleNoise`
* `GaussianBlur`
* `GlassBlur`
* `DefocusBlur`
* `MotionBlur`
* `ZoomBlur`
* `Fog`
* `Frost`
* `Snow`
* `Spatter`
* `Contrast`
* `Brightness`
* `Saturate`
* `JpegCompression`
* `Pixelate`
* `ElasticTransform`
* Added context `imgaug.random.temporary_numpy_seed()`.
@@ -0,0 +1,9 @@
# Cutout Augmenter #531 #570
* Added `imgaug.augmenters.arithmetic.apply_cutout_()`, which replaces
in-place a single rectangular area with a constant intensity value or a
constant color or gaussian noise.
See also the [paper](https://arxiv.org/abs/1708.04552) about Cutout.
* Added `imgaug.augmenters.arithmetic.apply_cutout()`. Same as
`apply_cutout_()`, but copies the input images before applying cutout.
* Added `imgaug.augmenters.arithmetic.Cutout`.
@@ -0,0 +1,54 @@
# Added in-place Methods for Coordinate-based Augmentables #532
* Added `Keypoint.project_()`.
* Added `Keypoint.shift_()`.
* Added `KeypointsOnImage.on_()`.
* Added setter for `KeypontsOnImage.items`.
* Added setter for `BoundingBoxesOnImage.items`.
* Added setter for `LineStringsOnImage.items`.
* Added setter for `PolygonsOnImage.items`.
* Added `KeypointsOnImage.remove_out_of_image_fraction_()`.
* Added `KeypointsOnImage.clip_out_of_image_fraction_()`.
* Added `KeypointsOnImage.shift_()`.
* Added `BoundingBox.project_()`.
* Added `BoundingBox.extend_()`.
* Added `BoundingBox.clip_out_of_image_()`.
* Added `BoundingBox.shift_()`.
* Added `BoundingBoxesOnImage.on_()`.
* Added `BoundingBoxesOnImage.clip_out_of_image_()`.
* Added `BoundingBoxesOnImage.remove_out_of_image_()`.
* Added `BoundingBoxesOnImage.remove_out_of_image_fraction_()`.
* Added `BoundingBoxesOnImage.shift_()`.
* Added `imgaug.augmentables.utils.project_coords_()`.
* Added `LineString.project_()`.
* Added `LineString.shift_()`.
* Added `LineStringsOnImage.on_()`.
* Added `LineStringsOnImage.remove_out_of_image_()`.
* Added `LineStringsOnImage.remove_out_of_image_fraction_()`.
* Added `LineStringsOnImage.clip_out_of_image_()`.
* Added `LineStringsOnImage.shift_()`.
* Added `Polygon.project_()`.
* Added `Polygon.shift_()`.
* Added `Polygon.on_()`.
* Added `Polygon.subdivide_()`.
* Added `PolygonsOnImage.remove_out_of_image_()`.
* Added `PolygonsOnImage.remove_out_of_image_fraction_()`.
* Added `PolygonsOnImage.clip_out_of_image_()`.
* Added `PolygonsOnImage.shift_()`.
* Added `PolygonsOnImage.subdivide_()`.
* Switched `BoundingBoxesOnImage.copy()` to a custom copy operation (away
from module `copy` module).
* Added parameters `bounding_boxes` and `shape` to
BoundingBoxesOnImage.copy()`.
* Added parameters `bounding_boxes` and `shape` to
BoundingBoxesOnImage.deepcopy()`.
* Switched `KeypointsOnImage.copy()` to a custom copy operation (away
from module `copy` module).
* Switched `PolygonsOnImage.copy()` to a custom copy operation (away
from module `copy` module).
* Added parameters `polygons` and `shape` to
PolygonsOnImage.copy()`.
* Added parameters `polygons` and `shape` to
PolygonsOnImage.deepcopy()`.
* Switched augmenters to use in-place functions for keypoints,
bounding boxes, line strings and polygons.
@@ -0,0 +1,50 @@
# Added Module `imgaug.augmenters.pillike` #479 #480 #538
* Added module `imgaug.augmenters.pillike`, which contains augmenters and
functions corresponding to commonly used PIL functions. Their outputs
are guaranteed to be identical to the PIL outputs.
* Added the following functions to the module:
* `imgaug.augmenters.pillike.equalize`
* `imgaug.augmenters.pillike.equalize_`
* `imgaug.augmenters.pillike.autocontrast`
* `imgaug.augmenters.pillike.autocontrast_`
* `imgaug.augmenters.pillike.solarize`
* `imgaug.augmenters.pillike.solarize_`
* `imgaug.augmenters.pillike.posterize`
* `imgaug.augmenters.pillike.posterize_`
* `imgaug.augmenters.pillike.enhance_color`
* `imgaug.augmenters.pillike.enhance_contrast`
* `imgaug.augmenters.pillike.enhance_brightness`
* `imgaug.augmenters.pillike.enhance_sharpness`
* `imgaug.augmenters.pillike.filter_blur`
* `imgaug.augmenters.pillike.filter_smooth`
* `imgaug.augmenters.pillike.filter_smooth_more`
* `imgaug.augmenters.pillike.filter_edge_enhance`
* `imgaug.augmenters.pillike.filter_edge_enhance_more`
* `imgaug.augmenters.pillike.filter_find_edges`
* `imgaug.augmenters.pillike.filter_contour`
* `imgaug.augmenters.pillike.filter_emboss`
* `imgaug.augmenters.pillike.filter_sharpen`
* `imgaug.augmenters.pillike.filter_detail`
* `imgaug.augmenters.pillike.warp_affine`
* Added the following augmenters to the module:
* `imgaug.augmenters.pillike.Solarize`
* `imgaug.augmenters.pillike.Posterize`.
(Currently alias for `imgaug.augmenters.color.Posterize`.)
* `imgaug.augmenters.pillike.Equalize`
* `imgaug.augmenters.pillike.Autocontrast`
* `imgaug.augmenters.pillike.EnhanceColor`
* `imgaug.augmenters.pillike.EnhanceContrast`
* `imgaug.augmenters.pillike.EnhanceBrightness`
* `imgaug.augmenters.pillike.EnhanceSharpness`
* `imgaug.augmenters.pillike.FilterBlur`
* `imgaug.augmenters.pillike.FilterSmooth`
* `imgaug.augmenters.pillike.FilterSmoothMore`
* `imgaug.augmenters.pillike.FilterEdgeEnhance`
* `imgaug.augmenters.pillike.FilterEdgeEnhanceMore`
* `imgaug.augmenters.pillike.FilterFindEdges`
* `imgaug.augmenters.pillike.FilterContour`
* `imgaug.augmenters.pillike.FilterEmboss`
* `imgaug.augmenters.pillike.FilterSharpen`
* `imgaug.augmenters.pillike.FilterDetail`
* `imgaug.augmenters.pillike.Affine`
@@ -0,0 +1,7 @@
# Standardized LUT Methods #542
* Added `imgaug.imgaug.apply_lut()`, which applies a lookup table to an image.
* Added `imgaug.imgaug.apply_lut_()`. In-place version of `apply_lut()`.
* Refactored all augmenters to use these new LUT functions.
This likely fixed some so-far undiscovered bugs in augmenters using LUT
tables.
@@ -0,0 +1,12 @@
# Drawing Bounding Box Labels #545
When drawing bounding boxes on images via `BoundingBox.draw_on_image()`
or `BoundingBoxesOnImage.draw_on_image()`, a box containing the label will now
be drawn over each bounding box's rectangle. If the bounding box's label is
set to `None`, the label box will not be drawn. For more detailed control,
use `BoundingBox.draw_label_on_image()`.
* Added method `imgaug.augmentables.BoundingBox.draw_label_on_image()`.
* Added method `imgaug.augmentables.BoundingBox.draw_box_on_image()`.
* Changed method `imgaug.augmentables.BoundingBox.draw_on_image()`
to automatically draw a bounding box's label.
@@ -0,0 +1,11 @@
# Index-based Access to Coordinate-based `*OnImage` Instances #547
Enabled index-based access to coordinate-based `*OnImage` instances, i.e. to
`KeypointsOnImage`, `BoundingBoxesOnImage`, `LineStringsOnImage` and
`PolygonsOnImage`. This allows to do things like
`bbsoi = BoundingBoxesOnImage(...); bbs = bbsoi[0:2];`.
* Added `imgaug.augmentables.kps.KeypointsOnImage.__getitem__()`.
* Added `imgaug.augmentables.bbs.BoundingBoxesOnImage.__getitem__()`.
* Added `imgaug.augmentables.lines.LineStringsOnImage.__getitem__()`.
* Added `imgaug.augmentables.polys.PolygonsOnImage.__getitem__()`.
@@ -0,0 +1,4 @@
# Added `round` Parameter to `Discretize` #553
Added the parameter `round` to `imgaug.parameters.Discretize`. The parameter
defaults to `True`, i.e. the default behaviour of `Discretize` did not change.
+7
View File
@@ -0,0 +1,7 @@
# Added Rain Augmenters #551
Added augmenter(s) to create fake rain effects. They currently seem to work
best at around medium-sized images (~224px).
* Added `imgaug.augmenters.weather.Rain`.
* Added `imgaug.augmenters.weather.RainLayer`.
@@ -0,0 +1,8 @@
# Add RandAugment #553
Added a RandAugment augmenter, similar to the one described in the paper
"RandAugment: Practical automated data augmentation with a reduced
search space".
* Added module `imgaug.augmenters.collections`
* Added augmenter `imgaug.augmenters.collections.RandAugment`.
@@ -0,0 +1,28 @@
# Improved Warnings on Probably-Wrong Image Inputs #594
Improved the errors and warnings on image augmentation calls.
`augment_image()` will now produce a more self-explanatory error
message when calling it as in `augment_image(list of images)`.
Calls of single-image augmentation functions (e.g.
`augment(image=...)`) with inputs that look like multiple images
will now produce warnings. This is the case for `(H, W, C)`
inputs when `C>=32` (as that indicates that `(N, H, W)` was
actually provided).
Calls of multi-image augmentation functions (e.g.
`augment(images=...)`) with inputs that look like single images
will now produce warnings. This is the case for `(N, H, W)`
inputs when `W=1` or `W=3` (as that indicates that `(H, W, C)`
was actually provided.)
* Added an assert in `augment_image()` to verify that inputs are
arrays.
* Added warnings for probably-wrong image inputs in
`augment_image()`, `augment_images()`, `augment()` (and its
alias `__call__()`).
* Added module `imgaug.augmenters.base`.
* Added warning
`imgaug.augmenters.base.SuspiciousMultiImageShapeWarning`.
* Added warning
`imgaug.augmenters.base.SuspiciousSingleImageShapeWarning`.
* Added `imgaug.testutils.assertWarns`, similar to `unittest`'s
`assertWarns`, but available in python <3.2.
@@ -0,0 +1,6 @@
# Improved RNG Handling during Polygon Augmentation #447
* Changed `Augmenter.augment_polygons()` to copy the augmenter's RNG
before starting concave polygon recovery. This is done for cleanliness and
should not have any effects for users.
* Removed RNG copies in `_ConcavePolygonRecoverer` to improve performance.
@@ -0,0 +1,5 @@
# Affine Translation Precision #489
* Removed a rounding operation in `Affine` translation that would unnecessarily
round floats to integers. This should make coordinate augmentation overall
more accurate.
@@ -0,0 +1,6 @@
# `Affine.get_parameters()` and `translate_px`/`translate_percent` #508
* Changed `Affine.get_parameters()` to always return a tuple `(x, y, mode)`
for translation, where `mode` is either `px` or `percent`,
and `x` and `y` are stochastic parameters. `y` may be `None` if the same
parameter (and hence samples) are used for both axes.
@@ -0,0 +1,10 @@
# Removed Outdated "Don't Import from this Module" Messages #539
The docstring of each module in ``imgaug.augmenters`` previously included a
suggestion to not directly import from that module, but instead use
``imgaug.augmenters.<AugmenterName>``. That was due to the categorization
still being unstable. As the categorization has now been fairly stable
for a long time, the suggestion was removed from all modules. Calling
``imgaug.augmenters.<AugmenterName>`` instead of
``imgaug.augmenters.<ModuleName>.<AugmenterName>`` is however still the
preferred way.
@@ -0,0 +1,32 @@
# Standardized `shift()` Interfaces of Coordinate-Based Augmentables #548
The interfaces for shift operations of all coordinate-based
augmentables (Keypoints, BoundingBoxes, LineStrings, Polygons)
were standardized. All of these augmentables have now the same
interface for shift operations. Previously, Keypoints used
a different interface (using `x` and `y` arguments) than the
other augmentables (using `top`, `right`, `bottom`, `left`
arguments). All augmentables use now the interface of Keypoints
as that is simpler and less ambiguous. Old arguments are still
accepted, but will produce deprecation warnings. Change the
arguments to `x` and `y` following `x=left-right` and
`y=top-bottom`.
**[breaking]** This breaks if one relied on calling `shift()` functions of
`BoundingBox`, `LineString`, `Polygon`, `BoundingBoxesOnImage`,
`LineStringsOnImage` or `PolygonsOnImage` without named arguments.
E.g. `bb = BoundingBox(...); bb_shifted = bb.shift(1, 2, 3, 4);`
will produce unexpected outputs now (equivalent to
`shift(x=1, y=2, top=3, right=4, bottom=0, left=0)`),
while `bb_shifted = bb.shift(top=1, right=2, bottom=3, left=4)` will still
work as expected.
* Added arguments `x`, `y` to `BoundingBox.shift()`, `LineString.shift()`
and `Polygon.shift()`.
* Added arguments `x`, `y` to `BoundingBoxesOnImage.shift()`,
`LineStringsOnImage.shift()` and `PolygonsOnImage.shift()`.
* Marked arguments `top`, `right`, `bottom`, `left` in
`BoundingBox.shift()`, `LineString.shift()` and `Polygon.shift()`
as deprecated. This also affects the corresponding `*OnImage`
classes.
* Added function `testutils.wrap_shift_deprecation()`.
@@ -0,0 +1,33 @@
# Simplified Standard Parameters of Augmenters #567 #595
Changed the standard parameters shared by all augmenters to a
reduced and more self-explanatory set. Previously, all augmenters
shared the parameters `name`, `random_state` and `deterministic`.
The new parameters are `seed` and `name`.
`deterministic` was removed as it was hardly ever used and because
it caused frequently confusion with regards to its meaning. The
parameter is still accepted but will now produce a deprecation
warning. Use `<augmenter>.to_deterministic()` instead.
(Reminder: `to_deterministic()` is necessary if you want to get
the same samples in consecutive augmentation calls. It is *not*
necessary if you want your generated samples to be dependent on
an initial seed or random state as that is *always* the case
anyways. You only have to manually set the seed, either
augmenter-specific via the `seed` parameter or global via
`imgaug.random.seed()` (affects only augmenters without their
own seed).)
`random_state` was renamed to `seed` as providing a seed value
is the more common use case compared to providing a random state.
Many users also seemed to be unaware that `random_state` accepted
seed values. The new name should make this more clear.
The old parameter `random_state` is still accepted, but will
likely be deprecated in the future.
**[breaking]** This patch breaks if one relied on the order of
`name`, `random_state` and `deterministic`. The new order is now
`seed=..., name=..., random_state=..., deterministic=...` (with the
latter two parameters being outdated or deprecated)
as opposed to previously
`name=..., deterministic=..., random_state=...`.
@@ -0,0 +1,242 @@
# Improved Default Values of Augmenters #582
**[breaking]** Most augmenters had previously default values that
made them equivalent to identity functions. Users had to explicitly
change the defaults to proper values in order to "activate"
augmentations. To simplify the usage of the library, the default
values of most augmenters were changed to medium-strength
augmentations. E.g.
`Sequential([Affine(), UniformVoronoi(), CoarseDropout()])`
should now produce decent augmentations.
A few augmenters were set to always-on, maximum-strength
augmentations. This is the case for:
* `Grayscale` (always fully grayscales images, use
`Grayscale((0.0, 1.0))` for random strengths)
* `RemoveSaturation` (same as `Grayscale`)
* `Fliplr` (always flips images, use `Fliplr(0.5)` for 50%
probability)
* `Flipud` (same as `Fliplr`)
* `TotalDropout` (always drops everything, use
`TotalDropout(0.1)` to drop everything for 10% of all images)
* `Invert` (always inverts images, use `Invert(0.1)` to invert
10% of all images)
* `Rot90` (always rotates exactly once clockwise by 90 degrees,
use `Rot90((0, 3))` for any rotation)
These settings seemed to better match user-expectations.
Such maximum-strength settings however were not chosen for all
augmenters where one might expect them. The defaults are set to
varying strengths for, e.g. `Superpixels` (replaces only some
superpixels with cellwise average colors), `UniformVoronoi` (also
only replaces some cells), `Sharpen` (alpha-blends with variable
strength, the same is the case for `Emboss`, `EdgeDetect` and
`DirectedEdgeDetect`) and `CLAHE` (variable clip limits).
*Note*: Some of the new default values will cause issues with
non-`uint8` inputs.
*Note*: The defaults for `per_channel` and `keep_size` were not
adjusted. It is currently still the default behaviour of all
augmenters to affect all channels in the same way and to resize
their outputs back to the input sizes.
The exact changes to default values are listed below.
**imgaug.arithmetic**
* `Add`
* `value`: `0` -> `(-20, 20)`
* `AddElementwise`
* `value`: `0` -> `(-20, 20)`
* `AdditiveGaussianNoise`
* `scale`: `0` -> `(0, 15)`
* `AdditiveLaplaceNoise`
* `scale`: `0` -> `(0, 15)`
* `AdditivePoissonNoise`
* `scale`: `0` -> `(0, 15)`
* `Multiply`
* `mul`: `1.0` -> `(0.8, 1.2)`
* `MultiplyElementwise`:
* `mul`: `1.0` -> `(0.8, 1.2)`
* `Dropout`:
* `p`: `0.0` -> `(0.0, 0.05)`
* `CoarseDropout`:
* `p`: `0.0` -> `(0.02, 0.1)`
* `size_px`: `None` -> `(3, 8)`
* `min_size`: `4` -> `3`
* Default for `size_px` is only used if neither `size_percent`
nor `size_px` is provided by the user.
* `CoarseSaltAndPepper`:
* `p`: `0.0` -> `(0.02, 0.1)`
* `size_px`: `None` -> `(3, 8)`
* `min_size`: `4` -> `3`
* Default for `size_px` is only used if neither `size_percent`
nor `size_px` is provided by the user.
* `CoarseSalt`:
* `p`: `0.0` -> `(0.02, 0.1)`
* `size_px`: `None` -> `(3, 8)`
* `min_size`: `4` -> `3`
* Default for `size_px` is only used if neither `size_percent`
nor `size_px` is provided by the user.
* `CoarsePepper`:
* `p`: `0.0` -> `(0.02, 0.1)`
* `size_px`: `None` -> `(3, 8)`
* `min_size`: `4` -> `3`
* Default for `size_px` is only used if neither `size_percent`
nor `size_px` is provided by the user.
* `SaltAndPepper`:
* `p`: `0.0` -> `(0.0, 0.03)`
* `Salt`:
* `p`: `0.0` -> `(0.0, 0.03)`
* `Pepper`:
* `p`: `0.0` -> `(0.0, 0.05)`
* `ImpulseNoise`:
* `p`: `0.0` -> `(0.0, 0.03)`
* `Invert`:
* `p`: `0` -> `1`
* `JpegCompression`:
* `compression`: `50` -> `(0, 100)`
**imgaug.blend**
* `BlendAlpha`
* `factor`: `0` -> `(0.0, 1.0)`
* `BlendAlphaElementwise`
* `factor`: `0` -> `(0.0, 1.0)`
**imgaug.blur**
* `GaussianBlur`:
* `sigma`: `0` -> `(0.0, 3.0)`
* `AverageBlur`:
* `k`: `1` -> `(1, 7)`
* `MedianBlur`:
* `k`: `1` -> `(1, 7)`
* `BilateralBlur`:
* `d`: `1` -> `(1, 9)`
* `MotionBlur`:
* `k`: `5` -> `(3, 7)`
**imgaug.color**
* `MultiplyHueAndSaturation`:
* `mul_hue`: `None` -> `(0.5, 1.5)`
* `mul_saturation`: `None` -> `(0.0, 1.7)`
* These defaults are only used if the user provided neither
`mul` nor `mul_hue` nor `mul_saturation`.
* `MultiplyHue`:
* `mul`: `(-1.0, 1.0)` -> `(-3.0, 3.0)`
* `AddToHueAndSaturation`:
* `value_hue`: `None` -> `(-40, 40)`
* `value_saturation`: `None` -> `(-40, 40)`
* These defaults are only used if the user provided neither
`value` nor `value_hue` nor `value_saturation`.
* `Grayscale`:
* `alpha`: `0` -> `1`
**imgaug.contrast**
* `GammaContrast`:
* `gamma`: `1` -> `(0.7, 1.7)`
* `SigmoidContrast`:
* `gain`: `10` -> `(5, 6)`
* `cutoff`: `0.5` -> `(0.3, 0.6)`
* `LogContrast`:
* `gain`: `1` -> `(0.4, 1.6)`
* `LinearContrast`:
* `alpha`: `1` -> `(0.6, 1.4)`
* `AllChannelsCLAHE`:
* `clip_limit`: `40` -> `(0.1, 8)`
* `tile_grid_size_px`: `8` -> `(3, 12)`
* `CLAHE`:
* `clip_limit`: `40` -> `(0.1, 8)`
* `tile_grid_size_px`: `8` -> `(3, 12)`
**convolutional**
* `Sharpen`:
* `alpha`: `0` -> `(0.0, 0.2)`
* `lightness`: `1` -> `(0.8, 1.2)`
* `Emboss`:
* `alpha`: `0` -> `(0.0, 1.0)`
* `strength`: `1` -> `(0.25, 1.0)`
* `EdgeDetect`:
* `alpha`: `0` -> `(0.0, 0.75)`
* `DirectedEdgeDetect`:
* `alpha`: `0` -> `(0.0, 0.75)`
**imgaug.flip**
* `Fliplr`:
* `p`: `0` -> `1`
* `Flipud`:
* `p`: `0` -> `1`
**imgaug.geometric**
* `Affine`:
* `scale`: `1` -> `{"x": (0.9, 1.1), "y": (0.9, 1.1)}`
* `translate_percent`: None -> `{"x": (-0.1, 0.1), "y": (-0.1, 0.1)}`
* `rotate`: `0` -> `(-15, 15)`
* `shear`: `0` -> `shear={"x": (-10, 10), "y": (-10, 10)}`
* These defaults are only used if no affine transformation
parameter was set by the user. Otherwise the not-set
parameters default again towards the identity function.
* `PiecewiseAffine`:
* `scale`: `0` -> `(0.0, 0.04)`
* `nb_rows`: `4` -> `(2, 4)`
* `nb_cols`: `4` -> `(2, 4)`
* `PerspectiveTransform`:
* `scale`: `0` -> `(0.0, 0.06)`
* `ElasticTransformation`:
* `alpha`: `0` -> `(0.0, 40.0)`
* `sigma`: `0` -> `(4.0, 8.0)`
* `Rot90`:
* `k`: `(no default)` -> `k=1`
**imgaug.pooling**
* `AveragePooling`:
* `k`: `(no default)` -> `(1, 5)`
* `MaxPooling`:
* `k`: `(no default)` -> `(1, 5)`
* `MinPooling`:
* `k`: `(no default)` -> `(1, 5)`
* `MedianPooling`:
* `k`: `(no default)` -> `(1, 5)`
**imgaug.segmentation**
* `Superpixels`:
* `p_replace`: `0.0` -> `(0.5, 1.0)`
* `n_segments`: `100` -> `(50, 120)`
* `UniformVoronoi`:
* `n_points`: `(no default)` -> `(50, 500)`
* `p_replace`: `1.0` -> `(0.5, 1.0)`.
* `RegularGridVoronoi`:
* `n_rows`: `(no default)` -> `(10, 30)`
* `n_cols`: `(no default)` -> `(10, 30)`
* `p_drop_points`: `0.4` -> `(0.0, 0.5)`
* `p_replace`: `1.0` -> `(0.5, 1.0)`
* `RelativeRegularGridVoronoi`: Changed defaults from
* `n_rows_frac`: `(no default)` -> `(0.05, 0.15)`
* `n_cols_frac`: `(no default)` -> `(0.05, 0.15)`
* `p_drop_points`: `0.4` -> `(0.0, 0.5)`
* `p_replace`: `1.0` -> `(0.5, 1.0)`
**imgaug.size**
* `CropAndPad`:
* `percent`: `None` -> `(-0.1, 0.1)`
* This default is only used if the user has provided
neither `px` nor `percent`.
* `Pad`:
* `percent`: `None` -> `(0.0, 0.1)`
* This default is only used if the user has provided
neither `px` nor `percent`.
* `Crop`:
* `percent`: `None` -> `(0.0, 0.1)`
* This default is only used if the user has provided
neither `px` nor `percent`.
@@ -0,0 +1,10 @@
# `setup.py` Now Accepts Any `opencv-*` Installation #586
`setup.py` was changed so that it now accepts `opencv-python`,
`opencv-python-headless`, `opencv-contrib-python` and
`opencv-contrib-python-headless` as valid OpenCV installations.
Previously, only `opencv-python-headless` was accepted, which
could easily cause conflicts when another one of the mentioned
libraries was already installed.
If none of the mentioned libraries is installed, `setup.py`
will default to adding `opencv-python` as a requirement.
@@ -0,0 +1,4 @@
* Deprecated method `Augmenter.reseed()`.
Use `Augmenter.seed_()` instead. #444
* Deprecated method `Augmenter.remove_augmenters_inplace()`.
Use `Augmenter.remove_augmenters_()` instead. #444
@@ -0,0 +1,6 @@
# Deprecated AffineCv2 in Favor of Affine #540
The augmenter `imgaug.augmenters.geometric.AffineCv2` was not properly
maintained for quite a while and its functionality is already covered
by `imgaug.augmenters.geometric.Affine` using parameter
`backend='cv2'`. Hence, it was now deprecated. Use `Affine` instead.
@@ -0,0 +1,3 @@
* Fixed `Resize` always returning an `uint8` array during image augmentation
if the input was a single numpy array and all augmented images had the
same shape. #442 #443
@@ -0,0 +1,3 @@
* Fixed `Affine` coordinate-based augmentation applying wrong offset
when shifting images to/from top-left corner. This would lead to an error
of around 0.5 to 1.0 pixels. #446
@@ -0,0 +1,2 @@
* Fixed keypoint augmentation in `PiecewiseAffine` potentially being
unaligned if a `KeypointsOnImage` instance contained no keypoints. #446
@@ -0,0 +1,2 @@
* Fixed `imgaug.validation.convert_iterable_to_string_of_types()` crashing due
to not converting types to strings before joining them. #446
@@ -0,0 +1,2 @@
* Fixed `imgaug.validation.assert_is_iterable_of()` producing a not
well-designed error if the input was not an iterable. #446
@@ -0,0 +1,5 @@
* Fixed image normalization crashing when an input ndarray of multiple images
was changed during augmentation to a list of multiple images with different
shapes *and* the original input ndarray represented a single image or
a collection of 2D `(H,W)` images. This problem affected `augment()`,
`augment_batch()` and `augment_batches()`.
@@ -0,0 +1 @@
* Fixed typo in image normalization. #451
@@ -0,0 +1,3 @@
* Fixed a problem in `WithChannels` that could lead random sampling in child
augmenters being unaligned between images and corresponding non-image
data. #451
@@ -0,0 +1,7 @@
# Fixed Missing RandomState Methods #486
* Added aliases to `imgaug.random.RNG` for some outdated numpy random number
sampling methods that existed in `numpy.random.RandomState` but not in
numpy's new RNG system (1.17+). These old methods are not used in `imgaug`,
but some custom augmenters and `Lambda` calls may require them when
interacting with the provided `random_state` instances.
@@ -0,0 +1,5 @@
# Fixed Affine Translation of Map-Data #489
* Fixed `Affine` producing unaligned augmentations between images and
segmentation maps or heatmaps when using `translate_px` and the segmentation
map or heatmap had a different height/width than corresponding image.
@@ -0,0 +1,4 @@
# Fixed `SnowflakesLayer` crash #471
* Fixed a crash in `SnowflakesLayer` that could occur when using values
close to `1.0` for `flake_size`.
@@ -0,0 +1,4 @@
# Fixed `MultiplyHueAndSaturation` RNG #493
* Fixed `MultiplyHueAndSaturation` crashing if the RNG provided via
`random_state` was not `None` or `imgaug.random.RNG`.
@@ -0,0 +1,2 @@
* Fixed `CloudLayer.draw_on_image()` producing tuples instead of arrays
as output for `float` input images. #540
@@ -0,0 +1,6 @@
# `Affine` Translate Type Falsely dependent on float/int Samples #508
* Fixed `Affine` parameter `translate_px` behaving like `translate_percent`
if a continuous stochastic parameter was provided.
Analogously `translate_percent` would behave like `translate_px` if
a discrete stochastic parameter was provided.
@@ -0,0 +1,4 @@
# Fixed Hanging Code in NixOS #414 #510
* Fixed code hanging indefinitely when using multicore augmentation
on NixOS.
@@ -0,0 +1,4 @@
# Fixed Abstract Base Classes Import #527
* Fixed a deprecation warning and potential crash in python 3.8
related to the use of `collections` instead of `collections.abc`.
@@ -0,0 +1,3 @@
# Fixed `scipy.fromfunction` Deprecated #529
* Fixed deprecated `scipy.fromfunction()` being called.
@@ -0,0 +1,6 @@
# Fixed crashes in numpy 1.18 #534
* Fixed `imgaug.random.normalize_generator()` crashing in numpy 1.18.
The function relied on `numpy.random.bit_generator.BitGenerator`, which
was moved in numpy 1.18 to `numpy.random.BitGenerator` without a
deprecation period for the old name.
@@ -0,0 +1,5 @@
# Fixed OpenCV Hanging in Multicore Augmentation #535
* Fixed an issue that could lead to endlessly hanging programs on some OS
when using multicore augmentation (e.g. via pool) and augmenters using
OpenCV.
@@ -0,0 +1,8 @@
# Fixed `random.seed` not always seeding in-place #557
Fixed `imgaug.random.seed()` not seeding the global `RNG` in-place
in numpy 1.17+. The (unfixed) function instead created a new
global `RNG` with the given seed. This set the seed of augmenters
created *after* the `seed()` call, but not of augmenters created
*before* the `seed()` call as they would continue to use the old
global RNG.
@@ -0,0 +1,4 @@
# Fixed `cval` in `ElasticTransformation` #561 #562
* Fixed `cval` in `ElasticTransformation` resulting new pixels in RGB images
being filled with `(cval, 0, 0)` instead of `(cval, cval, cval)`.
@@ -0,0 +1,2 @@
* Fixed some augmenters in module `weather` not transferring seed values
or random states that were provided upon creation to child augmenters. #568
@@ -0,0 +1,5 @@
* Fixed an inaccuracy in `PerspectiveTransform` that could lead to slightly
misaligned transformations between images and coordinate-based
augmentables (e.g. bounding boxes). The problem was more significant the
smaller the images and larger the `scale` values were. It was also
worsened by using `fit_output`. #585
@@ -0,0 +1,3 @@
* Fixed `KeepSizeByResize` potentially crashing if a single numpy array
was provided as the input for an iterable of images (as opposed to
a list of numpy arrays). #590
@@ -0,0 +1,3 @@
* Fixed an issue in Shapely 1.7a2 (python 3.8) that could lead to
a crash in `LineString.find_intersections_with()` if there was
no intersection. #600
@@ -0,0 +1,6 @@
# Refactored according to pylint requirements
* Refactored all core library files to fulfill (most) pylint requirements.
* [rarely breaking] Renamed
`imgaug.augmenters.size.KeepSizeByResize.get_shapes()` to `_get_shapes()`.
* Added a project-specific pylint configuration.
@@ -0,0 +1,4 @@
# Unified OpenCV Input Normalization #565
* Refactored various augmenters to use the same normalization for OpenCV
inputs. This probably fixes some previously undiscovered bugs.
@@ -0,0 +1,3 @@
* Renamed `Augmenter.reseed()` to `Augmenter.seed_()`. #444
* Renamed `Augmenter.remove_augmenters_inplace()` to
`Augmenter.remove_augmenters_()`. #444
+38
View File
@@ -0,0 +1,38 @@
# Add New `data` Module #606
This patch moves the example data functions from `imgaug.imgaug` to
the new module `imgaug.data`.
Add Modules:
* `imgaug.data`
Add Functions:
* `imgaug.data.quokka()`
* `imgaug.data.quokka_square()`
* `imgaug.data.quokka_heatmap()`
* `imgaug.data.quokka_segmentation_map()`
* `imgaug.data.quokka_keypoints()`
* `imgaug.data.quokka_bounding_boxes()`
* `imgaug.data.quokka_polygons()`
Deprecated Functions:
* `imgaug.imgaug.quokka()`.
Use `imgaug.data.quokka()` instead.
* `imgaug.imgaug.quokka_square()`.
Use `imgaug.data.quokka_square()` instead.
* `imgaug.imgaug.quokka_heatmap()`.
Use `imgaug.data.quokka_heatmap()` instead.
* `imgaug.imgaug.quokka_segmentation_map()`.
Use `imgaug.data.quokka_segmentation_map()` instead.
* `imgaug.imgaug.quokka_keypoints()`.
Use `imgaug.data.quokka_keypoints()` instead.
* `imgaug.imgaug.quokka_bounding_boxes()`.
Use `imgaug.data.quokka_bounding_boxes()` instead.
* `imgaug.imgaug.quokka_polygons()`.
Use `imgaug.data.quokka_polygons()` instead.
Removed Constants:
* [rarely breaking] `imgaug.imgaug.FILE_DIR`
* [rarely breaking] `imgaug.imgaug.QUOKKA_FP`
* [rarely breaking] `imgaug.imgaug.QUOKKA_ANNOTATIONS_FP`
* [rarely breaking] `imgaug.imgaug.QUOKKA_DEPTH_MAP_HALFRES_FP`
@@ -0,0 +1,34 @@
# Stricter Shape Handling in Augmentables #623
Various methods of augmentables have so far accepted tuples
of integers or numpy arrays for `shape` parameters. This was
the case for e.g. `BoundingBoxesOnImage.__init__(bbs, shape)`
or `Polygon.clip_out_of_image(image)`. This tolerant handling
of shapes conveys some risk that an input is actually a
numpy representation of a shape, i.e. the equivalent of
`numpy.array(shape_tuple)`.
To decrease the risk of such an input leading to bugs, arrays
are no longer recommended inputs for `shape` in
`KeypointsOnImage.__init__`, `BoundingBoxesOnImage.__init__`,
`LineStringsOnImage.__init__`, and `PolygonsOnImage.__init__`.
Their usage in these methods will now raise a deprecation warning.
In all other methods of augmentables that currently accept
image-like numpy arrays and shape tuples for parameters,
only arrays that are 2-dimensional or 3-dimensional are from
now on accepted. Other arrays (e.g. 1-dimensional ones)
will be rejected with an assertion error.
Add functions:
* `imgaug.augmentables.utils.normalize_imglike_shape()`.
List of deprecations:
* `numpy.ndarray` as value of parameter `shape` in
`KeypointsOnImage.__init__`.
* `numpy.ndarray` as value of parameter `shape` in
`BoundingBoxesOnImage.__init__`.
* `numpy.ndarray` as value of parameter `shape` in
`LineStringsOnImage.__init__`.
* `numpy.ndarray` as value of parameter `shape` in
`PolygonsOnImage.__init__`.
@@ -0,0 +1,9 @@
# Limit dtype Support in Alpha Blending in Windows #678
This patch marks the dtypes uint64, int64 and float64
as 'only supported to a limited degree' in blend_alpha().
The dtypes require float128 for accurate output
computations, which is not supported in Windows.
Additionally, a better error message is provided if one
of these dtypes is used and float128 is not supported.
@@ -0,0 +1,4 @@
* Fix legacy augmenters (i.e. no `_augment_batch_()`
implemented) not automatically falling back to
`_augment_keypoints()` for the augmentation of bounding
boxes, polygons and line strings. #617 #618
@@ -0,0 +1,4 @@
* Fixed a broken `imageio` dependency. The package no longer
supports python 3.4 and earlier and will fail to install in the
latest version. The dependency is now set to be more
restrictive for older python versions. #627 #628

Some files were not shown because too many files have changed in this diff Show More