docstr: check so that the text poly is in the same direction,
  and also filter some invalid polygons
  :param polys:
  :param tags:
  :return:
docstr_tok: ["check","so","that","the","text","poly","is","in","the","same","direction",",","and","also","filter","some","invalid","polygons",":","param","polys",":",":","param","tags",":",":","return",":"]
code: def check_and_validate_polys(
      self, polys, tags, img_height, img_width
  ):
      """
      check so that the text poly is in the same direction,
      and also filter some invalid polygons
      :param polys:
      :param tags:
      :return:
      """
      h, w = img_height, img_width
      if polys.shape[0] == 0:
          return polys
      polys[:, :, 0] = np.clip(polys[:, :, 0], 0, w - 1)
      polys[:, :, 1] = np.clip(polys[:, :, 1], 0, h - 1)
  
      validated_polys = []
      validated_tags = []
      for poly, tag in zip(polys, tags):
          p_area = self.polygon_area(poly)
          # invalid poly
          if abs(p_area) < 1:
              continue
          if p_area > 0:
              #'poly in wrong direction'
              if not tag:
                  tag = True  # reversed cases should be ignore
              poly = poly[(0, 3, 2, 1), :]
          validated_polys.append(poly)
          validated_tags.append(tag)
      return np.array(validated_polys), np.array(validated_tags)
  
file_path: PaddleOCR/ppocr/data/imaug/east_process.py
imports: import math
  import cv2
  import numpy
  import json
  import sys
  import os
label_desc: Use image node_id 5 for calling the EASTProcessTrain obj's underlying member method code with example usage: obj.check_and_validate_polys(polys, tags, img_height, img_width) and returns: np,  np, polys