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 object from category name and COCO formatted
  annotation dict (with fields "bbox", "segmentation", "category_id").
  
  Args:
      annotation_dict: dict
          COCO formatted annotation dict (with fields "bbox", "segmentation", "category_id")
      category_name: str
          Category name of the annotation
      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","object","from","category","name","and","COCO","formatted","annotation","dict","(","with","fields","``","bbox","''",",","``","segmentation","''",",","``","category_id","''",")",".","Args",":","annotation_dict",":","dict","COCO","formatted","annotation","dict","(","with","fields","``","bbox","''",",","``","segmentation","''",",","``","category_id","''",")","category_name",":","str","Category","name","of","the","annotation","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_coco_annotation_dict(
      cls,
      annotation_dict: Dict,
      full_shape: List[int],
      category_name: str = None,
      shift_amount: Optional[List[int]] = [0, 0],
  ):
      """
      Creates ObjectAnnotation object from category name and COCO formatted
      annotation dict (with fields "bbox", "segmentation", "category_id").
  
      Args:
          annotation_dict: dict
              COCO formatted annotation dict (with fields "bbox", "segmentation", "category_id")
          category_name: str
              Category name of the annotation
          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]
      """
      if annotation_dict["segmentation"]:
          return cls.from_coco_segmentation(
              segmentation=annotation_dict["segmentation"],
              category_id=annotation_dict["category_id"],
              category_name=category_name,
              shift_amount=shift_amount,
              full_shape=full_shape,
          )
      else:
          return cls.from_coco_bbox(
              bbox=annotation_dict["bbox"],
              category_id=annotation_dict["category_id"],
              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 4 for calling the ObjectAnnotation obj's underlying member method code with example usage: obj.from_coco_annotation_dict(cls, annotation_dict, full_shape, category_name, shift_amount) and returns: cls, cls