23 from convert_from_tensorflow
import *
26 parser = argparse.ArgumentParser(description=
'generate native mode model with weights from deep learning model')
27 parser.add_argument(
'--outdir', type=str, default=
'./', help=
'where to put generated files')
28 parser.add_argument(
'--infmt', type=str, default=
'tensorflow', help=
'format of the deep learning model')
29 parser.add_argument(
'infile', help=
'path to the deep learning model with weights')
30 parser.add_argument(
'--dump4tb', type=str, default=
'no', help=
'dump file for visualization in tensorboard')
32 return parser.parse_args()
37 if not os.path.isfile(args.infile):
38 print(
'the specified input file %s does not exist' % args.infile)
41 if not os.path.exists(args.outdir):
42 print(
'create output directory %s' % args.outdir)
45 basefile = os.path.split(args.infile)[1]
46 basefile = os.path.splitext(basefile)[0]
47 outfile = os.path.join(args.outdir, basefile) +
'.model'
49 if args.dump4tb.lower()
in (
'yes',
'true',
't',
'y',
'1'):
52 if args.infmt ==
'tensorflow':
55 if __name__ ==
'__main__':