References

Protobuf

PipelineParameter

Main pipeline message, defined by a name and a list of stages

Example

A typical pipeline
name: "my_pipeline"
random_seed: 0

stages { ... }
stages { ... }
stages { ... }
Field Type Label Default Description
name string optional    
revision uint32 optional    
description string optional    
mem_policy PipelineParameter.MemoryPolicy optional    
cap_rate float optional   Cap pipeline maximum iterations per seconds
random_seed int32 optional    
stages StageParameter repeated    
color_map ColorVal repeated    

PipelineParameter.MemoryPolicy

Name Description
POLICY_AUTO  
POLICY_MANUAL  
POLICY_MINIMUM  

StageParameter

Stage have mandatory name and type, an list of inputs and parameters, specific for the stage type

Example

Generic stage definition
stages {
  name: "stage_name"
  input: "first_input_stage"
  input: "second_input_stage"
  type: StageType
  type_param { ... }
}
Field Type Label Default Description
name string optional   Name of the stage
input string repeated   Name of the input stage(s)
disabled bool optional    
pool_size uint32 optional    
type StageParameter.StageType optional   Stage type specifier. See StageParameter for available stages.
source_param SourceParameter optional    
source_dataset_param SourceDatasetParameter optional    
fixed_window_param FixedWindowParameter optional    
sliding_window_param SlidingWindowParameter optional    
extract_class_param ExtractClassParameter optional    
resize_param ResizeParameter optional    
affine_transform_param AffineTransformParameter optional    
perspective_transform_param PerspectiveTransformParameter optional    
morphology_param MorphologyParameter optional    
threshold_param ThresholdParameter optional    
adaptive_threshold_param AdaptiveThresholdParameter optional    
range_threshold_param RangeThresholdParameter optional    
colorspace_param ColorspaceParameter optional    
color_shift_param ColorShiftParameter optional    
normalization_param NormalizationParameter optional    
padding_param PaddingParameter optional    
arithmetic_logic_param ArithmeticLogicParameter optional    
segmentation_param SegmentationParameter optional    
blur_param BlurParameter optional    
fill_holes_param FillHolesParameter optional    
convex_polygon_param ConvexPolygonParameter optional    
edges_param EdgesParameter optional    
cut_mask_convexities_param CutMaskConvexitiesParameter optional    
remove_areas_param RemoveAreasParameter optional    
stats_filter_param StatsFilterParameter optional    
cut_out_param CutOutParameter optional    
caliper_param CaliperParameter optional    
heatmap_param HeatmapParameter optional    
background_subtractor_param BackgroundSubtractorParameter optional    
count_convexities_param CountConvexitiesParameter optional    
fixed_classifier_param FixedClassifierParameter optional    
marginalization_param MarginalizationParameter optional    
wavelet_param WaveletParameter optional    
ranklet_param RankletParameter optional    
scattering_param ScatteringParameter optional    
svm_segmentation_param SvmSegmentationParameter optional    
max_pooling_param MaxPoolingParameter optional    
class_filter_param ClassFilterParameter optional    
nonmax_suppression_param NonmaxSuppressionParameter optional    
ranking_param RankingParameter optional    
data_augmentation_param DataAugmentationParameter optional    
random_transform_param RandomTransformParameter optional    
random_classifier_param RandomClassifierParameter optional    
color_classifier_param ColorClassifierParameter optional    
neural_network_param NeuralNetworkParameter optional    
svm_param SvmClassifierParameter optional    
overlap_filter_param OverlapFilterParameter optional    
source_socket_param SourceSocketParameter optional    
random_filter_param RandomFilterParameter optional    
contours_finder_param ContoursFinderParameter optional    
shapes_operations_param ShapesOperationsParameter optional    
shapes_filter_param ShapesFilterParameter optional    
elastic_transform_param ElasticTransformParameter optional    
channels_operations_param ChannelsOperationsParameter optional    
index_mask_param IndexMaskParameter optional    
remap_values_param RemapValuesParameter optional    
size_filter_param SizeFilterParameter optional    
distance_filter_param DistanceFilterParameter optional    
select_channels_param SelectChannelsParameter optional    
clip_param ClipParameter optional    
pipelines PipelineParameter repeated    
source_mvimpact_param SourceMVImpactParameter optional    
source_ximea_param SourceXimeaParameter optional    
source_avantes_param SourceAvantesParameter optional    
source_segy_param SourceSegyParameter optional    
source_segy_norm_param SourceSegyNormParameter optional    
custom_param CustomParam optional    

StageParameter.StageType

Available stages

Name Description
SOURCE_IMAGE Read input image(s) from file or device. See SourceParameter.
SOURCE_VIDEO Read input video from file or device. See SourceParameter.
SOURCE_CUSTOM DEPRECATED. See type: CUSTOM.
SOURCE_LMDB Read input images from LMDB database. See SourceParameter.
SOURCE_DATASET  
SOURCE_MVIMPACT DEPRECATED
SOURCE_XIMEA Capture images with a Ximea device. See SourceXimeaParameter.
SOURCE_AVANTES Capture spectrum with an Avantes device. See SourceAvantesParameter.
SOURCE_SEGY Scan SEG-Y files. See SourceSegyParameter.
SOURCE_SEGY_NORM Scan SEG-Y files. See SourceSegyNormParameter.
JOIN Join patches from multiple inputs.
FIXED_WINDOW Extract one or more rectangle sub-patches. See FixedWindowParameter.
SLIDING_WINDOW Extract sub-patches by sliding a rectangle of fixed size through. See SlidingWindowParameter.
EXTRACT_CLASS Extract class from index mask with a certain probability. See ExtractClassParameter.
RESIZE Resize each source patch using the interpolation. See ResizeParameter.
AFFINE_TRANSFORM Apply an affine transformation to input patches. See AffineTransformParameter.
PERSPECTIVE_TRANSFORM Apply a perspective transformation to input patches. See PerspectiveTransformParameter.
MORPHOLOGY Apply morphology operators to input patches. See MorphologyParameter.
THRESHOLD Apply a fixed-level threshold. See ThresholdParameter.
ADAPTIVE_THRESHOLD Apply an adaptive threshold. See AdaptiveThresholdParameter.
RANGE_THRESHOLD Classify the patches accordingly with a range value. See RangeThresholdParameter.
COLORSPACE Change color space of the input. See ColorspaceParameter.
COLOR_SHIFT Shift color value with a fixed offset for each channel. See ColorShiftParameter.
NORMALIZATION Normalize the input. See NormalizationParameter.
PADDING Add a border of specified color to each side. See PaddingParameter.
ARITHMETIC_LOGIC Generate output patches as result of arithmetic logic operations. See ArithmeticLogicParameter.
SEGMENTATION Classify the patches accordingly with the color range specified. See SegmentationParameter.
BLUR Smooth (blur) input patches. See BlurParameter.
FILL_HOLES Fills black connected components. See FillHolesParameter.
CONVEX_POLYGON Draw convex hull of objects in a bitmask. See ConvexPolygonParameter.
EDGES Find edges using the Canny algorithm. See EdgesParameter.
CUT_MASK_CONVEXITIES Draw a black line connecting convexity points. See CutMaskConvexitiesParameter.
REMOVE_AREAS Fill too small or too big blobs in a bitmask. See RemoveAreasParameter.
STATS_FILTER Accept patches only if the selected statistics is inside defined range. See StatsFilterParameter.
CUT_OUT Cut out the patch based on the bounding box of the associated shape. See CutOutParameter.
CALIPER Find the caliper of a shape. See CaliperParameter.
HEATMAP Create a heatmap from a set of classified patches. See HeatmapParameter.
BACKGROUND_SUBTRACTOR Subtract background from the input. See BackgroundSubtractorParameter.
COUNT_CONVEXITIES Classify a patch with the number of convexity points in its shape. See CountConvexitiesParameter.
FIXED_CLASSIFIER Assign a given class to the input patches. See FixedClassifierParameter.
EQUALIZE_HISTOGRAM Equalize histogram of input patches. See cv::equalizeHist
SPARSE_TO_DENSE From groups of patches to 1 root patch with “densified” heatmap
MARGINALIZATION  
WAVELET Perform Wavelet Pyramid Decomposition. See WaveletParameter.
RANKLET Perform 1d ranklet at defined levels of input image. See RankletParameter.
SCATTERING Perform scattering network transform on input image. See ScatteringParameter.
SVM_SEGMENTATION Create the segmentation bitmask with a SVM model. See SvmSegmentationParameter.
MAX_POOLING Perform a subsampling of 2-D patch, extractin max value. See MaxPoolingParameter.
CLASS_FILTER Keep or drop patches using filters based on area and values of each class of the patch. See ClassFilterParameter.
NONMAX_SUPPRESSION Cluster the input patches, according with a distance threshold. See NonmaxSuppressionParameter.
RANKING Filter out a defined number of patches for each class, according with their class value. See RankingParameter.
DATA_AUGMENTATION Augment data by applying affine trasformations to input patches. See DataAugmentationParameter.
RANDOM_TRANSFORM Apply a random transformation to the patches. See RandomTransformParameter.
RANDOM_CLASSIFIER Classify randomly the input patches. See RandomClassifierParameter.
COLOR_CLASSIFIER Classify the patches accordingly with the color range specified. See ColorClassifierParameter.
NEURAL_NETWORK Classify input patches using an ANN. See NeuralNetworkParameter.
SVM_CLASSIFIER Classify input patches with a SVM model. See SvmClassifierParameter.
OVERLAP_FILTER Filter patches by evaluating the overlapping with a reference shape. See OverlapFilterParameter.
SOURCE_SOCKET Emit patches received from a unix socket. See SourceSocketParameter.
RANDOM_FILTER Filter patches randomly with a given probability. See RandomFilterParameter.
CONTOURS_FINDER Find contours in each channel of input pathces. See ContoursFinderParameter.
SHAPES_OPERATIONS Perform operations between shapes of patches. See ShapesOperationsParameter
SHAPES_FILTER Filter shapes of patches. See ShapesFilterParameter
ELASTIC_TRANSFORM Apply elastic deformation to the patches. See ElasticTransformParameter
CONVEX_HULL Find convex hull of shapes of patches.
CHANNELS_OPERATIONS Perform operations between channels of a patch. See ChannelsOperationsParameter
SHAPES_ON_ROOT Remap shapes to root patch.
INDEX_MASK Create an index mask with the shapes and values of input patches. See IndexMaskParameter
COPY_VALUES Copy values from another patch.
SWAP_VALUES Swap pixels/values.
REMAP_VALUES Remap values. See RemapValuesParameter
SIZE_FILTER Filter patches basing on width and height. See SizeFilterParameter
DISTANCE_FILTER Filter patches basing on distance from a reference point. See DistanceFilterParameter
STACK_CHANNELS Stack channels from several input patches
SELECT_CHANNELS Select a subset of channels to form output patches. See SelectChannelsParameter
CLIP Clip patch image
PARALLEL_PIPELINE  
DEBUG_HEATMAP  
CUSTOM Defines a custom stage implemented as a Python object or class. See CustomParam

