From bcf157c023ef8c4fd9aeb3773c9fa25590ca0c41 Mon Sep 17 00:00:00 2001 From: 1060461902 Date: Wed, 18 May 2022 15:55:50 +0800 Subject: [PATCH] Update LiveVideoClassificationActivity.java Fix code logic errors --- .../demo/torchvideo/LiveVideoClassificationActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TorchVideo/app/src/main/java/org/pytorch/demo/torchvideo/LiveVideoClassificationActivity.java b/TorchVideo/app/src/main/java/org/pytorch/demo/torchvideo/LiveVideoClassificationActivity.java index b0469259..0d196866 100644 --- a/TorchVideo/app/src/main/java/org/pytorch/demo/torchvideo/LiveVideoClassificationActivity.java +++ b/TorchVideo/app/src/main/java/org/pytorch/demo/torchvideo/LiveVideoClassificationActivity.java @@ -119,10 +119,10 @@ protected AnalysisResult analyzeImage(ImageProxy image, int rotationDegrees) { 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 * 3 * Constants.TARGET_VIDEO_SIZE * Constants.TARGET_VIDEO_SIZE); mFrameCount++; - if (mFrameCount < 4) { + if (mFrameCount < Constants.COUNT_OF_FRAMES_PER_INFERENCE) { return null; }