Skip to content

add img_size in export_model #94

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

Merged
merged 1 commit into from
May 3, 2020
Merged
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
8 changes: 4 additions & 4 deletions tools/export_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import argparse
import numpy as np

from ppcls.modeling import architectures
import paddle.fluid as fluid
Expand All @@ -25,13 +24,14 @@ def parse_args():
parser.add_argument("-p", "--pretrained_model", type=str)
parser.add_argument("-o", "--output_path", type=str)
parser.add_argument("--class_dim", type=int, default=1000)
parser.add_argument("--img_size", type=int, default=224)

return parser.parse_args()


def create_input():
def create_input(img_size=224):
image = fluid.data(
name='image', shape=[None, 3, 224, 224], dtype='float32')
name='image', shape=[None, 3, img_size, img_size], dtype='float32')
return image


Expand All @@ -57,7 +57,7 @@ def main():

with fluid.program_guard(infer_prog, startup_prog):
with fluid.unique_name.guard():
image = create_input()
image = create_input(args.img_size)
out = create_model(args, model, image, class_dim=args.class_dim)

infer_prog = infer_prog.clone(for_test=True)
Expand Down