DBNet.pytorch icon indicating copy to clipboard operation
DBNet.pytorch copied to clipboard

eval时遇到错误,如何解决??

Open bowenliu1996 opened this issue 4 years ago • 3 comments

Traceback (most recent call last): File "tools/eval.py", line 78, in eval = EVAL(args.model_path) File "tools/eval.py", line 35, in init self.validate_loader = get_dataloader(config['dataset']['validate'], config['distributed']) File "/home/iip/dbnet/data_loader/init.py", line 89, in get_dataloader sampler = DistributedSampler(_dataset) File "/home/iip/anaconda3/envs/dbnet/lib/python3.6/site-packages/torch/utils/data/distributed.py", line 65, in init num_replicas = dist.get_world_size() File "/home/iip/anaconda3/envs/dbnet/lib/python3.6/site-packages/torch/distributed/distributed_c10d.py", line 638, in get_world_size return _get_group_size(group) File "/home/iip/anaconda3/envs/dbnet/lib/python3.6/site-packages/torch/distributed/distributed_c10d.py", line 220, in _get_group_size _check_default_pg() File "/home/iip/anaconda3/envs/dbnet/lib/python3.6/site-packages/torch/distributed/distributed_c10d.py", line 211, in _check_default_pg "Default process group is not initialized" AssertionError: Default process group is not initialized

bowenliu1996 avatar Sep 17 '21 14:09 bowenliu1996

求解决!谢谢大佬们!!

bowenliu1996 avatar Sep 17 '21 14:09 bowenliu1996

我是改了一下tools/eval.py def init_args(): parser = argparse.ArgumentParser(description='DBNet.pytorch') parser.add_argument('--model_path', required=False, default='output/DBNet_resnet18_FPN_DBHead/checkpoint/1.pth', type=str) parser.add_argument('--local_rank', dest='local_rank', default=0, type=int, help='Use distributed training')

args = parser.parse_args()
return args

if name == 'main': args = init_args() torch.distributed.init_process_group(backend="nccl", init_method="env://", world_size=torch.cuda.device_count(), rank=args.local_rank) eval = EVAL(args.model_path) result = eval.eval() print(result)

henuliulei avatar Sep 26 '21 02:09 henuliulei

https://github.com/WenmuZhou/DBNet.pytorch/blob/678b2ae55e018c6c16d5ac182558517a154a91ed/tools/eval.py#L35

  • 将上行代码,改为下面即可,因为这个不需要用分布式,所以设为False
self.validate_loader = get_dataloader(config['dataset']['validate'], False)

SWHL avatar Jun 08 '22 10:06 SWHL