ColorVal

Color value specification

Field Type Label Default Description
d double repeated   Value of the different channels

RealArray

Array of real numbers specification

Field Type Label Default Description
shape uint32 repeated   Array shape (e.g. shape: 3 shape: 3 is a 3X3 matrix)
shape_str string optional   Array shape, alternative to shape (shape_str: 3X3 is a 3X3 matrix)
d double repeated   Array values. Row major (C) ordering.

StatsMeasures

Statistical measures container. Useful for dataset statistics that can be calculated by aliquispl_lmdb stats.

Field Type Label Default Description
mean RealArray optional   Mean value(s) of the different channels.
stddev RealArray optional   Std value(s) of the different channels.
maxs RealArray optional   Maximum value(s) of the different channels.
mins RealArray optional   Minimum value(s) of the different channels.

Rectangle

Rectangle specifier. Rectangle is described by coordinates, width and height (absolute or relative to the source patch’s width and height) and by an anchor point inside the rectangle

Field Type Label Default Description
x int32 optional   Absolute x-coordinate of the anchor point
rel_x float optional   Relative x-coordinate of the anchor point
y int32 optional   Absolute y-coordinate of the anchor point
rel_y float optional   Relative y-coordinate of the anchor point
width uint32 optional   Absolute width of the rectangle
rel_width float optional   Relative width of the rectangle
height uint32 optional   Absolute height of the rectangle
rel_height float optional   Relative height of the rectangle
anchor Rectangle.AnchorType optional   Anchor point specifier. See Rectangle.AnchorType for available

Rectangle.AnchorType

Name Description
TOP_LEFT Top left corner point of the rectangle
TOP_CENTER Top center point of the rectangle
TOP_RIGHT Top right corner point of the rectangle
MIDDLE_LEFT Middle left point of the rectangle
MIDDLE_CENTER Middle center point of the rectangle
MIDDLE_RIGHT Middle right point of the rectangle
BOTTOM_LEFT Bottom left corner point of the rectangle
BOTTOM_CENTER Bottom center point of the rectangle
BOTTOM_RIGHT Bottom right point of the rectangle

TransformationMatrix

Generic 2d transformation matrix. Default is the identity. | a b c | | d e f | | g h i |

Field Type Label Default Description
a float optional    
b float optional    
c float optional    
d float optional    
e float optional    
f float optional    
g float optional    
h float optional    
i float optional    

SourceParameter

Apply to stages: SOURCE_IMAGE, SOURCE_VIDEO

Read input image(s) or video.

Require a path to a file or device. The path can be glob pattern (e.g. ‘images_*.png’).

If the stage is SOURCE_IMAGE, path can be a text file with a list of images paths to be loaded. Each line must be in the form: image_path [label [x y w h]], where image_path is the absolute or relative path to an image, label is a label to assign to the patch and x y h w are, respectively, the x and y origin and the width and height of a crop of the image. If label is defined, also classes_num must be defined. A file_list_base_path could be defined to load listed images from a defined path. This could be absolute or relative (to the list file directory)

Optionally, a scale (multiplicative constant to apply to all the element of the input array) and a loop flag could be defined.

If all images should be returned at the first iteration, bulk_load flag should be set true.

Available image formats depends on OpenCV.

Note that 16-bit images are always converted to 8-bit images (by dividing for 256).

If load_indexes is true, colors are considered indexed and the index-mask of colors indexes is returned instead of the standard RGB visualization.

Example

Simple source from image
stages {
  name: "result"
  type: SOURCE_IMAGE
  source_param {
    path: "path/to/image"
  }
}
Field Type Label Default Description
path string optional    
scale float optional    
classes_num uint32 optional    
default_class uint32 optional    
loop bool optional    
bulk_load bool optional    
width uint32 optional    
height uint32 optional    
fps uint32 optional    
unbuffered bool optional    
brightness uint32 optional    
contrast uint32 optional    
saturation uint32 optional    
hue float optional    
gain float optional    
exposure float optional    
offset_x float optional    
offset_y float optional    
white_balance_u float optional    
white_balance_v float optional    
white_balance_manual bool optional    
file_list_base_path string optional    
load_multipage bool optional    
load_indexes bool optional    
ximage_meta SourceParameter.XImageMetaType optional    
val_range_min float optional    
val_range_max float optional    

SourceParameter.XImageMetaType

Name Description
INDEX_MASK  
DISCARD  
SHAPES_FLATTEN  

FixedWindowParameter

Apply to stages: FIXED_WINDOW

Extract one or more sub-patches defined by a list of rectangle.

Example

Fixed windows which extract two sub-patches
stages {
  name: "result"
  type: FIXED_WINDOW
  input: "src"
  fixed_window_param {
    rects {
      x: 140
      y: 50
      width: 50
      height: 100
    }
    rects {
      x: 150
      y: 150
      width: 40
      height: 100
    }
  }
}
Field Type Label Default Description
rects Rectangle repeated   List of rectangle specified by absolute or relative coordinates and dimensions. See Rectangle for more definition details.
add_shape bool optional   Whether to add a shape around the output patches
keep_values bool optional   Whether to propagate the values array in the output patches

SlidingWindowParameter

Apply to stages: SLIDING_WINDOW.

Extract sub-patches by sliding a rectangle of fixed size through each source patch. Optionally a second input can be linked to a SLIDING_WINDOW stage, that is a bitmask defining the regions in which the window can actually move. A patch is extracted only when its percentage of overlapping with the bitmask is greater of a given amount.

A sliding window can be of two types: LINEAR or RANDOM. n A LINEAR sliding window starts from the top left corner of the input patches, scanning each one in row-major order using a certain step. A RANDOM sliding window jump randomly in the source patch, ensuring:

  • the bitmask minimum overlap constraint;
  • that each pair of extracted patches do overlap by a maximum amount;

The RANDOM sliding window try to extract max_patches, making max_iterations attempts.

Examples

Linear Sliding window
stages {
  name: "s_win"
  type: SLIDING_WINDOW
  input: "source_stage"
  sliding_window_param {
    width: 256
    height: 256
    step_x: 128
    step_y: 128
  }
}
Random sliding window with bitmask
stages {
  name: "s_win"
  type: SLIDING_WINDOW
  input: "source_stage"
  input: "bitmask_stage"
  sliding_window_param {
    type: RANDOM
    width: 256
    height: 256
    step_x: 128
    step_y: 128
    bitmask_min_overlap: 0.15
  }
}
Field Type Label Default Description
width uint32 optional   width of the sliding window
height uint32 optional   height of the sliding window
type SlidingWindowParameter.SlidingType optional   sliding type: LINEAR - RANDOM
bitmask_min_overlap float optional    
bitmask_value uint32 optional    
step_x uint32 optional   sliding window step in x direction
step_y uint32 optional   sliding window step in y direction
max_overlap float optional    
max_iterations uint32 optional   maximum number of iteration of RANDOM sliding
max_patches uint32 optional   maximum number of patches extracted, attempting max_iteration
center_inside bool optional   if true extract the patch only if its center fall inside the bitmask
add_shape bool optional   Whathever to add a shape around the output patches

SlidingWindowParameter.SlidingType

Name Description
LINEAR Linear sliding window
RANDOM Random sliding window

ResizeParameter

Apply to stages: RESIZE

Resize each source patch using the interpolation.

  • If both width and height are defined, patch is resized to match desired size.
  • If only width or height is defined, patch is resized to match the desired dimension while keeping aspect ratio.
  • If both fx and fy are defined, patch is scaled independently on x and y-axis.
  • If only fx or fy is defined, patch is scaled while keeping aspect ratio.

Both fx and fy have higher priority over width and height.

See:

Example

Resize patch to 200px x 50px
stages {
  name: "resize_width_height"
  type: RESIZE
  input: "src"
  resize_param {
    width: 200
    height: 50
  }
}
Field Type Label Default Description
interpolation InterpolationType optional   Interpolation algorithm to use in resize. See InterpolationType
width int32 optional   Desired width
height int32 optional   Desired height
fx float optional   Desired scale along x-axis
fy float optional   Desired scale along y-axis

AffineTransformParameter

Apply to stages: AFFINE_TRANSFORM

Apply an affine transformation to input patches, defined by resize, rotation, shear and interpolation method.

The stage can build a bitmask that is a parallelogram defining the area that contains actual transformed image (the rest are “outliers areas”). The bitmask is attached as the parent of the transformed image. The stage can crop outliers of the transformation in order to obtain a rectangular output image that contain only actual pixels.

