-
Notifications
You must be signed in to change notification settings - Fork 112
Open
Description
Good afternoon,
Using the pre-trained model UltraFace640 to detect faces on a picture it throws the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Data shape for input input does not match the model input shape. Data shape: [1, 3, 640, 480], model shape: [1, 3, 480, 640]
at org.jetbrains.kotlinx.dl.onnx.inference.OnnxInferenceModel.toTensors(OnnxInferenceModel.kt:227)
at org.jetbrains.kotlinx.dl.onnx.inference.OnnxInferenceModel.predict(OnnxInferenceModel.kt:212)
at org.jetbrains.kotlinx.dl.onnx.inference.OnnxInferenceModel.predict(OnnxInferenceModel.kt:198)
at org.jetbrains.kotlinx.dl.onnx.inference.OnnxInferenceModel.predict(OnnxInferenceModel.kt:190)
at org.jetbrains.kotlinx.dl.onnx.inference.OnnxHighLevelModel$DefaultImpls.predict(OnnxHighLevelModel.kt:50)
at org.jetbrains.kotlinx.dl.onnx.inference.facealignment.FaceDetectionModelBase.predict(FaceDetectionModelBase.kt:18)
at org.jetbrains.kotlinx.dl.onnx.inference.facealignment.FaceDetectionModelBase.predict(FaceDetectionModelBase.kt:18)
at org.jetbrains.kotlinx.dl.onnx.inference.facealignment.FaceDetectionModelBase.detectFaces(FaceDetectionModelBase.kt:44)
The sample code used to reproduce it is as follows:
val modelHub = ONNXModelHub(cacheDirectory = File("cache/pretrainedModels"))
val model = modelHub.loadPretrainedModel(ONNXModels.FaceDetection.UltraFace640)
model.use { faceDetectionModel ->
val imageFile = getFileFromResource("org/example/$picture")
val image = ImageConverter.toBufferedImage(imageFile)
val faces = faceDetectionModel.detectFaces(image, -1)
visualize(imageFile, faces)
}
Kind regards and really looking forward to hearing from you 💯
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels