Update example.py
Browse filesFor zero shot classification, model needs to be in eval mode. Otherwise, the prediction probabilities will not be repeatable for the same image across multiple runs.
- example.py +2 -0
example.py
CHANGED
|
@@ -15,6 +15,8 @@ def read_image(image_path):
|
|
| 15 |
|
| 16 |
# Load model
|
| 17 |
classifier.load_model()
|
|
|
|
|
|
|
| 18 |
|
| 19 |
import urllib.request
|
| 20 |
|
|
|
|
| 15 |
|
| 16 |
# Load model
|
| 17 |
classifier.load_model()
|
| 18 |
+
# Set model into eval mode
|
| 19 |
+
classifier.model.eval()
|
| 20 |
|
| 21 |
import urllib.request
|
| 22 |
|