SadmanSakib93 / Stratified-k-fold-cross-validation-Image-classification-keras

This python program demonstrates image classification with stratified k-fold cross validation technique.
35 stars 15 forks source link

Regarding val_acc and val_loss #7

Closed RakeshSahoo90 closed 1 year ago

RakeshSahoo90 commented 1 year ago

Sir, How to add val_accuracy and val_loss of each epoch with the existing training loss, and training accuracy? Can u please update us about the K-fold cross validation

SadmanSakib93 commented 1 year ago

To add the validation loss/accuracy, the following approach can be used within the stratified cross-validation code:

validation_generator = validation_datagen.flow_from_directory(
        validation_path,
        target_size=(img_rows, img_cols),
        batch_size=batch_size,
        class_mode='categorical',  # only data, no labels
        )

# fit model
history = model.fit(train_generator,
                        epochs=epoch,
                        validation_data=validation_generator)
RakeshSahoo90 commented 1 year ago

Thank you Sir

On Fri, Dec 2, 2022 at 7:26 AM Sadman Sakib @.***> wrote:

To add the validation loss/accuracy, the following approach can be used within the stratified cross-validation code:

` validation_generator = validation_datagen.flow_from_directory( validation_path, target_size=(img_rows, img_cols), batch_size=batch_size, class_mode='categorical', # only data, no labels )

fit model

history = model.fit(train_generator, epochs=epoch, validation_data=validation_generator)`

— Reply to this email directly, view it on GitHub https://github.com/SadmanSakib93/Stratified-k-fold-cross-validation-Image-classification-keras/issues/7#issuecomment-1334665778, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4QFS2BEQUQIOHUNYYHAOWLWLFJNBANCNFSM6AAAAAASQMSZNI . You are receiving this because you authored the thread.Message ID: <SadmanSakib93/Stratified-k-fold-cross-validation-Image-classification-keras/issues/7/1334665778 @github.com>