class_docstr: All about an annotation such as Mask, Category, BoundingBox.
class_docstr_tok: ["All","about","an","annotation","such","as","Mask",",","Category",",","BoundingBox","."]
docstr: Creates ObjectAnnotation from bool_mask (2D np.ndarray)
  
  Args:
      bool_mask: np.ndarray with bool elements
          2D mask of object, should have a shape of height*width
      category_id: int
          ID of the object category
      category_name: str
          Name of the object category
      full_shape: List
          Size of the full image, should be in the form of [height, width]
      shift_amount: List
          To shift the box and mask predictions from sliced image to full
          sized image, should be in the form of [shift_x, shift_y]
docstr_tok: ["Creates","ObjectAnnotation","from","bool_mask","(","2D","np.ndarray",")","Args",":","bool_mask",":","np.ndarray","with","bool","elements","2D","mask","of","object",",","should","have","a","shape","of","height","*","width","category_id",":","int","ID","of","the","object","category","category_name",":","str","Name","of","the","object","category","full_shape",":","List","Size","of","the","full","image",",","should","be","in","the","form","of","[","height",",","width","]","shift_amount",":","List","To","shift","the","box","and","mask","predictions","from","sliced","image","to","full","sized","image",",","should","be","in","the","form","of","[","shift_x",",","shift_y","]"]
code: def from_bool_mask(
      cls,
      bool_mask,
      category_id: Optional[int] = None,
      category_name: Optional[str] = None,
      shift_amount: Optional[List[int]] = [0, 0],
      full_shape: Optional[List[int]] = None,
  ):
      """
      Creates ObjectAnnotation from bool_mask (2D np.ndarray)
  
      Args:
          bool_mask: np.ndarray with bool elements
              2D mask of object, should have a shape of height*width
          category_id: int
              ID of the object category
          category_name: str
              Name of the object category
          full_shape: List
              Size of the full image, should be in the form of [height, width]
          shift_amount: List
              To shift the box and mask predictions from sliced image to full
              sized image, should be in the form of [shift_x, shift_y]
      """
      return cls(
          category_id=category_id,
          bool_mask=bool_mask,
          category_name=category_name,
          shift_amount=shift_amount,
          full_shape=full_shape,
      )
  
imports: import copy
  from typing import Dict, List, Optional
  import numpy
  from sahi.utils.coco import CocoAnnotation, CocoPrediction
  from sahi.utils.cv import get_bbox_from_bool_mask, get_bool_mask_from_coco_segmentation, get_coco_segmentation_from_bool_mask
  from sahi.utils.shapely import ShapelyAnnotation
label_desc: Use image node_id 1 for calling the ObjectAnnotation obj's underlying member method code with example usage: obj.from_bool_mask(cls, bool_mask, category_id, category_name, shift_amount, full_shape) and returns: cls