-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added upscale for 2,3,4 times and other minor changes
- Loading branch information
Showing
4 changed files
with
61 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# !/usr/bin/env python3 | ||
import argparse | ||
import logging | ||
import sys | ||
import tensorflow as tf | ||
from util.convert_model import convert_model | ||
|
||
|
||
def convert_model_program(argv=None): | ||
parser = argparse.ArgumentParser( | ||
description='Tensor Lite Converter') | ||
|
||
parser.add_argument('--model-file', dest='model_filepath', | ||
type=str, | ||
required=True, | ||
help='Define filepath to the model') | ||
|
||
parser.add_argument('--output', dest='save_path', type=str, default=None, help='') | ||
|
||
parser.add_argument('--verbosity', type=int, dest='accumulate', | ||
default=1, | ||
help='Define the save/load model path') | ||
|
||
args = parser.parse_args(args=argv) | ||
|
||
logger = logging.getLogger('model converter') | ||
logger.setLevel(logging.INFO) | ||
|
||
with tf.device('/device:CPU:0'): | ||
generate_model_path = args.model_filepath | ||
|
||
logger.info("Loading Model: {0}".format(generate_model_path)) | ||
model = tf.keras.models.load_model(generate_model_path, compile=False) | ||
|
||
converted_model = convert_model(model=model, dataset=None) | ||
with open(args.save_path, "wb") as f: | ||
f.write(converted_model) | ||
|
||
|
||
# If running the script as main executable | ||
if __name__ == '__main__': | ||
convert_model_program(sys.argv[1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters