android-demo-app
android-demo-app copied to clipboard
[torchvideo] It has bug in torchvideo when "temporal > 4"
I modify COUNT_OF_FRAMES_PER_INFERENCE=4 -> 16
in Constants.java
and it has error when program running:
E/AndroidRuntime: FATAL EXCEPTION: ModuleActivity
Process: org.pytorch.demo.torchvideo, PID: 6094
java.lang.IllegalStateException: Buffer underflow
Specific in LiveVideoClassificationActivity.java
:
TensorImageUtils.bitmapToFloatBuffer(centerCroppedBitmap,
0,
0,
Constants.TARGET_VIDEO_SIZE,
Constants.TARGET_VIDEO_SIZE,
Constants.MEAN_RGB,
Constants.STD_RGB,
inTensorBuffer,
(Constants.COUNT_OF_FRAMES_PER_INFERENCE - 1) * mFrameCount
* Constants.TARGET_VIDEO_SIZE * Constants.TARGET_VIDEO_SIZE);
mFrameCount in [0, 4] is normal, but it will have error when mFrameCount > 4
.
MainActivity.java
has the same problem of Buffer underflow
when COUNT_OF_FRAMES_PER_INFERENCE = 4
-> COUNT_OF_FRAMES_PER_INFERENCE > 4
.
So How to solve this problem of Buffer underflow
?
Thank you very much!