@@ -15,7 +15,8 @@ import org.pytorch.executorch.EValue
15
15
const val detectionScoreThreshold = .7f
16
16
const val iouThreshold = .55f
17
17
18
- class SSDLiteLargeModel (reactApplicationContext : ReactApplicationContext ) : BaseModel<Mat, Array<Detection>>(reactApplicationContext) {
18
+ class SSDLiteLargeModel (reactApplicationContext : ReactApplicationContext ) :
19
+ BaseModel <Mat , Array <Detection >>(reactApplicationContext) {
19
20
private var heightRatio: Float = 1.0f
20
21
private var widthRatio: Float = 1.0f
21
22
@@ -27,7 +28,7 @@ class SSDLiteLargeModel(reactApplicationContext: ReactApplicationContext) : Base
27
28
return Size (height.toDouble(), width.toDouble())
28
29
}
29
30
30
- override fun preprocess (input : Mat ): EValue {
31
+ fun preprocess (input : Mat ): EValue {
31
32
this .widthRatio = (input.size().width / getModelImageSize().width).toFloat()
32
33
this .heightRatio = (input.size().height / getModelImageSize().height).toFloat()
33
34
Imgproc .resize(input, input, getModelImageSize())
@@ -40,7 +41,7 @@ class SSDLiteLargeModel(reactApplicationContext: ReactApplicationContext) : Base
40
41
return postprocess(modelOutput)
41
42
}
42
43
43
- override fun postprocess (output : Array <EValue >): Array <Detection > {
44
+ fun postprocess (output : Array <EValue >): Array <Detection > {
44
45
val scoresTensor = output[1 ].toTensor()
45
46
val numel = scoresTensor.numel()
46
47
val bboxes = output[0 ].toTensor().dataAsFloatArray
0 commit comments