首页 > 解决方案 > Google Colab 中的 Tensorflow Slim:调用:无,524288

问题描述

这个问题是我在运行 model_main_tf2.py 而不是 train.py 时遇到的错误。这是 train.py 出现的错误:

Google Colab 中的 Tensorflow 2:缺少“train_dir”

该项目正在 Windows 10 中运行。

我正在按照教程在 Google Colab 中使用 Tensorflow 2 制作我自己的自定义模型: https ://medium.com/analytics-vidhya/custom-tensorflow-object-detection-model-on-google-colab-4402b8e7ee7e

我调用了这个函数:

!python /content/gdrive/MyDrive/my_tfod/research/object_detection/model_main_tf2.py --logtostderr--train_dir= /content/gdrive/MyDrive/my_tfod/research/--pipeline_config_path= /content/gdrive/MyDrive/my_tfod/research /images/pipeline.config

我得到这个错误:

2021-07-06 13:14:42.315650: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] 成功打开动态库 libcudart.so.11.0 2021-07-06 13:15:00.409048: I tensorflow/stream_executor /platform/default/dso_loader.cc:53]成功打开动态库libcuda.so.1 2021-07-06 13:15:00.533321:E tensorflow/stream_executor/cuda/cuda_driver.cc:328]调用cuInit失败:CUDA_ERROR_NO_DEVICE :未检测到支持 CUDA 的设备 2021-07-06 13:15:00.533412:I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] 内核驱动程序似乎没有在此主机上运行(8276ec42f903):/proc/ driver/nvidia/version 不存在 WARNING:tensorflow:There are non-GPU devices in tf.distribute.Strategy,未使用 nccl allreduce。W0706 13:15:00.535598 140574091941760 cross_device_ops.py:1387] 中有非 GPU 设备tf.distribute.Strategy,不使用 nccl allreduce。WARNING:tensorflow:Collective ops 在程序启动时未配置。某些性能功能可能未启用。W0706 13:15:00.536064 140574091941760 mirrored_strategy.py:379] 程序启动时未配置集体操作。某些性能功能可能未启用。INFO:tensorflow:Using MirroredStrategy with devices ('/job:localhost/replica:0/task:0/device:CPU:0',) I0706 13:15:00.593765 140574091941760 mirrored_strategy.py:369] Using MirroredStrategy with devices (' /job:localhost/replica:0/task:0/device:CPU:0',) Traceback(最近一次调用最后):文件“/content/gdrive/MyDrive/my_tfod/research/object_detection/model_main_tf2.py”,行114、在 tf.compat.v1.app.run() 文件“/usr/local/lib/python3.7/dist-packages/tensorflow/python/platform/app.py”中,第 40 行,init ():不兼容的构造函数参数。支持以下参数类型: 1. tensorflow.python.lib.io._pywrap_file_io.BufferedInputStream(filename: str, buffer_size: int, token: tensorflow.python.lib.io._pywrap_file_io.TransactionToken = None) 调用方式:None, 524288

我假设提供的路径有问题。我已将驱动器安装到 Google Drive。当我将 PythonPath 设置为研究时,我遇到了不同的错误,因此我将 PythonPath 设置为 /content/gdrive/MyDrive/models。错误修复时,错误总是最终导致这个错误。请让我知道修复程序,或者如果我需要提供更多信息来解决问题。谢谢你。

编辑:我忘了提到我使用的是 model_main_tf2.py 而不是 train.py 因为我得到“train_dir is missing”,我也不知道如何解决。

标签: pythongoogle-colaboratorytf-slim

解决方案


推荐阅读