cv2 dnn模块报错total(os[i]),如何解决?

问题遇到的现象和发生背景

使用cv2的dnn模块超分辨率出现
cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-5rb_9df3\opencv\modules\dnn\src\dnn.cpp:3520: error: (-215:Assertion failed) total(os[i]) > 0 in function 'cv::dnn::dnn4_v20201117::Net::Impl::getLayerShapesRecursively'

问题相关代码,请勿粘贴截图
    import cv2
    import os
    from cv2 import dnn_superres


    sr = dnn_superres.DnnSuperResImpl_create()
    path = "G:\\122\\LapSRN_x8.pb"
    sr.readModel(path)
    sr.setModel("lapsrn", 8)

    def read_path(file_pathname):
        for filename in os.listdir(file_pathname):
        print(filename)
        img = cv2.imread(file_pathname+'/'+filename,3)
        res = sr.upsample(img)
        cv2.imwrite('G:\\A-1-3'+"/"+filename,res)       

    read_path("G:\\A-1-2")


运行结果及报错内容

Traceback (most recent call last):
File "G:\122\122.py", line 19, in
read_path("G:\A-1-2")
File "G:\122\122.py", line 16, in read_path
res = sr.upsample(img)
cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-5rb_9df3\opencv\modules\dnn\src\dnn.cpp:3520: error: (-215:Assertion failed) total(os[i]) > 0 in function 'cv::dnn::dnn4_v20201117::Net::Impl::getLayerShapesRecursively'

我的解答思路和尝试过的方法
我想要达到的结果

你的构建代码是不是错了啊,兄弟啊

老哥,我也遇到这个问题了,请问你解决了吗?