城管三模型代码
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

52 行
2.6KB

  1. """Configurate arguments."""
  2. import argparse
  3. # 0: confidence, 1: point_shape, 2: offset_x, 3: offset_y, 4: cos(direction),
  4. # 5: sin(direction)
  5. NUM_FEATURE_MAP_CHANNEL = 6
  6. def add_common_arguments(parser):
  7. """Add common arguments for training and inference."""
  8. parser.add_argument('--detector_weights', default=r'E:\pycharmProject\DMPR-PS\weights\dp_detector_499.pth',
  9. help="The weights of pretrained detector.")
  10. parser.add_argument('--depth_factor', type=int, default=32,
  11. help="Depth factor.")
  12. parser.add_argument('--disable_cuda', action='store_true',
  13. help="Disable CUDA.")
  14. parser.add_argument('--gpu_id', type=int, default=0,
  15. help="Select which gpu to use.")
  16. def get_parser_for_inference():
  17. """Return argument parser for inference."""
  18. parser = argparse.ArgumentParser()
  19. parser.add_argument('--mode', default='image', choices=['image', 'video'],
  20. help="Inference image or video.")
  21. parser.add_argument('--video',
  22. help="Video path if you choose to inference video.")
  23. parser.add_argument('--inference_slot', action='store_true', default=False,
  24. help="Perform slot inference.")
  25. parser.add_argument('--thresh', type=float, default=0.3,
  26. help="Detection threshold.")
  27. parser.add_argument('--save', action='store_true', default=True,
  28. help="Save detection result to file.")
  29. parser.add_argument('--yoloimg-size', type=int, default=640,
  30. help='inference size (pixels)')
  31. parser.add_argument('--dmprimg-size', type=int, default=640,
  32. help='inference size (pixels)')
  33. parser.add_argument('--augment', action='store_true',
  34. help='augmented inference')
  35. parser.add_argument('--conf-thres', type=float, default=0.25,
  36. help='object confidence threshold')
  37. parser.add_argument('--iou-thres', type=float, default=0.45,
  38. help='IOU threshold for NMS')
  39. parser.add_argument('--ovlap-thres', type=float, default=0.6, help='overlap threshold for OBS')
  40. parser.add_argument('--agnostic-nms', action='store_true',
  41. help='class-agnostic NMS')
  42. parser.add_argument('--classes', nargs='+', type=int,
  43. help='filter by class: --class 0, or --class 0 2 3')
  44. parser.add_argument('--dmpr-thresh', type=float, default=0.3,
  45. help="Detection threshold.")
  46. add_common_arguments(parser)
  47. return parser