nuclearboy95 / Anomaly-Detection-PatchSVDD-PyTorch

246 stars 56 forks source link

overlap between the two patches #28

Open ZYNORl opened 2 months ago

ZYNORl commented 2 months ago

In self-supervised learning, there was an overlap between the two patches in the code implementation, but I saw that the picture on the paper showed that there was no overlap, what are the considerations here?

def generate_coords_position(H, W, K):
    with task('P1'):
        p1 = generate_coords(H, W, K)
        h1, w1 = p1

    pos = np.random.randint(8)

    with task('P2'):
        J = K // 4

        K3_4 = 3 * K // 4
        h_dir, w_dir = pos_to_diff[pos]
        h_del, w_del = np.random.randint(J, size=2)

        h_diff = h_dir * (h_del + K3_4)
        w_diff = w_dir * (w_del + K3_4)

        h2 = h1 + h_diff
        w2 = w1 + w_diff

        h2 = np.clip(h2, 0, H - K)
        w2 = np.clip(w2, 0, W - K)

        p2 = (h2, w2)

    return p1, p2, pos

image