code: def save_image(self, cat, img, data):
          
          filename = self.path(cat, img)
          mkdir(filename)
          if type(data) == np.ndarray:
              data = Image.fromarray(data).convert('RGB')
          data.save(filename)
docs: Saves a new image.