SSDObjectDetectionModel

class SSDObjectDetectionModel(internalModel: OnnxInferenceModel, modelKindDescription: String?) : SSDLikeModelBase<BufferedImage> , InferenceModel

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

Parameters

internalModel

model used to make predictions

Constructors

SSDObjectDetectionModel
Link copied to clipboard
fun SSDObjectDetectionModel(pathToModel: String)

Constructs the object detection model from a given path.

SSDObjectDetectionModel
Link copied to clipboard
fun SSDObjectDetectionModel(internalModel: OnnxInferenceModel, modelKindDescription: String? = null)

Functions

close
Link copied to clipboard
open override fun close()
convert
Link copied to clipboard
open override fun convert(output: OrtSession.Result): List<DetectedObject>

Converts raw model output to the result.

copy
Link copied to clipboard
open override fun copy(copiedModelName: String?, saveOptimizerState: Boolean, copyWeights: Boolean): SSDObjectDetectionModel
detectObjects
Link copied to clipboard
fun detectObjects(image: BufferedImage, topK: Int = 5): List<DetectedObject>

Returns the detected object for the given image sorted by the score.

fun detectObjects(imageFile: File, topK: Int = 5): List<DetectedObject>

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

initializeWith
Link copied to clipboard
open override fun initializeWith(vararg executionProviders: ExecutionProvider)

Initialize the model with the specified executions providers.

predict
Link copied to clipboard
open override fun predict(inputData: FloatArray): Int
open fun predict(input: BufferedImage): List<DetectedObject>

Makes prediction on the given input.

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

Properties

inputDimensions
Link copied to clipboard
open override val inputDimensions: LongArray
internalModel
Link copied to clipboard
open override val internalModel: OnnxInferenceModel
modelKindDescription
Link copied to clipboard
open override val modelKindDescription: String?

High-level description of the model. Used for model summary printing. For the model hub models it equals to the string representation of the OnnxModelType

preprocessing
Link copied to clipboard
open override val preprocessing: Operation<BufferedImage, Pair<FloatArray, TensorShape>>

Preprocessing operation specific to this model.