liudakai2 / UnsupDIS-pytorch

A pytorch implementation of UnsupervisedDeepImageStitching
GNU General Public License v3.0
112 stars 20 forks source link

the model input #3

Closed fanzhen12 closed 2 years ago

fanzhen12 commented 2 years ago

我想要观察一个网络,所以采取如下代码(以另外的一个网络模型为例): (I want to observe a network, so I adopt the following code (take another network model as an example):) image 结果如图所示(结果分为两部分,如代码所示,一部分是网络模型,一部分显示出具体每一层的参数): The results are shown in the figure (the results are divided into two parts, as shown in the code. One part is the network model and the other part shows the parameters of each layer): image image

同样地,我想要观察这个网络,所以采取如下代码(所有的包都已被引入): Similarly, I want to observe this network, so I take the following code (all packages have been introduced): image 结果如图所示(结果分为两部分,如代码所示,一部分是网络模型,一部分显示出具体每一层的参数): The results are shown in the figure (the results are divided into two parts, as shown in the code. One part is the network model and the other part shows the parameters of each layer): 网络模型如下所示(由于太长,之截取一部分,网络模型正常显示) The network model is as follows (because it is too long, some of it is intercepted, and the network model is displayed normally) image 但是,在运行summary函数时,出现以下错误, However, when running the summary function, the following error occurs:, image 错误在于 summary(model,(8,128,128)) 这一行,在summary函数中: The error lies in the line of summary (model, (8128128)). In the summary function: image 我不知道网络的输入是什么,因此总是无法通过此段代码打印出每一层的参数,我想请问一下,网络的输入形状是什么? I don't know what the input of the network is, so I can't print out the parameters of each layer through this code. So I have a question: What is the input shape of the network?

liudakai2 commented 2 years ago

输入tensor的shape是[8,128,128],请传入mode_align关键字参数

liudakai2 commented 2 years ago

如果summary不提供kwargs接口,你也可以依次在yolo.py中修改mode_align参数的默认值,分别打印align和fuse两个不同阶段的网络

fanzhen12 commented 2 years ago

请允许我像您请教两个问题: 问题一: image 经过修改,我使得mode_align=False变成了mode_align=True,同时经过将shape修改为: [8,128,128],代码段变为: image 出现了以下一个错误: image 也即是TypeError: Value after * must be an iterable, not int,请问这是为什么? ########################################################################################## 问题二: 请问,还有哪里我没有改对,另外,请问 model_align 是一个已经默认的参数,所以应该无需再传入,我试了一下,如果传入,代码段变为 image 是我model_align 传入的位置不对吗?

liudakai2 commented 2 years ago
  1. 或许你可以试试tuple类型的(8,128,128)而非list类型
  2. model_align是调用model实例的forward函数传入的参数,不是构造函数中的参数
fanzhen12 commented 2 years ago

在将[8,128,128]换成(8,128,128)后,我看到了希望,错误变成了 image 翻译过来也即: image 我觉得应该快要成功了,请问,这是什么情况?

liudakai2 commented 2 years ago

model = Model(opt.cfg, ch=3).cuda()

fanzhen12 commented 2 years ago

image 我又遇到了这个问题,我正在尝试解决它,如果你有什么建议,请告诉我好吗,如果我解决了,我会告诉你

fanzhen12 commented 2 years ago

image image image image image image image image image image image image 我似乎已经把模型进行了可视化,但正如你所见,有一个keyError错误,我不确定它是否可以忽略。

fanzhen12 commented 2 years ago

如果我已经完成了align阶段网络的打印,请问,对于fuse阶段网络的打印,我是不是应该把yolo.py文件中的model_align=True改为model_align=False,以及代码段改为: image

还请问,fuse阶段的输入tensor形状是什么

liudakai2 commented 2 years ago

我保持了两个阶段的输入tensor形状的一致性,建议多看看代码