Ravindra BagaleCourses & study guides English Track your progress

48. Small CNN Image Project in PyTorch

Data Science

48.4 Holdout Check

48.4 Holdout check

नेहमी fresh batch check — Chapter 38 overfit lesson nets लाही लागू.

हे का शिकायचं?

Why. नेहमी fresh batch check करा — Chapter 38 overfit lesson nets लाही लागू.

हे काय आहे?

What. Same rules ने नवीन batch बनावा; model.eval() आणि torch.no_grad() ने evaluate.

कसं करायचं?

How.

Holdout check

  1. make_batch(64) as test.
  2. argmax ने classes predict.
  3. Accuracy print.
model.eval()
X_test, y_test = make_batch(64)
with torch.no_grad():
 pred = model(X_test).argmax(1)
print("test acc", float((pred == y_test).float().mean()))

Ravindra Bagale's Tip

This easy synthetic task is mainly for learning the PyTorch API. Real photos will need much more data, and later also data augmentation, which means making extra training images by flipping, rotating or cropping them.