猫狗识别问题一 python+tensorflow+pycharm(也可anaconda)

开心按下小绿键,哭着面对一片红

猫狗识别

在b站找了别人分享的代码,想复现一下代码,复现的原代码是tensorflow1.0的版本,我是2.0的
主要用的pycharm,但如果知道jupyter怎么解决,也请不吝赐教!我也可转jupyter

程序已经加了

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

兴高采烈地按了小绿键,结果出现一片红,我人傻了

loss和accuracy的图也出不来

img

那片红海就是下面这串

WARNING:tensorflow:From D:\Anaconda\anaconda\lib\site-packages\tensorflow\pythohttps://img-mid.csdnimg.cn/release/static/image/mid/ask/306899203146114.png "#left")
n\compat\v2_compat.py:96: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
2022-01-04 21:18:32.242349: 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.
2022-01-04 21:18:35.267761: W tensorflow/core/framework/op_kernel.cc:1767] OP_REQUIRES failed at whole_file_read_ops.cc:116 : Unknown: NewRandomAccessFile failed to Create/Open: D:/PyCharm/create/try/catdog/data/train/cats : �ܾ����ʡ�
; Input/output error

关掉绘图的窗口就变成下面这串问题了

Traceback (most recent call last):
  File "D:/PyCharm/create/try/catdog/training.py", line 102, in <module>
    coord.join(threads)   # 等待所有线程结束
  File "D:\Anaconda\anaconda\lib\site-packages\tensorflow\python\training\coordinator.py", line 389, in join
    six.reraise(*self._exc_info_to_raise)
  File "D:\Anaconda\anaconda\lib\site-packages\six.py", line 719, in reraise
    raise value
  File "D:\Anaconda\anaconda\lib\site-packages\tensorflow\python\training\queue_runner_impl.py", line 257, in _run
    enqueue_callable()
  File "D:\Anaconda\anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1287, in _single_operation_run
    self._call_tf_sessionrun(None, {}, [], target_list, None)
  File "D:\Anaconda\anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1441, in _call_tf_sessionrun
    return tf_session.TF_SessionRun_wrapper(self._session, options, feed_dict,
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbe in position 90: invalid start byte

img

个人觉得问题出在下面三段的其中一个,但是吧,可能是我太菜了,看了不少博文也没找到正确的解决方案
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.

 W tensorflow/core/framework/op_kernel.cc:1767] OP_REQUIRES failed at whole_file_read_ops.cc:116 : Unknown: NewRandomAccessFile failed to Create/Open: D:/PyCharm/create/try/catdog/data/train/cats : �ܾ����ʡ�
; Input/output error

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbe in position 90: invalid start byte

如果通过ananconda使用jupyter的话也有类似的问题

WARNING:tensorflow:From D:\Anaconda\anaconda\lib\site-packages\tensorflow\python\compat\v2_compat.py:96: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term

好家伙,直接连空白的绘图都没有了
但是我觉得它的warning看起来好像只是版本的问题,当然,只是我觉得

img

问题图里的那个空白的绘图应该是长这个样子的

img

哭了,搞了几天,下了很多写好的代码,没有一个可以复现的,很喜欢这个程序的风格,不想再换人换代码了
如果知道怎么解决这片红海,把训练图(准确率与损失值)给复现出来,请不吝赐教!

你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。


因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。

针对第一个疑似问题添加了
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
然后第一个疑似问题和第二个疑似问题都消失了
但是下面这个还在
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbe in position 90: invalid start byte

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632