MCPcopy
hub / github.com/dbolya/yolact / evalimage

Function evalimage

eval.py:595–610  ·  view source on GitHub ↗
(net:Yolact, path:str, save_path:str=None)

Source from the content-addressed store, hash-verified

593 return x
594
595def evalimage(net:Yolact, path:str, save_path:str=None):
596 frame = torch.from_numpy(cv2.imread(path)).cuda().float()
597 batch = FastBaseTransform()(frame.unsqueeze(0))
598 preds = net(batch)
599
600 img_numpy = prep_display(preds, frame, None, None, undo_transform=False)
601
602 if save_path is None:
603 img_numpy = img_numpy[:, :, (2, 1, 0)]
604
605 if save_path is None:
606 plt.imshow(img_numpy)
607 plt.title(path)
608 plt.show()
609 else:
610 cv2.imwrite(save_path, img_numpy)
611
612def evalimages(net:Yolact, input_folder:str, output_folder:str):
613 if not os.path.exists(output_folder):

Callers 2

evalimagesFunction · 0.85
evaluateFunction · 0.85

Calls 2

FastBaseTransformClass · 0.90
prep_displayFunction · 0.85

Tested by

no test coverage detected