(net:Yolact, path:str, save_path:str=None)
| 593 | return x |
| 594 | |
| 595 | def 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 | |
| 612 | def evalimages(net:Yolact, input_folder:str, output_folder:str): |
| 613 | if not os.path.exists(output_folder): |
no test coverage detected