๐ ๋ค์ํ ์๊ฐํ ๋ฐฉ๋ฒ
๋ํ์ ์ผ๋ก 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 |