Running an Integrated Image Segmenter in Java
Hi @fsamekl ,

Can you also provide me the tflite model please so that i can replicate the issue ? This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you.
The segmentation model I trained using YOLOv5S was converted to tflite and deployed using TensorFlow Lite on Android. However, when it ran, it reported an error and crashed, which seems to have two issues. The first one is: Java. lang. IllegalArgumentException: Error occurred when initializing ImageSegment: Image segmentation models are expected to have only 1 output, found 2
The second one: Error getting native address of native library: task_vision_jni, I would like to ask how to solve this problem? thanks

Here is my code:
public class MainActivity extends AppCompatActivity {
    private ImageView iv_Y_result, iv_H_result;
    private TextView tv_result;
    private Button btn_result;
    private String MODEL_YOLOV5SSEG = "yolov5s-seg.tflite";
    private Context context;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        context = this;

        iv_H_result = findViewById(R.id.iv_H_result);
        iv_Y_result = findViewById(R.id.iv_Y_result);
        btn_result = findViewById(R.id.btn_result);
        tv_result = findViewById(R.id.tv_result);

        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.a3);

        iv_Y_result.setImageBitmap(bitmap);

        btn_result.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.a3);
                TensorImage tensorImage = TensorImage.fromBitmap(bitmap);

                ImageSegmenter.ImageSegmenterOptions options = ImageSegmenter.ImageSegmenterOptions.builder()
                        .setBaseOptions(BaseOptions.builder().build())
                        .setOutputType(OutputType.CONFIDENCE_MASK)
                        .build();

                ImageSegmenter imageSegmenter =
                        null;
                try {
                    imageSegmenter = ImageSegmenter.createFromFileAndOptions(context, MODEL_YOLOV5SSEG, options);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }

                // Run inference
                List<Segmentation> results = imageSegmenter.segment(tensorImage);
                Log.e("HENG", results.toString());
            }
        });
    }
}