android-demo-app
android-demo-app copied to clipboard
[ObjectDetection]: java.lang.IllegalStateException: Expected IValue type Tuple, actual type TensorList
Hi, when i used the Object Detection Demo, i encountered an IllegalStateException that expected IValue type to be Tuple, but actual type is TensorList. Here is the original code from MainActivity.java
:
IValue[] outputTuple = mModule.forward(IValue.from(inputTensor)).toTuple();
final Tensor outputTensor = outputTuple[0].toTensor();
The error happens when i click the Detect
button:
E/AndroidRuntime: FATAL EXCEPTION: Thread-2
Process: com.lannguyen.food_detector, PID: 8115
java.lang.IllegalStateException: Expected IValue type Tuple, actual type TensorList
at org.pytorch.IValue.preconditionType(IValue.java:332)
at org.pytorch.IValue.toTuple(IValue.java:313)
at com.lannguyen.food_detector.MainActivity.run(MainActivity.java:238)
at java.lang.Thread.run(Thread.java:923)
I've tried to modify using the TensorList type but the ArrayList results
is empty:
Tensor[] outputTuple = mModule.forward(IValue.from(inputTensor)).toTensorList();
final Tensor outputTensor = outputTuple[0];
Also there is an unusual point that the mOutputRow
in PrePostProcessor.java
in my case doesn't have the original value 25200
but 19200
to not trigger any errors. The output tensor is [1,3, 80, 80 ,85]
so i have to modify that value to 19200
instead 25200
.
If you have any ideas to fix it, feel free to comment below. Thank you very much in advance!
I got same error...anyone can please assist...
Has anyone solved above-mentioned error?
have you solved above mentioned error? please update if you done it