WenmuZhou / PytorchOCR

基于Pytorch的OCR工具库,支持常用的文字检测和识别算法

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

code error

morestart opened this issue · comments

class RandomNoise:
    def __init__(self, random_rate):
        self.random_rate = random_rate

    def __call__(self, data: dict):
        """
        对图片加噪声
        :param data: {'img':,'text_polys':,'texts':,'ignore_tags':}
        :return:
        """
        if random.random() > self.random_rate:
            return data
        data['img'] = (random_noise(data['img'], mode='gaussian', clip=True) * 255).astype(im.dtype)
        return data

astype(im.dtype), im is not found, may be is data['img'].dtype?

you are right,could you PR your correct code to me?

ok, i will create a pr

PR submitted