def create_network(name, *args, **kwargs): if name == "xception": return xception(*args, **kwargs) raise NotImplementedError(f"{name} is not implemented in the repo")
parser.add_argument("--width", type=int, default=299, help="input width") parser.add_argument("--height", type=int, default=299, help="input height") parser.add_argument("--file_name", type=str, default="xception", help="xception output file name.") parser.add_argument("--file_format", type=str, choices=["AIR", "ONNX", "MINDIR"], default="MINDIR", help="file format") parser.add_argument("--device_target", type=str, choices=["Ascend", "GPU", "CPU"], default="GPU", help="device target") args = parser.parse_args() if args.device_target == "Ascend": config = config_ascend elif args.device_target == "GPU": config = config_gpu else: raise ValueError("Unsupported device_target.") context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target) context.set_context(device_id=args.device_id) if __name__ == "__main__": # define net net = xception(class_num=config.class_num) # load checkpoint param_dict = load_checkpoint(args.ckpt_file) load_param_into_net(net, param_dict) net.set_train(False) image = Tensor(np.zeros([config.batch_size, 3, args.height, args.width], np.float32)) export(net, image, file_name=args.file_name, file_format=args.file_format)
def xceptionnet(*args, **kwargs): return xception(*args, **kwargs)