ONNX
Satyam Goyal commited on
Commit
757f0c8
·
1 Parent(s): 4e66120

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 +6 -2
  2. demo.py +5 -5
README.md CHANGED
@@ -5,14 +5,18 @@ This model is ported from [PaddleHub](https://github.com/PaddlePaddle/PaddleHub)
5
  ## Demo
6
 
7
  Run the following command to try the demo:
 
8
  ```shell
9
  # detect on camera input
10
  python demo.py
11
  # detect on an image
12
  python demo.py --input /path/to/image
 
 
 
13
  ```
14
 
15
- ## Example outputs
16
 
17
  ![webcam demo](./examples/pphumanseg_demo.gif)
18
 
@@ -26,4 +30,4 @@ All files in this directory are licensed under [Apache 2.0 License](./LICENSE).
26
 
27
  - https://arxiv.org/abs/1512.03385
28
  - https://github.com/opencv/opencv/tree/master/samples/dnn/dnn_model_runner/dnn_conversion/paddlepaddle
29
- - https://github.com/PaddlePaddle/PaddleHub
 
5
  ## Demo
6
 
7
  Run the following command to try the demo:
8
+
9
  ```shell
10
  # detect on camera input
11
  python demo.py
12
  # detect on an image
13
  python demo.py --input /path/to/image
14
+
15
+ # get help regarding various parameters
16
+ python demo.py --help
17
  ```
18
 
19
+ ### Example outputs
20
 
21
  ![webcam demo](./examples/pphumanseg_demo.gif)
22
 
 
30
 
31
  - https://arxiv.org/abs/1512.03385
32
  - https://github.com/opencv/opencv/tree/master/samples/dnn/dnn_model_runner/dnn_conversion/paddlepaddle
33
+ - https://github.com/PaddlePaddle/PaddleHub
demo.py CHANGED
@@ -29,15 +29,15 @@ try:
29
  help_msg_backends += "; {:d}: TIMVX"
30
  help_msg_targets += "; {:d}: NPU"
31
  except:
32
- print('This version of OpenCV does not support TIM-VX and NPU. Visit https://gist.github.com/fengyuentau/5a7a5ba36328f2b763aea026c43fa45f for more information.')
33
 
34
  parser = argparse.ArgumentParser(description='PPHumanSeg (https://github.com/PaddlePaddle/PaddleSeg/tree/release/2.2/contrib/PP-HumanSeg)')
35
- parser.add_argument('--input', '-i', type=str, help='Path to the input image. Omit for using default camera.')
36
- parser.add_argument('--model', '-m', type=str, default='human_segmentation_pphumanseg_2021oct.onnx', help='Path to the model.')
37
  parser.add_argument('--backend', '-b', type=int, default=backends[0], help=help_msg_backends.format(*backends))
38
  parser.add_argument('--target', '-t', type=int, default=targets[0], help=help_msg_targets.format(*targets))
39
- parser.add_argument('--save', '-s', type=str, default=False, help='Set true to save results. This flag is invalid when using camera.')
40
- 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.')
41
  args = parser.parse_args()
42
 
43
  def get_color_map_list(num_classes):
 
29
  help_msg_backends += "; {:d}: TIMVX"
30
  help_msg_targets += "; {:d}: NPU"
31
  except:
32
+ 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.')
33
 
34
  parser = argparse.ArgumentParser(description='PPHumanSeg (https://github.com/PaddlePaddle/PaddleSeg/tree/release/2.2/contrib/PP-HumanSeg)')
35
+ parser.add_argument('--input', '-i', type=str, help='Usage: Set input path to a certain image, omit if using camera.')
36
+ parser.add_argument('--model', '-m', type=str, default='human_segmentation_pphumanseg_2021oct.onnx', help='Usage: Set model path, defaults to human_segmentation_pphumanseg_2021oct.onnx.')
37
  parser.add_argument('--backend', '-b', type=int, default=backends[0], help=help_msg_backends.format(*backends))
38
  parser.add_argument('--target', '-t', type=int, default=targets[0], help=help_msg_targets.format(*targets))
39
+ parser.add_argument('--save', '-s', type=str, default=False, help='Usage: Set “True” to save a file with results. Invalid in case of camera input. Default will be set to “False”.')
40
+ 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.')
41
  args = parser.parse_args()
42
 
43
  def get_color_map_list(num_classes):