class_docstr: MS COCO instance segmentation dataset.
  
  Parameters
  ----------
  root : str, default '~/mxnet/datasets/coco'
      Path to folder storing the dataset.
  splits : list of str, default ['instances_val2017']
      Json annotations name.
      Candidates can be: instances_val2017, instances_train2017.
  transform : callable, default None
      A function that takes data and label and transforms them. Refer to
      :doc:`./transforms` for examples.
  
      A transform function for object detection should take label into consideration,
      because any geometric modification will require label to be modified.
  min_object_area : float, default is 1
      Minimum accepted ground-truth area, if an object's area is smaller than this value,
      it will be ignored.
  skip_empty : bool, default is True
      Whether skip images with no valid object. This should be `True` in training, otherwise
      it will cause undefined behavior.
class_docstr_tok: ["MS","COCO","instance","segmentation","dataset",".","Parameters","--","--","--","--","--","root",":","str",",","default","'~\/mxnet\/datasets\/coco'","Path","to","folder","storing","the","dataset",".","splits",":","list","of","str",",","default","[","'instances_val2017","'","]","Json","annotations","name",".","Candidates","can","be",":","instances_val2017",",","instances_train2017",".","transform",":","callable",",","default","None","A","function","that","takes","data","and","label","and","transforms","them",".","Refer","to",":","doc",":","`",".\/transforms","`","for","examples",".","A","transform","function","for","object","detection","should","take","label","into","consideration",",","because","any","geometric","modification","will","require","label","to","be","modified",".","min_object_area",":","float",",","default","is","1","Minimum","accepted","ground-truth","area",",","if","an","object","'s","area","is","smaller","than","this","value",",","it","will","be","ignored",".","skip_empty",":","bool",",","default","is","True","Whether","skip","images","with","no","valid","object",".","This","should","be","`","True","`","in","training",",","otherwise","it","will","cause","undefined","behavior","."]
docstr: Check and load ground-truth labels
docstr_tok: ["Check","and","load","ground-truth","labels"]
code: def _check_load_bbox(self, coco, entry):
      """Check and load ground-truth labels"""
      ann_ids = coco.getAnnIds(imgIds=entry["id"], iscrowd=None)
      objs = coco.loadAnns(ann_ids)
      # check valid bboxes
      valid_objs = []
      valid_segs = []
      width = entry["width"]
      height = entry["height"]
      for obj in objs:
          if obj.get("ignore", 0) == 1:
              continue
          # crowd objs cannot be used for segmentation
          if obj.get("iscrowd", 0) == 1:
              continue
          # need accurate floating point box representation
          x1, y1, w, h = obj["bbox"]
          x2, y2 = x1 + np.maximum(0, w), y1 + np.maximum(0, h)
          # clip to image boundary
          x1 = np.minimum(width, np.maximum(0, x1))
          y1 = np.minimum(height, np.maximum(0, y1))
          x2 = np.minimum(width, np.maximum(0, x2))
          y2 = np.minimum(height, np.maximum(0, y2))
          # require non-zero seg area and more than 1x1 box size
          if (
              obj["area"] > self._min_object_area
              and x2 > x1
              and y2 > y1
              and (x2 - x1) * (y2 - y1) >= 4
          ):
              contiguous_cid = self.json_id_to_contiguous[
                  obj["category_id"]
              ]
              valid_objs.append([x1, y1, x2, y2, contiguous_cid])
  
              segs = obj["segmentation"]
              assert isinstance(segs, list), "{}".format(
                  obj.get("iscrowd", 0)
              )
              valid_segs.append(
                  [
                      np.asarray(p).reshape(-1, 2).astype("float32")
                      for p in segs
                      if len(p) >= 6
                  ]
              )
      # there is no easy way to return a polygon placeholder: None is returned
      # in validation, None cannot be used for batchify -> drop label in transform
      # in training: empty images should be be skipped
      if not valid_objs:
          valid_objs = None
          valid_segs = None
      else:
          valid_objs = np.asarray(valid_objs).astype("float32")
      return valid_objs, valid_segs
  
file_path: gluon-cv/gluoncv/data/mscoco/instance.py
imports: from __future__ import absolute_import
  from __future__ import division
  import os
  import numpy
  from PIL import Image
  import mxnet
  from .utils import try_import_pycocotools
  from ..base import VisionDataset
label_desc: Use image node_id 9 for calling the COCOInstance obj's underlying member method code with example usage: obj._check_load_bbox(coco, entry) and returns: valid_objs,  valid_segs