BaseDetector.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from tracker import update_tracker
  2. import cv2
  3. class baseDet(object):
  4. def __init__(self):
  5. self.img_size = 640
  6. self.threshold = 0.3
  7. self.stride = 1
  8. def build_config(self):
  9. self.faceTracker = {}
  10. self.faceClasses = {}
  11. self.faceLocation1 = {}
  12. self.faceLocation2 = {}
  13. self.frameCounter = 0
  14. self.currentCarID = 0
  15. self.recorded = []
  16. self.font = cv2.FONT_HERSHEY_SIMPLEX
  17. def feedCap(self, im):
  18. retDict = {
  19. 'frame': None,
  20. 'faces': None,
  21. 'list_of_ids': None,
  22. 'face_bboxes': []
  23. }
  24. self.frameCounter += 1
  25. im, faces, face_bboxes = update_tracker(self, im)
  26. retDict['frame'] = im
  27. retDict['faces'] = faces
  28. retDict['face_bboxes'] = face_bboxes
  29. return retDict
  30. def init_model(self):
  31. raise EOFError("Undefined model type.")
  32. def preprocess(self):
  33. raise EOFError("Undefined model type.")
  34. def detect(self):
  35. raise EOFError("Undefined model type.")