lindawangg / COVID-Net

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

Runtime Error #213

Open SamanehShamshiri opened 2 years ago

SamanehShamshiri commented 2 years ago

while I'm running the code, I got this error: Output: ./output/COVIDNet-lr0.0002 13992 16490 Saved baseline checkpoint Baseline eval: [[194. 6.] [ 9. 191.]] Sens Negative: 0.970, Positive: 0.955 PPV Negative: 0.956, Positive: 0.970 Training started Traceback (most recent call last): File "train_tf.py", line 144, in batch_x, batch_y, weights, is_training = next(generator) File "/home/samaneh/workspace/COVID-Net-master/data.py", line 167, in next model_inputs = self.getitem(self.n) File "/home/samaneh/workspace/COVID-Net-master/data.py", line 219, in getitem top_percent=self.top_percent, File "/home/samaneh/workspace/COVID-Net-master/data.py", line 23, in process_image_file img = crop_top(img, percent=top_percent) File "/home/samaneh/workspace/COVID-Net-master/data.py", line 12, in crop_top offset = int(img.shape[0] * percent) AttributeError: 'NoneType' object has no attribute 'shape'

Although I downloaded version 3 based on #155 I still have this error. I am using python 3.6, TensorFlow 1.15, open-cv 4.2, and running the code on Linux Manjaro. would you please tell me how I can solve this problem?

haydengunraj commented 2 years ago

Hi @SamanehShamshiri,

The first thing to do would be to double-check that the image files exist, which you can do by printing the file path passed to cv2.imread() just before the error occurs. cv2.imread() returns None when the path it is given doesn't exist, so the error you're getting happens when this None value is treated as a NumPy array later on.

If this is a path issue, printing the file paths passed to cv2.imread() should help debug it. However, if it is an issue where the image file names in the label list are incorrect (i.e., an error on our end), that would be something we can fix. With the given information, it's impossible for me to tell which it is.