내용으로 건너뛰기
Out of the Box
사용자 도구
로그인
사이트 도구
검색
도구
문서 보기
이전 판
Fold/unfold all
역링크
최근 바뀜
미디어 관리자
사이트맵
로그인
>
최근 바뀜
미디어 관리자
사이트맵
추적:
visdom
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
====== Visdom ====== ===== 이미지 축 변환 ===== 일반 이미지(height x widht x channel)에서 torch (channel x height x width)로 변환 <code python> def hwc2chw(img): assert img.shape == (84, 84, 3) return np.transpose(img, (2, 0, 1)) # (3, 84, 84) def chw2hwc(img): assert img.shape == (3, 84, 84) return np.transpose(img, (1, 2, 0)) # (84, 84, 3) </code> 이미지 보이기 <code python> viz.image(o, win='name', opts=dict(width=256, height=256)) </code> viz_line 편의함수 <code python> viz = visdom.Visdom() def viz_line_(viz, title, x, y, window_size=25, width=None, height=None, ymin=None, ymax=None): title_ = title.replace(' ', '_') if type(y) == dict: _, update = getattr(viz, '_{}'.format(title_), (None, None)) legend, xs, ys = [], [], [] for k, v in sorted(y.items()): k_ = k.replace(' ', '_') dq, _ = getattr(viz, '_{}'.format(k_), (collections.deque(maxlen=window_size), None)) dq.append(v) legend.append(k) xs.append([x]) ys.append([np.mean(dq)]) viz.line(X=np.column_stack(xs), Y=np.column_stack(ys), win=title, update=update, opts=dict(title=title, width=width, height=height, legend=legend)) setattr(viz, '_{}'.format(title_), (None, 'append')) else: dq, update = getattr(viz, '_{}'.format(title_), (collections.deque(maxlen=window_size), None)) dq.append(y) y_mean = np.mean(dq) viz.line(X=[x], Y=[y_mean], win=title, update=update, opts=dict(title=f'{title}: {y_mean}', width=width, height=height, ytickmin=ymin, ytickmax=ymax)) setattr(viz, '_{}'.format(title_), (dq, 'append')) viz_line = functools.partial(viz_line_, viz) </code>
visdom.txt
· 마지막으로 수정됨: 2024/03/23 02:38 저자
127.0.0.1
문서 도구
문서 보기
이전 판
역링크
Fold/unfold all
맨 위로