简体   繁体   English

没有注册任何OpKernel以在iOS上使用这些attrs支持Op'DecodeJpeg'

[英]No OpKernel was registered to support Op 'DecodeJpeg' with these attrs on ios

I have followed the steps from Tensorflow For Poets ( link ) to train my own dataset using tensorflow, and getting very good prediction result.This provides me retrained.py, label_images.py, retrained_graph.pb, retrained_labels.txt files.So i have my own model graph and label file. 我按照Tensorflow For Poets( link )的步骤使用tensorflow训练了自己的数据集,并获得了很好的预测结果。这为我提供了retrained.py,label_images.py,retrained_graph.pb,retrained_labels.txt文件。我自己的模型图和标签文件。

After that i have downloaded Tensorflow Example Project for iOS from github. 之后,我从github下载了iOS的Tensorflow示例项目。 The project runs successfully in iOS platform. 该项目在iOS平台上成功运行。 but when i am using my own retrained_graph.pb, retrained_labels.txt file on behalf of examples model and label file , i am getting error as following - 但是当我代表示例模型和标签文件使用自己的retrained_graph.pb,retrained_labels.txt文件时,出现以下错误-

Errors : 错误:

Could not create TensorFlow Graph: Invalid argument: No OpKernel was registered to support Op 'DecodeJpeg' with these attrs. 无法创建TensorFlow图:无效的参数:没有使用这些attrs注册任何OpKernel支持Op'DecodeJpeg'。 Registered devices: [CPU], Registered kernels: 注册设备:[CPU],注册内核:

[[Node: DecodeJpeg = DecodeJpegacceptable_fraction=1, channels=3, dct_method="", fancy_upscaling=true, ratio=1, try_recover_truncated=false]] [[节点:DecodeJpeg = DecodeJpegacceptable_fraction = 1,频道= 3,dct_method =“”,fancy_upscaling = true,ratio = 1,try_recover_truncated = false]]

and ,

Couldn't load model: Invalid argument: No OpKernel was registered to support Op 'DecodeJpeg' with these attrs. 无法加载模型:无效的参数:没有使用这些attrs注册任何OpKernel以支持Op'DecodeJpeg'。 Registered devices: [CPU], Registered kernels: 注册设备:[CPU],注册内核:

[[Node: DecodeJpeg = DecodeJpegacceptable_fraction=1, channels=3, dct_method="", fancy_upscaling=true, ratio=1, try_recover_truncated=false]] [[节点:DecodeJpeg = DecodeJpegacceptable_fraction = 1,频道= 3,dct_method =“”,fancy_upscaling = true,ratio = 1,try_recover_truncated = false]]

Can you help me please ? 你能帮我吗 ? I have been searching a long time for it . 我一直在寻找它。 thanks 谢谢

You're placing the image decoding operation on the GPU, while this op is available only for the execution on the CPU. 您将图像解码操作放置在GPU上,而此操作仅可用于在CPU上执行。

From the documentation 文档中

If you would like TensorFlow to automatically choose an existing and supported device to run the operations in case the specified one doesn't exist, you can set allow_soft_placement to True in the configuration option when creating the session. 如果您希望TensorFlow在不存在指定设备的情况下自动选择一个现有的受支持的设备来运行操作,则可以在创建会话时在配置选项中将allow_soft_placement设置为True。

therefore, you simply have to change your session initialization with 因此,您只需使用以下命令更改会话初始化

 tf.Session(config=tf.ConfigProto(
  allow_soft_placement=True))

TensorFlow on iOS is a Subset of PC's, It doesn't contain some functions that use too much memory. iOS上的TensorFlow是PC的子集,它不包含某些占用过多内存的功能。

You can transform you pb-file to which CoreML supports. 您可以将CoreML支持的pb文件转换为。

This Tool may help you tf-coreml 该工具可能会帮助您tf-coreml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM