Detectron2: How to do the inference with multi gpu?

Created on 17 Jan 2020  路  1Comment  路  Source: facebookresearch/detectron2

I have multi gpus, how to run the inference/predict with multi gpu?

e.g.
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1,0"

predictor = DefaultPredictor(cfg)
im = cv2.imread(full_filename)
outputs = predictor(im)


When I use the multiprocessing to run detectron2, the detectron2 only run on 1 gpu, then I get below memory error, how to automatically swtich into other gpu?

----ERROR MESSAGE-----
pixel_mean = torch.Tensor(cfg.MODEL.PIXEL_MEAN).to(self.device).view(num_channels, 1, 1)
RuntimeError: CUDA error: out of memory

Most helpful comment

cfg.MODEL.DEVICE='cuda:1' will let the predictor run on gpu 1.

>All comments

cfg.MODEL.DEVICE='cuda:1' will let the predictor run on gpu 1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DeepLakhani99 picture DeepLakhani99  路  4Comments

invisprints picture invisprints  路  4Comments

kl720 picture kl720  路  3Comments

limsijie93 picture limsijie93  路  3Comments

RomRoc picture RomRoc  路  4Comments