📊 다양한 시각화 방법
대표적으로 WandB는 학습log 시각화를 주로 사용한다.
대표적으로 다음과 같다.
- Loss, Accuracy 그래프
- Model parameter(gradient) 그래프
- pred_img 시각화
- sweep 그래프
- Confusion Matrix
- ROC, PR Curve
1. Loss, Accuracy 그래프
💻 코드
wandb.log({'loss':loss}, step=epoch)
wandb.log({'val_loss': val_loss,
'val_acc': val_accuracy })
📊 시각화

2. Model parameter(gradient) 그래프
💻 코드
wandb.watch(model, criterion, log="all", log_freq=10)
log="all"을 주면 gradient와 parameter, bias를 모두 기록할 수 있다.
📊 시각화

3. Pred_Img 시각화
💻 코드
ex_images.append(wandb.Image(data[0],
caption="Pred:{} Truth:{}".format(pred[0].item(), target[0])
))
wandb.log({"Image": ex_images})
📊 시각화

cf) index바를 조절해 학습진행경과확인이 가능하다.
4. sweep 그래프
💻 코드
sweep_id = wandb.sweep(sweep_config, project="mnist", entity='v2llain')
wandb.agent(sweep_id, run_sweeep, count=6)
📊 시각화

X축: configuration된 parameter이름
y축: 변경된 값
맨 우측: 성능측정값
5. Confusion Matrix
💻 코드
sweep실행❌)
wandb.sklearn.plot_confusion_matrix(y_test, y_pred,
labels=classes_name)
sweep실행⭕️)
wandb.log({
"Confusion Matrix":
wandb.plot.confusion_matrix(preds=best_all_preds,
y_true=best_all_labels,
class_names=classes_name
)})
📊 시각화

6. ROC, PR Curve
💻 코드
wandb.log({'roc': wandb.plots.ROC(y_test, y_prob_pred, cnb.classes_)})
wandb.log({'pr': wandb.plots.precision_recall(y_test, y_prob_pred, cnb.classes_)})
📊 시각화

'Deep Learning : Vision System > Pytorch & MLOps' 카테고리의 다른 글
[🔥PyTorch 2.2]: transformv2 , torch.compile (0) | 2024.01.31 |
---|---|
[WandB] Step 2. WandB Sweeps (2) | 2024.01.09 |
[WandB] Step 1. WandB Experiments. with MNIST (2) | 2024.01.09 |