Select Git revision
coverage.yaml
-
Utz-Uwe Haus authored
3fe42a89a Version: Set release flag for libcyaml 1.0.1 release. dfd2ac4d8 Merge pull request #114 from tlsa/tlsa/v1.0.1-release b0d16857b Buildsystem: Bump version for v1.0.1 release. bdb28606f Merge pull request #112 from tlsa/tlsa/type-check 94272f0c1 Tests: Add test for NULL pointer mapping values. 3be7c368a Tests: Fix uint test for NULL pointer values in sequence. acf52d71d Load: Trivial whitespace fix. a01510f91 Load: Handle NULL pointer values before doing event type checks. c606d9c4e Merge pull request #113 from idryzhov/master a57771d2b Buildsystem: Explicitly create directories needed for installation e68a9eb4c Merge pull request #111 from tlsa/tlsa/v1-release c3a2029d0 Buildsystem: Bump version for v1.0.0 release. 2cee4889d Docs: Update documentation of build variants. be7cdf2d9 Buildsystem: Make default variant depend on VERSION_DEVEL. b95ac43a3 Load: Squash Clang warning. 3dfef4c22 Docs: Remove status section from README. 2330b962e Merge pull request #109 from tlsa/tlsa/fix-bad-event-string 4d07d4a32 Tests: Add load test for string value with bad YAML data. 5bb470a89 Tests: Add loading test with string value at the top level. d74f5d909 Load: Ensure that the event type gets validated for the schema type. 5ad2ef7cd Load: Minor code style change. 4fdea52ad Merge pull request #106 from tlsa/tlsa/squash-conversion-warnings bdcf26698 Buildsystem: Enable -Wconversion. 58a1ad3f2 UTF8: Squash Wconversion warnings. e47d464bf Save: Squash Wconversion warnings. 2988975ee Load: Squash Wconversion warnings. bb2750950 Tests: Squash Wconversion warnings. e593bf2e0 Data: Squash Wconversion warnings. efe6816b8 Examples: Change type to avoid Wconversion warning. 3751a8ce5 Free: Squash -Wconversion warnings. 108d685f1 Merge pull request #104 from tlsa/tlsa/github-actions da499b74a README: Update CI badge for change to GitHub Actions. 70e08526f CI: Switch from Travis to GitHub Actions. 16c46157e Merge pull request #102 from tlsa/tlsa/client-logging-context 60234a8af API: Allow client to provide a context pointer for logging. b52e54a61 API: Fix to cyaml_save_data() documentation. 2b90d8681 Merge pull request #100 from tlsa/tlsa/allow-null-pointer-values 40c790ec9 Tests: Add tests for error handling in saving of NULL pointer values. 6196de87a Tests: Add tests for saving NULL pointer values. 8cc3fc5d5 Tests: Add tests for loading NULL pointer values. 9bb0cc250 Tests: Fix a test for handling of inequal sequence min/max. a43435a39 Save: Add support for NULL pointer value flag. 27b8e35a8 Load: Add support for NULL pointer value flag. 350e24865 Save: Tiny code tidy. 519da0b34 Load: Fix a comment typo. 4109ccbf8 Util: Add helper function to test bits in value flags. 5ce153943 API: Add value flag to permit pointers to have NULL values. 5eb33f594 Merge pull request #99 from esmil/master 2098f6d83 Makefile: optionally use pkg-config to find libyaml 6f7101839 Merge pull request #95 from tlsa/tlsa/fix-comments 3ca5908a2 Save: Fix some comments. a7e7087b5 Tests: Fix comment in strdup test. 8237e7080 Docs: Improve LGTM button alt text. baa34c196 Merge pull request #93 from tlsa/tlsa/anchor-alias f3f9e8c5c Docs: Mention alias/anchor support in README. 68515b668 Docs: Only need one LGTM button in README. 41bd11858 Tests: Add tests for alias/anchor edge cases. dae05efeb Tests: Add tests for non-scalar anchors. 4c60be6ab Tests: Add tests for loading with anchored scalars. 55291b582 Tests: Add error handling test for alias to incomplete anchor. 1458f678a Tests: Add error handling test for alias to undefined anchor. 36ff99249 Tests: Make the OOM load test use aliases and anchors. 3dd10c9fa Load: Add support for aliases and anchors. 3a31773d1 API: Add error code for invalid alias. df2feaef3 Load: Move cyaml_event enum definition. 681361183 Tests: Add test for cyaml_strdup. c4ec99629 Mem: Add strdup implementation using client allocator. 98dc9648a Load: Store libyaml events in the load context. 9287b956d UTF8: Slight rearrangement of code for coverage. 7ea096710 Tests: Add test for saving to file with error. 48f54fc66 Tests: Do cleanup after failure reason is printed. 3544bff3b API: Add config option for YAML alias support. 88baf4908 API: Fix a few documentation typos. git-subtree-dir: deps/libcyaml git-subtree-split: 9099f54d3e298580a228425ea784d9aaf98b8ee5
Utz-Uwe Haus authored3fe42a89a Version: Set release flag for libcyaml 1.0.1 release. dfd2ac4d8 Merge pull request #114 from tlsa/tlsa/v1.0.1-release b0d16857b Buildsystem: Bump version for v1.0.1 release. bdb28606f Merge pull request #112 from tlsa/tlsa/type-check 94272f0c1 Tests: Add test for NULL pointer mapping values. 3be7c368a Tests: Fix uint test for NULL pointer values in sequence. acf52d71d Load: Trivial whitespace fix. a01510f91 Load: Handle NULL pointer values before doing event type checks. c606d9c4e Merge pull request #113 from idryzhov/master a57771d2b Buildsystem: Explicitly create directories needed for installation e68a9eb4c Merge pull request #111 from tlsa/tlsa/v1-release c3a2029d0 Buildsystem: Bump version for v1.0.0 release. 2cee4889d Docs: Update documentation of build variants. be7cdf2d9 Buildsystem: Make default variant depend on VERSION_DEVEL. b95ac43a3 Load: Squash Clang warning. 3dfef4c22 Docs: Remove status section from README. 2330b962e Merge pull request #109 from tlsa/tlsa/fix-bad-event-string 4d07d4a32 Tests: Add load test for string value with bad YAML data. 5bb470a89 Tests: Add loading test with string value at the top level. d74f5d909 Load: Ensure that the event type gets validated for the schema type. 5ad2ef7cd Load: Minor code style change. 4fdea52ad Merge pull request #106 from tlsa/tlsa/squash-conversion-warnings bdcf26698 Buildsystem: Enable -Wconversion. 58a1ad3f2 UTF8: Squash Wconversion warnings. e47d464bf Save: Squash Wconversion warnings. 2988975ee Load: Squash Wconversion warnings. bb2750950 Tests: Squash Wconversion warnings. e593bf2e0 Data: Squash Wconversion warnings. efe6816b8 Examples: Change type to avoid Wconversion warning. 3751a8ce5 Free: Squash -Wconversion warnings. 108d685f1 Merge pull request #104 from tlsa/tlsa/github-actions da499b74a README: Update CI badge for change to GitHub Actions. 70e08526f CI: Switch from Travis to GitHub Actions. 16c46157e Merge pull request #102 from tlsa/tlsa/client-logging-context 60234a8af API: Allow client to provide a context pointer for logging. b52e54a61 API: Fix to cyaml_save_data() documentation. 2b90d8681 Merge pull request #100 from tlsa/tlsa/allow-null-pointer-values 40c790ec9 Tests: Add tests for error handling in saving of NULL pointer values. 6196de87a Tests: Add tests for saving NULL pointer values. 8cc3fc5d5 Tests: Add tests for loading NULL pointer values. 9bb0cc250 Tests: Fix a test for handling of inequal sequence min/max. a43435a39 Save: Add support for NULL pointer value flag. 27b8e35a8 Load: Add support for NULL pointer value flag. 350e24865 Save: Tiny code tidy. 519da0b34 Load: Fix a comment typo. 4109ccbf8 Util: Add helper function to test bits in value flags. 5ce153943 API: Add value flag to permit pointers to have NULL values. 5eb33f594 Merge pull request #99 from esmil/master 2098f6d83 Makefile: optionally use pkg-config to find libyaml 6f7101839 Merge pull request #95 from tlsa/tlsa/fix-comments 3ca5908a2 Save: Fix some comments. a7e7087b5 Tests: Fix comment in strdup test. 8237e7080 Docs: Improve LGTM button alt text. baa34c196 Merge pull request #93 from tlsa/tlsa/anchor-alias f3f9e8c5c Docs: Mention alias/anchor support in README. 68515b668 Docs: Only need one LGTM button in README. 41bd11858 Tests: Add tests for alias/anchor edge cases. dae05efeb Tests: Add tests for non-scalar anchors. 4c60be6ab Tests: Add tests for loading with anchored scalars. 55291b582 Tests: Add error handling test for alias to incomplete anchor. 1458f678a Tests: Add error handling test for alias to undefined anchor. 36ff99249 Tests: Make the OOM load test use aliases and anchors. 3dd10c9fa Load: Add support for aliases and anchors. 3a31773d1 API: Add error code for invalid alias. df2feaef3 Load: Move cyaml_event enum definition. 681361183 Tests: Add test for cyaml_strdup. c4ec99629 Mem: Add strdup implementation using client allocator. 98dc9648a Load: Store libyaml events in the load context. 9287b956d UTF8: Slight rearrangement of code for coverage. 7ea096710 Tests: Add test for saving to file with error. 48f54fc66 Tests: Do cleanup after failure reason is printed. 3544bff3b API: Add config option for YAML alias support. 88baf4908 API: Fix a few documentation typos. git-subtree-dir: deps/libcyaml git-subtree-split: 9099f54d3e298580a228425ea784d9aaf98b8ee5
test_inception_model.py 8.42 KiB
import keras
import pytest
from src.model_modules.inception_model import InceptionModelBase
class TestInceptionModelBase:
@pytest.fixture
def base(self):
return InceptionModelBase()
@pytest.fixture
def input_x(self):
return keras.Input(shape=(32, 32, 3))
@staticmethod
def step_in(element, depth=1):
for _ in range(depth):
element = element.input._keras_history[0]
return element
def test_init(self, base):
assert base.number_of_blocks == 0
assert base.part_of_block == 0
assert base.ord_base == 96
assert base.act_number == 0
def test_block_part_name(self, base):
assert base.block_part_name() == chr(96)
base.part_of_block += 1
assert base.block_part_name() == 'a'
def test_create_conv_tower_3x3(self, base, input_x):
opts = {'input_x': input_x, 'reduction_filter': 64, 'tower_filter': 32, 'tower_kernel': (3, 3)}
tower = base.create_conv_tower(**opts)
# check last element of tower (activation)
assert base.part_of_block == 1
assert tower.name == 'Block_0a_act_2/Relu:0'
act_layer = tower._keras_history[0]
assert isinstance(act_layer, keras.layers.advanced_activations.ReLU)
assert act_layer.name == "Block_0a_act_2"
# check previous element of tower (conv2D)
conv_layer = self.step_in(act_layer)
assert isinstance(conv_layer, keras.layers.Conv2D)
assert conv_layer.filters == 32
assert conv_layer.padding == 'same'
assert conv_layer.kernel_size == (3, 3)
assert conv_layer.strides == (1, 1)
assert conv_layer.name == "Block_0a_3x3"
# check previous element of tower (activation)
act_layer2 = self.step_in(conv_layer)
assert isinstance(act_layer2, keras.layers.advanced_activations.ReLU)
assert act_layer2.name == "Block_0a_act_1"
# check previous element of tower (conv2D)
conv_layer2 = self.step_in(act_layer2)
assert isinstance(conv_layer2, keras.layers.Conv2D)
assert conv_layer2.filters == 64
assert conv_layer2.kernel_size == (1, 1)
assert conv_layer2.padding == 'same'
assert conv_layer2.name == 'Block_0a_1x1'
assert conv_layer2.input._keras_shape == (None, 32, 32, 3)
def test_create_conv_tower_3x3_activation(self, base, input_x):
opts = {'input_x': input_x, 'reduction_filter': 64, 'tower_filter': 32, 'tower_kernel': (3, 3)}
# create tower with standard activation function
tower = base.create_conv_tower(activation='tanh', **opts)
assert tower.name == 'Block_0a_act_2_tanh/Tanh:0'
act_layer = tower._keras_history[0]
assert isinstance(act_layer, keras.layers.core.Activation)
assert act_layer.name == "Block_0a_act_2_tanh"
# create tower with activation function class
tower = base.create_conv_tower(activation=keras.layers.LeakyReLU, **opts)
assert tower.name == 'Block_0b_act_2/LeakyRelu:0'
act_layer = tower._keras_history[0]
assert isinstance(act_layer, keras.layers.advanced_activations.LeakyReLU)
assert act_layer.name == "Block_0b_act_2"
def test_create_conv_tower_1x1(self, base, input_x):
opts = {'input_x': input_x, 'reduction_filter': 64, 'tower_filter': 32, 'tower_kernel': (1, 1)}
tower = base.create_conv_tower(**opts)
# check last element of tower (activation)
assert base.part_of_block == 1
assert tower.name == 'Block_0a_act_1_1/Relu:0'
act_layer = tower._keras_history[0]
assert isinstance(act_layer, keras.layers.advanced_activations.ReLU)
assert act_layer.name == "Block_0a_act_1"
# check previous element of tower (conv2D)
conv_layer = self.step_in(act_layer)
assert isinstance(conv_layer, keras.layers.Conv2D)
assert conv_layer.filters == 32
assert conv_layer.padding == 'same'
assert conv_layer.kernel_size == (1, 1)
assert conv_layer.strides == (1, 1)
assert conv_layer.name == "Block_0a_1x1"
assert conv_layer.input._keras_shape == (None, 32, 32, 3)
def test_create_conv_towers(self, base, input_x):
opts = {'input_x': input_x, 'reduction_filter': 64, 'tower_filter': 32, 'tower_kernel': (3, 3)}
_ = base.create_conv_tower(**opts)
tower = base.create_conv_tower(**opts)
assert base.part_of_block == 2
assert tower.name == 'Block_0b_act_2_1/Relu:0'
def test_create_pool_tower(self, base, input_x):
opts = {'input_x': input_x, 'pool_kernel': (3, 3), 'tower_filter': 32}
tower = base.create_pool_tower(**opts)
# check last element of tower (activation)
assert base.part_of_block == 1
assert tower.name == 'Block_0a_act_1_3/Relu:0'
act_layer = tower._keras_history[0]
assert isinstance(act_layer, keras.layers.advanced_activations.ReLU)
assert act_layer.name == "Block_0a_act_1"
# check previous element of tower (conv2D)
conv_layer = self.step_in(act_layer)
assert isinstance(conv_layer, keras.layers.Conv2D)
assert conv_layer.filters == 32
assert conv_layer.padding == 'same'
assert conv_layer.kernel_size == (1, 1)
assert conv_layer.strides == (1, 1)
assert conv_layer.name == "Block_0a_1x1"
# check previous element of tower (maxpool)
pool_layer = self.step_in(conv_layer)
assert isinstance(pool_layer, keras.layers.pooling.MaxPooling2D)
assert pool_layer.name == "Block_0a_MaxPool"
assert pool_layer.pool_size == (3, 3)
assert pool_layer.padding == 'same'
# check avg pool tower
opts = {'input_x': input_x, 'pool_kernel': (3, 3), 'tower_filter': 32}
tower = base.create_pool_tower(max_pooling=False, **opts)
pool_layer = self.step_in(tower._keras_history[0], depth=2)
assert isinstance(pool_layer, keras.layers.pooling.AveragePooling2D)
assert pool_layer.name == "Block_0b_AvgPool"
assert pool_layer.pool_size == (3, 3)
assert pool_layer.padding == 'same'
def test_inception_block(self, base, input_x):
conv = {'tower_1': {'reduction_filter': 64, 'tower_kernel': (3, 3), 'tower_filter': 64},
'tower_2': {'reduction_filter': 64, 'tower_kernel': (5, 5), 'tower_filter': 64, 'activation': 'tanh'}}
pool = {'pool_kernel': (3, 3), 'tower_filter': 64}
opts = {'input_x': input_x, 'tower_conv_parts': conv, 'tower_pool_parts': pool}
block = base.inception_block(**opts)
assert base.number_of_blocks == 1
concatenated = block._keras_history[0].input
assert len(concatenated) == 4
block_1a, block_1b, block_pool1, block_pool2 = concatenated
assert block_1a.name == 'Block_1a_act_2/Relu:0' # <- sometimes keras changes given name (I don't know why yet)
assert block_1b.name == 'Block_1b_act_2_tanh/Tanh:0'
assert block_pool1.name == 'Block_1c_act_1/Relu:0'
assert block_pool2.name == 'Block_1d_act_1/Relu:0'
assert self.step_in(block_1a._keras_history[0]).name == "Block_1a_3x3"
assert self.step_in(block_1b._keras_history[0]).name == "Block_1b_5x5"
assert isinstance(self.step_in(block_pool1._keras_history[0], depth=2), keras.layers.pooling.MaxPooling2D)
assert isinstance(self.step_in(block_pool2._keras_history[0], depth=2), keras.layers.pooling.AveragePooling2D)
# next block
opts['input_x'] = block
opts['tower_pool_parts']['max_pooling'] = True
block = base.inception_block(**opts)
assert base.number_of_blocks == 2
concatenated = block._keras_history[0].input
assert len(concatenated) == 3
block_2a, block_2b, block_pool = concatenated
assert block_2a.name == 'Block_2a_act_2/Relu:0'
assert block_2b.name == 'Block_2b_act_2_tanh/Tanh:0'
assert block_pool.name == 'Block_2c_act_1/Relu:0'
assert self.step_in(block_2a._keras_history[0]).name == "Block_2a_3x3"
assert self.step_in(block_2b._keras_history[0]).name == "Block_2b_5x5"
assert isinstance(self.step_in(block_pool._keras_history[0], depth=2), keras.layers.pooling.MaxPooling2D)
def test_batch_normalisation(self, base, input_x):
base.part_of_block += 1
bn = base.batch_normalisation(input_x)._keras_history[0]
assert isinstance(bn, keras.layers.normalization.BatchNormalization)
assert bn.name == "Block_0a_BN"