Closed zxiangwei closed 2 years ago
sorry,i have downloaded the file point_model.pt,but i met another error when executepoint_infer = PointInferer(str(args.point))
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
And when i use vpn.It executes for a long time with no results.
What should i do to solve this problem?
Thank you for the issue.
Actually, I have no idea because I have not experienced running Adeleine on VPN. Does the changing VPN settings make a difference?
Thanks for your reply, I found that the program is mostly stuck here:
And i stumbled upon a problem, when I execute, the following prompt appears, what does this do?
And i have downloaded this file.Can I avoid downloading it in the program and just use it directly? Thank you!
I see the problem.
Yes, you can use the pretrained file directly.
In order to do this, you need to call ResNet34 incorporating the pretrained weight in the line instead of using torch.hub
.
When it comes to the original ResNet34, you can refer this.
In summary, after you call ResNet34 using above function, you need to give the pretrained weight (you already have downloaded) using load_state_dict
method like the code below.
class ResNet(nn.Module):
def __init__(self):
super(ResNet, self).__init__()
self.model = resnet34(pretrained=False)
weight = torch.load(YOUR_PRETRAINED_FILE_PATH)
self.model.load_state_dict(weight)
self.model = nn.Sequential(*list(self.model.children())[:-1])
self.up = nn.UpsamplingBilinear2d(scale_factor=2)
for param in self.parameters():
param.requires_grad = False
def forward(self, x):
x = self.model(x)
x = self.up(x)
return x
Sorry for the late reply. Thank you very much for your help, I executed the code self.model.load_state_dict(weight)
, but reported the following error:
How can I solve it please? thank you.
Do you use resnet34
from the link?
model.load_state_dict
method works in my environment
Have you solved?
Sorry, I haven't solved this problem yet. It's the same error reported last time. I want to confirm the problem of the environment again. My resnet34 is imported from the package torchvision.models, and then the weight file name I downloaded is resnet34-88a5e79d.pth. Are both of these correct?
The weigh file name your downloaded is correct.
My resnet34 is imported from the package torchvision.models
Strictly speaking, it is incorrect. My resnet34
is imported from this. In the module, torchvision.models.resnet34
is re-defined by the function. This can lead to changing keys in the weight file. Therefore, you need to import resnet34
from the module.
Thank you very much, after I changed to resnet34 as you said, the model loaded correctly. But when I selected the picture and clicked to color it, the following error appeared: RuntimeError: The size of tensor a (127) must match the size of tensor b (128) at non-singleton dimension 2 The forward function in the class DownResBlock reports an error. How can I solve it please? thank you.
The error seems to correspond to #25
When it comes to the size mismatch error, the error comes from the limited shape that the point model can accept. At present, the point model can accept only shapes that are two to the Nth power (ex: 256, 512, 1024, etc). So, tentatively, you need to resize your images.
I am sorry for the inconvenience. Tentatively, please follow that.
Thank you very much for your help, I adjusted the pixels of the picture and now have the colorized result. Thanks again for your help.
I ran server.py in the program “Adeleine” and got a error: NameError: free variable 'point_infer' referenced before assignment in enclosing scope
it seems that it needs the pretrained file.how could i got this?thank you!