You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.5 KiB

  1. #!/usr/bin/env python3
  2. import cv2
  3. import sys
  4. import rospy
  5. import object_detector_python3 as od
  6. import detection_node_python3 as dn
  7. import deep_learning_model_options as do
  8. if __name__ == '__main__':
  9. print('cv2.__version__ =', cv2.__version__)
  10. print('Python version (must be > 3.0):', sys.version)
  11. assert(int(sys.version[0]) >= 3)
  12. models_directory = do.get_directory()
  13. print('Using the following directory for deep learning models:', models_directory)
  14. use_neural_compute_stick = do.use_neural_compute_stick()
  15. if use_neural_compute_stick:
  16. print('Attempt to use an Intel Neural Compute Stick 2.')
  17. else:
  18. print('Not attempting to use an Intel Neural Compute Stick 2.')
  19. use_tiny = True
  20. if use_tiny:
  21. confidence_threshold = 0.0
  22. else:
  23. confidence_threshold = 0.5
  24. detector = od.ObjectDetector(models_directory,
  25. use_tiny_yolo3=use_tiny,
  26. confidence_threshold=confidence_threshold,
  27. use_neural_compute_stick=use_neural_compute_stick)
  28. default_marker_name = 'object'
  29. node_name = 'DetectObjectsNode'
  30. topic_base_name = 'objects'
  31. fit_plane = False
  32. node = dn.DetectionNode(detector, default_marker_name, node_name, topic_base_name, fit_plane)
  33. node.main()
  34. try:
  35. rospy.spin()
  36. except KeyboardInterrupt:
  37. print('interrupt received, so shutting down')