docs: def image_predict(self, X):
          """
          Predicts class label for the entire image.
  
          Parameters:
          -----------
  
          X: array, shape = [n_samples, n_pixels_y, n_pixels_x, n_bands]
              Array of training images
  
          y: array, shape = [n_samples] or [n_samples, n_pixels_y, n_pixels_x]
              Target labels or masks.
          """
          self._check_image(X)
  
          if self.mode == 'majority_class':
              predictions = self.pixel_classifier.image_predict(X)
  
          elif self.mode == 'mean_prob':
              probabilities = self.image_predict_proba(X)
              predictions = (probabilities[..., self.target] > self.target_threshold).astype(np.int)
  
          patches, _ = self._to_patches(predictions)
  
          row_steps = self._image_size[0] // self.patch_size[0]
          col_steps = self._image_size[1] // self.patch_size[1]
  
          # how can this be optimised?
          for i, j, k in itertools.product(range(row_steps), range(col_steps), range(self._samples)):
              patches[k, i, j] = self._target(patches[k, i, j])
  
          return predictions