class_docstr: Bounding Box representation.
  
  Should **not** be instantiated directly, instead use `from_*` methods.
  e.g. `from_xyxy`, `from_xywh`.
  Is able to transform coordinates into different formats,
  e.g. `xyxy`, `xywh`.
  
  # Examples
  
  Create from `xywh` format, and get `xyxy` coordinates.
  ```python
  bbox = BBox.from_xywh(1, 1, 4, 4)
  xyxy = bbox.xyxy
  ```
class_docstr_tok: ["Bounding","Box","representation",".","Should","*","*","not","*","*","be","instantiated","directly",",","instead","use","`","from_","*","`","methods",".","e.g",".","`","from_xyxy","`",",","`","from_xywh","`",".","Is","able","to","transform","coordinates","into","different","formats",",","e.g",".","`","xyxy","`",",","`","xywh","`",".","#","Examples","Create","from","`","xywh","`","format",",","and","get","`","xyxy","`","coordinates",".","``","`","python","bbox","=","BBox.from_xywh","(","1",",","1",",","4",",","4",")","xyxy","=","bbox.xyxy","``","`"]
docstr: Tries to automatically fix invalid coordinates.
  
  # Returns
  - False if nothing was fixed (data had no problems)
  - True if data was successfully fixed
  - Raises `InvalidDataError` if unables to automatically fix the data
docstr_tok: ["Tries","to","automatically","fix","invalid","coordinates",".","#","Returns","-","False","if","nothing","was","fixed","(","data","had","no","problems",")","-","True","if","data","was","successfully","fixed","-","Raises","`","InvalidDataError","`","if","unables","to","automatically","fix","the","data"]
code: def autofix(
      self, img_w, img_h, record_id: Optional[Any] = None
  ) -> bool:
      """Tries to automatically fix invalid coordinates.
  
      # Returns
      - False if nothing was fixed (data had no problems)
      - True if data was successfully fixed
      - Raises `InvalidDataError` if unables to automatically fix the data
      """
      # conditions where data can be fixed
      if self.xmin < 0:
          autofix_log(
              "AUTOFIX-SUCCESS",
              f"Clipping bbox xmin from {self.xmin} to 0 (Before: {self})",
              record_id=record_id,
          )
          self.xmin = max(self.xmin, 0)
  
      if self.ymin < 0:
          autofix_log(
              "AUTOFIX-SUCCESS",
              f"Clipping bbox ymin from {self.ymin} to 0 (Before: ({self}))",
              record_id=record_id,
          )
          self.ymin = max(self.ymin, 0)
  
      if self.xmax > img_w:
          autofix_log(
              "AUTOFIX-SUCCESS",
              f"Clipping bbox xmax from {self.xmax} to image width {img_w} (Before: {self})",
              record_id=record_id,
          )
          self.xmax = min(self.xmax, img_w)
  
      if self.ymax > img_h:
          autofix_log(
              "AUTOFIX-SUCCESS",
              f"Clipping bbox ymax from {self.ymax} to image height {img_h} (Before: {self})",
              record_id=record_id,
          )
          self.ymax = min(self.ymax, img_h)
  
      # conditions where data cannot be fixed
      if (self.xmin >= self.xmax) or (self.ymin >= self.ymax):
          msg = []
          if self.xmin >= self.xmax:
              msg += [
                  f"\tx_min:{self.xmin} is greater than or equal to x_max:{self.xmax}"
              ]
          if self.ymin >= self.ymax:
              msg += [
                  f"\ty_min:{self.ymin} is greater than or equal to y_max:{self.ymax}"
              ]
  
          msg = "\n".join(msg)
          raise InvalidDataError(
              f"Cannot auto-fix coordinates: {self}\n{msg}"
          )
  
      if (
          self.xmin < 0
          or self.ymin < 0
          or self.xmax > img_w
          or self.ymax > img_h
      ):
          return True
  
      return False
  
file_path: icevision/icevision/core/bbox.py
imports: from icevision.imports import *
  from icevision.utils import *
  from .exceptions import *
label_desc: Use image node_id 8 for calling the BBox obj's underlying member method code with example usage: obj.autofix(img_w, img_h, record_id) and returns: False, True