facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
30.56k stars 7.49k forks source link

How to run apply_net on cpu?? #707

Closed frankkim1108 closed 4 years ago

frankkim1108 commented 4 years ago

My environment is Ubuntu 16.04 Python 3.7

I am trying to run apply_net on CPU instead of GPU. I saw other issues where people tried to run the demo.py on the CPU. I followed the steps and it worked on the demo.

However, I want to run apply_net on the CPU.

I tried adding --opts MODEL.DEVICE cpubut I guess there aren't any functions in apply_net to use --opts.

I tried reinstalling CPU version of torch and torchvision through pip -> torch==1.3.0+cpu -> torchvision==0.4.1+cpu

when I reran apply_net there was an error.

So I redownloaded -> torch ==1.3.0 -> torchvision==0.4.1

Would there be a way to run apply_net on cpu??

On the cmd I wrote python apply_net.py dump configs/densepose_rcnn_R_101_FPN_s1x.yaml model2.pkl, input.jpg --output result.pkl -v if I run this, it runs on GPU

What do I need to add to make it run on CPU?

ppwwyyxx commented 4 years ago

Please include details about the problem following the issue template.

frankkim1108 commented 4 years ago

@ppwwyyxx I wrote some more detail. Sorry for the vague question.

ppwwyyxx commented 4 years ago

With https://github.com/facebookresearch/detectron2/pull/650 you should be able to run it with --opts MODEL.DEVICE cpu.

frankkim1108 commented 4 years ago

@ppwwyyxx Thank you, always, for your response. I haven't cloned the most recent version for weeks.