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!
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
:The error happens when i click the
Detect
button:I've tried to modify using the TensorList type but the
ArrayList results
is empty:Also there is an unusual point that the
mOutputRow
inPrePostProcessor.java
in my case doesn't have the original value25200
but19200
to not trigger any errors. The output tensor is[1,3, 80, 80 ,85]
so i have to modify that value to19200
instead25200
.If you have any ideas to fix it, feel free to comment below. Thank you very much in advance!