Thanks for the answer, I am strting to grasp it.
I tried adding a 3rd folder to the catdogsproyect, so I make a ‘bears’ folder in the sample train and validation, the thing is, I trained the network, and I want to test the prediccions (because I am working with very few images the accuracy is awfull but that is not what I am looking for in this moment)
So, in my prediction.py I have this code
batch_size = 64
#Instanciamos el modelo pre entrenado
vgg = Vgg16()
vgg.model.load_weights('gatosyperos3epocs.h5')
batches = vgg.get_batches('datos/mygato/', batch_size=batch_size)
#Si quiero solo porcentajes
#batches = vgg.get_batches('datos/mygato/', batch_size=batch_size, class_mode=None)
#batches = vgg.test('datos/mygato/', batch_size=batch_size)
imgs,labels = next(batches)
filenames = batches.filenames
pred = vgg.predict(imgs)
print("La prediccion dio "+str(pred))
print("Los nombres"+str(filenames))
print("Los indices son :")
print(str(batches.class_indices))
print("Si quiero solo el vector"+str(pred[:2]))
My output is
Found 4 images belonging to 3 classes.
La prediccion dio (array([0.9563, 0.9997, 0.9986, 0.9986], dtype=float32), array([0, 1, 2, 2]), ['tench', 'goldfish', 'great_white_shark', 'great_white_shark'])
Los nombres['bears/44465723_b99395d4c2.jpg', 'cats/rengar2.jpg', 'cats/rengar.jpg', 'dogs/images.jpeg']
Los indices son :
{'dogs': 2, 'cats': 1, 'bears': 0}
Si quiero solo el vector(array([0.9563, 0.9997, 0.9986, 0.9986], dtype=float32), array([0, 1, 2, 2]))
So, because I have 3 clases I have 3 indexes, thats allright, then I have an array with 0 (bear), 1 cat (1) and 2 dogs
I thought that because of the OHC I will have this other array
[0,0,1]
[0,1,0]
[0,1,0]
[1,0,0]
What I did wrong?
EDIT: Sorry for my English it is not my natal tongue