code: def compute_metadata(
      sample_collection,
      overwrite=False,
      num_workers=None,
      skip_failures=True,
      warn_failures=False,
  ):
      """Populates the ``metadata`` field of all samples in the collection.
  
      Any samples with existing metadata are skipped, unless
      ``overwrite == True``.
  
      Args:
          sample_collection: a
              :class:`fiftyone.core.collections.SampleCollection`
          overwrite (False): whether to overwrite existing metadata
          num_workers (None): a suggested number of threads to use
          skip_failures (True): whether to gracefully continue without raising an
              error if metadata cannot be computed for a sample
          warn_failures (False): whether to log a warning if metadata cannot
              be computed for a sample
      """
      num_workers = fou.recommend_thread_pool_workers(num_workers)
  
      if sample_collection.media_type == fom.GROUP:
          sample_collection = sample_collection.select_group_slices(
              _allow_mixed=True
          )
  
      if num_workers <= 1:
          _compute_metadata(sample_collection, overwrite=overwrite)
      else:
          _compute_metadata_multi(
              sample_collection, num_workers, overwrite=overwrite
          )
  
      if skip_failures and not warn_failures:
          return
  
      num_missing = len(sample_collection.exists("metadata", False))
      if num_missing > 0:
          msg = (
              "Failed to populate metadata on %d samples. "
              + 'Use `dataset.exists("metadata", False)` to retrieve them'
          ) % num_missing
  
          if skip_failures:
              logger.warning(msg)
          else:
              raise ValueError(msg)
  
imports: import itertools
  import logging
  import multiprocessing.dummy
  import os
  import requests
  from PIL import Image
  import eta.core.utils
  import eta.core.video
  import fiftyone
  from fiftyone.core.odm import DynamicEmbeddedDocument
  import fiftyone.core.fields
  import fiftyone.core.media
  import fiftyone.core.utils
label_desc: Use image node_id 2 for calling a global function with example usage: compute_metadata(sample_collection, overwrite, num_workers, skip_failures, warn_failures) without return types