def input_options(parser): parser.add_argument('input_files', nargs="*", help="test data file to input", completer_method=Cmd.path_complete) parser.add_argument('-B', '--bit_shift', type=float, default=None, help="shift input before offset and divisor. Negative for right shift.") parser.add_argument('-D', '--divisor', type=float, default=None, help="divide all input data by this value") parser.add_argument('-O', '--offset', type=float, default=None, help="offset all input data by this value") parser.add_argument('-H', '--height', type=int, default=None, help="adjust image height to this value") parser.add_argument('-W', '--width', type=int, default=None, help="adjust image width this value") parser.add_argument('-T', '--transpose', action="store_true", help='Swap W and H') parser.add_argument('-F', '--nptype', choices=np.sctypeDict.keys(), default=None, help='interpret pixels as this numpy type') parser.add_argument('-M', '--mode', choices=MODES.keys(), default=None, help="mode to import image in") parser.add_argument('-N', '--norm_func', choices=MODES.keys(), default=None, help="lambda function to apply on input in the form x: fn(x)") parser.add_argument('--rgb888_rgb565', action="store_true", help="convert 3 channel 8bits input into 1 channel 16bit rgb565")
def image_mode(self, val): val = find_choice(MODES.keys(), val) self.settings['image_mode'] = str(val)
}, 'adjust_image': { 'type': bool, 'descr': 'adjust image input size and channels' }, 'image_width': { 'type': int, 'descr': 'input image width' }, 'image_height': { 'type': int, 'descr': 'input image height' }, 'image_mode': { 'type': str, 'descr': 'input image mode (one of {})'.format(", ".join(MODES.keys())) }, 'input_divisor': { 'type': float, 'descr': 'divide input tensor values by this value' }, 'input_offset': { 'type': float, 'descr': 'add this value to input tensor values' }, 'input_norm_func': { 'type': str, 'descr': 'lambda function in the form x: fn(x) where x is any input' }, 'graph_name': { 'type': str,
'type': bool, 'descr': 'adjust image input size and channels', 'choices': [True, False] }, 'image_width': { 'type': int, 'descr': 'input image width' }, 'image_height': { 'type': int, 'descr': 'input image height' }, 'image_mode': { 'type': str, 'descr': 'input image mode', 'choices': MODES.keys() }, 'input_divisor': { 'type': float, 'descr': 'divide input tensor values by this value' }, 'input_offset': { 'type': float, 'descr': 'add this value to input tensor values' }, 'input_norm_func': { 'type': str, 'descr': 'lambda function in the form x: fn(x) where x is any input' }, 'graph_name': { 'type': str,
] DEFAULT_OPT_DESCRIPTIONS = { 'log_level': {'type': str, 'descr': 'set logging level', 'choices': VALID_LOG_LEVELS}, 'load_quantization': {'type': bool, 'descr': 'load TFLITE quantization information', 'choices': [True, False]}, 'load_dequantized': {'type': bool, 'descr': 'load the dequantized constant values from tflite quantized graph', 'choices': [True, False]}, 'fusions': {'type': bool, 'descr': 'run standard graph fusions on graph load', 'choices': [True, False]}, 'adjust_order': {'type': bool, 'descr': 'adjust activation and parameter dimension order\ to match autotiler on graph load', 'choices': [True, False]}, 'weight_equalization': {'type': bool, 'descr': 'equalize weights on graph load', 'choices': [True, False]}, 'equalization_threshold': {'type': float, 'descr': 'threshold for weight equalization convergence'}, 'adjust_image': {'type': bool, 'descr': 'adjust image input size and channels', 'choices': [True, False]}, 'image_width': {'type': int, 'descr': 'input image width'}, 'image_height': {'type': int, 'descr': 'input image height'}, 'image_mode': {'type': str, 'descr': 'input image mode', 'choices': MODES.keys()}, 'input_divisor': {'type': float, 'descr': 'divide input tensor values by this value'}, 'input_offset': {'type': float, 'descr': 'add this value to input tensor values'}, 'input_norm_func': {'type': str, 'descr': 'lambda function in the form x: fn(x) where x is any input'}, 'graph_name': {'type': str, 'descr': 'name of the graph used for code generation'}, 'template_file': {'type': str, 'descr': 'template file used for code generation'}, } class NNToolShellSettings(Cmd): ''' This class have all the settings and properties that can be set up from the NNToolShell To see the Code Generation settings, please refer to generation/autotiler_options.py ''' def __init__(self, *args, **kwargs): super(NNToolShellSettings, self).__init__(*args, **kwargs)