razeineldin / DeepSeg

DeepSeg: Deep Neural Network Framework for Automatic Brain Tumor Segmentation using Magnetic Resonance FLAIR Images
MIT License
26 stars 13 forks source link

issues on train.py and predict.py #4

Closed SabirKhanAkash closed 2 years ago

SabirKhanAkash commented 3 years ago

It will be very much helpful for me if you kindly tell me which versions of the python libraries did you use in this work. and can you please explain this two lines

config['val_cases_file'] = "data/valid_cases_unique.txt" # path to the validation cases file
config['valid_cases_dir'] = "valid_cases/"

as I'm not able find that txt file. Where do I get this txt file ? When I run predict.py I get this error.

FileNotFoundError: [Errno 2] No such file or directory: 'data/valid_cases_unique.txt'

and when I run train.py I get this error tho both train and validation dataset gets verified.

Traceback (most recent call last):
  File "D:/Study Materials/Study/4th Year/7th Semester/CSE 4000/Code/DeepSeg/train.py", line 98, in <module>
    main()
  File "D:/Study Materials/Study/4th Year/7th Semester/CSE 4000/Code/DeepSeg/train.py", line 94, in main
    do_augment=config['do_augment']
  File "D:/Study Materials/Study/4th Year/7th Semester/CSE 4000/Code/DeepSeg/train.py", line 53, in train_deepseg_model
    epochs=epochs, initial_epoch=initial_epoch, callbacks=[csv_logger, model_checkpoint, csv_logger, tensor_board])#, model_earlystopping])
  File "C:\Python3.7\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 819, in fit
    use_multiprocessing=use_multiprocessing)
  File "C:\Python3.7\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py", line 235, in fit
    use_multiprocessing=use_multiprocessing)
  File "C:\Python3.7\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py", line 593, in _process_training_inputs
    use_multiprocessing=use_multiprocessing)
  File "C:\Python3.7\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py", line 706, in _process_inputs
    use_multiprocessing=use_multiprocessing)
  File "C:\Python3.7\lib\site-packages\tensorflow_core\python\keras\engine\data_adapter.py", line 738, in __init__
    raise ValueError("`y` argument is not supported when using "
ValueError: `y` argument is not supported when using python generator as input.

Process finished with exit code 1

@razeineldin please answer, sir.

minaabeigi commented 2 years ago

did you find out what is the valid_cases_unique.txt file?

razeineldin commented 2 years ago

It will be very much helpful for me if you kindly tell me which versions of the python libraries did you use in this work.

This repository was implemented on Ubuntu 18.04 machine with Python 3.6, Keras 2.2.

as I'm not able find that txt file. Where do I get this txt file ? When I run predict.py I get this error.

FileNotFoundError: [Errno 2] No such file or directory: 'data/valid_cases_unique.txt'

I added a sample data folder including both files for better illustration. _validcases.txt: includes the Case IDs of all 2D validation images, while _valid_casesunique.txt: includes only the uniques Case IDs of all validation images after removing duplicates.

SabirKhanAkash commented 2 years ago

If I want to train the model and not using the pretrained weights and when I run train.py for training then I'm now getting this error

Verifying train dataset
Traceback (most recent call last):
  File "D:/Study Materials/Study/4th Year/7th Semester/CSE 4000/Code/DeepSeg/train.py", line 98, in <module>
    main()
  File "D:/Study Materials/Study/4th Year/7th Semester/CSE 4000/Code/DeepSeg/train.py", line 94, in main
    do_augment=config['do_augment']
  File "D:/Study Materials/Study/4th Year/7th Semester/CSE 4000/Code/DeepSeg/train.py", line 37, in train_deepseg_model
    verify_segmentation_dataset(train_images, train_annotations, n_classes)
  File "D:\Study Materials\Study\4th Year\7th Semester\CSE 4000\Code\DeepSeg\data.py", line 160, in verify_segmentation_dataset
    assert len(img_seg_pairs)>0, "Dataset looks empty or path is wrong "
AssertionError: Dataset looks empty or path is wrong 

Process finished with exit code 1

from the error log i discovered that in the data.py in verify_segmentation_dataset() function there is a function get_pairs_from_paths(images_path, segs_path) which should return pairs but instead it's returning NULL. I don't know why. Can you check my repo here that I forked from you.

@razeineldin

UPDATE: Fixed the issue by changing the directory path of config[dataset_path] to full path from my local drive. Previously I set it to only DATASET/dataset_brats19/ that's why images were not loading to model. Now model is being trained perfectly. Can I know which version of TensorFlow did you use in this project ?