argument 1 must be sequence of length 2, not 3怎么解决

Traceback (most recent call last):
  File "D:/Program Files/Python/python workspace/train/resnet50_segnet.py", line 255, in <module>
    callbacks=[checkpoint_period, reduce_lr, early_stopping])
  File "D:\ProgramData\Anaconda3\envs\py37\lib\site-packages\tensorflow\python\util\deprecation.py", line 324, in new_func
    return func(*args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\py37\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1829, in fit_generator
    initial_epoch=initial_epoch)
  File "D:\ProgramData\Anaconda3\envs\py37\lib\site-packages\tensorflow\python\keras\engine\training.py", line 108, in _method_wrapper
    return method(self, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\py37\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1063, in fit
    steps_per_execution=self._steps_per_execution)
  File "D:\ProgramData\Anaconda3\envs\py37\lib\site-packages\tensorflow\python\keras\engine\data_adapter.py", line 1117, in __init__
    model=model)
  File "D:\ProgramData\Anaconda3\envs\py37\lib\site-packages\tensorflow\python\keras\engine\data_adapter.py", line 786, in __init__
    peek, x = self._peek_and_restore(x)
  File "D:\ProgramData\Anaconda3\envs\py37\lib\site-packages\tensorflow\python\keras\engine\data_adapter.py", line 843, in _peek_and_restore
    peek = next(x)
  File "D:/Program Files/Python/python workspace/train/resnet50_segnet.py", line 113, in generate_arrays_from_file
    label = label.resize((int(WIDTH/2), int(HEIGHT/2),NCLASSES))
  File "D:\ProgramData\Anaconda3\envs\py37\lib\site-packages\PIL\Image.py", line 1935, in resize
    return self._new(self.im.resize(size, resample, box))
TypeError: argument 1 must be sequence of length 2, not 3

Process finished with exit code 1
 

应该是检查点设置的时候出现了参数不匹配的问题,题主请发给我一份更详细的代码,我实际测试一下。

多了一个参数

#这句修改下,
 label = label.resize((int(WIDTH/2), int(HEIGHT/2)),NCLASSES)

 

参数个数不对

更新一下
sudo pip install Pillow --upgrade

看一下你报错的py 文件 找到你自己编写的那个文档,不用看那些系统的py文件,然后找到对应的报错行,这是参数传递不对,参数传递要求的是长度为2的序列,你传递的是长度为3 ,看一下接口就能解决了。