code: def test_train_FeatureSet(self):
      batch_size = 8
      epoch_num = 5
      images = []
      labels = []
      for i in range(0, 8):
          features = np.random.uniform(0, 1, (200, 200, 3))
          label = np.array([2])
          images.append(features)
          labels.append(label)
  
      image_frame = DistributedImageFrame(
          self.sc.parallelize(images), self.sc.parallelize(labels)
      )
  
      transformer = Pipeline(
          [
              BytesToMat(),
              Resize(256, 256),
              CenterCrop(224, 224),
              ChannelNormalize(
                  0.485, 0.456, 0.406, 0.229, 0.224, 0.225
              ),
              MatToTensor(),
              ImageFrameToSample(target_keys=["label"]),
          ]
      )
      data_set = (
          FeatureSet.image_frame(image_frame)
          .transform(transformer)
          .to_dataset()
      )
  
      model = Sequential()
      model.add(SpatialConvolution(3, 1, 5, 5))
      model.add(View([1 * 220 * 220]))
      model.add(Linear(1 * 220 * 220, 20))
      model.add(LogSoftMax())
      optim_method = SGD(learningrate=0.01)
      optimizer = Optimizer.create(
          model=model,
          training_set=data_set,
          criterion=ClassNLLCriterion(),
          optim_method=optim_method,
          end_trigger=MaxEpoch(epoch_num),
          batch_size=batch_size,
      )
      optimizer.set_validation(
          batch_size=batch_size,
          val_rdd=data_set,
          trigger=EveryEpoch(),
          val_method=[Top1Accuracy()],
      )
  
      trained_model = optimizer.optimize()
  
      predict_result = trained_model.predict_image(
          image_frame.transform(transformer)
      )
      assert (predict_result.get_predict().count(), 8)
  
file_path: analytics-zoo/pyzoo/test/zoo/feature/test_feature_common.py
imports: import pytest
  from bigdl.nn.layer import *
  from bigdl.nn.criterion import *
  from bigdl.optim.optimizer import *
  from test.zoo.pipeline.utils.test_utils import ZooTestCase
  from zoo.feature.common import *
  from zoo import init_nncontext, init_spark_conf
label_desc: Use image node_id 4 for calling the TestFeatureCommon obj's underlying member method code with example usage: obj.test_train_FeatureSet() without return types