You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
model.fit_generator(train_batches,steps_per_epoch=3,validation_data=valid_batches,validation_steps=3, epochs=5,verbose=2)
The code above is VGG16 model that classifies cats and dogs, but when I train the network I still get accuracy 0.5, why?
106s - loss: 3.9315 - acc: 0.4333 - val_loss: 8.0151 - val_acc: 0.5000
I've already used the pretrained model and it worked, but now it doesn't work
The text was updated successfully, but these errors were encountered:
This collection of samples does not contain a sample of VGG16. Could you please add more information about the piece of code you are commenting on ? Thanks
train_path='train'
valid_path='valid'
test_path='test'
#batches for train, valid and test set
train_batches=ImageDataGenerator(rescale =
1./255).flow_from_directory(train_path,target_size=(224,224),classes=
['dog','cat'], batch_size=10)
valid_batches=ImageDataGenerator(rescale =
1./255).flow_from_directory(valid_path,target_size=(224,224),classes=
['dog','cat'], batch_size=10)
test_batches=ImageDataGenerator(rescale =
1./255).flow_from_directory(test_path,target_size=(224,224),classes=
['dog','cat'], batch_size=10)
#build CNN
input_shape = (224, 224, 3)
model=Sequential()
model.add(Conv2D(64, (3, 3), input_shape=(224,224,3),
activation='relu',padding='same'))
model.add(Conv2D(64, (3, 3),activation='relu',padding='same'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(128, (3, 3),activation='relu',padding='same'))
model.add(Conv2D(128, (3, 3),activation='relu',padding='same'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(256, (3, 3),activation='relu',padding='same'))
model.add(Conv2D(256, (3, 3),activation='relu',padding='same'))
model.add(Conv2D(256, (3, 3),activation='relu',padding='same'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(512, (3, 3),activation='relu',padding='same'))
model.add(Conv2D(512, (3, 3),activation='relu',padding='same'))
model.add(Conv2D(512, (3, 3),activation='relu',padding='same'))
model.add(Flatten())
model.add(Dense(4096, activation='relu'))
model.add(Dense(4096, activation='relu'))
model.add(Dense(2,activation='softmax'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=
['accuracy'])
model.fit_generator(train_batches,steps_per_epoch=3,validation_data=valid_batches,validation_steps=3, epochs=5,verbose=2)
The code above is VGG16 model that classifies cats and dogs, but when I train the network I still get accuracy 0.5, why?
106s - loss: 3.9315 - acc: 0.4333 - val_loss: 8.0151 - val_acc: 0.5000
I've already used the pretrained model and it worked, but now it doesn't work
The text was updated successfully, but these errors were encountered: