LogoLogo
HomeCommunity
EN master
EN master
  • Introduction
  • Components
  • Quickstart
    • Using Docker
    • Using Java SDK
    • Using Python SDK
    • Using CLI
  • Building from source
  • Installing Binaries
  • Configurations
    • JSON
    • YAML
  • GitHub
  • Examples
    • Java
      • Server
        • Pipeline Steps
          • Image To NDArray Step
          • Python Step
          • DL4J Step
          • Keras Step
          • ONNX Step
          • Tensorflow Step
        • Sequence Pipeline
        • Graph Pipeline
      • Client
        • Running Predictions
        • Inspecting a Server
    • Python
      • Server
        • Pipeline Steps
          • Image To NDArray Step
          • Python Step
          • DL4J Step
        • Sequence Pipeline
        • Graph Pipeline
      • Client
        • Running Predictions
        • Inspecting a Server
    • IPython Notebook
      • Basic
      • ONNX
        • Pytorch (IRIS)
        • Pytorch (MNIST)
      • Keras
      • Tensorflow
      • DL4J
    • CLI
      • Use-Cases
        • Creating a Sequence Pipeline
        • Creating a Graph Pipeline
        • Create Server URL with Inspection Queries
        • Adding Extra Classpaths
        • Multiple Instances of a Server
      • Commands
        • Serve Command
        • Logs Command
        • Inspect Command
        • Profile Command
  • How-To Guides
    • Serving a BMI Model
      • With HTML Content
    • Performing Object Detection
    • RPA Use-Case
    • Showing Metrics
      • Prometheus
      • Grafana
  • References
    • Pipeline Steps
      • IMAGE_TO_NDARRAY
      • IMAGE_CROP
      • IMAGE_RESIZE
      • DEEPLEARNINGL4J
      • KERAS
      • ND4JTENSORFLOW
      • ONNX
      • TENSORFLOW
      • SAMEDIFF
      • CLASSIFIER_OUTPUT
      • REGRESSION_OUTPUT
      • LOGGING
      • BOUNDING_BOX_FILTER
      • BOUNDING_BOX_TO_POINT
      • CROP_GRID
      • CROP_FIXED_GRID
      • DRAW_BOUNDING_BOX
      • DRAW_FACE_KEY_POINT
      • DRAW_GRID
      • DRAW_FIXED_GRID
      • DRAW_HEATMAP
      • DRAW_POINTS
      • DRAW_SEGMENTATION
      • EXTRACT_BOUNDING_BOX
      • SSD_TO_BBOX
      • YOLO_BBOX
      • RELATIVE_TO_ABSOLUTE
      • SHOW_IMAGE
      • FRAME_CAPTURE
      • VIDEO_CAPTURE
      • PERSPECTIVE_TRANSFORM
    • Inference Configuration
      • MQTT Configuration
      • KAFKA Configuration
    • CLI Commands
      • Serve Command
      • Logs Command
      • Inspect Command
      • Pythonpaths Command
      • Build Command
      • Config Command
      • Predict Command
      • Profile Command
  • Change Logs
    • Version 0.1.0
  • Contribution Guidelines
Powered by GitBook
On this page

Was this helpful?

  1. References
  2. Pipeline Steps

IMAGE_TO_NDARRAY

ImageToNDArrayStep is a PipelineStep for converting images to n-dimensional arrays. The exact way that images are converted is highly configurable (formats, channels, output sizes, normalization, etc).

Configs

Descriptions

config

Configuration for how conversion should be performed.

keys

May be null. If non-null, these are the names of images in the Data instance to convert.

outputNames

May be null. If non-null, the input images are renamed to this in the output Data instance after conversion to n-dimensional array.

keepOtherValues

True by default. If true, copy all the other (non-converted/non-image) entries in the input data to the output data.

metadata

False by default. If true, include metadata about the images in the output data. For example, if/how it was cropped, and the original input size.

metadataKey

Sets the key that the metadata will be stored under. Not relevant if metadata == false. Default is @ImageToNDArrayStepMetadata

ImageToNDArrayConfig is configuration for converting an image into n-dimensional array. This configuration is used in config from ImageToNDArrayStep, for example:

inferenceConfiguration.pipeline(SequencePipeline.builder()
                .add(new ImageToNDArrayStep() //add ImageToNDArrayStep() into pipeline to set image to NDArray for input
                        .config(new ImageToNDArrayConfig() //image configuration
                                .width(28)
                                .height(28)
                                .dataType(NDArrayType.FLOAT)
                                .aspectRatioHandling(AspectRatioHandling.CENTER_CROP)
                                .includeMinibatchDim(true)
                                .channelLayout(NDChannelLayout.GRAYSCALE)
                                .format(NDFormat.CHANNELS_FIRST)
                                .normalization(ImageNormalization.builder().type(ImageNormalization.Type.SCALE).build())
                        )
                        .keys("image")
                        .outputNames("input_layer")
                        .keepOtherValues(true)
                        .metadata(false)
                        .metadataKey(ImageToNDArrayStep.DEFAULT_METADATA_KEY))
                .build()

Configs

Descriptions

height

Output array image height. Leave null to convert to the same size as the image height.

width

Output array image width. Leave null to convert to the same size as the image width.

dataType

Data type of the n-dimensional array. Default value is FLOAT.

includeMinibatchDim

If true, the output array will contain an extra dimension for the minibatch number. This will look like (1, Channels, Height, Width) instead of (Channels, Height, Width) for format == CHANNELS_FIRST or (1, Height, Width, Channels) instead of (Height, Width, Channels) for format == CHANNELS_LAST. Default is true.

aspectRatioHandling

An enum to Handle the situation where the input image and output NDArray have different aspect ratios.

CENTER_CROP (crop larger dimension then resize if necessary), PAD (pad smaller dimension then resize if necessary), STRETCH (simply resize, distorting if necessary). Default is CENTER_CROP.

format

The format to be used when converting an Image to an NDArray. Default is CHANNEL_FIRST. Another option is CHANNEL_LAST.

channelLayout

An enum that represents the type (and order) of the color channels for an image after it has been converted to an NDArray. For example, RGB vs. BGR etc, default value is RGB.

normalization

Configuration that specifies the normalization type of an image array values.

listHandling

An enum to specify how to handle a list of input images. Default is NONE.

PreviousPipeline StepsNextIMAGE_CROP

Last updated 4 years ago

Was this helpful?