code: def generate_label(self):
      train_path = os.path.join(self.annotation_path, "train2017")
      val_path = os.path.join(self.annotation_path, "val2017")
      save_train_path = os.path.join(self.save_path, "train2017")
      save_val_path = os.path.join(self.save_path, "val2017")
  
      if not os.path.exists(save_train_path):
          os.makedirs(save_train_path)
      if not os.path.exists(save_val_path):
          os.makedirs(save_val_path)
  
      for label_id in tqdm(os.listdir(train_path), desc="trainset"):
          label = np.array(
              Image.open(os.path.join(train_path, label_id)).convert(
                  "P"
              )
          )
          label = self.encode_label(label)
          label = Image.fromarray(label)
          label.save(os.path.join(save_train_path, label_id))
  
      for label_id in tqdm(os.listdir(val_path), desc="valset"):
          label = np.array(
              Image.open(os.path.join(val_path, label_id)).convert("P")
          )
          label = self.encode_label(label)
          label = Image.fromarray(label)
          label.save(os.path.join(save_val_path, label_id))
  
file_path: PaddleSeg/tools/data/convert_cocostuff.py
imports: import os
  import argparse
  import cv2
  import numpy
  from PIL import Image
  from tqdm import tqdm
label_desc: Use image node_id 3 for calling the COCOStuffGenerator obj's underlying member method code with example usage: obj.generate_label() without return types