tensorflow for poets: “The name 'import/input' refers to an Operation not in the graph.”

前端 未结 11 1284
长情又很酷
长情又很酷 2020-12-29 23:17

I was following the codelabs tensorflow for poets and the training worked fine but when I runned the script to evaluate a image:

python -m scripts.label_imag         


        
11条回答
  •  鱼传尺愫
    2020-12-30 00:10

    Setting input layer to Mul works for me. However, it seems to be ignoring my input size settings and doesn't do any magic to resize the image to 299x299 which I guess Mul is expecting. I did this:

    set INPUT_WIDTH=194 
    set INPUT_HEIGHT=141 
    set INPUT_LAYER=Mul 
    python -m scripts.label_image --image=%IMAGE% --input_height=%INPUT_HEIGHT% \
    --input_width=%INPUT_WIDTH% --graph=%GRAPH% \
    --input_layer=%INPUT_LAYER% --output_layer=final_result
    

    and got this:

    ValueError: Cannot feed value of shape (1, 141, 194, 3) 
    for Tensor 'import/Mul:0', which has shape '(1, 299, 299, 3)'
    

    And ohhh, looking at the code, input_width and input_height are what to normalize to, not to normalize from. So it's all good. Also I needed to add my labels.

提交回复
热议问题