python - 你如何定期清除 Google Colab 的输出

标签 python tensorflow google-colaboratory object-detection-api

我正在使用 Google Colab 训练对象检测模型,使用 tensorflow 对象检测 api。当我运行单元 train.py 时,它会不断打印诊断输出。大约 30 分钟后,由于单元格输出中打印的行数过多,浏览器崩溃。

是否有任何脚本可以用来定期(比如每 30 分钟)清除输出,而不是手动按下 clear output button

最佳答案

您可以使用 google.colab.output.clear()

from google.colab import output

for i in range(100):
  print(i)
  # do something
  if i%10 == 0:
    output.clear()

关于python - 你如何定期清除 Google Colab 的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57086398/

相关文章:

python - 在同一线程下的 tensorflow 中创建多个图

c++ - iOS : "Invalid argument: Session was not created with a graph before Run()!" 上的 TensorFlow C++ 推理错误

python - Tensorflow Windows 访问文件夹被拒绝 :"NewRandomAccessFile failed to Create/Open: Access is denied. ; Input/output error"

machine-learning - sklearn.model_selection GridSearchCV 抛出 KeyError : 'mean_train_score'

google-colaboratory - colab 上的 TPU 规范

google-colaboratory - Colab 不支持符号链接(symbolic link) (ln) 操作

python - 在 python 中每 5 分钟运行一次与系统时钟同步的函数的最佳方法是什么?

python - 替换 theano 图中表达式的变量

Python - 如何使用另一个函数创建测试函数?

python - 根据索引位置连接一维和二维数组