lindawangg / COVID-Net

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

AttributeError: 'NoneType' object has no attribute 'shape' #138

Closed baranaldemir closed 3 years ago

baranaldemir commented 3 years ago

I wanted to use train_tf.py, but the TensorFlow version used in the project is really old, and I guess they are not available anymore. I converted train_tf.py to the tf2 version by using tf_upgrade_v2. And now I am getting this error as I'm running train_tf.py:

2021-03-03 22:58:02.017040: I TensorFlow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
Output: ./output/COVIDNet-lr0.0002
13441 517
2021-03-03 22:58:04.110877: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2021-03-03 22:58:04.110969: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2021-03-03 22:58:04.111841: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (DESKTOP-61JI4EB): /proc/driver/nvidia/version does not exist
2021-03-03 22:58:04.115047: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-03-03 22:58:16.331608: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:339] None of the MLIR optimization passes are enabled (registered 0 passes)
2021-03-03 22:58:16.770584: I tensorflow/core/platform/profile_utils/cpu_utils.cc:114] CPU Frequency: 3593255000 Hz
Saved baseline checkpoint
Baseline eval:
Traceback (most recent call last):
  File "train_tf_2.py", line 90, in <module>
    eval(sess, graph, testfiles, os.path.join(args.datadir,'test'),
  File "/home/baran/my_env/COVID-Net/eval.py", line 19, in eval
    x = process_image_file(os.path.join(testfolder, line[1]), 0.08, input_size)
  File "/home/baran/my_env/COVID-Net/data.py", line 22, in process_image_file
    img = crop_top(img, percent=top_percent)
  File "/home/baran/my_env/COVID-Net/data.py", line 11, in crop_top
    offset = int(img.shape[0] * percent)
AttributeError: 'NoneType' object has no attribute 'shape'
haydengunraj commented 3 years ago

This is most likely caused by a missing image file in your dataset. You can try my suggestion from #134 to help identify the problem files.

baranaldemir commented 3 years ago

@haydengunraj Yeah seems like I have the same issue mentioned here #127. How can we fix this?

haydengunraj commented 3 years ago

Ah I see, we're in the process of fixing a couple of different dataset-related issues (including this one) which should be pushed along with the next release. In the meantime, I'd advise trying some of the the suggestions from #126 and #127.

haydengunraj commented 3 years ago

I believe this is now fixed in the v8 release, but feel free to reopen if this is not the case.