code: def filter_bboxes_by_visibility(original_shape, bboxes, transformed_shape, transformed_bboxes,
                                  threshold=0., min_area=0.):
      
      img_height, img_width = original_shape[:2]
      transformed_img_height, transformed_img_width = transformed_shape[:2]
  
      visible_bboxes = []
      for bbox, transformed_bbox in zip(bboxes, transformed_bboxes):
          if not all(0.0 <= value <= 1.0 for value in transformed_bbox[:4]):
              continue
          bbox_area = calculate_bbox_area(bbox, img_height, img_width)
          transformed_bbox_area = calculate_bbox_area(transformed_bbox, transformed_img_height, transformed_img_width)
          if transformed_bbox_area < min_area:
              continue
          visibility = transformed_bbox_area / bbox_area
          if visibility >= threshold:
              visible_bboxes.append(transformed_bbox)
      return visible_bboxes
docs: Filter bounding boxes and return only those boxes whose visibility after transformation is above
      the threshold and minimal area of bounding box in pixels is more then min_area.
  
      Args:
          original_shape (tuple): original image shape
          bboxes (list): original bounding boxes
          transformed_shape(tuple): transformed image
          transformed_bboxes (list): transformed bounding boxes
          threshold (float): visibility threshold. Should be a value in the range [0.0, 1.0].
          min_area (float): Minimal area threshold.