You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Usage with the Merger class for segmentation and classification, and the seperate augmentation and deaugmentation piplines.
tta_seg_merger=Merger(mode="mean")tta_cls_merger=Merger(mode="mean")tta_seg_merger.reset()tta_cls_merger.reset()fortranintta_trans:tran:Chainaug_tensor=tran.do_image(image)# simulate real datamask=aug_tensorlabel=torch.randn(3,1000,dtype=torch.float32)# for segmentation, [B,K,H,W]undo_mask=tran.undo_image(mask)tta_seg_merger.append(undo_mask)# for classification, [B,K]undo_label=tran.undo_label(label)tta_cls_merger.append(undo_label)seg_results=tta_seg_merger.resultseg_mask=seg_results.argmax(dim=1)# [B,H,W]cls_results=tta_cls_merger.resultcls_score,cls_index=cls_results.max(dim=1)# [B], [B]
Usage with the built-in list and the seperate augmentation and deaugmentation piplines.
tta_seg_results= []tta_cls_results= []fortranintta_trans:tran:Chainaug_tensor=tran.do_image(image)# simulate real datamask=aug_tensorlabel=torch.randn(3,1000,dtype=torch.float32)# for segmentation, [B,K,H,W]undo_mask=tran.undo_image(mask)tta_seg_results.append(undo_mask)# for classification, [B,K]undo_label=tran.undo_label(label)tta_cls_results.append(undo_label)seg_results=sum(tta_seg_results)/len(tta_seg_results)seg_mask=seg_results.argmax(dim=1)# [B,H,W]cls_results=sum(tta_cls_results)/len(tta_cls_results)cls_score,cls_index=cls_results.max(dim=1)# [B], [B]