elif args.model_la == 'resnet': model_la = model_.ResNet() elif args.model_la == 'resnet_pca': model_la = model_.ResNet_pca() elif args.model_la == 'lcnn_9': model_la = model_.lcnn_9layers() elif args.model_la == 'lcnn_29': model_la = model_.lcnn_29layers_v2() elif args.model_la == 'lcnn_9_pca': model_la = model_.lcnn_9layers_pca() elif args.model_la == 'lcnn_29_pca': model_la = model_.lcnn_29layers_v2_pca() elif args.model_la == 'lcnn_9_icqspec': model_la = model_.lcnn_9layers_icqspec() elif args.model_la == 'lcnn_9_prodspec': model_la = model_.lcnn_9layers_prodspec() elif args.model_la == 'lcnn_9_CC': model_la = model_.lcnn_9layers_CC(ncoef=args.ncoef_la) elif args.model_la == 'lcnn_29_CC': model_la = model_.lcnn_29layers_CC(ncoef=args.ncoef_la) elif args.model_la == 'resnet_CC': model_la = model_.ResNet_CC(ncoef=args.ncoef_la) if args.model_pa == 'lstm': model_pa = model_.cnn_lstm() elif args.model_pa == 'resnet': model_pa = model_.ResNet() elif args.model_pa == 'resnet_pca': model_pa = model_.ResNet_pca() elif args.model_pa == 'lcnn_9': model_pa = model_.lcnn_9layers()
elif args.model == 'resnet': model = model_.ResNet(nclasses=args.n_classes) elif args.model == 'resnet_pca': model = model_.ResNet_pca(nclasses=args.n_classes) elif args.model == 'lcnn_9': model = model_.lcnn_9layers(nclasses=args.n_classes) elif args.model == 'lcnn_29': model = model_.lcnn_29layers_v2(nclasses=args.n_classes) elif args.model == 'lcnn_9_pca': model = model_.lcnn_9layers_pca(nclasses=args.n_classes) elif args.model == 'lcnn_29_pca': model = model_.lcnn_29layers_v2_pca(nclasses=args.n_classes) elif args.model == 'lcnn_9_icqspec': model = model_.lcnn_9layers_icqspec(nclasses=args.n_classes) elif args.model == 'lcnn_9_prodspec': model = model_.lcnn_9layers_prodspec(nclasses=args.n_classes) elif args.model == 'lcnn_9_CC': model = model_.lcnn_9layers_CC(nclasses=args.n_classes, ncoef=args.ncoef, init_coef=args.init_coef) elif args.model == 'lcnn_29_CC': model = model_.lcnn_29layers_CC(nclasses=args.n_classes, ncoef=args.ncoef, init_coef=args.init_coef) elif args.model == 'resnet_CC': model = model_.ResNet_CC(nclasses=args.n_classes, ncoef=args.ncoef, init_coef=args.init_coef) if args.pretrained_path is not None: ckpt = torch.load(args.pretrained_path,
elif args.model == 'resnet': model = model_.ResNet() elif args.model == 'resnet_pca': model = model_.ResNet_pca() elif args.model == 'lcnn_9': model = model_.lcnn_9layers() elif args.model == 'lcnn_29': model = model_.lcnn_29layers_v2() elif args.model == 'lcnn_9_pca': model = model_.lcnn_9layers_pca() elif args.model == 'lcnn_29_pca': model = model_.lcnn_29layers_v2_pca() elif args.model == 'lcnn_9_icqspec': model = model_.lcnn_9layers_icqspec() elif args.model == 'lcnn_9_prodspec': model = model_.lcnn_9layers_prodspec() elif args.model == 'lcnn_9_CC': model = model_.lcnn_9layers_CC(ncoef=args.ncoef, init_coef=args.init_coef) elif args.model == 'lcnn_29_CC': model = model_.lcnn_29layers_CC(ncoef=args.ncoef, init_coef=args.init_coef) elif args.model == 'resnet_34_CC': model = model_.ResNet_34_CC(ncoef=args.ncoef, init_coef=args.init_coef) print('Loading model') ckpt = torch.load(args.cp_path, map_location=lambda storage, loc: storage) model.load_state_dict(ckpt['model_state'], strict=True) model.eval()