IndexError: list index out of range
Entretoize opened this issue · 4 comments
Entretoize commented
I upgraded the code to tensorflow 2 with tf_upgrade_v2 because I wasn't able to run the code without, then I've been able to download and generate noised images and train the spatialCNN to an average PSNR of 32.34 following your steps up to python main_spatialCNN.py --phase=test_temp
Then I got this outputs:
F:\MyData\Git\ViDeNN-2\Spatial-CNN>python main_spatialCNN.py --phase=test_temp
2021-06-04 07:48:16.916830: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cudart64_110.dll
GPU
2021-06-04 07:48:28.745326: 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: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-06-04 07:48:28.768121: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library nvcuda.dll
2021-06-04 07:48:28.837217: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1733] Found device 0 with properties:
pciBusID: 0000:07:00.0 name: NVIDIA GeForce RTX 3080 computeCapability: 8.6
coreClock: 1.785GHz coreCount: 68 deviceMemorySize: 10.00GiB deviceMemoryBandwidth: 707.88GiB/s
2021-06-04 07:48:28.837354: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cudart64_110.dll
2021-06-04 07:48:29.497184: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cublas64_11.dll
2021-06-04 07:48:29.497294: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cublasLt64_11.dll
2021-06-04 07:48:29.937941: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cufft64_10.dll
2021-06-04 07:48:30.017723: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library curand64_10.dll
2021-06-04 07:48:30.298235: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cusolver64_11.dll
2021-06-04 07:48:30.580547: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cusparse64_11.dll
2021-06-04 07:48:30.612636: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cudnn64_8.dll
2021-06-04 07:48:30.625687: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1871] Adding visible gpu devices: 0
2021-06-04 07:48:33.146814: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1258] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-06-04 07:48:33.146933: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1264] 0
2021-06-04 07:48:33.147929: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1277] 0: N
2021-06-04 07:48:33.186170: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1418] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7168 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce RTX 3080, pci bus id: 0000:07:00.0, compute capability: 8.6)
F:\python3.9\lib\site-packages\tensorflow\python\keras\legacy_tf_layers\convolutional.py:414: UserWarning: `tf.layers.conv2d` is deprecated and will be removed in a future version. Please Use `tf.keras.layers.Conv2D` instead.
warnings.warn('`tf.layers.conv2d` is deprecated and '
F:\python3.9\lib\site-packages\tensorflow\python\keras\engine\base_layer_v1.py:1692: UserWarning: `layer.apply` is deprecated and will be removed in a future version. Please use `layer.__call__` method instead.
warnings.warn('`layer.apply` is deprecated and '
F:\python3.9\lib\site-packages\tensorflow\python\keras\legacy_tf_layers\normalization.py:307: UserWarning: `tf.layers.batch_normalization` is deprecated and will be removed in a future version. Please use `tf.keras.layers.BatchNormalization` instead. In particular, `tf.control_dependencies(tf.GraphKeys.UPDATE_OPS)` should not be used (consult the `tf.keras.layers.BatchNormalization` documentation).
warnings.warn(
2021-06-04 07:48:33.383608: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1733] Found device 0 with properties:
pciBusID: 0000:07:00.0 name: NVIDIA GeForce RTX 3080 computeCapability: 8.6
coreClock: 1.785GHz coreCount: 68 deviceMemorySize: 10.00GiB deviceMemoryBandwidth: 707.88GiB/s
2021-06-04 07:48:33.383739: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1871] Adding visible gpu devices: 0
WARNING:tensorflow:From F:\python3.9\lib\site-packages\tensorflow\python\keras\layers\normalization.py:534: _colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
W0604 07:48:33.418567 10008 deprecation.py:330] From F:\python3.9\lib\site-packages\tensorflow\python\keras\layers\normalization.py:534: _colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
[*] Initialize model successfully...
[*] Reading checkpoint...
INFO:tensorflow:Restoring parameters from ./ckpt\Spatial-CNN-276150
I0604 07:48:37.203566 10008 saver.py:1298] Restoring parameters from ./ckpt\Spatial-CNN-276150
[*] Load weights SUCCESS...
Traceback (most recent call last):
File "F:\MyData\Git\ViDeNN-2\Spatial-CNN\main_spatialCNN.py", line 101, in <module>
tf.compat.v1.app.run()
File "F:\python3.9\lib\site-packages\tensorflow\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "F:\python3.9\lib\site-packages\absl\app.py", line 303, in run
_run_main(main, args)
File "F:\python3.9\lib\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "F:\MyData\Git\ViDeNN-2\Spatial-CNN\main_spatialCNN.py", line 80, in main
denoiser_for_temp3_training(model)
File "F:\MyData\Git\ViDeNN-2\Spatial-CNN\main_spatialCNN.py", line 58, in denoiser_for_temp3_training
denoiser.test(noisy_eval_files, eval_files, ckpt_dir=args.ckpt_dir, save_dir='../Temp3-CNN/data/train/denoised/')
File "F:\MyData\Git\ViDeNN-2\Spatial-CNN\model_spatialCNN.py", line 135, in test
noisy = cv2.imread(eval_data_noisy[idx])
IndexError: list index out of range
Do you have an idea of what is the problem ?
Entretoize commented
I looked up at the code and python add_noise_temp3-CNN.py
hasn't created the noisy images...
Entretoize commented
Ok, I found the problem, it's about windows using counter slashes instead of slashes in paths, I corrected with that code:
folder = img_path.split('/')[-2]
if folder=="train":
folder = img_path.split('\\')[-2]
Entretoize commented
The will you correct something ?
clausmichele commented
I've updated the README with a warning for windows users pointing to this issue.