【问题标题】:Training tensorflow detection api on colaboratory在 colaboratory 上训练 tensorflow 检测 api
【发布时间】:2018-05-23 21:21:11
【问题描述】:

我正在尝试在 colaboratory 上训练 tensorflow 对象检测 api。

当我以“%run train.py ...”运行 train.py 时,我收到错误“重复标志错误:标志“主”被定义了两次。

当我以“!python train.py ...”运行 train.py 时,我收到错误“没有名为部署的模块”。

我已经使用以下方法设置了路径: 导入系统

sys.path.append('/content/models/research/slim')
sys.path.append('/content/models/research')
sys.path.append('/content/models/research/object_detection') 

此外,我正在从 object_detection 目录运行 train。我不确定我还需要做什么才能成功运行 train.py 脚本。

【问题讨论】:

    标签: python tensorflow google-colaboratory


    【解决方案1】:

    下面的 sn-p 是专门设置 colab 上的 tensorflow object detection api。

    `

    !apt-get install protobuf-compiler python-pil python-lxml python-tk
    !pip install Cython
    !pip install jupyter
    !pip install matplotlib
    
    !git clone https://github.com/tensorflow/models.git
    
    %cd /content/models/research
    
    !protoc object_detection/protos/*.proto --python_out=.
    
    %set_env PYTHONPATH=/content/models/research:/content/models/research/slim
    
    !python object_detection/builders/model_builder_test.py
    

    `

    在 google colab 上,需要执行上述一系列行以使您的对象检测 api 启动并运行。 实际安装详情见here

    以下行指定如何运行训练脚本

    %run object_detection/train.py \
        --logtostderr \
        --pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG} \
        --train_dir=${PATH_TO_TRAIN_DIR}
    

    从官方文档来看,所有这些脚本都是在

    /模型/研究

    目录。不是来自对象检测文件夹本身。

    【讨论】:

      猜你喜欢
      • 2018-05-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-18
      • 2019-06-28
      • 1970-01-01
      • 2018-07-17
      • 1970-01-01
      相关资源
      最近更新 更多