Skip to content

Commit

Permalink
Fix model preparation step failure in ONNXRT examples (#1423)
Browse files Browse the repository at this point in the history
Signed-off-by: yuwenzho <yuwen.zhou@intel.com>
  • Loading branch information
yuwenzho committed Nov 28, 2023
1 parent 2627d33 commit eaa57f6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 0 deletions.
Expand Up @@ -19,6 +19,8 @@ pip install -r requirements.txt
python prepare_model.py --input_model='resnet50_v1.pb' --output_model='resnet50_v1.onnx'
```

> Note: For now, use "onnx==1.14.1" in this step in case you get an error `ValueError: Could not infer attribute explicit_paddings type from empty iterator`. Refer to this [link](https://github.com/onnx/tensorflow-onnx/issues/2262) for more details of this error.
## 3. Prepare Dataset

Download dataset [ILSVR2012 validation Imagenet dataset](http://www.image-net.org/challenges/LSVRC/2012/downloads).
Expand Down
Expand Up @@ -8,6 +8,12 @@
MAX_TIMES_RETRY_DOWNLOAD = 5


def reinstall_onnx():
# For now, use "onnx==1.14.1" in this step in case you get an error
# `ValueError: Could not infer attribute explicit_paddings type from empty iterator`.
# Refer to https://github.com/onnx/tensorflow-onnx/issues/2262 for more details of this error.
subprocess.call(['pip', 'install', 'onnx==1.14.1'])

def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("--input_model", type=str, required=False, default="resnet50_v1.pb")
Expand Down Expand Up @@ -91,4 +97,5 @@ def prepare_model(input_model, output_model):

if __name__ == "__main__":
args = parse_arguments()
reinstall_onnx()
prepare_model(args.input_model, args.output_model)
Expand Up @@ -19,6 +19,8 @@ pip install -r requirements.txt
python prepare_model.py --output_model='ssd_mobilenet_v1_coco_2018_01_28.onnx'
```

> Note: For now, use "onnx==1.14.1" in this step in case you get an error `ValueError: Could not infer attribute explicit_paddings type from empty iterator`. Refer to this [link](https://github.com/onnx/tensorflow-onnx/issues/2262) for more details of this error.
## 3. Prepare Dataset

Download [MS COCO 2017 dataset](https://cocodataset.org/#download).
Expand Down
Expand Up @@ -10,6 +10,12 @@
MAX_TIMES_RETRY_DOWNLOAD = 5


def reinstall_onnx():
# For now, use "onnx==1.14.1" in this step in case you get an error
# `ValueError: Could not infer attribute explicit_paddings type from empty iterator`.
# Refer to https://github.com/onnx/tensorflow-onnx/issues/2262 for more details of this error.
subprocess.call(['pip', 'install', 'onnx==1.14.1'])

def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("--input_model",
Expand Down Expand Up @@ -105,4 +111,5 @@ def prepare_model(input_model, output_model):

if __name__ == "__main__":
args = parse_arguments()
reinstall_onnx()
prepare_model(args.input_model, args.output_model)
Expand Up @@ -19,6 +19,8 @@ pip install -r requirements.txt
python prepare_model.py --output_model='ssd_mobilenet_v2_coco_2018_03_29.onnx'
```

> Note: For now, use "onnx==1.14.1" in this step in case you get an error `ValueError: Could not infer attribute explicit_paddings type from empty iterator`. Refer to this [link](https://github.com/onnx/tensorflow-onnx/issues/2262) for more details of this error.
## 3. Prepare Dataset

Download [MS COCO 2017 dataset](https://cocodataset.org/#download).
Expand Down
Expand Up @@ -9,6 +9,12 @@
MAX_TIMES_RETRY_DOWNLOAD = 5


def reinstall_onnx():
# For now, use "onnx==1.14.1" in this step in case you get an error
# `ValueError: Could not infer attribute explicit_paddings type from empty iterator`.
# Refer to https://github.com/onnx/tensorflow-onnx/issues/2262 for more details of this error.
subprocess.call(['pip', 'install', 'onnx==1.14.1'])

def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("--input_model",
Expand Down Expand Up @@ -105,4 +111,5 @@ def prepare_model(input_model, output_model):

if __name__ == "__main__":
args = parse_arguments()
reinstall_onnx()
prepare_model(args.input_model, args.output_model)

0 comments on commit eaa57f6

Please sign in to comment.