Hello, is source code available for the NPU SDK’s convertkeras
binary and others?
EDIT: Seems it’s almost all in there, along with specs to generate the PyInstaller binaries, but not the .py files themselves (convertkeras.py, convertensorflow.py…)
I am trying to get Mask_RCNN up and running, but it has custom layers that I need to pass to the convertkeras
binary. It’s likely using the keras.models.load_model
function which can usually have custom_objects
specified as a parameter, but it seems there is no way to make convertkeras
use custom_objects
. Now that I’ve discovered the PyInstaller specs, I’ll try to modify and rebuild convertkeras
for Mask_RCNN specifically.
EDIT2: Here is the convertkeras.py
code:
from argparse import ArgumentParser
from acuitylib.acuitylog import AcuityLog as al
from acuitylib.vsi_nn import VSInn
from acuitylib.utils import get_output_net_data_path
def main():
options = ArgumentParser(description='Tensorzone convert tool.')
options.add_argument('--keras-model', required=True, help='Tensorflow keras file')
options.add_argument('--net-output', help='Acuity net output file')
options.add_argument('--data-output', help='Acuity net data output file')
options.add_argument('--convert-engine', default='Keras', help="Try convert use specify engine in order, ' 'support engine include [Keras, TFLite], default is Keras")
options.add_argument('--inputs', default=None, help='Specify input list, default is model input')
options.add_argument('--input-size-list', default=None, help="Set each input tensor size list, each input size split by #, each size split by ,Each entry in the list should match an entry in '--inputs', default is model input size list")
options.add_argument('--outputs', default=None, help='Specify output list, default is model output')
args = options.parse_args()
al.reset_log_count()
net_output_path, data_output_path = get_output_net_data_path(args.keras_model, args.net_output, args.data_output)
nn = VSInn()
net = nn.load_keras(args.keras_model, inputs=args.inputs, input_size_list=args.input_size_list, outputs=args.outputs, convert_engine=args.convert_engine)
nn.save_model(net, net_output_path)
nn.save_model_data(net, data_output_path)
al.print_log_count()
if __name__ == '__main__':
main()