def test_base_pipeline_config(self): config_dict = { 'name': 'my_pipelne', 'num_epochs': 10, 'shuffle': True, 'feature_processors': { 'image': { 'input_layers': ['image'], 'output_layers': ['reshap_0'], 'layers': [{ 'Resize': { 'height': 28, 'width': 28 } }, { 'Reshape': { 'target_shape': [784] } }] }, } } config = BasePipelineConfig.from_dict(config_dict) config_to_dict = config.to_dict() assert config_to_dict['name'] == config_dict['name'] assert config_to_dict['num_epochs'] == config_dict['num_epochs'] assert config_to_dict['shuffle'] == config_dict['shuffle'] assert_equal_feature_processors(config_to_dict['feature_processors'], config_dict['feature_processors'])
def test_feature_processors(self): config_dict = { 'image1': { 'input_layers': ['image'], 'output_layers': ['reshap_0'], 'layers': [{ 'Resize': { 'height': 28, 'width': 28 } }, { 'Reshape': { 'target_shape': [784] } }] }, 'image2': { 'input_layers': ['image'], 'output_layers': ['reshap_0'], 'layers': [{ 'Standardization': {} }, { 'Resize': { 'height': 28, 'width': 28 } }, { 'Reshape': { 'target_shape': [784] } }] } } config = FeatureProcessorsConfig.from_dict(config_dict) config_to_dict = config.to_dict() assert_equal_feature_processors(config_to_dict, config_dict)
def test_tf_record_image_pipeline_config(self): config_dict = { 'batch_size': 64, 'num_epochs': 10, 'shuffle': True, 'data_files': ['train_data_file'], 'meta_data_file': 'meta_data_file', 'feature_processors': { 'image': { 'input_layers': ['image'], 'output_layers': ['reshap_0'], 'layers': [{ 'Resize': { 'height': 28, 'width': 28 } }, { 'Reshape': { 'target_shape': [784] } }] }, } } config = TFRecordImagePipelineConfig.from_dict(config_dict) config_to_dict = config.to_dict() assert config_to_dict['num_epochs'] == config_dict['num_epochs'] assert config_to_dict['shuffle'] == config_dict['shuffle'] assert config_to_dict['data_files'] == config_dict['data_files'] assert config_to_dict['meta_data_file'] == config_dict[ 'meta_data_file'] assert_equal_feature_processors(config_to_dict['feature_processors'], config_dict['feature_processors'])