# synthtextloader = Synth80k('/home/jiachx/publicdatasets/SynthText/SynthText', target_size=768, viz=True, debug=True) # train_loader = torch.utils.data.DataLoader( # synthtextloader, # batch_size=1, # shuffle=False, # num_workers=0, # drop_last=True, # pin_memory=True) # train_batch = iter(train_loader) # image_origin, target_gaussian_heatmap, target_gaussian_affinity_heatmap, mask = next(train_batch) from craft import CRAFT from torchutil import copyStateDict net = CRAFT(freeze=True) net.load_state_dict( copyStateDict(torch.load('/data/CRAFT-pytorch/1-7.pth'))) net = net.cuda() net = torch.nn.DataParallel(net) net.eval() dataloader = ICDAR2015(net, '/data/CRAFT-pytorch/icdar2015', target_size=768, viz=True) train_loader = torch.utils.data.DataLoader(dataloader, batch_size=1, shuffle=False, num_workers=0, drop_last=True, pin_memory=True) total = 0 total_sum = 0
# pin_memory=True) # train_batch = iter(train_loader) # image_origin, target_gaussian_heatmap, target_gaussian_affinity_heatmap, mask = next(train_batch) from craft import CRAFT from torchutil import copyStateDict import argparse parser = argparse.ArgumentParser(description='123') parser.add_argument('--load_model', default='', type=str, help='folder path to input images') args = parser.parse_args() net = CRAFT(freeze=True) net.load_state_dict(copyStateDict(torch.load(args.load_model))) net = net.cuda() net = torch.nn.DataParallel(net) net.eval() dataloader = ICDAR2015(net, './data/icdar15/train_images/', target_size=768, viz=True) train_loader = torch.utils.data.DataLoader(dataloader, batch_size=1, shuffle=False, num_workers=0, drop_last=True, pin_memory=True) total = 0 total_sum = 0
if __name__ == '__main__': # synthtextloader = Synth80k('/home/jiachx/publicdatasets/SynthText/SynthText', target_size=768, viz=True, debug=True) # train_loader = torch.utils.data.DataLoader( # synthtextloader, # batch_size=1, # shuffle=False, # num_workers=0, # drop_last=True, # pin_memory=True) # train_batch = iter(train_loader) # image_origin, target_gaussian_heatmap, target_gaussian_affinity_heatmap, mask = next(train_batch) from detector import Detector from torchutil import copyStateDict net = Detector(freeze=True) net.load_state_dict(copyStateDict(torch.load('./pretrain/1-7.pth'))) net = net.cuda() net = torch.nn.DataParallel(net) net.eval() dataloader = ICDAR2015(net, './data/icdar2015', target_size=768, viz=True) train_loader = torch.utils.data.DataLoader(dataloader, batch_size=1, shuffle=False, num_workers=0, drop_last=True, pin_memory=True) total = 0 total_sum = 0 for index, (opimage, region_scores, affinity_scores, confidence_mask, confidences_mean) in enumerate(train_loader): total += 1
if __name__ == '__main__': # synthtextloader = Synth80k('/home/jiachx/publicdatasets/SynthText/SynthText', target_size=768, viz=True, debug=True) # train_loader = torch.utils.data.DataLoader( # synthtextloader, # batch_size=1, # shuffle=False, # num_workers=0, # drop_last=True, # pin_memory=True) # train_batch = iter(train_loader) # image_origin, target_gaussian_heatmap, target_gaussian_affinity_heatmap, mask = next(train_batch) from craft import CRAFT from torchutil import copyStateDict net = CRAFT(freeze=True) net.load_state_dict(copyStateDict(torch.load('/ic15_iter_1300.pth'))) net = net.cuda() net = torch.nn.DataParallel(net) net.eval() dataloader = ICDAR2015(net, '/icdar2015/icdar2015train', target_size=640, viz=True) train_loader = torch.utils.data.DataLoader(dataloader, batch_size=1, shuffle=False, num_workers=0, drop_last=True, pin_memory=True) total = 0 total_sum = 0
# image_origin, target_gaussian_heatmap, target_gaussian_affinity_heatmap, mask = next(train_batch) from craft import CRAFT from torchutil import copyStateDict import argparse parser = argparse.ArgumentParser(description='123') parser.add_argument('--load_model', default='', type=str, help='folder path to input images') args = parser.parse_args() net = CRAFT(freeze=True) net.load_state_dict( copyStateDict(torch.load(args.load_model))) net = net.cuda() net = torch.nn.DataParallel(net) net.eval() dataloader = ICDAR2015(net, './data/icdar15/train_images/', target_size=768, viz=True) train_loader = torch.utils.data.DataLoader( dataloader, batch_size=1, shuffle=False, num_workers=0, drop_last=True, pin_memory=True) total = 0 total_sum = 0 for index, (opimage, region_scores, affinity_scores, confidence_mask, confidences_mean) in enumerate(train_loader): total += 1