Skip to content

Commit

Permalink
fix error from nested compose in SVTR Transform in MS2.2 (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhtmike authored Nov 13, 2023
1 parent 8ea4da4 commit 25bd212
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mindocr/data/transforms/svtr_transform.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import math
import numbers
import random
from typing import Callable, Iterable

import cv2
import numpy as np

from mindspore.dataset.transforms import Compose
from mindspore.dataset.vision import RandomColorAdjust

__all__ = ["SVTRRecAug"]


class Compose:
def __init__(self, funcs: Iterable[Callable]) -> None:
self.funcs = funcs

def __call__(self, x):
for fn in self.funcs:
x = fn(x)
return x


def sample_asym(magnitude, size=None):
return np.random.beta(1, 4, size) * magnitude

Expand Down

0 comments on commit 25bd212

Please sign in to comment.