Python imgaug.new_random_state() Examples

The following are 7 code examples of imgaug.new_random_state(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module imgaug , or try the search function .
Example #1
Source File: utils.py    From steppy-toolkit with MIT License 5 votes vote down vote up
def reseed(augmenter, deterministic=True):
    augmenter.random_state = ia.new_random_state(get_seed())
    if deterministic:
        augmenter.deterministic = True

    for lists in augmenter.get_children_lists():
        for aug in lists:
            aug = reseed(aug, deterministic=True)
    return augmenter 
Example #2
Source File: utils.py    From open-solution-salt-identification with MIT License 5 votes vote down vote up
def reseed(augmenter, deterministic=True):
    augmenter.random_state = ia.new_random_state(get_seed())
    if deterministic:
        augmenter.deterministic = True

    for lists in augmenter.get_children_lists():
        for aug in lists:
            aug = reseed(aug, deterministic=True)
    return augmenter 
Example #3
Source File: test_imgaug.py    From imgaug with MIT License 5 votes vote down vote up
def test_new_random_state__induce_pseudo_random(mock_rng):
    with warnings.catch_warnings(record=True) as caught_warnings:
        warnings.simplefilter("always")

        _ = ia.new_random_state(seed=None, fully_random=False)

    assert mock_rng.create_pseudo_random_.call_count == 1
    assert len(caught_warnings) == 1
    assert "is deprecated" in str(caught_warnings[-1].message) 
Example #4
Source File: test_imgaug.py    From imgaug with MIT License 5 votes vote down vote up
def test_new_random_state__induce_fully_random(mock_rng):
    with warnings.catch_warnings(record=True) as caught_warnings:
        warnings.simplefilter("always")

        _ = ia.new_random_state(seed=None, fully_random=True)

    assert mock_rng.create_fully_random.call_count == 1
    assert len(caught_warnings) == 1
    assert "is deprecated" in str(caught_warnings[-1].message) 
Example #5
Source File: test_imgaug.py    From imgaug with MIT License 5 votes vote down vote up
def test_new_random_state__use_seed(mock_rng):
    with warnings.catch_warnings(record=True) as caught_warnings:
        warnings.simplefilter("always")

        _ = ia.new_random_state(seed=1)

    mock_rng.assert_called_once_with(1)
    assert len(caught_warnings) == 1
    assert "is deprecated" in str(caught_warnings[-1].message) 
Example #6
Source File: utils.py    From open-solution-data-science-bowl-2018 with MIT License 5 votes vote down vote up
def reseed(augmenter, deterministic=True):
    augmenter.random_state = ia.new_random_state(get_seed())
    if deterministic:
        augmenter.deterministic = True

    for lists in augmenter.get_children_lists():
        for aug in lists:
            aug = reseed(aug, deterministic=True)
    return augmenter 
Example #7
Source File: utils.py    From open-solution-mapping-challenge with MIT License 5 votes vote down vote up
def reseed(augmenter_sequence, deterministic=True):
    for aug in augmenter_sequence:
        aug.random_state = ia.new_random_state(get_seed())
        if deterministic:
            aug.deterministic = True
    return augmenter_sequence