Closed haolyuan closed 3 years ago
It seems that your machine has no cuda devices or the cuda device is not available. And you may have loaded the wrong checkpoint.
It seems that your machine has no cuda devices or the cuda device is not available. And you may have loaded the wrong checkpoint.
Thanks! I have solved the problem.
When I run
python tools/dist_inference.py \ --img_dir path/to/your/directory/of/images \ --save_dir path/where/results/are/saved \ --cfg experiments/coco/higher_hrnet/w32_512_adam_lr1e-3.yaml \ TEST.MODEL_FILE models/pose_coco/pose_higher_hrnet_w32_512.pth \ TEST.SCALE_FACTOR '[0.5, 1.0, 2.0]'
It occurs thatRuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.
Besides, there are another problemProcess Process-1: Traceback (most recent call last): File "/home/ubuntu/anaconda3/envs/mykaolin/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap self.run() File "/home/ubuntu/anaconda3/envs/mykaolin/lib/python3.7/multiprocessing/process.py", line 99, in run self._target(*self._args, **self._kwargs) File "tools/dist_inference.py", line 123, in worker model.load_state_dict(torch.load(cfg.TEST.MODEL_FILE), strict=True) File "/home/ubuntu/anaconda3/envs/mykaolin/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1052, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for PoseHigherResolutionNet: Missing key(s) in state_dict: "conv_scale_layers.0.0.weight", "conv_scale_layers.0.0.bias", "conv_scale_layers.0.1.weight", "conv_scale_layers.0.1.bias", "conv_scale_layers.0.1.running_mean", "conv_scale_layers.0.1.running_var", "conv_scale_layers.0.3.weight", "conv_scale_layers.0.3.bias", "conv_scale_layers.1.0.weight", "conv_scale_layers.1.0.bias", "conv_scale_layers.1.1.weight", "conv_scale_layers.1.1.bias", "conv_scale_layers.1.1.running_mean", "conv_scale_layers.1.1.running_var", "conv_scale_layers.1.3.weight", "conv_scale_layers.1.3.bias".
I am confused why GPU doesn't work.