box.py 727 B

123456789101112131415161718
  1. class Box:
  2. def __init__(self, x_min, y_min, x_max, y_max, score, kind):
  3. self.x_min = float(x_min)
  4. self.y_min = float(y_min)
  5. self.x_max = float(x_max)
  6. self.y_max = float(y_max)
  7. self.score = float(score)
  8. self.kind = str(kind)
  9. def __repr__(self):
  10. return f'Box({self.x_min}, {self.y_min}, {self.x_max}, {self.y_max}, {self.score}, {self.kind})'
  11. def __eq__(self, other):
  12. if isinstance(other, Box):
  13. return (self.x_min == other.x_min and self.y_min == other.y_min and
  14. self.x_max == other.x_max and self.y_max == other.y_max and
  15. self.score == other.score and self.kind == other.kind)
  16. return False