Update README.md
Browse files
README.md
CHANGED
|
@@ -71,10 +71,8 @@ Il modello Γ¨ stato addestrato per **20 epoche** con i seguenti risultati (basat
|
|
| 71 |
|
| 72 |
## π» Come Usare il Modello
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 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
|
|
@@ -85,7 +83,7 @@ import requests
|
|
| 85 |
from io import BytesIO
|
| 86 |
import os
|
| 87 |
|
| 88 |
-
URL_MODELLO = "https://huggingface.co/FlavioRubensOttaviani/autonomous-driving-object-detection-deepLearning/resolve/main/modello_guida_autonoma_cifar10.h5"
|
| 89 |
NOME_FILE_LOCALE = "modello_scaricato.h5"
|
| 90 |
|
| 91 |
if not os.path.exists(NOME_FILE_LOCALE):
|
|
@@ -105,7 +103,7 @@ def esegui_inferenza(url_immagine):
|
|
| 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)
|
|
@@ -113,10 +111,7 @@ def esegui_inferenza(url_immagine):
|
|
| 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
|
|
|
|
| 71 |
|
| 72 |
## π» Come Usare il Modello
|
| 73 |
|
| 74 |
+
1)Potete scaricare l'intero codice dal file Notebook (si consiglia di applicare la denormalizzazione).
|
| 75 |
+
2)Per testare il modello direttamente in Python, utilizzate lo script di inferenza seguente:
|
|
|
|
|
|
|
| 76 |
|
| 77 |
```python
|
| 78 |
import tensorflow as tf
|
|
|
|
| 83 |
from io import BytesIO
|
| 84 |
import os
|
| 85 |
|
| 86 |
+
URL_MODELLO = "[https://huggingface.co/FlavioRubensOttaviani/autonomous-driving-object-detection-deepLearning/resolve/main/modello_guida_autonoma_cifar10.h5](https://huggingface.co/FlavioRubensOttaviani/autonomous-driving-object-detection-deepLearning/resolve/main/modello_guida_autonoma_cifar10.h5)"
|
| 87 |
NOME_FILE_LOCALE = "modello_scaricato.h5"
|
| 88 |
|
| 89 |
if not os.path.exists(NOME_FILE_LOCALE):
|
|
|
|
| 103 |
img_input = np.expand_dims(img_array, axis=0)
|
| 104 |
|
| 105 |
preds = model.predict(img_input, verbose=0)[0]
|
| 106 |
+
label = "VEICOLO π" if preds[0] > preds[1] else "ANIMALE π"
|
| 107 |
conf = max(preds) * 100
|
| 108 |
|
| 109 |
plt.imshow(img)
|
|
|
|
| 111 |
plt.axis('off')
|
| 112 |
plt.show()
|
| 113 |
|
| 114 |
+
URL_TEST = "[https://raw.githubusercontent.com/YoongiKim/CIFAR-10-images/master/test/automobile/0001.jpg](https://raw.githubusercontent.com/YoongiKim/CIFAR-10-images/master/test/automobile/0001.jpg)"
|
|
|
|
|
|
|
|
|
|
| 115 |
esegui_inferenza(URL_TEST)
|
| 116 |
|
| 117 |
## π¨βπ» Autore
|