Обнаружение объекта Android TFlite не отображает результат

Это код для обнаружения объекта:

          public void detectImage(Bitmap image2){
    try {

        Detect model = Detect.newInstance(getApplicationContext());

        // Creates inputs for reference.
        TensorImage image = TensorImage.fromBitmap(image2);

        // Runs model inference and gets result.
        Detect.Outputs outputs = model.process(image);
        Detect.DetectionResult detectionResult = outputs.getDetectionResultList().get(0);


        score = detectionResult.getScoreAsFloat();
        location = detectionResult.getLocationAsRectF();
        category = detectionResult.getCategoryAsString();


        int arr[] = new int[2];



        // Releases model resources if no longer used.
        model.close();
    } catch (IOException e) {
        // TODO Handle the exception
    }

}

и я добавил эту строку, чтобы установить ее в текстовое поле:

      tv.setText(score);

Но он не отображал значение балла. В чем может быть проблема?

0 ответов

Другие вопросы по тегам