View Source PostDNN (postdnn v0.1.5)
Post-processing utilities for Deep Neural Network.
Link to this section Summary
Functions
Adjust NMS result to aspect of the input image. (letterbox)
Clamp value within {lower, upper}.
Create a list of (x,y) coordinates for mesh grid points - top-left of each grid.
Execute post processing: nms.
Create a priorbox which is a list of the coodinate of the boxes in each grid.
Take records satisfying the predicate function pred?
from table.
Take records satisfying the predicate function pred?
from tables.
Link to this section Functions
Adjust NMS result to aspect of the input image. (letterbox)
parameters
Parameters:
- nms_result - NMS result {:ok, result}
- [rx, ry] - aspect ratio of the input image
Clamp value within {lower, upper}.
Create a list of (x,y) coordinates for mesh grid points - top-left of each grid.
parameters
Parameters
- shape - tupple {width, height} for overall size.
- pitches - list of grid spacing.
- opts
- :center - return center of each grid.
- :transpose - return transposed table
- :normalize - normalize (x,y) cordinate to {0.0..1.0}
- :rowfirst - change to row scan first. (default: column scan first)
examples
Examples
meshgrid({416,416}, [8,16,32,64], [:center])
Execute post processing: nms.
parameters
Parameters
- num_boxes - number of candidate boxes
- num_class - number of category class
- boxes - binaries, serialized boxes tensor[
num_boxes
][4]; dtype: float32 - scores - binaries, serialized score tensor[
num_boxes
][num_class
]; dtype: float32 - opts
- iou_threshold: - IOU threshold
- score_threshold: - score cutoff threshold
- sigma: - soft IOU parameter
- boxrepr: - type of box representation
- :center - center pos and width/height
- :topleft - top-left pos and width/height
- :corner - top-left and bottom-right corner pos
- label: map - replace "number" with "name" label according to a map %{0 => "foo", 1 => "baa", ...}
- label: path - given a file path, read it and create the label map
examples
Examples
non_max_suppression_multi_class(
Nx.shape(scores), Nx.to_binary(boxes), Nx.to_binary(scores), boxrepr: :corner
)
Create a priorbox which is a list of the coodinate of the boxes in each grid.
parameters
Parameters
- shape - tupple {width, height} for overall size.
- pitch_boxes - list of tupples which have grid spacing and boxes size.
- opts
- :transpose - return transposed table
- :normalize - normalize (x,y) cordinate to {0.0..1.0}
- :rowfirst - change to row scan first. (default: column scan first)
examples
Examples
priorbox({416,416}, [{8, [8, 10, 15]}, {16, [16, 20]}], [:normalize])
Take records satisfying the predicate function pred?
from table.
parameters
Parameters
- tensor - 2rank tensor (table). each row represents a record.
- pred? - predicate function to sieve records. a function that returns a rank1 tensor with '1' in the index position of records to be kept and '0' in the index position of those to be discarded.
examples
Examples
pred? = fn tensor -> Nx.greater(tensor, 0.2) end
sieve(table, pred?)
Take records satisfying the predicate function pred?
from tables.
parameters
Parameters
- tensor - 2rank tensor (table). each row represents a record.
- list - list of tensors which has same size of axis 0.
- pred? - predicate function to sieve records. a function that returns a rank1 tensor with '1' in the index position of records to be kept and '0' in the index position of those to be discarded.
examples
Examples
pred? = fn tensor -> Nx.greater(tensor, 0.2) end
sieve(table1, [table2, table2], pred?)