InvalidArgumentError: Unknown image file format. One of JPEG, PNG, GIF, BMP required.

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值