Open zhongwenkun886 opened 1 year ago
below is my test code, I calculate the code “ predictor.set_image(image) ” running time , in my laptop pc (RTX3060),it cost about 50ms using GPU.
sam_checkpoint = "./weights/mobile_sam.pt" model_type = "vit_t" device = "cuda" if torch.cuda.is_available() else "cpu" sam = sam_model_registrymodel_type sam.to(device=device) sam.eval() predictor = SamPredictor(sam)
for i in range(10): torch.cuda.synchronize() start = time.time()
predictor.set_image(image) torch.cuda.synchronize() print('time cost = ', (time.time() - start) * 1000, "ms")
I also faced the same problem
below is my test code, I calculate the code “ predictor.set_image(image) ” running time , in my laptop pc (RTX3060),it cost about 50ms using GPU.
sam_checkpoint = "./weights/mobile_sam.pt" model_type = "vit_t" device = "cuda" if torch.cuda.is_available() else "cpu" sam = sam_model_registrymodel_type sam.to(device=device) sam.eval() predictor = SamPredictor(sam)
for i in range(10): torch.cuda.synchronize() start = time.time()