lindawangg / COVID-Net

COVID-Net Open Source Initiative
Other
1.15k stars 480 forks source link

Error during the training #65

Closed jchilela closed 3 years ago

jchilela commented 4 years ago

I am following the tutorial. I've downloaded the datasets, the model COVIDNet-CXR3-B and I am trying to train.

When I start running the code it gives the error in the first epoch. Bellow is the error. I am using this code to start the training:

python train_tf.py --weightspath models/COVIDNet-CXR3-B --metaname model.meta --ckptname model-1014

Saved baseline checkpoint Baseline eval: [[95. 5. 0.] [ 5. 94. 1.] [ 5. 4. 91.]] Sens Normal: 0.950, Pneumonia: 0.940, COVID-19: 0.910 PPV Normal: 0.905, Pneumonia 0.913, COVID-19: 0.989 Training started ____ ERROR__ 1/1678 [..............................] - ETA: 5:47:41Traceback (most recent call last): File "train_tf.py", line 100, in batch_x, batch_y, weights = next(generator) File "/Users/juliogabrielchilela1/artificialIntelligence/data.py", line 131, in next batch_x, batch_y, weights = self.getitem(self.n) File "/Users/juliogabrielchilela1/artificialIntelligence/data.py", line 180, in getitem__ self.input_shape[0]) File "/Users/juliogabrielchilela1/artificialIntelligence/data.py", line 22, in process_image_file img = crop_top(img, percent=top_percent) File "/Users/juliogabrielchilela1/artificialIntelligence/data.py", line 11, in crop_top offset = int(img.shape[0] * percent) AttributeError: 'NoneType' object has no attribute 'shape'

haydengunraj commented 4 years ago

In process_image_file(), the first step is to load the image with cv2.imread(), which returns None if the image path does not exist. The error then comes from None being passed to crop_top().

This seems to be a path issue - double-check that the data is where you expect it to be and that the --datadir path is set correctly. If that doesn't resolve the issue, try printing the filepath that is being loaded by cv2.imread() and ensure that it exists.

lindawangg commented 4 years ago

The problem is that some images were removed from the covid-chestxray-dataset, such as 4-x-day1.jpg, so I would suggest to use train_split_v3.txt rather than train_COVIDx3.txt.

hnguyentt commented 4 years ago

This error also occurs when inferencing with test_COVIDx3.txt. It is because this image should be in cohen dataset.

https://github.com/lindawangg/COVID-Net/blob/master/test_COVIDx3.txt#L115

Edwardsleo commented 4 years ago

The problem is that some images were removed from the covid-chestxray-dataset, such as 4-x-day1.jpg, so I would suggest to use train_split_v3.txt rather than train_COVIDx3.txt.

I used train_COVIDx3.txt , train_split_v3 not able to reslove this issue..

CHANANEHassen commented 4 years ago

i got this problem when i run train_tf.py OSError: File models/COVIDNet-CXR3-S\model.meta does not exist. even tho I have downloaded the model CXR3 A and CRX small but it seems that no one would work for me can you help thanks