code: def test_different_thresholds_unweighted(self):
      y_true = [0, 1, 0, 1]
      y_pred = [0.1, 0.2, 0.4, 0.7]
  
      # with threshold = 0.3, y_pred will be converted to [0, 0, 1, 1]
      # cm = [[1, 1],
      #       [1, 1]]
      # sum_row = [2, 2], sum_col = [2, 2], true_positives = [1, 1]
      # iou = true_positives / (sum_row + sum_col - true_positives))
      expected_result = (1 / (2 + 2 - 1) + 1 / (2 + 2 - 1)) / 2
      obj = metrics.BinaryIoU(target_class_ids=[0, 1], threshold=0.3)
      result = obj(y_true, y_pred)
      self.assertAllClose(result, expected_result, atol=1e-3)
  
      # with threshold = 0.5, y_pred will be converted to [0, 0, 0, 1]
      # cm = [[2, 0],
      #       [1, 1]]
      # sum_row = [2, 2], sum_col = [3, 1], true_positives = [2, 1]
      # iou = true_positives / (sum_row + sum_col - true_positives))
      expected_result = (2 / (2 + 3 - 2) + 1 / (2 + 1 - 1)) / 2
      obj = metrics.BinaryIoU(target_class_ids=[0, 1], threshold=0.5)
      result = obj(y_true, y_pred)
      self.assertAllClose(result, expected_result, atol=1e-3)
  
imports: import numpy
  import pytest
  from keras import layers
  from keras import models
  from keras import testing
  from keras.metrics import iou_metrics
label_desc: Use image node_id 3 for calling the BinaryIoUTest obj's underlying member method code with example usage: obj.test_different_thresholds_unweighted() without return types