View Source PostDNN (postdnn v0.1.3)
Post-processing utilities for Deep Neural Network.
Link to this section Summary
Functions
Adjust NMS result to aspect of the input image. (letterbox)
Create a list of (x,y) coordinates for mesh grid points - top-left of each grid.
Execute post processing: nms.
Take records satisfying the predicate function pred?
from table.
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
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
)
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?)