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

Adds support for emitting darknet models #409

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 8 additions & 1 deletion mmdnn/conversion/_script/IRToCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ def _convert(args):
raise NotImplementedError("ONNX emitter needs IR weight file")
else:
emitter = OnnxEmitter(args.IRModelPath, args.IRWeightPath)
elif args.dstFramework == 'darknet':
from mmdnn.conversion.darknet.darknet_emitter import DarknetEmitter
if args.IRWeightPath is None:
emitter = DarknetEmitter(args.IRModelPath)
else:
assert args.dstWeightPath
emitter = DarknetEmitter((args.IRModelPath, args.IRWeightPath))
else:
assert False

Expand All @@ -79,7 +86,7 @@ def _get_parser():
parser.add_argument(
'--dstFramework', '-f',
type=_text_type,
choices=['caffe', 'caffe2', 'cntk', 'mxnet', 'keras', 'tensorflow', 'coreml', 'pytorch', 'onnx'],
choices=['caffe', 'caffe2', 'cntk', 'mxnet', 'keras', 'tensorflow', 'coreml', 'pytorch', 'onnx', 'darknet'],
required=True,
help='Format of model at srcModelPath (default is to auto-detect).')

Expand Down
2 changes: 1 addition & 1 deletion mmdnn/conversion/_script/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _get_parser():
parser.add_argument(
'--dstFramework', '-df',
type=_text_type,
choices=['caffe', 'caffe2', 'cntk', 'mxnet', 'keras', 'tensorflow', 'coreml', 'pytorch', 'onnx'],
choices=['caffe', 'caffe2', 'cntk', 'mxnet', 'keras', 'tensorflow', 'coreml', 'pytorch', 'onnx', 'darknet'],
required=True,
help='Format of model at srcModelPath (default is to auto-detect).')
parser.add_argument(
Expand Down
4 changes: 3 additions & 1 deletion mmdnn/conversion/_script/dump_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def dump_code(framework, network_filepath, weight_filepath, dump_filepath, dump_
from mmdnn.conversion.mxnet.saver import save_model
elif framework == 'pytorch':
from mmdnn.conversion.pytorch.saver import save_model
elif framework == 'darknet':
from mmdnn.conversion.darknet.saver import save_model
elif framework == 'tensorflow':
from mmdnn.conversion.tensorflow.saver import save_model
save_model(MainModel, network_filepath, weight_filepath, dump_filepath, dump_tag)
Expand All @@ -40,7 +42,7 @@ def _get_parser():
parser = argparse.ArgumentParser(description='Dump the model code into target model.')

parser.add_argument(
'-f', '--framework', type=_text_type, choices=["caffe", "cntk", "mxnet", "keras", "tensorflow", 'pytorch', 'onnx'],
'-f', '--framework', type=_text_type, choices=["caffe", "cntk", "mxnet", "keras", "tensorflow", 'pytorch', 'onnx', 'darknet'],
required=True,
help='Format of model at srcModelPath (default is to auto-detect).'
)
Expand Down
Loading