错误:导入matplotlib; matplotlib.use(' Agg')(Tensorflow Jupyter)

时间:2018-04-09 17:28:27

标签: python matplotlib tensorflow jupyter

我试图运行tensorflow对象检测。我收到了这个错误。

function proofTool() {
    var items = selection;
    if ( items.length != 2 ) //makes sure that 2 items are selected
    {
        alert("Select the and group the artwork and select the guide to center it on before running this script.");
    }
    else
    {
        //assigns selected guide to guide and other selection to artwork
        var artwork = null;
        var guide = null;
        for ( i = 0; i != 2; ++i )
        {
            if ( items[ i ].name == "Guide" )
            {
                guide = items[ i ];
            }
            else
            {
                artwork = items[ i ];
            }
        }
        // makes sure that things are sleected and got assigned
        if ( ( null == artwork ) || ( null == guide ) )
        {
            alert("Select the and group the artwork and select the guide to center it on before running this script.");
        }
        else
        {
            //Resizes artwork proportionately to fit in Guide area
            if (artwork.width >= artwork.height) 
            {
                var scale = (artwork.width / guide.width);
            } 
            else 
            {
                var scale = (artwork.height / guide.height);
            }
            artwork.width /= scale;
            artwork.height /= scale;

            //centers artwork on center of selected guide
            var guideXPos = (guide.position[0]+guide.width/2);
            var guideYPos = (guide.position[1]-guide.height/2);
            artwork.position = [guideXPos-(artwork.width/2), guideYPos+(artwork.height/2)];
            redraw();
        }//Close of Position/re-size If/Else
    }//Close of item select
}//Close of proofTool function

proofTool();

我该如何解决这个问题?它仍然有效,但我不想像其他主题建议那样隐藏此错误。

1 个答案:

答案 0 :(得分:1)

我的obtect_detection_tutorial笔记本中遇到了类似的问题,我找到的解决方案是:

切割以下代码行:

    %matplotlib inline

在最后一个for循环之前粘贴它,迭代测试图像(代码的最后一个单元格)。

希望它有所帮助。