code: def create(
      dataset,
      label=None,
      feature=None,
      model="resnet-50",
      verbose=True,
      batch_size=64,
  ):
      """
      Create a :class:`ImageSimilarityModel` model.
  
      Parameters
      ----------
      dataset : SFrame
          Input data. The column named by the 'feature' parameter will be
          extracted for modeling.
  
      label : string
          Name of the SFrame column with row labels to be used as uuid's to
          identify the data. If 'label' is set to None, row numbers are used to
          identify reference dataset rows when the model is queried.
  
      feature : string
          Name of the column containing either the input images or extracted features.
          'None' (the default) indicates that only feature column or the  only image
          column in `dataset` should be used as the feature.
  
      model: string, optional
          Uses a pretrained model to bootstrap an image similarity model
  
             - "resnet-50" : Uses a pretrained resnet model.
  
             - "squeezenet_v1.1" : Uses a pretrained squeezenet model.
  
             - "VisionFeaturePrint_Scene": Uses an OS internal feature extractor.
                                            Only on available on iOS 12.0+,
                                            macOS 10.14+ and tvOS 12.0+.
  
          Models are downloaded from the internet if not available locally. Once
          downloaded, the models are cached for future use.
  
      verbose : bool, optional
          If True, print progress updates and model details.
  
      batch_size : int, optional
          If you are getting memory errors, try decreasing this value. If you
          have a powerful computer, increasing this value may improve performance.
  
      Returns
      -------
      out : ImageSimilarityModel
          A trained :class:`ImageSimilarityModel` model.
  
      See Also
      --------
      ImageSimilarityModel
  
      Examples
      --------
      .. sourcecode:: python
  
          # Train an image similarity model
          >>> model = turicreate.image_similarity.create(data)
  
          # Query the model for similar images
          >>> similar_images = model.query(data)
          +-------------+-----------------+-------------------+------+
          | query_label | reference_label |      distance     | rank |
          +-------------+-----------------+-------------------+------+
          |      0      |        0        |        0.0        |  1   |
          |      0      |       519       |   12.5319706301   |  2   |
          |      0      |       1619      |   12.5563764596   |  3   |
          |      0      |       186       |   12.6132604915   |  4   |
          |      0      |       1809      |   12.9180964745   |  5   |
          |      1      |        1        | 2.02304872852e-06 |  1   |
          |      1      |       1579      |   11.4288186151   |  2   |
          |      1      |       1237      |   12.3764325949   |  3   |
          |      1      |        80       |   12.7264363676   |  4   |
          |      1      |        58       |   12.7675058558   |  5   |
          +-------------+-----------------+-------------------+------+
          [500 rows x 4 columns]
      """
      start_time = _time.time()
      if not isinstance(dataset, _tc.SFrame):
          raise TypeError("'dataset' must be of type SFrame.")
  
      # Check parameters
      allowed_models = list(_pre_trained_models.IMAGE_MODELS.keys())
      if _mac_ver() >= (10, 14):
          allowed_models.append("VisionFeaturePrint_Scene")
  
          # Also, to make sure existing code doesn't break, replace incorrect name
          # with the correct name version
          if model == "VisionFeaturePrint_Screen":
              print(
                  "WARNING: Correct spelling of model name is VisionFeaturePrint_Scene.  VisionFeaturePrint_Screen will be removed in future releases."
              )
              model = "VisionFeaturePrint_Scene"
  
      _tkutl._check_categorical_option_type(
          "model", model, allowed_models
      )
      if len(dataset) == 0:
          raise _ToolkitError("Unable to train on empty dataset")
      if (label is not None) and (label not in dataset.column_names()):
          raise _ToolkitError(
              "Row label column '%s' does not exist" % label
          )
      if (feature is not None) and (
          feature not in dataset.column_names()
      ):
          raise _ToolkitError(
              "Image feature column '%s' does not exist" % feature
          )
      if batch_size < 1:
          raise ValueError(
              "'batch_size' must be greater than or equal to 1"
          )
  
      # Set defaults
      if feature is None:
          # select feature column : either extracted features columns or image column itself
          try:
              feature = image_analysis._find_only_image_extracted_features_column(
                  dataset, model
              )
              feature_type = "extracted_features_array"
          except:
              feature = None
          if feature is None:
              try:
                  feature = _tkutl._find_only_image_column(dataset)
                  feature_type = "image"
              except:
                  raise _ToolkitError(
                      "No feature column specified and no column with expected type image or array is found."
                      + ' "datasets" consists of columns with types: '
                      + ", ".join(
                          [x.__name__ for x in dataset.column_types()]
                      )
                      + "."
                  )
      else:
          if image_analysis._is_image_deep_feature_sarray(
              dataset[feature], model
          ):
              feature_type = "extracted_features_array"
          elif dataset[feature].dtype is _tc.Image:
              feature_type = "image"
          else:
              raise _ToolkitError(
                  'The "{feature}" column of the SFrame neither has the dataype image or array (for extracted features)'.format(
                      feature=feature
                  )
                  + ' "datasets" consists of columns with types: '
                  + ", ".join(
                      [x.__name__ for x in dataset.column_types()]
                  )
                  + "."
              )
  
      _tkutl._handle_missing_values(dataset, feature)
      feature_extractor = (
          _image_feature_extractor._create_feature_extractor(model)
      )
      if feature_type == "image":
          # Extract features
          extracted_features = _tc.SFrame(
              {
                  "__image_features__": feature_extractor.extract_features(
                      dataset,
                      feature,
                      verbose=verbose,
                      batch_size=batch_size,
                  ),
              }
          )
      else:
          extracted_features = _tc.SFrame(
              {"__image_features__": dataset[feature]}
          )
  
      # Train a similarity model using the extracted features
      if label is not None:
          extracted_features[label] = dataset[label]
      nn_model = _tc.nearest_neighbors.create(
          extracted_features,
          label=label,
          features=["__image_features__"],
          verbose=verbose,
      )
  
      # set input image shape
      if model in _pre_trained_models.IMAGE_MODELS:
          input_image_shape = _pre_trained_models.IMAGE_MODELS[
              model
          ].input_image_shape
      else:  # model == VisionFeaturePrint_Scene
          input_image_shape = (3, 299, 299)
  
      # Save the model
      state = {
          "similarity_model": nn_model,
          "model": model,
          "feature_extractor": feature_extractor,
          "input_image_shape": input_image_shape,
          "label": label,
          "feature": feature,
          "num_features": 1,
          "num_examples": nn_model.num_examples,
          "training_time": _time.time() - start_time,
      }
      return ImageSimilarityModel(state)
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import time
  import turicreate
  from turicreate.toolkits._model import CustomModel
  import turicreate.toolkits._internal_utils
  from turicreate.toolkits._main import ToolkitError
  from turicreate.toolkits._model import PythonProxy
  from .._internal_utils import _mac_ver
  from ..None import _pre_trained_models
  from ..None import _image_feature_extractor
  from ..image_analysis import image_analysis
label_desc: Use image node_id 1 for calling a global function with example usage: create(dataset, label, feature, model, verbose, batch_size) and returns: ImageSimilarityModel