Satyam Goyal commited on
Commit
8d3a72f
·
1 Parent(s): 7cf14e0

Merge pull request #95 from Satgoy152:adding-doc

Browse files

Improved help messages for demo programs (#95)
- Added Demo Documentation
- Updated help messages
- Changed exception link

Files changed (2) hide show
  1. README.md +5 -1
  2. demo.py +9 -9
README.md CHANGED
@@ -7,11 +7,14 @@ Please note that the model is trained with Chinese license plates, so the detect
7
  ## Demo
8
 
9
  Run the following command to try the demo:
 
10
  ```shell
11
  # detect on camera input
12
  python demo.py
13
  # detect on an image
14
  python demo.py --input /path/to/image
 
 
15
  ```
16
 
17
  ### Example outputs
@@ -19,8 +22,9 @@ python demo.py --input /path/to/image
19
  ![lpd](./examples/lpd_yunet_demo.gif)
20
 
21
  ## License
 
22
  All files in this directory are licensed under [Apache 2.0 License](./LICENSE)
23
 
24
  ## Reference
25
 
26
- - https://github.com/ShiqiYu/libfacedetection.train
 
7
  ## Demo
8
 
9
  Run the following command to try the demo:
10
+
11
  ```shell
12
  # detect on camera input
13
  python demo.py
14
  # detect on an image
15
  python demo.py --input /path/to/image
16
+ # get help regarding various parameters
17
+ python demo.py --help
18
  ```
19
 
20
  ### Example outputs
 
22
  ![lpd](./examples/lpd_yunet_demo.gif)
23
 
24
  ## License
25
+
26
  All files in this directory are licensed under [Apache 2.0 License](./LICENSE)
27
 
28
  ## Reference
29
 
30
+ - https://github.com/ShiqiYu/libfacedetection.train
demo.py CHANGED
@@ -23,19 +23,19 @@ try:
23
  help_msg_backends += "; {:d}: TIMVX"
24
  help_msg_targets += "; {:d}: NPU"
25
  except:
26
- print('This version of OpenCV does not support TIM-VX and NPU. Visit https://gist.github.com/fengyuentau/5a7a5ba36328f2b763aea026c43fa45f for more information.')
27
 
28
  parser = argparse.ArgumentParser(description='LPD-YuNet for License Plate Detection')
29
- parser.add_argument('--input', '-i', type=str, help='Path to the input image. Omit for using default camera.')
30
- parser.add_argument('--model', '-m', type=str, default='license_plate_detection_lpd_yunet_2022may.onnx', help='Path to the model.')
31
  parser.add_argument('--backend', '-b', type=int, default=backends[0], help=help_msg_backends.format(*backends))
32
  parser.add_argument('--target', '-t', type=int, default=targets[0], help=help_msg_targets.format(*targets))
33
- parser.add_argument('--conf_threshold', type=float, default=0.9, help='Filter out faces of confidence < conf_threshold.')
34
- parser.add_argument('--nms_threshold', type=float, default=0.3, help='Suppress bounding boxes of iou >= nms_threshold.')
35
- parser.add_argument('--top_k', type=int, default=5000, help='Keep top_k bounding boxes before NMS.')
36
- parser.add_argument('--keep_top_k', type=int, default=750, help='Keep keep_top_k bounding boxes after NMS.')
37
- parser.add_argument('--save', '-s', type=str2bool, default=False, help='Set true to save results. This flag is invalid when using camera.')
38
- parser.add_argument('--vis', '-v', type=str2bool, default=True, help='Set true to open a window for result visualization. This flag is invalid when using camera.')
39
  args = parser.parse_args()
40
 
41
  def visualize(image, dets, line_color=(0, 255, 0), text_color=(0, 0, 255), fps=None):
 
23
  help_msg_backends += "; {:d}: TIMVX"
24
  help_msg_targets += "; {:d}: NPU"
25
  except:
26
+ print('This version of OpenCV does not support TIM-VX and NPU. Visit https://github.com/opencv/opencv/wiki/TIM-VX-Backend-For-Running-OpenCV-On-NPU for more information.')
27
 
28
  parser = argparse.ArgumentParser(description='LPD-YuNet for License Plate Detection')
29
+ parser.add_argument('--input', '-i', type=str, help='Usage: Set path to the input image. Omit for using default camera.')
30
+ parser.add_argument('--model', '-m', type=str, default='license_plate_detection_lpd_yunet_2022may.onnx', help='Usage: Set model path, defaults to license_plate_detection_lpd_yunet_2022may.onnx.')
31
  parser.add_argument('--backend', '-b', type=int, default=backends[0], help=help_msg_backends.format(*backends))
32
  parser.add_argument('--target', '-t', type=int, default=targets[0], help=help_msg_targets.format(*targets))
33
+ parser.add_argument('--conf_threshold', type=float, default=0.9, help='Usage: Set the minimum needed confidence for the model to identify a license plate, defaults to 0.9. Smaller values may result in faster detection, but will limit accuracy. Filter out faces of confidence < conf_threshold.')
34
+ parser.add_argument('--nms_threshold', type=float, default=0.3, help='Usage: Suppress bounding boxes of iou >= nms_threshold. Default = 0.3. Suppress bounding boxes of iou >= nms_threshold.')
35
+ parser.add_argument('--top_k', type=int, default=5000, help='Usage: Keep top_k bounding boxes before NMS.')
36
+ parser.add_argument('--keep_top_k', type=int, default=750, help='Usage: Keep keep_top_k bounding boxes after NMS.')
37
+ parser.add_argument('--save', '-s', type=str2bool, default=False, help='Usage: Set “True” to save file with results (i.e. bounding box, confidence level). Invalid in case of camera input. Default will be set to “False”.')
38
+ parser.add_argument('--vis', '-v', type=str2bool, default=True, help='Usage: Default will be set to “True” and will open a new window to show results. Set to “False” to stop visualizations from being shown. Invalid in case of camera input.')
39
  args = parser.parse_args()
40
 
41
  def visualize(image, dets, line_color=(0, 255, 0), text_color=(0, 0, 255), fps=None):