首页 > 解决方案 > 为什么 Google colaboratory 停止打印?

问题描述

from PIL import Image

for i in range(1,15):
  im = Image.open('star%d.png'%i)
  black = []
  black_pixels=0
  for pixel in im.getdata():
    if pixel == (0, 0, 0):
      black_pixels += 1
    black.append(black_pixels)
  print(black_pixels)

print(black)

我想检查 14 张图像的黑色像素数,但 Google colab 打印如下:

IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.
'''
'''
Current values:
NotebookApp.iopub_data_rate_limit=1000000.0 (bytes/sec)
NotebookApp.rate_limit_window=3.0 (secs)

无论图像数量如何,Google colab 在计算最后一张图像的像素时总是这样打印

我怎么解决这个问题?(对不起我的英语水平低)

标签: printinggoogle-colaboratory

解决方案


推荐阅读