1. UNet模型定义 importtorchimporttorch.nnasnnimporttorch.nn.functionalasFclassDoubleConv(nn.Module):"""(convolution => [BN] => ReLU) * 2"""def__init__(self,in_channels,out_channels):super().__init__()self.double_conv=nn.Sequential(nn.Conv2d(in_channels,out_channels,kernel_size=3,pa...
SAM2-UNet: Segment Anything 2 Makes Strong Encoder for Natural and Medical Image Segmentation Xinyu Xiong, Zihuang Wu, Shuangyi Tan, Wenxue Li, Feilong Tang, Ying Chen, Siying Li, Jie Ma, Guanbin Li Introduction Image segmentation plays an important role in vision understanding. Recently, the...
interpolate(self.head(x), scale_factor=4, mode='bilinear') return out, out1, out2 if __name__ == "__main__": with torch.no_grad(): model = SAM2UNet().cuda() x = torch.randn(1, 3, 352, 352).cuda() out, out1, out2 = model(x) print(out.shape, out1.shape, out2....
sam2unet.jpg test.py test.sh train.py train.sh README License SAM2-UNet: Segment Anything 2 Makes Strong Encoder for Natural and Medical Image Segmentation Xinyu Xiong, Zihuang Wu, Shuangyi Tan, Wenxue Li, Feilong Tang, Ying Chen, Siying Li, Jie Ma, Guanbin Li ...
SAM2-UNet: Segment Anything 2 Makes Strong Encoder for Natural and Medical Image Segmentation - SAM2-UNet/requirements.txt at main · WZH0120/SAM2-UNet
12 Commits sam2 sam2_configs .gitattributes LICENSE README.md SAM2UNet.py dataset.py eval.py eval.sh requirements.txt sam2unet.jpg test.py test.sh train.py train.sh Releases No releases published Packages No packages published Contributors2...
Cannot retrieve latest commit at this time. History 9 Commits sam2 sam2_configs .gitattributes LICENSE README.md SAM2UNet.py dataset.py eval.py eval.sh requirements.txt sam2unet.jpg test.py test.sh train.py train.sh Languages Python96.7% Cuda3.0% Shell0.3%...
SAM2-UNet: Segment Anything 2 Makes Strong Encoder for Natural and Medical Image Segmentation - SAM2-UNet/test.sh at main · WZH0120/SAM2-UNet
SAM2-UNet: Segment Anything 2 Makes Strong Encoder for Natural and Medical Image Segmentation - SAM2-UNet/.gitattributes at main · WZH0120/SAM2-UNet
(args.test_image_path, args.test_gt_path, 352) model = SAM2UNet().to(device) model.load_state_dict(torch.load(args.checkpoint), strict=True) model.eval() model.cuda() os.makedirs(args.save_path, exist_ok=True) for i in range(test_loader.size): with torch.no_grad(): image, ...