� EVER 2021-07-23 23:24 采纳率: 0%
浏览 461

请教pycharm报错RecursionError: maximum recursion depth exceeded如何解决

代码是

from nets.unet import mobilenet_unet

if __name__ == "__main__":
    model = mobilenet_unet(2, input_height=416, input_width=416)
    model.summary()

运行之后报错

D:\anaconda3\envs\tensorflow-gpu\python.exe D:/myproject/Semantic-Segmentation-master/Semantic-Segmentation-master/UM/test.py
Using TensorFlow backend.
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
  File "D:/myproject/Semantic-Segmentation-master/Semantic-Segmentation-master/UM/test.py", line 11, in <module>
    model = mobilenet_unet(2, input_height=416, input_width=416)
  File "D:\myproject\Semantic-Segmentation-master\Semantic-Segmentation-master\UM\nets\unet.py", line 56, in mobilenet_unet
    model =  _unet(n_classes, get_mobilenet_encoder, input_height=input_height, input_width=input_width)
  File "D:\myproject\Semantic-Segmentation-master\Semantic-Segmentation-master\UM\nets\unet.py", line 7, in _unet
    model = _unet(n_classes, get_mobilenet_encoder, input_height=input_height, input_width=input_width)
  File "D:\myproject\Semantic-Segmentation-master\Semantic-Segmentation-master\UM\nets\unet.py", line 7, in _unet
    model = _unet(n_classes, get_mobilenet_encoder, input_height=input_height, input_width=input_width)
  File "D:\myproject\Semantic-Segmentation-master\Semantic-Segmentation-master\UM\nets\unet.py", line 7, in _unet
    model = _unet(n_classes, get_mobilenet_encoder, input_height=input_height, input_width=input_width)
  [Previous line repeated 995 more times]
RecursionError: maximum recursion depth exceeded

Process finished with exit code 1

在网上搜了解决方法是在代码前加


import sys
sys.setrecursionlimit(2000000000) #设置递归深度

但是又报错

D:\anaconda3\envs\tensorflow-gpu\python.exe D:/myproject/Semantic-Segmentation-master/Semantic-Segmentation-master/UM/test.py
Using TensorFlow backend.
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
D:\anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\framework\dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])

Process finished with exit code -1073741571 (0xC00000FD)

环境是Win10+tensorflow1.13.2+keras2.1.5+python3.6
请问到底是哪里错了,应该怎么解决啊?

  • 写回答

3条回答 默认 最新

  • 咕泡-三木 2021-07-24 15:00
    关注

    把mobilenet_unet的参数值改小还会储秀安这条的提示吗

    提示的意思就是递归次数太多了,可能会无休止,所以程序报错了

    评论

报告相同问题?

问题事件

  • 创建了问题 7月23日

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算