刘不住头发 2022-01-05 00:13 采纳率: 100%
浏览 351
已结题

猫狗识别问题一 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

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

3条回答 默认 最新

  • 有问必答小助手 2022-01-06 10:09
    关注

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


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


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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 1月14日
  • 已采纳回答 1月6日
  • 创建了问题 1月5日

悬赏问题

  • ¥15 如何删除这个虚拟音频
  • ¥50 hyper默认的default switch
  • ¥15 网站打不开,提示502 Bad Gateway
  • ¥20 基于MATLAB的绝热压缩空气储能系统代码咨询
  • ¥15 R语言建立随机森林模型出现的问题
  • ¥15 中级微观经济学,生产可能性边界问题
  • ¥15 TCP传输时不同网卡传输用时差异过大
  • ¥15 请各位看看我写的属于什么算法,或者有更正确的写法?
  • ¥15 html5 qrcode 扫描器
  • ¥15 爬取网页信息并保存需要完整代码