person_jump_with_rtsp.py 875 B

123456789101112131415161718192021222324252627282930313233
  1. from load_streams import LoadStreams
  2. from person_jump_check import PersonJump
  3. import cv2
  4. import datetime
  5. stream_loader = LoadStreams(r"rtsp://admin:lww123456@172.16.22.16:554/Streaming/Channels/0501")
  6. region_points = [(820, 200), (1600, 200), (1600, 530), (820, 530)]
  7. counter = PersonJump(
  8. show=True,
  9. region=region_points,
  10. model="no_train_person_jump.pt",
  11. classes=[0],
  12. conf=0.4,
  13. )
  14. if __name__ == "__main__":
  15. model_name = "no_train_person_jump.pt"
  16. for sources, imgs, _ in stream_loader:
  17. im0 = counter.count(imgs[0])
  18. if counter.in_count > 0:
  19. data_time = str(datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S"))
  20. file_name = "high_speed_fall" + data_time + ".jpg"
  21. print(file_name)
  22. cv2.imwrite(file_name, im0)
  23. print("person jump!")
  24. counter.in_count = 0