摘要:
import json import numpy as np import torch from scipy.cluster.vq import kmeans2,kmeans from sklearn.cluster import k_means import random with open("i 阅读全文
摘要:
k=2 data = np.random.randn(100,2) data[:50]+=2.0 center_index = np.random.choice(np.arange(len(data)), k) center = data[center_index] iters = 20 def d 阅读全文
摘要:
按照面积排序 from scipy.cluster.vq import kmeans import numpy as np new_anchor = np.arange(0,9).reshape(3,3) print(new_anchor) print(new_anchor.prod(axis =1 阅读全文
摘要:
from albumentations.core.transforms_interface import DualTransform from albumentations.pytorch import ToTensorV2, ToTensor import random View Code # 随 阅读全文
摘要:
import numpy as np def draw_gauss(heatmap, x, y, gsize): height, width = heatmap.shape[:2] gsize += 1 - (gsize % 2) sigma = gsize / 6 s = 2 * sigma * 阅读全文
摘要:
class GIoULoss(nn.Module): def __init__(self): super().__init__() def forward(self, A, B): num_bbox = A.size(0) * A.size(2) ax, ay, ar, ab = A[:, 0], 阅读全文
摘要:
def smooth_l1_loss_modify(predict, target, mask, sigma=3): # predict: bx2x96x128 # target : bx2x96x128 # mask : bx2x96x128 num_object = mask.sum().ite 阅读全文
摘要:
import torch import torch.nn as nn import torch.nn.functional as F import torchvision.datasets.mnist as mnist import torchvision.transforms as T impor 阅读全文
摘要:
import torch import torch.nn as nn import numpy as np import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() s 阅读全文
摘要:
class BatchNormalization(Module): def __init__(self, in_feature, momentum=0.9, eps=1e-8): self.mu = 0 self.var = 1 self.momentum = momentum self.eps = 阅读全文