class_docstr: ObjectDetection dataset as DataFrame.
  
  Parameters
  ----------
  data : the input for pd.DataFrame
      The input data.
  dataset_type : str, optional
      The dataset type, can be voc/coco or more, used to annotate the optional fields.
  classes : list of str, optional
      The class synsets for this dataset, if `None`, it will infer from the data.
class_docstr_tok: ["ObjectDetection","dataset","as","DataFrame",".","Parameters","--","--","--","--","--","data",":","the","input","for","pd.DataFrame","The","input","data",".","dataset_type",":","str",",","optional","The","dataset","type",",","can","be","voc\/coco","or","more",",","used","to","annotate","the","optional","fields",".","classes",":","list","of","str",",","optional","The","class","synsets","for","this","dataset",",","if","`","None","`",",","it","will","infer","from","the","data","."]
docstr: Load dataset from coco format annotations.
  
  The structure of a default coco 2017 dataset looks like:
  .
  ├── annotations
  |   |── instances_val2017.json
  ├── train2017
  └── val2017
  
  The default relative root folder (if set to `None`) is `anno_file/../`.
code: def from_coco(
      cls, anno_file, root=None, min_object_area=0, use_crowd=False
  ):
      """Load dataset from coco format annotations.
  
      The structure of a default coco 2017 dataset looks like:
      .
      ├── annotations
      |   |── instances_val2017.json
      ├── train2017
      └── val2017
  
      The default relative root folder (if set to `None`) is `anno_file/../`.
      """
      # construct from COCO format
      try_import_pycocotools()
      from pycocotools.coco import COCO
  
      if isinstance(anno_file, Path):
          anno_file = str(anno_file.expanduser().resolve())
      elif isinstance(anno_file, str):
          anno_file = os.path.expanduser(anno_file)
      coco = COCO(anno_file)
  
      if isinstance(root, Path):
          root = str(root.expanduser().resolve())
      elif isinstance(root, str):
          root = os.path.abspath(os.path.expanduser(root))
      elif root is None:
          # try to use the default coco structure
          root = os.path.join(os.path.dirname(anno_file), "..")
          logger.info(
              "Using default root folder: %s. Specify `root=...` if you feel it is wrong...",
              root,
          )
      else:
          raise valueError("Unable to parse root: {}".format(root))
  
      # synsets
      classes = [c["name"] for c in coco.loadCats(coco.getCatIds())]
      # load entries
      d = {"image": [], "rois": [], "image_attr": []}
      image_ids = sorted(coco.getImgIds())
      for entry in coco.loadImgs(image_ids):
          if "coco_url" in entry:
              dirname, filename = entry["coco_url"].split("/")[-2:]
              abs_path = os.path.join(root, dirname, filename)
          else:
              abs_path = os.path.join(root, entry["file_name"])
          if not os.path.exists(abs_path):
              raise IOError("Image: {} not exists.".format(abs_path))
          label = _check_load_coco_bbox(
              coco,
              entry,
              min_object_area=min_object_area,
              use_crowd=use_crowd,
          )
          if not label:
              continue
          d["image_attr"].append(
              {"width": entry["width"], "height": entry["height"]}
          )
          d["image"].append(abs_path)
          d["rois"].append(label)
      df = pd.DataFrame(d)
      return cls(
          df.sort_values("image").reset_index(drop=True),
          dataset_type="coco",
          classes=list(classes),
      )
  
imports: import logging
  import os
  from pathlib import Path
  import warnings
  import numpy
  import pandas
  import matplotlib.pyplot
  from PIL import Image
  import cv2
  from ..data import is_url, url_data
  from ...utils.filesystem import import_try_install
  from ...utils.bbox import bbox_xywh_to_xyxy, bbox_clip_xyxy
label_desc: Use image node_id 5 for calling the ObjectDetectionDataset obj's underlying member method code with example usage: obj.from_coco(cls, anno_file, root, min_object_area, use_crowd) and returns: cls