1.问题描述:
本地跑深度学习代码是ok的,放到了服务器上用Jupyter出错了。
明明图片是符合格式要求的(JPEG, PNG, GIF, BMP required)。
Traceback (most recent call last):
File "/mnt/core-image/train.py", line 130, in <module>
valid_images, valid_labels = process_features(features, data_augmentation=False)
File "/mnt/core-image/train.py", line 27, in process_features
image_tensor = load_and_preprocess_image(image, data_augmentation=data_augmentation)
File "/mnt/core-image/prepare_data.py", line 10, in load_and_preprocess_image
image_tensor = tf.io.decode_image(contents=image_raw, channels=CHANNELS, dtype=tf.dtypes.float32)
File "/root/miniconda3/envs/myconda/lib/python3.9/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/root/miniconda3/envs/myconda/lib/python3.9/site-packages/tensorflow/python/eager/execute.py", line 54, in quick_execute
tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError: Unknown image file format. One of JPEG, PNG, GIF, BMP required. [Op:DecodeImage]
2.排查
检查后发现是由于 产生了隐藏文件.ipynb_checkpoints,
产生原因:
每当你创建一个新的 notebook 时,都会创建一个检查点文件以及你的 notebook 文件;它将位于你保存位置的隐藏子目录中称作
.ipynb_checkpoints,也是一个 .ipynb 文件
参考==>https://zhuanlan.zhihu.com/p/36858283
3.解决
1.查看关键字是.ipynb_checkpoints的(包含子目录)
ls -Ra | grep .ipynb_checkpoints
2.删除关键字是.ipynb_checkpoints的
find ./ -type d -name '.ipynb_checkpoints' |xargs rm -fr