首页 > 解决方案 > google colab 在进程中设置一个 '^C'

问题描述

我正在运行从本教程获得的这段代码 我正在尝试运行 tensorflow 对象检测 api,所有代码都运行良好,如果你运行所有调用,所有单元格都会运行良好,最后,我的图像被分类。

Buuut 有 1 个不能正常工作的单元,它可以工作,但不喜欢它必须工作。

当我用!python legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_pets.config 它训练我的模型时,启动 tensorflow 并开始训练,但它只运行 3 步、4 步,有时是 20、21、23 步,最后,google colab^C在此过程中设置了一个

我永远无法完成培训,因为 google colab 关闭了我的流程,有人知道发生了什么?

我已经尝试使用 GPU 和 TPU 实例。

[...]
INFO:tensorflow:Restoring parameters from training/model.ckpt-0
I1022 20:41:48.368024 139794549495680 tf_logging.py:115] Restoring parameters from training/model.ckpt-0
INFO:tensorflow:Running local_init_op.
I1022 20:41:52.779153 139794549495680 tf_logging.py:115] Running local_init_op.
INFO:tensorflow:Done running local_init_op.
I1022 20:41:52.997912 139794549495680 tf_logging.py:115] Done running local_init_op.
INFO:tensorflow:Starting Session.
I1022 20:41:59.072830 139794549495680 tf_logging.py:115] Starting Session.
INFO:tensorflow:Saving checkpoint to path training/model.ckpt
I1022 20:41:59.245162 139793493063424 tf_logging.py:115] Saving checkpoint to path training/model.ckpt
INFO:tensorflow:Starting Queues.
I1022 20:41:59.252097 139794549495680 tf_logging.py:115] Starting Queues.
INFO:tensorflow:global_step/sec: 0
I1022 20:42:10.151180 139793484670720 tf_logging.py:159] global_step/sec: 0
INFO:tensorflow:Recording summary at step 0.
I1022 20:42:16.119055 139793476278016 tf_logging.py:115] Recording summary at step 0.
INFO:tensorflow:global step 1: loss = 14.0911 (28.770 sec/step)
I1022 20:42:28.496783 139794549495680 tf_logging.py:115] global step 1: loss = 14.0911 (28.770 sec/step)
INFO:tensorflow:global step 2: loss = 12.4958 (10.529 sec/step)
I1022 20:42:39.334129 139794549495680 tf_logging.py:115] global step 2: loss = 12.4958 (10.529 sec/step)
INFO:tensorflow:global step 3: loss = 11.6073 (8.267 sec/step)
I1022 20:42:47.601801 139794549495680 tf_logging.py:115] global step 3: loss = 11.6073 (8.267 sec/step)
^C

标签: pythontensorflowobject-detectiongoogle-colaboratoryobject-detection-api

解决方案


我同意 Bob Smith 关于这里的“内存不足”问题。您可以通过Haohui的一个简单技巧将内存从 12GB 升级到 25GB 来应对它。在 Colab 中运行以下代码:

a = []
while(1):
    a.append('1')

它将使会话崩溃,并且您将在屏幕左下方收到一条消息“您想切换到高 RAM 运行时...”。


推荐阅读