code: def _get_data(feature, annotations):
      from PIL import Image as _PIL_Image
  
      rs = np.random.RandomState(1234)
  
      def from_pil_image(pil_img, image_format="png"):
          # The above didn't work, so as a temporary fix write to temp files
          if image_format == "raw":
              image = np.array(pil_img)
              FORMAT_RAW = 2
              return tc.Image(
                  _image_data=image.tobytes(),
                  _width=image.shape[1],
                  _height=image.shape[0],
                  _channels=image.shape[2],
                  _format_enum=FORMAT_RAW,
                  _image_data_size=image.size,
              )
          else:
              with tempfile.NamedTemporaryFile(
                  mode="w+b", suffix="." + image_format
              ) as f:
                  pil_img.save(f, format=image_format)
                  return tc.Image(f.name)
  
      num_examples = 100
      max_num_boxes_per_image = 10
      classes = _CLASSES
      images = []
      anns = []
      FORMATS = ["png", "jpeg", "raw"]
      for i in range(num_examples):
          # Randomly determine image size (should handle large and small)
          img_shape = tuple(rs.randint(100, 1000, size=2)) + (3,)
          img = rs.randint(255, size=img_shape)
  
          pil_img = _PIL_Image.fromarray(img, mode="RGB")
          # Randomly select image format
          image_format = FORMATS[rs.randint(len(FORMATS))]
          images.append(
              from_pil_image(pil_img, image_format=image_format)
          )
  
          ann = []
          for j in range(rs.randint(max_num_boxes_per_image)):
              left, right = np.sort(rs.randint(0, img_shape[1], size=2))
              top, bottom = np.sort(rs.randint(0, img_shape[0], size=2))
  
              x = (left + right) / 2
              y = (top + bottom) / 2
  
              width = max(right - left, 1)
              height = max(bottom - top, 1)
  
              label = {
                  "coordinates": {
                      "x": x,
                      "y": y,
                      "width": width,
                      "height": height,
                  },
                  "label": classes[rs.randint(len(classes))],
                  "type": "rectangle",
              }
              ann.append(label)
          anns.append(ann)
  
      data = tc.SFrame(
          {
              feature: tc.SArray(images),
              annotations: tc.SArray(anns),
          }
      )
      return data
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import unittest
  import pytest
  from .None import util
  import turicreate
  import tempfile
  import numpy
  import platform
  import pytest
  import sys
  import os
  from turicreate.toolkits._main import ToolkitError
  from turicreate.toolkits._internal_utils import _raise_error_if_not_sarray, _mac_ver
  from six import StringIO
label_desc: Use image node_id 1 for calling a global function with example usage: _get_data(feature, annotations) and returns: data, tc, tc