'RandomFlip' object is not callable

boingboing·2024년 4월 3일
0
class RandomFlip(object):
  def __cal__(self, data):
    label, input = data['label'], data['input']

    if np.random.rand() > 0.5:
      label = np.fliplr(label) # 2차원 배열에서 좌우로 뒤집습니다.
      input = np.fliplr(input)

    if np.random.rand() > 0.5:
      label = np.flipud(label) # 2차원 배열에서 위아래로 뒤집습니다.
      input = np.flipud(input)

    data = {'label':label, 'input': input}

    return data

원인

함수에서 def cal 이름 오류

__call__으로 고치면 해결됨. call로 넣어야 callable함.

0개의 댓글