+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

暂无数据

找不到TensforFlow插件错误_image_op.so

发布于2021-04-12 14:54     阅读(221)     评论(0)     点赞(16)     收藏(1)


0

1

2

3

4

5

6

7

8

9

我正在tensorflow使用TFA在CPU上运行2.1

我收到此错误,因为该文件实际上存在于我的机器上,所以令人困惑。这段代码基本上是从TFA页面复制而来的,我应该能够使用TFA复制欧氏距离变换。

import tensorflow
import numpy as np
import tensorflow_addons as tfa
import matplotlib.pyplot as plt

with tensorflow.device('/CPU:0'):

    img_path = tensorflow.keras.utils.get_file('tensorflow.png','https://tensorflow.org/images/tf_logo.png')

    img_raw = tensorflow.io.read_file(img_path)
    img = tensorflow.io.decode_image(img_raw)
    img = tensorflow.image.convert_image_dtype(img, tensorflow.float32)
    img = tensorflow.image.resize(img, [500,500])

    plt.title("TensorFlow Logo with shape {}".format(img.shape))
    _ = plt.imshow(img)
    plt.show(block=False)

    bw_img = tensorflow.image.rgb_to_grayscale(img)

    gray = tensorflow.image.convert_image_dtype(bw_img, tensorflow.uint8)

    # The op expects a batch of images, so add a batch dimension
    gray = tensorflow.expand_dims(gray, 0)
    eucid = tfa.image.euclidean_dist_transform(gray)
    eucid = tensorflow.squeeze(eucid, (0, -1))
    _ = plt.imshow(eucid, cmap='gray')

    #
    # Tell user how to end code.
    #
    print("\nPress ctrl-c or ctrl-break or close windows to exit.\n")

    plt.show()

这是我正在使用的版本

tensorflow 2.1.0
TFA 0.9.1
Python 3.7.0

tensorflow是通过安装的condaTFA通过pip

这是我得到的错误

Traceback (most recent call last):
  File "debug3.py", line 34, in <module>
    eucid = tfa.image.euclidean_dist_transform(gray)
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow_addons\image\distance_transform.py", line 69, in euclidean_dist_transform
    output = _image_so.ops.addons_euclidean_distance_transform(images)
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow_addons\utils\resource_loader.py", line 56, in ops
    self._ops = tf.load_op_library(get_path_to_datafile(self.relative_path))
  File "C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow_core\python\framework\load_library.py", line 57, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: C:\ProgramData\Anaconda3\envs\tf\lib\site-packages\tensorflow_addons\custom_ops\image\_image_ops.so not found

当我查看该目录时,该目录_image_ops.so在那里。

将不胜感激。我在网上搜索,但找不到答案。


解决方案


暂无回答

0

1

2

3

4

5

6

7

8

9



所属网站分类: 技术文章 > 问答

作者:黑洞官方问答小能手

链接: https://www.pythonheidong.com/blog/article/936029/d77c05cf6e86125eb98b/

来源: python黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

16 0
收藏该文
已收藏

评论内容:(最多支持255个字符)