code: def instances_to_polylines(
      sample_collection, in_field, out_field, tolerance=2, filled=True
  ):
      """Converts the instance segmentations in the specified field of the
      collection into :class:`fiftyone.core.labels.Polylines` instances.
  
      For detections with masks, the returned polylines will trace the boundaries
      of the masks; otherwise, the polylines will trace the bounding boxes
      themselves.
  
      Args:
          sample_collection: a
              :class:`fiftyone.core.collections.SampleCollection`
          in_field: the name of the :class:`fiftyone.core.labels.Detections`
              field to convert
          out_field: the name of the :class:`fiftyone.core.labels.Polylines`
              field to populate
          tolerance (2): a tolerance, in pixels, when generating approximate
              polylines for each region. Typical values are 1-3 pixels
          filled (True): whether the polylines should be filled
      """
      fov.validate_collection_label_fields(
          sample_collection,
          in_field,
          fol.Detections,
      )
  
      samples = sample_collection.select_fields(in_field)
      in_field, processing_frames = samples._handle_frame_field(
          in_field
      )
      out_field, _ = samples._handle_frame_field(out_field)
  
      for sample in samples.iter_samples(autosave=True, progress=True):
          if processing_frames:
              images = sample.frames.values()
          else:
              images = [sample]
  
          for image in images:
              label = image[in_field]
              if label is None:
                  continue
  
              image[out_field] = label.to_polylines(
                  tolerance=tolerance, filled=filled
              )
  
file_path: fiftyone/fiftyone/utils/labels.py
imports: import eta.core.utils
  import fiftyone.core.labels
  import fiftyone.core.utils
  import fiftyone.core.validation
label_desc: Use image node_id 7 for calling a global function with example usage: instances_to_polylines(sample_collection, in_field, out_field, tolerance, filled) without return types