Ejemplo n.º 1
0
def get_input_fn(mode, data_files, meta_data_file):
    return plx.processing.create_input_data_fn(
        mode=mode,
        pipeline_config=TFRecordImagePipelineConfig(
            shuffle=plx.Modes.is_train(mode),
            dynamic_pad=False,
            batch_size=64 if plx.Modes.is_train(mode) else 32,
            data_files=data_files,
            meta_data_file=meta_data_file,
            feature_processors=FeatureProcessorsConfig.from_dict(
                {'image': {
                    'input_layers': [['image', 0, 0]],
                    'output_layers': [['std', 0, 0]],
                    'layers': [
                        {'Cast': {
                            'name': 'cast',
                            'dtype': 'float32',
                            'inbound_nodes': [['image', 0, 0]]
                        }},
                        {'Standardization': {
                            'name': 'std',
                            'inbound_nodes': [['cast', 0, 0]]
                        }},
                    ]
                }})
        )
    )
Ejemplo n.º 2
0
 def get_pipeline_config(mode):
     return TFRecordImagePipelineConfig(
         dynamic_pad=False,
         data_files=train_data_file
         if Modes.is_train(mode) else eval_data_file,
         meta_data_file=meta_data_filename,
         feature_processors=FeatureProcessorsConfig({
             'image':
             GraphConfig(input_layers=[['image', 0, 0]],
                         output_layers=[['image_out', 0, 0]],
                         layers=[
                             CastConfig(dtype='float32',
                                        name='image_out',
                                        inbound_nodes=[['image', 0, 0]])
                         ])
         }))
Ejemplo n.º 3
0
    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)