Example

Generic affine transform
stages {
  name: "affine"
  input: "src"
  type: AFFINE_TRANSFORM
  affine_transform_param {
    resize {
      fx: 0.25
      fy: 0.25
    }
    rotation: 45
    shear: 20
  }
}
Field Type Label Default Description
interpolation InterpolationType optional   Iterpolation type used for transforming
resize ResizeParameter optional   New size, as (new_width or fx) and (new_height or fy)
rotation float optional   Rotation in degrees, clockwise
shear float optional   Shear in degrees, clockwise, apply a force along positive x-axis
transformation TransformationMatrix optional   Use transformation matrix instead
inverse bool optional   set transform as the inverse (dst -> src)
build_bitmask bool optional   Whether to build a bitmask of the transform.
crop_outliers bool optional   Whether to crop the outliers (and some “good” transformed image)
padding_color ColorVal optional    

PerspectiveTransformParameter

Apply to stages: PERSPECTIVE_TRANSFORM

Field Type Label Default Description
interpolation InterpolationType optional   Iterpolation type used for transforming
transformation TransformationMatrix optional   Warp transformation matrix
resize ResizeParameter optional   New size, as (new_width or fx) and (new_height or fy)
inverse bool optional   set transform as the inverse (dst -> src)
padding_color ColorVal optional    
replicate_border bool optional    

MorphologyParameter

Apply to stages: MORPHOLOGY

Apply morphology operators to input patches (they must be images).

See opencv documentation for more details:

Example

Erode two times with a 3x3 square kernel
stages {
    name: "erode"
    input: "thresh"
    type: MORPHOLOGY
    morphology_param {
       type: ERODE
       iterations_num: 2
       kernel {
         shape_str: "3x3"
         d:255 d:255 d:255
         d:255 d:255 d:255
         d:255 d:255 d:255
       }
     }
  }
Field Type Label Default Description
type MorphologyParameter.MorphologyType optional   Type of morphology operation
kernel RealArray optional   Kernel of morphology operation
iterations_num int32 optional   Number of iterations

MorphologyParameter.MorphologyType

Available morphology operators

Name Description
ERODE  
DILATE  
OPEN  
CLOSE  
GRADIENT  
TOP_HAT  
BLACK_HAT  

ThresholdParameter

Apply to stages: THRESHOLD

Apply a fixed-level threshold to input patches. Input patches must be single-channel, 8-bit int or 32-bit floats.

See opencv documentation for more details:

Example

Otus’s thresholding
stages {
  name: "otsu_binary"
  input: "gray"
  type: THRESHOLD
  threshold_param {
    type: OTSU_BINARY
  }
}
Field Type Label Default Description
type ThresholdParameter.ThresholdType optional   Type of threshold. See ThresholdParameter.ThresholdType
threshold float optional   Threshold value (used only with BINARY or BINARY_INV)

ThresholdParameter.ThresholdType

Available threshold method.

See opencv documentation for more details: cv::ThresholdTypes

Name Description
BINARY  
BINARY_INV  
OTSU_BINARY  
OTSU_BINARY_INV  
TRIANGLE_BINARY  
TRIANGLE_BINARY_INV  

AdaptiveThresholdParameter

Apply to stages: ADAPTIVE_THRESHOLD

Apply an adaptive threshold to input patches.

See opencv documentation for more details:

Example

Adaptive threhsold with mean-method and a block-size of 25x25
stages {
   name: "binary_mean_c"
   input: "gray"
   type: ADAPTIVE_THRESHOLD
   adaptive_threshold_param {
     type: BINARY
     adaptive_method: MEAN_C
     block_size: 25
   }
}
Field Type Label Default Description
type AdaptiveThresholdParameter.ThresholdType optional   Type of threshold. See ThresholdParameter.ThresholdType
adaptive_method AdaptiveThresholdParameter.AdaptiveMethod optional   Adaptive thresholding algorithm to use. See AdaptiveThresholdParameter.AdaptiveMethod
block_size uint32 optional   Size of pixel neighborhood that is used to calculate a threshold value. Must be odd.
sub_const float optional   Constant subtracted from the mean or weighted mean

AdaptiveThresholdParameter.ThresholdType

Name Description
BINARY  
BINARY_INV  

AdaptiveThresholdParameter.AdaptiveMethod

Name Description
MEAN_C  
GAUSSIAN_C  

NonmaxSuppressionParameter

Apply to stages: NONMAX_SUPPRESSION

Cluster the input patches, according with a distance threshold.

A first cluster is defined from the patch with the highest class value. The other patches are added to the cluster if its distance, in the root patch, from the cluster centroid is smaller than a thresholding parameter. n A second cluster is created from the outliers of the first cluster with the same procedure, and so on while each patch is assigned to a cluster.

Clusters with less than a minimum patches number are discarded.

Another implementation of the algorithm is available, based on Dbscan clustering. See scikit-learn documentation for more details: - sklearn.cluster.DBSCAN

At the output, for each cluster a patch is produced with the dimensions of the minimum rectangle which contains all the patches of the cluster. The class cluster is calculated adding toghether, for each class, the class values of the patches and considering the class with the highest value obtained. The cluster class value is assigned taking the max class value of the patches of that class in the cluster.

Example

Cluster input patches ensuring a minimum patch number of 5
stages {
   name: "non_max"
   type: NONMAX_SUPPRESSION
   input: "class_filter"
   nonmax_suppression_param {
   threshold: 10
   min_patches_num: 5
   }
}
Field Type Label Default Description
method NonmaxSuppressionParameter.SuppressionMethod optional   Method adopted for suppresion. See SuppressionMethod for details.
threshold float optional   Euclidean distance threshold value for clustering
min_patches_num uint32 optional   Minimum number of patches per cluster

NonmaxSuppressionParameter.SuppressionMethod

Name Description
EUCLIDEAN_DISTANCE  

RankingParameter

Apply to stages: RANKING

Filter out a defined number of patches for each class, according with their class value.

Input patches originated from different roots can be grouped. In this case the group are treated separately and the number of the output patches is consistence with the number of the roots.

Example

This stage filter out only 1 patch of class 1 for each root
stages {
   name: "rank_stage"
   type: RANKING
   input: "previous_stage_name"
   ranking_param {
       class_rank_def: "0:0, 1:1, 2:0"
       group_by_root: true
   }
}
Field Type Label Default Description
class_rank_def string optional   Classes identification and desired number of patch(es) ( i.e “<classid>:<limit>[:<offset>] [, <classid>:<limit>[:<offset>] …]” )
group_by_root bool optional   Enable the grouping by root.

DataAugmentationParameter

Apply to stages: DATA_AUGMENTATION

Augment data by applying affine trasformations to input patches.

The stage resizes, shears and rotates images in specified evenly spaced intervals. n The resize interval can be on a linear-scale or on a log-scale by setting the resize_step_method parameter. n Resize can be bound on x and y-axis, i.e. fx and fy are incremented toghether, by setting the resize_step_bind to true, otherwise each increment is independent to the other, i.e. for each fx, fy takes all the values in { fy }_n. n Patches can also be flipped at the end of the transformation.

Stage can build the bitmask of each transformation.

Example

