code: def train(self):
      samples = []
  
      print("Digit images preprocessing...")
  
      for index_digit in range(0, 10, 1):
          list_file_digit_sample = (
              IMAGE_DIGIT_SAMPLES.GET_LIST_IMAGE_SAMPLES(index_digit)
          )
  
          for file_name in list_file_digit_sample:
              data = read_image(file_name)
  
              image_pattern = rgb2gray(data)
  
              for index_pixel in range(len(image_pattern)):
                  if image_pattern[index_pixel] < 128:
                      image_pattern[index_pixel] = 1
                  else:
                      image_pattern[index_pixel] = 0
  
              samples += [image_pattern]
  
      print("SOM initialization...")
      self.__network = som(2, 5, type_conn.grid_four, None, True)
  
      print("SOM training...")
      self.__network.train(samples, 300)
  
      print("SOM is ready...")
  
imports: from pyclustering.nnet.som import som, type_conn
  from pyclustering.samples.definitions import IMAGE_DIGIT_SAMPLES
  from pyclustering.utils import read_image, rgb2gray
  from tkinter import *
  from tkinter import messagebox
  import math
  import pickle
  import os
  import random
label_desc: Use image node_id 2 for calling the recognizer obj's underlying member method code with example usage: obj.train() without return types