CenterNet icon indicating copy to clipboard operation
CenterNet copied to clipboard

Is possible to run ModelZoo models without GPU?

Open jrobador opened this issue 2 years ago • 1 comments

Hi everyone, I followed the correct steps to run the demo. However, I got the following error: python demo.py multi_pose --demo 3.mp4 --load_model ../models/multi_pose_dla_3x.pth

Fix size testing. training chunk_sizes: [32] The output will be saved to /home/jrobador/CIII/CenterNet/CenterNet/src/lib/../../exp/multi_pose/default heads {'hm': 1, 'wh': 2, 'hps': 34, 'reg': 2, 'hm_hp': 17, 'hp_offset': 2} Creating model... loaded ../models/multi_pose_dla_3x.pth, epoch 320 Traceback (most recent call last): File "demo.py", line 56, in demo(opt) File "demo.py", line 21, in demo detector = Detector(opt) File "/home/jrobador/CIII/CenterNet/CenterNet/src/lib/detectors/multi_pose.py", line 26, in init super(MultiPoseDetector, self).init(opt) File "/home/jrobador/CIII/CenterNet/CenterNet/src/lib/detectors/base_detector.py", line 26, in init self.model = self.model.to(opt.device) File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 386, in to return self._apply(convert) File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 193, in _apply module._apply(fn) File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 193, in _apply module._apply(fn) File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 193, in _apply module._apply(fn) File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 199, in _apply param.data = fn(param.data) File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/nn/modules/module.py", line 384, in convert return t.to(device, dtype if t.is_floating_point() else None, non_blocking) File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/cuda/init.py", line 162, in _lazy_init _check_driver() File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/cuda/init.py", line 75, in _check_driver raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

I also tried using a tutorial that i founded on internet, (https://programmerclick.com/article/43101758055/) and i got the following error: python demo.py multi_pose --demo 3.mp4 --load_model multi_pose_dla_3x.pth Fix size testing. training chunk_sizes: [32] The output will be saved to /home/jrobador/CIII/CenterNet/CenterNet/src/lib/../../exp/multi_pose/default heads {'hm': 1, 'wh': 2, 'hps': 34, 'reg': 2, 'hm_hp': 17, 'hp_offset': 2} Creating model... Downloading: "http://dl.yf.io/dla/models/imagenet/dla34-ba72cf86.pth" to /home/jrobador/.cache/torch/checkpoints/dla34-ba72cf86.pth 100.0% Traceback (most recent call last): File "demo.py", line 56, in demo(opt) File "demo.py", line 21, in demo detector = Detector(opt) File "/home/jrobador/CIII/CenterNet/CenterNet/src/lib/detectors/multi_pose.py", line 26, in init super(MultiPoseDetector, self).init(opt) File "/home/jrobador/CIII/CenterNet/CenterNet/src/lib/detectors/base_detector.py", line 25, in init self.model = load_model(self.model, opt.load_model) File "/home/jrobador/CIII/CenterNet/CenterNet/src/lib/models/model.py", line 34, in load_model checkpoint = torch.load(model_path, map_location=lambda storage, loc: storage) File "/home/jrobador/anaconda3/envs/CIII/lib/python3.7/site-packages/torch/serialization.py", line 382, in load f = open(f, 'rb') FileNotFoundError: [Errno 2] No such file or directory: 'multi_pose_dla_3x.pth'

jrobador avatar May 25 '22 21:05 jrobador

You have to go to the 'CenterNet/src/lib/detectors/base_detector.py' file and replace if opt.gpus[0] >= 0: opt.device = torch.device('cuda') else: opt.device = torch.device('cpu') with opt.device = torch.device('cpu') only. Also delete (or uncomment) any line that is torch.cuda.synchronize() in 'CenterNet/src/lib/detectors/base_detector.py', 'CenterNet/src/lib/detectors/ctdet.py', 'CenterNet/src/lib/detectors/exdet.py', 'CenterNet/src/lib/detectors/ddd.py', 'CenterNet/src/lib/detectors/multi_pose.py'

I might be missing something but basically just delete any line which contain .cuda

MrComNguoi avatar Sep 13 '22 08:09 MrComNguoi