RazvanDu / DUCK-Net

Using DUCK-Net for polyp image segmentation. ( Nature Scientific Reports 2023 )
Creative Commons Attribution 4.0 International
101 stars 25 forks source link

Model training #8

Closed umang4002 closed 11 months ago

umang4002 commented 11 months ago

In the model training in the 16th line

model.fit(x=image_augmented, y=mask_augmented, epochs=1, batch_size=4, validation_data=(x_valid, y_valid), verbose=1, callbacks=[csv_logger])

_NotFoundError: ProgressFull/kvasir_progress_csv_DuckNet_filters_172023-12-01 20:02:22.394228.csv; No such file or directory. Error is coming. I am using KVASIR dataset for training. Please help image

maenstru56 commented 11 months ago

Hello,

GitHub doesn't allow empty directories to be added to repositories so that's why we couldn't add the whole directory structure for our project. You can either create the "ProgressFull" directory and "ModelSaveTensorFlow" directory with its sub-directories manually, or modify the code to check if they exist and if not to create them automatically. As a guide, your directory structure should look like this: | CustomLayers | ImageLoader | ModelArchitecture | ModelSaveTensorFlow | | kvasir | | cvc-clinicdb | | cvc-colondb | | etis-laribpolypdb | | ADD ANY OTHER DATASET DIRECTORY HERE, MAKE SURE IT HAS THE SAME NAME AS THE ONE IN THE DATA LOADER AND IN THE MODEL NOTEBOOK ("dataset_type" variable) | ProgressFull

Additionally, if you want to train the model on different datasets, I suggest that you first run the training for 1-2 epochs, force the model to save (set "min_loss_for_saving = 1.0") and check that the model was saved properly, and that it generated the progress files.

I hope this helps!

umang4002 commented 11 months ago

Thankyou for the information. I will surely give it a try.

umang4002 commented 11 months ago

image Thankyou for your help, I followed the steps suggested by you, but still same error persists. Can you please help me out ?

maenstru56 commented 11 months ago

Hello,

I think the most likely explanation for the error is the way the save paths are defined. Based on your operating system you might want to modify these lines of code: ct = datetime.now()

model_type = "DuckNet"

progresspath = 'ProgressFull/' + dataset_type + '_progress_csv_' + model_type + '_filters_' + str(filters) + '\' + str(ct) + '.csv' progressfullpath = 'ProgressFull/' + dataset_type + '_progress_' + model_type + '_filters_' + str(filters) + '\' + str(ct) + '.txt' plotpath = 'ProgressFull/' + dataset_type + '_progress_plot_' + model_type + '_filters_' + str(filters) + '\' + str(ct) + '.png' modelpath = 'ModelSaveTensorFlow/' + dataset_type + '/' + model_type + '_filters_' + str(filters) + '\' + str(ct)

I suggest that you try experimenting with the following: