Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model quantized error Non-zero status code returned while running Resize node #1

Closed
rdcdt1 opened this issue Feb 21, 2024 · 5 comments

Comments

@rdcdt1
Copy link

rdcdt1 commented Feb 21, 2024

Hi thx for your work very great app
but i got an questions the first time i copy the 2 model in assests it work but seem to me that it's the not quantized model running so i remove the model.onnx left modem_fp16.onnx rename it to model.onnx but now i get this error ( at this error the app crash):
[E:onnxruntime:, sequential_executor.cc:514 ExecuteKernel] Non-zero status code returned while running Resize node. Name:'pre-/Resize' Status Message: upsamplebase.h:369 ScalesValidation 'Cubic' mode only support 2-D inputs ('Bicubic') or 4-D inputs with the corresponding outermost 2 scale values being 1 in the Resize operator
FATAL EXCEPTION: DefaultDispatcher-worker-2 Process: com.ml.shubham0204.depthanything, PID: 23065 ai.onnxruntime.OrtException: Error code - ORT_FAIL - message: Non-zero status code returned while running Resize node. Name:'pre-/Resize' Status Message: upsamplebase.h:369 ScalesValidation 'Cubic' mode only support 2-D inputs ('Bicubic') or 4-D inputs with the corresponding outermost 2 scale values being 1 in the Resize operator at ai.onnxruntime.OrtSession.run(Native Method) at ai.onnxruntime.OrtSession.run(OrtSession.java:395) at ai.onnxruntime.OrtSession.run(OrtSession.java:242) at ai.onnxruntime.OrtSession.run(OrtSession.java:210) at com.ml.shubham0204.depthanything.DepthAnything$predict$2.invokeSuspend(DepthAnything.kt:44) at com.ml.shubham0204.depthanything.DepthAnything$predict$2.invoke(Unknown Source:8) at com.ml.shubham0204.depthanything.DepthAnything$predict$2.invoke(Unknown Source:4) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78) at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167) at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1) at com.ml.shubham0204.depthanything.DepthAnything.predict(DepthAnything.kt:37) at com.ml.shubham0204.depthanything.MainActivity$ImageSelectionUI$pickMediaLauncher$1$1.invokeSuspend(MainActivity.kt:104) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@13f19ec, Dispatchers.Default]

@shubham0204
Copy link
Owner

shubham0204 commented Feb 21, 2024

I was not able to reproduce the issue, and the app worked perfectly fine.

  • Did you try using multiple images? If not, try using different RGB images with the app. If seems that the model received no inputs, or one of the dimensions of inputTensor were zero,
val inputTensor  = OnnxTensor.createTensor(
            ortEnvironment ,
            imagePixels ,
            longArrayOf( 1 , inputImage.width.toLong() , inputImage.height.toLong() , 3 ) ,
            OnnxJavaType.UINT8 )

@rdcdt1
Copy link
Author

rdcdt1 commented Feb 22, 2024

i try with multiple image ( muliple size ) still crash with the same logcat
here the apk that i generate https://mega.nz/file/YqYxGJAK#SaNAABcya6poD76eRL97Oj9uwZwGueenFEbuGyzPSR4

@shubham0204
Copy link
Owner

@rdcdt1 can you try the latest models (of Depth-Anything-V2) with the app? I faced several issues while compiling ONNX for the preprocessing module which contained the Resize operation. I have removed it completely in the latest build and the model now accepts constant/static image sizes of 256 or 512.
See the models here.

@rdcdt1
Copy link
Author

rdcdt1 commented Jun 26, 2024

@shubham0204 thx now it work create i change some code i will push on a fork. it add the abbility to select with model you want to use base on the the assets model present in the folder. to simplify the task i only add the use of 256 or 512 which is needed to be at the end of the model name
https://github.com/rdcdt1/Depth-Anything-Android

@shubham0204
Copy link
Owner

That's great @rdcdt1! You can open a pull request and we'll work on it from there
Thanks!

@rdcdt1 rdcdt1 closed this as completed Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants