SSDObjectDetectionModel

class SSDObjectDetectionModel : OnnxInferenceModel

Special model class for detection objects on images with built-in preprocessing and post-processing.

It internally uses ONNXModels.ObjectDetection.SSD trained on the COCO dataset.

Note that output class labels do not correspond to ids in COCO annotations. If you want to evaluate this model on the COCO validation/test set, you need to convert class predictions using appropriate mapping.

Since

0.3

See also

Constructors

SSDObjectDetectionModel
Link copied to clipboard
fun SSDObjectDetectionModel()

Functions

close
Link copied to clipboard
open override fun close()

Releases the ONNXRuntime - related resources.

copy
Link copied to clipboard
open override fun copy(copiedModelName: String?, saveOptimizerState: Boolean, copyWeights: Boolean): TensorFlowInferenceModel
detectObjects
Link copied to clipboard
fun detectObjects(imageFile: File, topK: Int = 5): List<DetectedObject>
fun detectObjects(inputData: FloatArray, topK: Int = 5): List<DetectedObject>

Returns the top N detected object for the given image file sorted by the score.

evaluate
Link copied to clipboard
fun evaluate(dataset: Dataset, metric: Metrics): Double
predict
Link copied to clipboard
open override fun predict(inputData: FloatArray): Int
fun predict(dataset: Dataset): List<Int>
fun predict(inputData: FloatArray, inputTensorName: String, outputTensorName: String): Int

Predicts the class of inputData.

predictRaw
Link copied to clipboard
fun predictRaw(inputData: FloatArray): Map<String, Any>

Returns list of multidimensional arrays with data from model outputs.

predictRawWithShapes
Link copied to clipboard
fun predictRawWithShapes(inputData: FloatArray): List<Pair<FloatBuffer, LongArray>>

Returns list of pairs from model outputs.

predictSoftly
Link copied to clipboard
fun predictSoftly(inputData: FloatArray): FloatArray

Predicts vector of probabilities instead of specific class in predict method.

open override fun predictSoftly(inputData: FloatArray, predictionTensorName: String): FloatArray
reshape
Link copied to clipboard
open override fun reshape(vararg dims: Long)

Chain-like setter to set up input shape.

toString
Link copied to clipboard
open override fun toString(): String

Properties

inputDataType
Link copied to clipboard
lateinit var inputDataType: OnnxJavaType

Data type for input tensor.

inputDimensions
Link copied to clipboard
open override val inputDimensions: LongArray
inputShape
Link copied to clipboard
lateinit var inputShape: LongArray

Data shape for prediction.

name
Link copied to clipboard
var name: String?
outputDataType
Link copied to clipboard
lateinit var outputDataType: OnnxJavaType

Data type for output tensor.

outputShape
Link copied to clipboard
lateinit var outputShape: LongArray

Data shape for prediction.