import uuid
uuid_gen = uuid.uuid4()
print(uuid_gen)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| # 支持多分类和二分类 | |
| class FocalLoss(nn.Module): | |
| """ | |
| This is a implementation of Focal Loss with smooth label cross entropy supported which is proposed in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| import torch.nn as nn | |
| import torchvision | |
| class NonLocalBlock(nn.Module): | |
| def __init__(self, channel): | |
| super(NonLocalBlock, self).__init__() | |
| self.inter_channel = channel // 2 | |
| self.conv_phi = nn.Conv2d(in_channels=channel, out_channels=self.inter_channel, kernel_size=1, stride=1,padding=0, bias=False) |