Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix yolov7's MaxPool2d's bug #362

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/yolov7/yolov7-tiny.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __BASE__: [
per_batch_size: 16 # 16 * 8 = 128
img_size: 640 # image sizes
sync_bn: True
precision_mode: 'allow_fp32_to_fp16'

network:
model_name: yolov7
Expand Down
5 changes: 5 additions & 0 deletions demo/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def get_parser_infer(parents=None):
parser.add_argument(
"--ms_enable_graph_kernel", type=ast.literal_eval, default=False, help="use enable_graph_kernel or not"
)
parser.add_argument(
"--precision_mode", type=str, default=None, help="set accuracy mode of network model"
)
parser.add_argument("--weight", type=str, default="yolov7_300.ckpt", help="model.ckpt path(s)")
parser.add_argument("--img_size", type=int, default=640, help="inference size (pixels)")
parser.add_argument(
Expand All @@ -53,6 +56,8 @@ def get_parser_infer(parents=None):
def set_default_infer(args):
# Set Context
ms.set_context(mode=args.ms_mode, device_target=args.device_target, max_call_depth=2000)
if args.precision_mode is not None:
ms.set_context(ascend_config={"precision_mode":args.precision_mode})
if args.ms_mode == 0:
ms.set_context(jit_config={"jit_level": "O2"})
if args.device_target == "Ascend":
Expand Down
5 changes: 5 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def get_parser_test(parents=None):
parser.add_argument(
"--ms_enable_graph_kernel", type=ast.literal_eval, default=False, help="use enable_graph_kernel or not"
)
parser.add_argument(
"--precision_mode", type=str, default=None, help="set accuracy mode of network model"
)
parser.add_argument("--weight", type=str, default="yolov7_300.ckpt", help="model.ckpt path(s)")
parser.add_argument("--per_batch_size", type=int, default=32, help="size of each image batch")
parser.add_argument("--img_size", type=int, default=640, help="inference size (pixels)")
Expand Down Expand Up @@ -71,6 +74,8 @@ def get_parser_test(parents=None):
def set_default_test(args):
# Set Context
ms.set_context(mode=args.ms_mode, device_target=args.device_target, max_call_depth=2000)
if args.precision_mode is not None:
ms.set_context(ascend_config={"precision_mode":args.precision_mode})
if args.ms_mode == 0:
ms.set_context(jit_config={"jit_level": "O2"})
if args.device_target == "Ascend":
Expand Down
Loading