Augment data by rotatins and scalings
stages {
   name: "data_augment"
   type: DATA_AUGMENTATION
   input: "source_stage"
   data_augmentation_param {
       rotation_start: 0
       rotation_end: 360
       rotation_step: 10

       resize_step_method: LINEAR
       resize_step_bind: true

       resize_start {
           fx: 0.1
           fy: 0.1
       }

       resize_step_x: 0.1
       resize_step_y: 0.1

       resize_end {
           fx: 1.1
           fy: 1.1
       }
}
Field Type Label Default Description
interpolation InterpolationType optional   Interpolation algorithm to use in resize. See InterpolationType
rotation_start float optional   Starting rotation in degree (included)
rotation_end float optional   End rotation in degree (not included)
rotation_step float optional   Rotation step in degree
shear_start float optional   Starting shear (included)
shear_end float optional   Ending shear (not included)
shear_step float optional   Shear step
resize_start ResizeParameter optional   Start resize factor
resize_end ResizeParameter optional   End resize factor
resize_step_x float optional   Resize step on x axis
resize_step_y float optional   Resize step on y axis
resize_step_method DataAugmentationParameter.ResizeStepMethod optional   Resize type of scale
resize_step_bind bool optional   Joinyly or independently scale on each axis
flip_x DataAugmentationParameter.FlipType optional   Type of flip along x
flip_y DataAugmentationParameter.FlipType optional   Type of flip along y
build_bitmask bool optional   Build a bitmask for each tranformation (see: AffineTransformParameter)
crop_outliers bool optional   Crop outliers for each tranformation (see: AffineTransformParameter)

DataAugmentationParameter.ResizeStepMethod

Name Description
LINEAR Sample step uniformly on a linear-scale fi_n = fi_0 + n * resize_step_i, with i in { x, y }
LOG_UNIFORM Sample step uniformly on a log-scale fi_(n+1) = 1 / (1 / fi_n - resize_step_i) if fi_n < 1 fi_(n+1) = fi_n + resize_step_i otherwise with i in { x, y }

DataAugmentationParameter.FlipType

Flip types lists

Name Description
NONE never do the flip on the specified axis
RANDOM randomly choose when to do the flip
ALWAYS do the flip on the specified axis

RandomTransformParameter

Apply to stages: RANDOM_TRANSFORM

Apply a random transformation to the patch by sampling random values in the defined intervals for each transformation kind.

The patch can be rotated, sheared, resized or flipped. Colors can be shifted and gamma corrected.

Example

Generic random transform
stages {
   name: "all"
   type: RANDOM_TRANSFORM
   input: "src"
   random_transform_param {
       resize_min { fx: 0.7 }
       resize_max { fx: 1.3 }
       rotation_min: 0
       rotation_max: 360
       flip_x: true
       flip_y: true
       color_shift {
           basis: {
               shape_str: "3x3"
               d: 0.6 d: 0.7 d: 0.4
               d: 0.8 d: -0.5 d: -0.2
               d: -0.1 d: -0.5 d: 0.9
           }
           magnitude { d: 7.1 d: 5.5 d: 2.6 }
           stddev: 5
       }
       gamma_min: 0.5
       gamma_max: 1.5
   }
}
Field Type Label Default Description
interpolation InterpolationType optional   Interpolation algorithm to use in resize. See InterpolationType
rotation_min float optional   Min rotation in degree
rotation_max float optional   Max rotation in degree
shear_min float optional   Min shear
shear_max float optional   Max shear
resize_min ResizeParameter optional   Min scale factor
resize_max ResizeParameter optional   Max scale factor
flip_x bool optional   Randomly flip horizontally if true
flip_y bool optional   Randomly flip vertically if true
build_bitmask bool optional   Build a bitmask for each tranformation (see: AffineTransformParameter)
color_shift RandomTransformParameter.RandomColorShift optional   Random color shift parameters. See RandomTransformParameter.RandomColorShift
gamma_min float optional   Min gamma
gamma_max float optional   Max gamma
seed uint32 optional   Random seed reserved for the stage

RandomTransformParameter.RandomColorShift

Field Type Label Default Description
basis RealArray optional   The basis of color vectors used for random color shift (e.g. eigen vectors of PCA over training set)
magnitude ColorVal optional   Magnitude of transformation for each basis vector (e.g. eigen values of PCA over training set)
stddev float optional   Standard deviation of the normal variate distribution

RandomClassifierParameter

Apply to stages: RANDOM_CLASSIFIER

Classify randomly the input patches.

Example

Classify randomly input patches in 3 classes
stages {
   name: "rand_class"
   type: RANDOM_CLASSIFIER
   input: "input_stage_name"
   random_classifier_param {
       classes_num: 3
   }
}
Field Type Label Default Description
classes_num uint32 optional   number of classes to be used
load_iter_exp uint32 optional   if defined, perform 2**load_iter_exp iteration (simulate time-consuming classification)

FixedClassifierParameter

Apply to stages: FIXED_CLASSIFIER

Assign a given class to the input patches.

Example

Assign class 3 to the input patches (the total classes number is 5)
stages {
   name: "fix_class"
   type: FIXED_CLASSIFIER
   input: "input_stage_name"
   fixed_classifier_param {
       class_index: 3
       classes_num: 5
   }
}
Field Type Label Default Description
class_index uint32 optional   index of the class
classes_num uint32 optional   number of classes to be used

ColorClassifierParameter

Apply to stages: COLOR_CLASSIFIER

Classify the patches accordingly with the color range specified.

For each class, more than one range can be defined.

If range of different classes overlap, the first class defined has priority.

The patches that lie out of range class definition are assigned to class 0.

Optionally a bitmask can be linked as second input, defining the regions in which the range check is performed.

Example

Classify the patches in the first and second ranges in the class 1, the patches in the third range in the class 2
stages {
   name: "color_class"
   type: COLOR_CLASSIFIER
   input: "segmentation"
   color_classifier_param {
       class { # First class
           range { # first range
               lower_bound { d: 0 d: 0 d: 50 }
               upper_bound { d: 20 d: 255 d: 255 }
           }
           range { # second range
               lower_bound { d: 121 d: 0 d: 50 }
               upper_bound { d: 180 d: 255 d: 255 }
           }
       }
       class { # Second class
           range { # third range
               lower_bound { d: 21 d: 0 d: 50 }
               upper_bound { d: 35 d: 255 d: 255 }
           }
       }
   }
}
Field Type Label Default Description
class ColorClassifierParameter.ColorClass repeated   color range descriptor of each class. See ColorClass for definition details
normalize bool optional   DEPRECATED
debug bool optional   NOT YET IMPLEMENTED

ColorClassifierParameter.ColorClass

List of ranges that identify a class

Field Type Label Default Description
range RangeThresholdParameter repeated   See RangeThresholdParameter for definition details

NeuralNetworkParameter

Apply to stages: NEURAL_NETWORK

Classify input patches using an ANN, defined by a model file and a deploy file created with Caffe framework.

See Caffe for implementation details.

Optionally the classification can be run using the fully-convolutional method.

Optionally the fully_cluster method can be used to cluster the results: all the contigous patches of the same or different classes are clustered together. Each cluster produces a new single patch with value equal to the maximum of the cluster and size equal to the minimum enclosing rectangle containing all the patches of that cluster.

In the decoration phase a circle centered on the center of the maxima of the cluster is drawn. The radius of the circle is equal to the distance between the center of the maxima and the farthest maximum (1 if there is only one maximum)(?).

Optionally the classification can be run using the GPU.

Example

Classification of input patches with a CNN in fully-convolutional mode and running on the GPU
stages {
  name: "classes"
  type: NEURAL_NETWORK
  input: "src"
  neural_network_param {
    scale: 0.0039215 #1/255
    model: "net.caffemodel"
    deploy: "deploy.prototxt"
    fully_deploy: "deploy_fully.prototxt"
    fully_subst_layers: "fc3 => fc3-conv, fc4 => fc4-conv, fc5 => fc5-conv"
    gpu: true
  }
}
Field Type Label Default Description
framework NeuralNetworkParameter.NeuralNetworkFramework optional   Which framework to use
model string optional   Contains the parameters of the network (e.g. /path/to/model.caffemodel).
deploy string optional   Describe the topology of the network (e.g. /path/to/deploy.prototxt).
scale float optional   Scale the input by a constant factor.
mean_file string optional   Contains the file for input normalization (e.g. /path/to/mean_image.png)
fully_deploy string optional   Describe the topology of the fully convolutional network (e.g. /path/to/fully_deploy.prototxt).
fully_subst_layers string optional   Mapping of layer names from classic CNN to a fully CNN (e.g. “fc1=>fc1-conv,fc2=>fc2-conv”)
fully_cluster bool optional   Enable the fully cluster method.
aggregation_policy NeuralNetworkParameter.ClassesAggregationPolicy optional   All the contigous patches to cluster together. Default: classes separated.
gpu bool optional   Run the ANN using gpu.
gpu_id uint32 optional   Which GPU to use on multi-GPU systems
disable_packing bool optional   Disabling packing patches of the same shape into a single batch
disable_heatmap_packing bool optional   Disabling packing patches when using heatmap_multiplier
heatmap bool optional   Return an heatmap
heatmap_multiplier uint32 optional   Evaluate and merge multiple heatmaps progressively shifting the source image
heatmap_multiplier_stride uint32 optional   Stride on source image for multiple heatmaps evaluation
heatmap_rounding NeuralNetworkParameter.HeatmapRounding optional    

NeuralNetworkParameter.ClassesAggregationPolicy

Specify the clas aggregation policy

Field Type Label Default Description
aggregate string repeated   Classes to aggregate (e.g. aggregate: “1,2” aggregate: “2,3”)

NeuralNetworkParameter.NeuralNetworkFramework

Name Description
CAFFE  
KERAS  

NeuralNetworkParameter.HeatmapRounding

Name Description
CEIL  
ROUND  
FLOOR  

SvmClassifierParameter

Apply to stage: SVM_CLASSIFIER

Perform binary image classification with the provided SVM model.

Patches are given values based on the distance of the sample from the hyperplane. Therefore output patches has two value that are one the negative of the other.

The SVM model can be trained with the aliquis_svm_train host. The host can train linear SVM models (with clas-liblinear parameter) or kernel SVM models (with clas-libsvm parameter).

For other info, look at the help with aliquis_svm_train -h

Example

SVM classification
stages {
  name: "svm"
  type: SVM_CLASSIFIER
  input: "src"
  svm_param {
    model: 'svm_model.npz'
  }
}
Field Type Label Default Description
model string optional   SVM model file

WaveletParameter

Apply to stages: WAVELET

Perform the 2d wavelet decomposition of input image.

To use this stage, PyWavelets is (pip install PyWavelets) and Aliquis must be built with BUILD_SUPPORT_WAVELET=1.

The output patch is a representation of the pyramid decomposition of the input patch, up to the max_lev_num level. If it is not specified, the decomposition is performed up to the maximum permitted level.

The wavelet type can be selected by one of those available in PyWavelet.

The input image is extendend before computing the transformation. Available pad_mode are: zero, constant, symmetric, reflect, periodic, smooth, periodization.

If input patch has more than one channel (e.g. RGB, HSL, …), the wavelet decomposition is performed on each channel independetly.

Example

Perform Wavelet Decomposition
stages {
  name: "wavelet"
  type: WAVELET
  input: "src"
  wavelet_param {
    max_level_num: 4
    type: 'db4'
    pad_mode: 'symmetric'
  }
}
Field Type Label Default Description
max_lev_num int32 optional   Number of level of the wavelet pyramid
packed bool optional   Not Implemented Yet
type string optional   Wavelet type
pad_mode string optional   Padding mode

RankletParameter

Apply to stages: RANKLET

Perform the 1d ranklet at defined levels of input image.

Input patch must be of shape 1xN or Nx1. Output patch will be composed of L rows, where L is the number of levels and M columns, where M is the max width of the ranklet among defined levels.

Each level is stacked vertically and centered horizontally

Example

Perform Ranklet
stages {
  name: "ranklet"
  type: RANKLET
  input: "src"
  ranklet_param {
    levels: 2
    levels: 3
    levels: 4
  }
}
Field Type Label Default Description
levels int32 repeated   levels to be computed

MaxPoolingParameter

Apply to stages: MAX_POOLING

Perform a subsampling of 2-D patch(es) sliding a fixed window across the input and extracting its maximum value.

The sliding stride is set to one and the sub-patch(es) have dimensions: > Wo = Wi - sub_window_w n > Ho = Hi - sub_window_h

Field Type Label Default Description
sub_window_w int32 optional   Pooling window width
sub_window_h int32 optional   Pooling window height

ColorspaceParameter

Apply to stages: COLORSPACE

Change color space of the input.

Conversion are made passing first through BGR format and then to the specified one. See OpenCV documentation for more details: Color Conversion in OpenCV

Custom conversions can be performed from BGR to GRAY or from HSV to GRAY.

In the first case r,g,b coefficient can be defined in order to weight the different channel:

> GRAY = b_coeff*B + g_coeff*G + r_coeff*R.

In the latter, gamma exponents can be specified and the following conversion is performed:

> GRAY = H^gamma_1 * S^gamma_2 * V^gamma_3.

Both custom conversions follow a saturation policy on pixel values.

Example

Convert to HSV
stages {
  name: "hsv"
  type: COLORSPACE
  input: "src"
  colorspace_param {
    color_format: HSV
  }
}
Convert to grayscale
stages {
  name: "gray"
  type: COLORSPACE
  input: "src"
  colorspace_param {
    color_format: GRAY
  }
}
Custom conversion from BGR to GRAY
stages {
  name: "source_gray"
  type: COLORSPACE
  input: "source"
  colorspace_param {
    color_format: GRAY
    conv_options {
      conv_type: GRAYSCALE_CUSTOM
      b_coeff: 0.33
      g_coeff: 0.33
      r_coeff: 0.33
    }
  }
}
Field Type Label Default Description
color_format ColorFormat optional   Output colorspace of the patch(es). See ColorFormat for available formats.
conv_options ColorspaceParameter.ColorspaceConversionOptions optional   Conversion options for GRAY color_format output.

ColorspaceParameter.ColorspaceConversionOptions

Field Type Label Default Description
conv_type ColorspaceParameter.ColorspaceConversionOptions.ConversionType optional   Conversion type for GRAY color_format output.
r_coeff float optional   R-channel coefficient for GRAYSCALE_CUSTOM.
g_coeff float optional   G-channel coefficient for GRAYSCALE_CUSTOM.
b_coeff float optional   B-channel coefficient for GRAYSCALE_CUSTOM.
gamma_1 float optional   H-exponent for GRAYSCALE_GAMMA.
gamma_2 float optional   S-exponent for GRAYSCALE_GAMMA.
gamma_3 float optional   V-exponent for GRAYSCALE_GAMMA.

ColorspaceParameter.ColorspaceConversionOptions.ConversionType

Gray conversion type

Name Description
GRAYSCALE_REC_601 Conversion with coefficient b: 0.1140 g: 0.5870 r: 0.2990 for the BGR channels.
GRAYSCALE_REC_709 Conversion with coefficient b: 0.0722 g: 0.7152 r: 0.2126 for the BGR channels.
GRAYSCALE_GAMMA Conversion from HSV to GRAY with custom gamma exponents.
GRAYSCALE_CUSTOM Conversion from BGR to GRAY with custom bgr coefficients.

ColorShiftParameter

Apply to stages: COLOR_SHIFT

Shift color value with a fixed offset for each channel.

Example

Make image more reddish
stages {
  name: "out"
  input: "src"
  type: COLOR_SHIFT
  color_shift_param {
    offset { d: 0.1 d: 0 d: 0 }
  }
}
Field Type Label Default Description
offset ColorVal optional   Shift value(s)

RangeThresholdParameter

Apply to stages: RANGE_THRESHOLD

Perform threshold on the elements of the patch that lie between two specified boundary.

See OpenCV documentation for more details: cv::inRange

Example

Bitmask of green, saturated pixels
stages {
  name: "green_bitmask"
  type: RANGE_THRESHOLD
  input: "src_hsv"
  range_threshold_param {
    lower_bound { d: 100 d: 100 d: 100 }
    upper_bound { d: 140 d: 255 d: 255 }
  }
}
Field Type Label Default Description
lower_bound ColorVal optional   lower boundary. Can be single or multi-channel (i.e. {d:C1_lbound d:C2_lbound d:C3_lbound})
upper_bound ColorVal optional   upper boundary. Can be single or multi-channel (i.e. {d:C1_ubound d:C2_ubound d:C3_ubound})

ClassFilterParameter

Apply to stages: CLASS_FILTER

Keep or drop patches using filters based on area and values of each class of the patch.

Each input patch is kept only if all conditions are verified at the same time.

Example

Exclude patches with class “0” or max value less than 0.9
stages {
  name: "out"
  type: CLASS_FILTER
  input: "classifier"
  class_filter_param {
    class_exclude: "0"
    value_threshold: 0.9
  }
}
Field Type Label Default Description
default_policy ClassFilterParameter.FilterDefaultPolicy optional   Behaviour for classes not included in class_include/class_exclude lists
value_threshold float optional   Keep patch only if greatest value is greater than this threshold
area_threshold float optional   Keep patch only if area (w*h) is greater than this threshold
class_include string optional   Keep patch if the class with greatest value is included in this set
class_exclude string optional   Drop patch if the class with greatest value is included in this set

ClassFilterParameter.FilterDefaultPolicy

Policy for classes not included in class_include/class_exclude lists

Name Description
CLASS_ACCEPT Default keep patch if not included in any list
CLASS_REJECT Default drop patch if not included in any list

SourceMVImpactParameter

Parameters for MVImpact device. Deprecated

Field Type Label Default Description
device_serial string optional    
width uint32 optional    
height uint32 optional    
exposure_time float optional   uint32 fps = 7;

SourceXimeaParameter

Apply to stages: SOURCE_XIMEA

Acquire images from a Ximea camera.

Example

Field Type Label Default Description
device_serial string optional   Serial ID
timeout uint32 optional   Timeout for image get operation (ms)
exposure float optional   Exposure time (ms)
gain float optional   Gain (dB)
offset_x uint32 optional   Offset of the returned crop on x-axis (px)
offset_y uint32 optional   Offset of the returned crop on y-axis (px)
width uint32 optional   Width of the returned crop on x-axis (px)
height uint32 optional   Height of the returned crop on y-axis (px)
color bool optional   Whether to get a color image or a grayscale image
white_point ColorVal optional   White point for white balance
sharpness float optional   Sharpness
gammaY float optional   Gamma of Y component
gammaC float optional   Gamma of C component
trigger bool optional   Whether to use the hardware trigger on GPIO1
soft_trigger bool optional   Whether to use the software trigger
bandwidth_limit uint32 optional    
warmup_pattern string optional    

SourceAvantesParameter

Apply to stages: SOURCE_AVANTES

Acquire data from a Avantes spectrometer.

The stage return a row image of shape 1xN, where N is the number of pixels of the sensor. Each pixel represent radiation intensity of a specific wavelenght range. Sensor values are converted from int16 to float32 to avoid loosing precision.

Patches can be processed with any stage that can support images with 1px height.

Field Type Label Default Description
device_serial string optional   Serial ID
timeout uint32 optional   Timeout for image get operation (ms)
integration_time float optional   Integration (i.e. exposure) time (ms)
start_pixel uint32 optional   Start pixel (i.e. wavelength)
stop_pixel uint32 optional   End pixel (i.e. wavelength)
integration_delay float optional   Delay between trigger and acquisition (ns)
averages_num uint32 optional    
dark_correction bool optional    
dark_correction_forget_percentage uint32 optional   in [0-100]
smooth_pixels uint32 optional    
trigger bool optional    
trigger_sync bool optional    
trigger_source_level bool optional   false->edge, true->level
strobe_control uint32 optional    
laser_delay float optional    
laser_pulse_width float optional    
saturation_detection uint32 optional   0->off, 1->on, 2->autocorrect (only with averages_num=1)

ScatteringParameter

Field Type Label Default Description
M uint32 optional   M, number of layers
J uint32 optional   J, number of scalings
L uint32 optional   L, number of rotations
mosaic bool optional   whatever to output a mosaic representation (for visualizaation) or single image with many channels (for classification)

NormalizationParameter

Apply to stages: NORMALIZATION

Normalize the input following the formula:

> p’ = (p - offset) * (mult_coeff * scale) + add_coeff

where p’ and p are the output and input patch(es) respectively, whereas the other parameters are specified below.

Field Type Label Default Description
stats_path string optional   Statistical measures from StatsMeasures (i.e. stats_path: “/path/to/stats.apb”).
method NormalizationParameter.NormalizationMethod optional   Normalization method.
add_coeff float optional   Normalization addittive coefficient.
mult_coeff float optional   Normalization multiplier coefficient.
stddev_scale float optional   Standard deviation scaling.

NormalizationParameter.NormalizationMethod

Offset and scale definition method

Name Description
RESCALING offset = mins, scale = 1 / (maxs - mins). See StatsMeasures for mins, maxs definition.
RELATIVE_RESCALING offset = min(p), scale = 1 / (max(p) - min(p))
STANDARDIZATION offset = mean, scale = 1 / (stddev_scale * stddev). See StatsMeasures for mean, stddev definition.

PaddingParameter

Apply to stage: PADDING

Add a border with specified policy to each side width different dimensions

Example

Add border on each side with color high only on first channel (red if color format of the patch is RGB)
stages {
  name: "out"
  type: PADDING
  input: "src"
  padding_param {
    size_left: 50
    size_right: 50
    size_top: 10
    size_bottom: 10
    color { d: 255 d: 0 d: 0 }
    border_type: CONSTANT
  }
}
Field Type Label Default Description
size_left uint32 optional   Left border size(in px)
size_right uint32 optional   Right border size(in px)
size_top uint32 optional   Top border size(in px)
size_bottom uint32 optional   Bottom border size(in px)
color ColorVal optional   Color of the border
border_type PaddingParameter.Border optional   Copy border policy

PaddingParameter.Border

Name Description
CONSTANT iiiiii|abcdefgh|iiiiiii with some specified i
REPLICATE aaaaaa|abcdefgh|hhhhhhh
REFLECT fedcba|abcdefgh|hgfedcb
WRAP cdefgh|abcdefgh|abcdefg
REFLECT_101 gfedcb|abcdefgh|gfedcba

CaliperParameter

Apply to stages: CALIPER

Find the caliper of a blob in a bitmask.

This stage expects the first input to be a bitmask of a single blob. Then it searches the two perpendicular lines that pass through the center (baricenter) of the blob and that are oriented as the second moments. Finally it searches the maximum segments that fits inside the blob on each line, that are the maximum and minimum axis of the blob.

If a second input is given, it is expected to be a patch with a shape that represents a point that should be on the main line to estimate its tilt (e.g. a stalk of a fruit).

Field Type Label Default Description
cross_major_axis bool optional   caliper is on the axis perpendicular the major one
simmetry_ratio float optional   threshold of the semiaxes ratio below which the asimmetry is corrected
correction_policy CaliperParameter.CorrectionPolicy optional   policy for the asimmetry correction
match_roots bool optional    

CaliperParameter.CorrectionPolicy

Name Description
DOUBLE_MIN in case of asimmetry sets the caliper value to the double of the minor semiaxis and modifies the shape
DOUBLE_MAX in case of asimmetry sets the caliper value to the double of the major semiaxis and modifies the shape
ZERO in case of asimmetry sets the caliper value to zero but doesn’t modify the shape

ArithmeticLogicParameter

Apply to stage: ARITHMETIC_LOGIC

Generate output patches as result of arithmetic logic operations

Depending on choosed operation, the stage can have multiple inputs (arity of the operation). Output patches are added as supatches of parentid input patches.

Images values can be clipped using min and max value ranges of input patches.

Example

Bitwise AND between two inputs
stages {
  name: "out"
  type: ARITHMETIC_LOGIC
  input: "src_bitmask_mod"
  input: "src"
  arithmetic_logic_param {
    op: BITWISE_AND
  }
}
Field Type Label Default Description
op ArithmeticLogicParameter.Operation optional   Operation type. See: ArithmeticLogicParameter.Operation
parentid uint32 optional   Input id to use as parent patch
const float optional   Constant used in OFFSET and SCALE
clipping bool optional   Whether to clip output values or not

ArithmeticLogicParameter.Operation

Name Description
ADD p1 + … + pn (N-ary)
SUBTRACT p1 - p2 (Binary)
MULTIPLY p1 * … * pn (N-ary)
DIVIDE p1 / p2 (Binary)
OFFSET p1 + k (Unary)
SCALE p1 * k (Unary)
BITWISE_AND p1 & … & pn (N-ary)
BITWISE_OR p1 | … | pn (N-ary)
BITWISE_XOR p1 ^ … ^ pn (N-ary)
BITWISE_NOT ~p1 (Unary)

SegmentationParameter

Apply to stage: SEGMENTATION

Create shapes out of blobs in bitmask image. The research can be of two types: contours or distance transform.

In case of CONTOURS, the stage searches for contours of blobs in a bitmask image (second input) of an source image (first input). Than it fit the contours with the defined shape, in order to return a patch with shapes of each blob on the source image.

In case of DISTANCE_TRANSFORM, the cv::distanceTransform algorithm is used to process the bitmask and find shapes.

Example

Exact segmentation without fitting (i.e. return polygons)
stages {
  name: "out"
  type: SEGMENTATION
  input: "src"
  input: "bitmask"
  segmentation_param {
    shape: POLYGON
    convex_hull: true
    match_parents: true
  }
}
Field Type Label Default Description
type SegmentationParameter.Type optional   Method of segmentation
shape SegmentationParameter.Shape optional   Fitted shape
match_parents bool optional   Whether to match source patches and bitmasks by parents
approx_epsilon float optional   Simplify contours before fitting
spline_degree uint32 optional   Degree of the interpolating spline
spline_smoothness float optional   Smoothness of the interpolating spline
spline_step float optional   Setp of the interpolating spline
convex_hull bool optional   Whether to use the convex hull when fitting shape
separate bool optional    
area_threshold_min float optional   Min area to return a shape
area_threshold_max float optional   Max area to return a shape
size_threshold_min float optional   Min size of an object with the DISTANCE_TRANSFORM
size_threshold_max float optional   Max size of an object with the DISTANCE_TRANSFORM

SegmentationParameter.Type

Type of segmentation

Name Description
CONTOURS  
DISTANCE_TRANSFORM  

SegmentationParameter.Shape

Shape to be fitted

Name Description
ROTATED_RECTANGLE  
RECTANGLE  
INNER_CIRCLE  
OUTER_CIRCLE  
ELLIPSE  
POLYGON  

BlurParameter

Apply to stage: BLUR

Smooth (blur) input patches.

See OpenCV documentation for more details:

Example

Gaussian blur with 5x5 kernel
stages {
  name: "out"
  type: BLUR
  input: "src"
  blur_param {
    type: GAUSSIAN
    kernel_width: 5
    kernel_height: 5
    sigma_x: 1.0
    sigma_y: 1.0
  }
}
Field Type Label Default Description
type BlurParameter.Type optional   Blur method
kernel_size uint32 optional   Positive and odd (only MEDIAN, BILATERAL)
kernel_width uint32 optional   Positive and odd (only GAUSSIAN, BOXFILTER)
kernel_height uint32 optional   Positive and odd (only GAUSSIAN, BOXFILTER)
sigma float optional   Sigma parameter (Only BILATERAL)
sigma_x float optional   Sigma x parameter (Only GAUSSIAN)
sigma_y float optional   Sigma y parameter (Only GAUSSIAN)
sigma_color float optional   Sigma color parameter (Only BILATERAL)
normalize bool optional   area normalization, true for mean, false for sum (only BOXFILTER)

BlurParameter.Type

Name Description
GAUSSIAN convolves each point in the input array with a Gaussian kernel and then sums them all to produce the output array
BOXFILTER each output pixel is the mean or sum of its kernel neighbors
MEDIAN replaces each pixel with the median of its neighboring pixels (located in a square neighborhood around the evaluated pixel)
BILATERAL considers the neighboring pixels and assigns weights with 2 components: the first is the same weighting used by the Gaussian filter, the second takes into account the difference in intensity between the neighboring pixels and the evaluated one

FillHolesParameter

Apply to stages: FILL_HOLES

Fills connected external components with a specified pixel value. Takes only grayscale images.

Field Type Label Default Description
val uint32 optional   Filler value. Range [0, 255]
bg uint32 optional   Background value. Range [0, 255]

BackgroundSubtractorParameter

Apply to stages: BACKGROUND_SUBTRACTOR

Subtract background from the input.

Background can be created with MOG algorithm or KNN algorithm.

See OpenCV documentation for more details:

Field Type Label Default Description
type BackgroundSubtractorParameter.Type optional   Type of background subtractor.
history_length uint32 optional   Length of the history for background creation.
detect_shadows bool optional   If true, the algorithm will detect shadows and mark them.
var_threshold float optional   MOG2 threshold on the squared Mahalanobis distance between the pixel and the model to decide whether a pixel is well described by the background model.
dist2_threshold float optional   KNN threshold on the squared distance between the pixel and the sample to decide whether a pixel is close to that sample.

BackgroundSubtractorParameter.Type

Background creation method

Name Description
MOG2 Mog algorithm
KNN KNN algorithm

ConvexPolygonParameter

Apply to stage: CONVEX_POLYGON

Draw the minimum convex polygon containing the white connected regions in a bitmask.

Example

Convex polygon
stages {
  name: "convex_polygon"
  input: "src_bitmask"
  type: CONVEX_POLYGON
  convex_polygon_param {
    approx_method: NONE
  }
}
Field Type Label Default Description
approx_method ConvexPolygonParameter.ApproxMethod optional   Whether to approximate the polygon

ConvexPolygonParameter.ApproxMethod

Name Description
NONE No approximation
SIMPLE Preprocess contours by simplifying straight segments

EdgesParameter

Apply to stage: EDGES

Find edges using the Canny algorithm. Input patch must be single channel 8-bit image.

See: cv::Canny

Example

Find edges in a grayscale image
stages {
  name: "edges"
  input: "gray"
  type: EDGES
  threshold_param {
    thresh_1: 30
    thresh_2: 150
  }
}
Field Type Label Default Description
thresh_1 float optional   First threshold of Canny algorithm
thresh_2 float optional   Second threshold of Canny algorithm

CutMaskConvexitiesParameter

Apply to stage: CUT_MASK_CONVEXITIES

Cut masks connecting convexity points with black lines.

The stage separete a blob with convexity points in a bitmask by drawing a black line between convexity points, in order to split the blob. This is useful when there is the assumption that objects should be convex, so a blob with convexities may represents two overlapping objects.

Field Type Label Default Description
type CutMaskConvexitiesParameter.Type optional   Type of cut
depth_min uint32 optional   Minimum depth to be considered a convexity
depth_max uint32 optional   Maximum depth to be considered a convexity
distance_min uint32 optional   Minimum distance between the convexities to be cutted
distance_max uint32 optional   Maximum distance between the convexities to be cutted
x_diff_min uint32 optional   Minimum x difference between the convexities to be cutted
x_diff_max uint32 optional   Maximum x difference between the convexities to be cutted
y_diff_min uint32 optional   Minimum y difference between the convexities to be cutted
y_diff_max uint32 optional   Maximum y difference between the convexities to be cutted
vertical bool optional   Cut entire image vertically at x-coordinate of each convexity points
horizontal bool optional   Cut entire image horizontally at y-coordinate of each convexity points
line_thickness uint32 optional   Thickness of the cutting line
iterations_num uint32 optional   Number of iterations

CutMaskConvexitiesParameter.Type

Name Description
COUPLE Cut couple of convexity points
SINGLE Cut the entire image vertically/horizontally

RemoveAreasParameter

Apply to stage: REMOVE_AREA

Fill contours with val whose area is less than threshold_min or greater than threshold_max. Useful to preprocess e.g. segmentation bitmasks before SEGMENTATION stage.

Field Type Label Default Description
threshold_min uint32 optional   Remove areas less than this
threshold_max uint32 optional   Remove areas greater than this
val uint32 optional   Value to use to fill areas to be removed

StatsFilterParameter

Apply to stage: STATS_FILTER

Accept patches only if the selected statistics is inside the range defined by the min and max thresholds.

Statistics is calculated on color values of the full patch.

If bitmask flag is True, input patch is considered a bitmask (False where value is 0, True elsewhere).

If a second input is present, statistics are checked on first input, but second input is used to extract output patches.

Example

Filter out patches whom median pixels value is less than the 50
stages {
  name: "medianfilter"
  type: STATS_FILTER
  input: "src"
  stats_filter_param {
    type: MEDIAN
    threshold_min: 50
  }
}
Field Type Label Default Description
type StatsFilterParameter.Type optional   Type of statistic
threshold_min float optional   Min value to accept
threshold_max float optional   Max value to accept
bitmask bool optional   Whether first input is a bitmask or a standard image

StatsFilterParameter.Type

Name Description
SUM Sum of values
MEAN Mean of values
MEDIAN Median of values
VAR Variance of values
STD_DEV Standard deviation of values

CutOutParameter

Apply to stage: CUT_OUT

Cut out the patch based on the bounding box of the associated shape.

The stage accept the type of the bounding box and the margin in each axis to keep from the border of the shape. Margins (on each axis) can be specified in pixels or in relation to width and height. If both way are specified, the two margins are summed. Generally, this stage is used after [SEGMENTATION](@ref StageParameter::SEGMENTATION) stage.

Example

Cut patches and return a squared image:
stages {
  name: "item"
  type: CUT_OUT
  input: "item_shapes"
  cut_out_param {
    type: SQUARED
    border_policy: KEEP
    margin_x_rel: 0.1
    margin_y_rel: 0.1
  }
}
Field Type Label Default Description
type CutOutParameter.Type optional   Type of bounding box
border_policy CutOutParameter.BorderPolicy optional   Border policy in case bounding box is outside the image
margin_x uint32 optional   Left and right margins in pixels
margin_x_rel float optional   Left and right margins in multiples of image width
margin_y uint32 optional   Top and bottom margins in pixels
margin_y_rel float optional   Top and bottom margins in multiples of image height
background_color ColorVal optional   NOT IMPLEMENTED YET
border_fill_color ColorVal optional   NOT IMPLEMENTED YET

CutOutParameter.Type

Name Description
BOUNDING_BOX Exact bounding box of shape
SQUARED The smallest square that contain the shape
PRECISE NOT IMPLEMENTED YET

CutOutParameter.BorderPolicy

Name Description
DISCARD Discard the patch if any side of the bounding box of the shape is outside the image
KEEP Always keep the patch
FILL NOT IMPLEMENTED YET

CustomParam

Apply to stage: CUSTOM

Defines a custom stage implemented as a Python object or class.

The object must exhibit a feed() method with variable arguments list.

It will get in inputs the patches from previous stages and should returns the output patches as a list.

Example

A python stage that apply a custom filter. MyFilter is a object (e.g. a class) that exhibiting a feed() method, defined in my_filter.py module
stages {
  name: "my_filter"
  type: CUSTOM
  input: "src"
  custom_param {
    proxy: "my_filter:MyFilter"
  }
}
Field Type Label Default Description
proxy string optional   Path to Python object exhibiting feed() method. If omitted, it should be defined with .set_proxy method in the Python host
args string repeated   Arguments used to initilize the custom stage

HeatmapParameter

Apply to stage: HEATAMAP

Create a heatmap from a set of classified patches.

Patches are recomposed using their position on their grandpa patch (i.e. they passed through a decomposition phase (e.g. sliding window) and a classification phase (e.g. SVM_CLASSIFIER)).

Field Type Label Default Description
min_value float optional   minimum value for outliers saturation
max_value float optional   maximum value for outliers saturation
not_argmax_suppression bool optional   set to zero the pixels for which the class is not the argmax

SvmSegmentationParameter

Apply to stage: SVM_SEGMENTATION

Perform binary image segmentation with the provided SVM model.

Each pixel is classified with the provided SVM model and the stage outputs a binary mask (bitmask).

The SVM model can be trained with the aliquis_svm_train host. The host can train linear SVM models (with segm-liblinear parameter) or kernel SVM models (with segm-libsvm parameter).

A linear model is usually preferred to reach high performance (FPS), as the kernel version of the SVM doesn’t parallelize well on a large number of samples (i.e. pixels).

For other info, look at the help with aliquis_svm_train -h

Example

SVM segmentation
stages {
  name: "svm"
  type: SVM_SEGMENTATION
  input: "src"
  svm_segmentation_param {
    model_file: 'svm_model.npz'
  }
}
Field Type Label Default Description
model_file string optional    
const float optional   deprecated
scale float optional   deprecated

CountConvexitiesParameter

Apply to stage: COUNT_CONVEXITIES

Classify a patch with the number of convexity points of its shape.

Field Type Label Default Description
depth_min uint32 optional   Minimum depth to be considered a convexity
depth_max uint32 optional   Maximum depth to be considered a convexity

OverlapFilterParameter

Apply to stage: OVERLAP_FILTER

Keep or discard patches by estimating the overlapping with a reference patch.

The stage gets two inputs: the first one must have no more than one patch with a single shape; the second input is a stream of patches (eventually with associated shapes) that must be filtered.

They are keep if the overlapping between

Example

Keep a patch if its shape overlaps at least for an half the reference shape
stages {
  name: "filter"
  type: OVERLAP_FILTER
  input: "ref_shape"
  input: "check_shapes"
  overlap_filter_param {
    threshold: 0.5
    inout: IN
    reference: SHAPE
  }
}
Field Type Label Default Description
threshold float optional   Minimum amount of overlapping to consider the shape IN
inout OverlapFilterParameter.InOut optional   Keep the patch if it is IN or if it is OUT of the reference shape
reference OverlapFilterParameter.Reference optional   Use the SHAPE of the patch or the whole PATCH
match_parents bool optional    
match_roots bool optional    

OverlapFilterParameter.InOut

Name Description
IN  
OUT  

OverlapFilterParameter.Reference

Name Description
PATCH  
SHAPE  

SourceSocketParameter

Apply to stage: SOURCE_SOCKET

Emits a patch when a pickled image is received on a unix socket. This allows to debug a pipeline by submitting custom images to the pipeline.

To send images to this stage, a client must know the process group id (pgid) of the host running the pipeline and the stage name.

For example, a python client can send images to this stage with the following code:

Example

Sample client to send images
import socket
import cPickle as pickle

# Open connection and get default_path
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect('aliquis_debugger_{}_{}.socket'.format(pgid, stage_name)
default_path = pickle.load(sock.makefile('rb'))['default_path']

# Send images
for img in get_imgs_from_path(default_path):
    sock.sendall(pickle.dumps(img, -1))
Source debug stage
stages {
  name: "src"
  type: SOURCE_SOCKET
  source_socket_param {
    default_path: "/path/to/imgs/image_*.png"
  }
}
Field Type Label Default Description
default_path string optional   Default path that is sent from the stage to the client when connection is estabilished.

RandomFilterParameter

Apply to stage: RANDOM_FILTER

Keep patches only with the given probability. Drops the others.

Random filter stage
stages {
  name: "random_filter"
  type: RANDOM_FILTER
  random_filter_param {
    keep_probability: 0.8
  }
}
Field Type Label Default Description
keep_probability float optional    

ContoursFinderParameter

Apply to stage: CONTOURS_FINDER

Find polygonal contours in each channel of input patches. Only contours of high-level islands are reported, that means that holes are not recognized.

Classification value is given by mean of pixel values inside the polygon. It could be below the threshold if big holes are present.

Contours finder stage
stages {
  name: "contours_finder"
  type: CONTOURS_FINDER
  contours_finder_param {
    method: MARCHING
    threhsold: 0.7
    value_type: RANKING
    num: 4
  }
}
Field Type Label Default Description
method ContoursFinderParameter.Method optional   Method to use to extract contours
threshold float optional   Threshold of the algorithm
num int32 optional   Number of values to rank or neighbors connectivity to mean values on. Available values when NEIGHBORS: {0,4,8}
value_type ContoursFinderParameter.ValueType optional   Method to use to select which values to mean on
approx_epsilon float optional   Simplify contours

ContoursFinderParameter.Method

Name Description
MARCHING_SQUARES Scikit-learn implementation of the marching squares algorithm

ContoursFinderParameter.ValueType

Name Description
RANKING Mean over ‘num’ maximum values
NEIGHBORS Mean over neighbors (with connectivity 4 or 8)

ShapesOperationsParameter

Apply to stage: SHAPES_OPERATIONS

UNMAINTAINED

Field Type Label Default Description
op ShapesOperationsParameter.Operation optional   Operation type. See: ShapesOperationsParameter.Operation
const float optional   Constant used in OFFSET and SCALE
groubpy ShapesOperationsParameter.Operation optional   Operation to apply to all shapes of a patch before the operation with the other patch
mode ShapesOperationsParameter.Mode optional   How to perform the operation
match_roots bool optional   If ‘mode: PATCHES’, group patches by root

ShapesOperationsParameter.Operation

Name Description
UNION  
INTERSECTION  
DIFFERENCE  
SYMMETRIC_DIFFERENCE  
BUFFER  
CONVEX_HULL  
SIMPLIFY  

ShapesOperationsParameter.Mode

Name Description
INPUTS_WISE Operation is performed between i-th patch of every input
PATCHES_WISE Operation is performed between all patches of each input

ShapesFilterParameter

Apply to stage: SHAPES_FILTER

Filter patches with shapes outside defined threhsolds.

Axis ratio is the ratio of minor and major axis of the ellipse that best fit the shape.

Keep only small circular shapes
stages {
  name: "filtered_shapes"
  type: SHAPES_FILTER
  input: "shapes"
  shape_filter_param {
    area_threshold_max: 1000
    axis_ratio_threshold_min: 0.9
  }
}
Field Type Label Default Description
area_threshold_min float optional   Min area of a shape to keep
area_threshold_max float optional   Max area of a shape to keep
axis_ratio_threshold_min float optional   Min fitted ellipse axis ratio of a shape to keep
axis_ratio_threshold_max float optional   Max fitted ellipse axis ratio of a shape to keep

ElasticTransformParameter

Apply to stage: ELASTIC_TRANSFORM

Find polygonal contours in each channel of input patches. Only contours of high-level islands are reported, that means that holes are not recognized.

Classification value is given by mean of pixel values inside the polygon. It could be below the threshold if big holes are present.

Elastic transform stage
stages {
  name: "elastic"
  type: ELASTIC_TRANSFORM
  input: "src"
  elastic_transform_param {
    alpha: 1
    sigma: 20
  }
}
Field Type Label Default Description
alpha float optional    
sigma float optional    
preserve_square_size int32 optional    
interpolation InterpolationType optional    
seed int32 optional    

ChannelsOperationsParameter

Apply to stage: CHANNELS_OPERATIONS

Perform operations betweeen channels of a patch

Mean of RGB
stages {
  name: "mean"
  type: CHANNELS_OPERATIONS
  input: "src"
  channels_operations_param {
    op: MEAN
    channels: "0, 1, 2"
  }
}
Field Type Label Default Description
op ChannelsOperationsParameter.Operation optional    
channels string optional    

ChannelsOperationsParameter.Operation

Name Description
ADD c1 + … + cn (N-ary)
MEAN (c1 + … + cn)/n (N-ary)
MULTIPLY c1 * … * cn (N-ary)
SUBTRACT c1 - c2 (Binary)
BITWISE_AND p1 & … & pn (N-ary)
BITWISE_OR p1 | … | pn (N-ary)
BITWISE_XOR p1 ^ … ^ pn (N-ary)

IndexMaskParameter

Apply to stage: INDEX_MASK

Create an index mask with the shapes and values of input patches

Index mask from contours
stages {
  name: "index_mask"
  type: INDEX_MASK
  input: "contours"
  index_mask_param {
    background: 255
  }
}
Field Type Label Default Description
background int32 optional   Value used to fill the background

RemapValuesParameter

Apply to stage: REMAP_VALUES

Remap values array. Syntax: “srcid=>dstid [, srcid=>dstid …]”. Omitted and negative values are lost.

Remap values
stages {
  name: "newvals"
  type: REMAP_VALUES
  input: "crops"
  remap_values_param {
    remap: "1=>3"
    classes_num: 8
  }
Field Type Label Default Description
remap string optional    
classes_num uint32 optional    

ExtractClassParameter

Field Type Label Default Description
class_id uint32 optional    
method ExtractClassParameter.ProbDensityMethod optional    
prob float optional    
sigma float optional    

ExtractClassParameter.ProbDensityMethod

Offset and scale definition method

Name Description
UNIFORM  
GAUSSIAN  
DISTANCE_TRANSFORM  

SizeFilterParameter

Apply to stage: SIZE_FILTER

Filter patches with size based thresholds.

Keep only small circular shapes
stages {
  name: "filtered_shapes"
  type: SIZE_FILTER
  input: "shapes"
  size_filter_param {
    area_max: 1000
    axis_ratio_min: 0.9
  }
}
Field Type Label Default Description
area_min float optional   Min area of a patch to keep
area_max float optional   Max area of a patch to keep
axis_ratio_min float optional   Min axis ratio of a patch to keep
axis_ratio_max float optional   Max axis ratio of a patch to keep
width_min float optional   Min area of a patch to keep
width_max float optional   Max area of a patch to keep
height_min float optional   Min area of a patch to keep
height_max float optional   Max area of a patch to keep

DistanceFilterParameter

Apply to stage: DISTANCE_FILTER

Filter patches by the distance to a reference shape or patch.

Keep patches max 300px away from a reference shape
stages {
  name: "filtered_patches"
  type: DISTANCE_FILTER
  input: "reference"
  input: "patches"
  distance_filter_param {
    threshold: 300
  }
}
Field Type Label Default Description
threshold float optional   Maximum distance in px to consider the shape IN
default_policy DistanceFilterParameter.Policy optional   What to do if there’s no reference patch
inout DistanceFilterParameter.InOut optional   Whether to keep the patch if it is IN or if it is OUT of the reference shape
reference DistanceFilterParameter.Reference optional   Use the SHAPE of the patch or the whole PATCH center as reference point
match_roots bool optional   xy = 6; // Hardcoded coordinates (maybe Rectangle type?)

DistanceFilterParameter.InOut

Name Description
IN  
OUT  

DistanceFilterParameter.Reference

Name Description
PATCH  
SHAPE  

DistanceFilterParameter.Policy

Name Description
KEEP  
DISCARD  

MarginalizationParameter

Field Type Label Default Description
class_aggregation string optional   E.g.: “2, 3, 4; 5, 6, 7” (all weigths =1). E.g. w/ weights: “2:0.5, 3:0.25, 4; 5, 6, 7:1.5” (missing weights default to 1); all the classes belonging to the winning subgroup are set to 0 and to the winning class is assigned the sum of the subgroup; the values of the classes external to the winning subgroupo
merge_contiguous bool optional    

SelectChannelsParameter

Field Type Label Default Description
ch uint32 repeated   Channels list

ClipParameter

Field Type Label Default Description
min float optional   Clip left bound
max float optional   Clip right bound
clip_val_range bool optional   Clip also patches val_range attribute

SourceSegyParameter

Apply to stages: SOURCE_SEGY

Read slices from SEG-Y files.

Field Type Label Default Description
path string optional    
direction SourceSegyParameter.Direction optional    
use_mmap bool optional    
scale float optional    
loop bool optional    
bulk_load bool optional    

SourceSegyParameter.Direction

Name Description
INLINE  
CROSSLINE  
DEPTH  

SourceSegyNormParameter

Apply to stages: SOURCE_SEGY_NORM

Read patches from SEG-Y files using xyz points+normals cloud.

Field Type Label Default Description
path string optional    
spec_type SourceSegyNormParameter.SpecType optional    
point_cloud_path string optional    
use_mmap bool optional    
scale float optional    
keep_empty bool optional    
patch_width uint32 optional    
patch_height uint32 optional    

SourceSegyNormParameter.SpecType

Name Description
WGS84_FAR  
WGS84_NEAR  
WGS84_VARIANCE  

SourceDatasetParameter

Field Type Label Default Description
path string optional    
scale float optional    
batch_size uint32 optional    
split_set string optional    
shuffle bool optional    
keep_remainder bool optional    
loop bool optional    

InterpolationType

List of interpolation types.

See OpenCV documentation:

Name Description
BILINEAR Bilinear interpolation (default)
NEAREST Nearest neighbor interpolation
AREA Resampling using pixel area relation.
CUBIC Bicubic interpolation
LANCZOS4 Lanczos interpolation over 8x8 neighborhood

ColorFormat

List of color formats.

Name Description
UNKNOWN Unknown format
GRAY Gray format
CIE_XYZ Rec 709 with D65 white point
CIE_Lab CIE L*a*b*
CIE_Luv CIE L*u*v*
BGR BGR format. Default for color images
RGB RGB format
HSV HSV format
HLS HLS format
YCrCb Warning: not implemented yet

Python

class aliquis.Patch(im, subpatches, values, tr, colorfmt, val_range, shapes, parent_ptr)

PyPatchObject objects

A Patch containing the image im. Only im argument is required.

addSubpatch()

Add son to this patch

addSubpatchFromRect()

Add subpatch from origin:size

addSubpatchWithShapes()

Add subpatch with different shapes

addSubpatchWithValues()

Add subpatch with different values array

classes_num

Number of classes defined for this patch

colorfmt

Patch’s color format

getGlobalTransform()

Get global transformation matrix

getParent()

Return the parent patch (if exists, None otherwise)

getRoot()

Return the root of the patches tree

getTransformTo()

Get global transformation matrix

id

Image identifier

im

NumPy array containing actual datas (tipically an image)

remove()

Remove this patch from hierarchy tree

shapes

Patch’s shapes

subpatches

Patch sons in hierarchy

tr

Patch transformation relative to parent

val_range

Patch’s pixel values range

values

Classification values

class aliquis.Pipeline(path_or_pl_def, base_path=None, parent_stages_names=None, encrypted=False, mapping={})
cap_time
description
feed_time
init_time
input_stages
layers
layers_def
mem_policy
name
output_stages
parent_stages_names
revision
stages
unused_patches
feed(stages_inputs={})
def group_list(l, n):
llen = len(l) d = llen / n r = llen % n return [ l[i:i+d+1] for i in range(0, r * (d + 1), d + 1) ] + ([ l[i:i+d] for i in range(r * (d + 1), llen, d) ] if d > 0 else [])
next()
run()