from inference import Infer from models.AlbuNet.AlbuNet import AlbuNet import segmentation_models_pytorch as smp inferer = Infer(threshold=0.75) model = smp.Unet("se_resnext50_32x4d", classes=6) model.cuda() inferer.inference(model)
video_transforms, is_train=False) testloader = torch.utils.data.DataLoader( testdataset, batch_size=cfg.TRAIN.ST_BATCH_SIZE * num_gpu, drop_last=True, shuffle=False, num_workers=int(cfg.WORKERS)) if args.eval_fid: algo = Infer(output_dir, 1.0) algo.eval_fid2(testloader, video_transforms, image_transforms) elif args.eval_fvd: algo = Infer(output_dir, 1.0) algo.eval_fvd(imageloader, storyloader, testloader, cfg.STAGE) elif args.load_ckpt != None: # For inference training result algo = Infer(output_dir, 1.0, args.load_ckpt) algo.inference(imageloader, storyloader, testloader, cfg.STAGE) else: # For training model algo = GANTrainer(output_dir, args, ratio=1.0) algo.train(imageloader, storyloader, testloader, cfg.STAGE) else: datapath = '%s/test/val_captions.t7' % (cfg.DATA_DIR) algo = GANTrainer(output_dir) algo.sample(datapath, cfg.STAGE)
from inference import Infer from datetime import datetime import os import segmentation_models_pytorch as smp inferer1 = Infer( rez_dir="inferred", image_folder="inferred2/overlay", batch_size=3, num_batches=2, batch_id=0, ) inferer2 = Infer( rez_dir="inferred", image_folder="inferred2/overlay", batch_size=3, num_batches=2, batch_id=1, ) model = smp.Unet("se_resnext50_32x4d") model.cuda() inferer1.inference(model) inferer2.inference(model)