Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为什么这几个代码不上传呢? #19

Closed
shichengcn opened this issue Dec 3, 2020 · 0 comments
Closed

为什么这几个代码不上传呢? #19

shichengcn opened this issue Dec 3, 2020 · 0 comments

Comments

@shichengcn
Copy link

from data import get_train_transform, get_test_transform
from data import get_random_eraser

import numpy as np

def get_random_eraser(p=0.5, s_l=0.02, s_h=0.4, r_1=0.3, r_2=3.3333333333333335, v_l=0, v_h=255, pixel_level=False):

def eraser(input_img):
    img_h, img_w, img_c = input_img.shape
    p_1 = np.random.rand()
    if p_1 > p:
        return input_img
    else:
        while 1:
            s = np.random.uniform(s_l, s_h) * img_h * img_w
            r = np.random.uniform(r_1, r_2)
            w = int(np.sqrt(s / r))
            h = int(np.sqrt(s * r))
            left = np.random.randint(0, img_w)
            top = np.random.randint(0, img_h)
            if left + w <= img_w:
                if top + h <= img_h:
                    break

        if pixel_level:
            c = np.random.uniform(v_l, v_h, (h, w, img_c))
        else:
            c = np.random.uniform(v_l, v_h)
        input_img[top:top + h, left:left + w, :] = c
        return input_img

return eraser
@shichengcn shichengcn changed the title 缺少文件 为什么这几个文件不上传呢 Dec 3, 2020
@shichengcn shichengcn changed the title 为什么这几个文件不上传呢 为什么这几个代码不上传呢? Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant