【问题标题】:AIY image classification project on ubuntuubuntu 上的 AIY 图像分类项目
【发布时间】:2019-07-26 08:44:26
【问题描述】:

(venv) nvidia@tegra-ubuntu:~/tensorflow-for-poets-2$ IMAGE_SIZE=128 (venv) nvidia@tegra-ubuntu:~/tensorflow-for-poets-2$ ARCHITECTURE='mobilenet_0.25_128_quantized' (venv) nvidia@tegra-ubuntu:~/tensorflow-for-poets-2$ ARCHITECTURE="mobilenet_0.25_128_quantized"

(venv) nvidia@tegra-ubuntu:~/tensorflow-for-poets-2$ python -m scripts.retrain \

我使用上面的代码在 ubuntu 上训练 mobilenet,训练效果很好....但是,当我尝试测试新图像时,我使用了下面的代码。

(venv) nvidia@tegra-ubuntu:~/tensorflow-for-poets-2$ python -m scripts.label_image \

--graph=tf_files/retrained_graph.pb  \
--image=tf_files/Test_Images_Randomized/2018-10-23_14-24-57_696.jpg

我收到了这个错误。

非常感谢任何人帮助解决这个问题。自上周以来,我一直坚持这一点....提前谢谢

ValueError: 无法为形状为“(1, 128, 128, 3)”的张量“import/input:0”提供形状 (1, 224, 224, 3) 的值

【问题讨论】:

    标签: ubuntu tensorflow


    【解决方案1】:

    确保在“label_image”脚本中调整输入图像分辨率。

    可能会调整为使用全分辨率模型,默认输入大小为 224x224。这应该可以解决您的尺寸错误。 :)

    解决这个问题:

    def read_tensor_from_image_file(file_name,
                                input_height=224,
                                input_width=224,
                                input_mean=0,
                                input_std=255):
    

    到

    def read_tensor_from_image_file(file_name,
                                input_height=128,
                                input_width=128,
                                input_mean=0,
                                input_std=255):
    

    【讨论】:

    • 我尝试了您的代码并得到以下错误:bash: read_tensor_from_image_file(file_name, input_height=128, input_width=128, input_mean=0, input_std=255]): command not found
    • 你修改过Tensorflow提供的label_image.py脚本吗?这是需要修改的,以解决您的尺寸问题。此外,在您上面粘贴的代码中,末尾有一个结束方括号“]”,没有任何右括号,删除它。
    猜你喜欢
    • 2022-11-26
    • 1970-01-01
    • 1970-01-01
    • 2019-05-06
    • 2020-11-12
    • 1970-01-01
    • 2012-09-17
    • 1970-01-01
    • 2017-02-01
    相关资源
    最近更新 更多