Update README.md
Browse files
README.md
CHANGED
|
@@ -76,6 +76,7 @@ Puoi utilizzare questo codice per testare il modello direttamente in Python:
|
|
| 76 |
1) Potete scaricare direttamente l'intero codice dal file Notebook (consiglio di applicare denormalizzazione mi sono dimenticato).
|
| 77 |
2) Utilizzarte lo script di inferenza che segue:
|
| 78 |
|
|
|
|
| 79 |
import tensorflow as tf
|
| 80 |
import numpy as np
|
| 81 |
import matplotlib.pyplot as plt
|
|
@@ -104,17 +105,20 @@ def esegui_inferenza(url_immagine):
|
|
| 104 |
img_input = np.expand_dims(img_array, axis=0)
|
| 105 |
|
| 106 |
preds = model.predict(img_input, verbose=0)[0]
|
| 107 |
-
|
| 108 |
-
|
| 109 |
|
| 110 |
plt.imshow(img)
|
| 111 |
-
plt.title(f"{
|
| 112 |
plt.axis('off')
|
| 113 |
plt.show()
|
| 114 |
|
| 115 |
URL_TEST = "https://raw.githubusercontent.com/YoongiKim/CIFAR-10-images/master/test/automobile/0001.jpg"
|
| 116 |
esegui_inferenza(URL_TEST)
|
| 117 |
|
|
|
|
|
|
|
|
|
|
| 118 |
## 👨💻 Autore
|
| 119 |
**Flavio Rubens Ottaviani**
|
| 120 |
Progetto sviluppato per il corso di Deep Learning e Reti Neurali Artificiali.
|
|
|
|
| 76 |
1) Potete scaricare direttamente l'intero codice dal file Notebook (consiglio di applicare denormalizzazione mi sono dimenticato).
|
| 77 |
2) Utilizzarte lo script di inferenza che segue:
|
| 78 |
|
| 79 |
+
```python
|
| 80 |
import tensorflow as tf
|
| 81 |
import numpy as np
|
| 82 |
import matplotlib.pyplot as plt
|
|
|
|
| 105 |
img_input = np.expand_dims(img_array, axis=0)
|
| 106 |
|
| 107 |
preds = model.predict(img_input, verbose=0)[0]
|
| 108 |
+
label = "VEICOLO" if preds[0] > preds[1] else "ANIMALE"
|
| 109 |
+
conf = max(preds) * 100
|
| 110 |
|
| 111 |
plt.imshow(img)
|
| 112 |
+
plt.title(f"{label} ({conf:.2f}%)")
|
| 113 |
plt.axis('off')
|
| 114 |
plt.show()
|
| 115 |
|
| 116 |
URL_TEST = "https://raw.githubusercontent.com/YoongiKim/CIFAR-10-images/master/test/automobile/0001.jpg"
|
| 117 |
esegui_inferenza(URL_TEST)
|
| 118 |
|
| 119 |
+
URL_TEST = "https://raw.githubusercontent.com/YoongiKim/CIFAR-10-images/master/test/automobile/0001.jpg"
|
| 120 |
+
esegui_inferenza(URL_TEST)
|
| 121 |
+
|
| 122 |
## 👨💻 Autore
|
| 123 |
**Flavio Rubens Ottaviani**
|
| 124 |
Progetto sviluppato per il corso di Deep Learning e Reti Neurali Artificiali.
|