Open afm215 opened 1 year ago
Hello, but it still cannot be found: urllib.error.HTTPError: HTTP Error 404: Not Found
.
Regarding the iresnet34
model, the URL you provided (http://sota.nizhib.ai/pytorch-insightface/iresnet34-5b0d0e90.pth
) appears to be invalid or the file may have been moved or deleted. Please help me.
Seems that the urls are not valid anymore. I have collected the weights stored in my machine cache and made them available at these urls : model_urls = { 'iresnet34': 'https://cdn.matix-media.net/dd/09944308', 'iresnet50': 'https://cdn.matix-media.net/dd/6fd38627', 'iresnet100': 'https://cdn.matix-media.net/dd/15963a78', } you can change the corresponding lines in iresnet.py file and it should work. Normally the weights should be correct but don't hesitate to proceed with some tests to check that the resulting models have satisfying performances (I have only checked that no exceptions are raised). In particular, while the resnet34 and resnet50 are coming directly from my cache, I didn't have resnet100 weights, so I had to convert the corresponding weights from the insightface mxnet model , so if you aim to use it, you would likely want to make some tests to see if everything is allright.
Dear nizhib,
I hope this email finds you well. After implementing the changes you suggested, I encountered an issue related to model state dictionary loading. I'm hoping you can provide some guidance on how to address this.
Here's the traceback of the error I received: Traceback (most recent call last): File "/media/gq/9AE4359D52457624/code/AdaTrans-master/training/train.py", line 72, in <module> ID_LOSS = IDLoss(crop=True, backbone='r34').cuda() File "/media/gq/9AE4359D52457624/code/AdaTrans-master/models/ops/id_loss.py", line 13, in init self.facenet = iresnet34(pretrained=True) File "/media/gq/9AE4359D52457624/code/AdaTrans-master/models/ops/insightface.py", line 362, in iresnet34 **kwargs) File "/media/gq/9AE4359D52457624/code/AdaTrans-master/models/ops/insightface.py", line 356, in _iresnet model.load_state_dict(state_dict) File "/home/gq/anaconda3/envs/stylegan/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1605, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for IResNet: Missing key(s) in state_dict: "prelu.weight", "layer1.0.prelu.weight", "layer1.0.bn3.weight", "layer1.0.bn3.bias", "layer1.0.bn3.running_mean", "layer1.0.bn3.running_var", "layer1.0.downsample.0.weight", "layer1.0.downsample.1.weight", "layer1.0.downsample.1.bias", "layer1.0.downsample.1.running_mean", "layer1.0.downsample.1.running_var", "layer1.1.prelu.weight", "layer1.1.bn3.weight", "layer1.1.bn3.bias", "layer1.1.bn3.running_mean", "layer1.1.bn3.running_var", "layer1.2.prelu.weight", "layer1.2.bn3.weight", "layer1.2.bn3.bias", "layer1.2.bn3.running_mean", "layer1.2.bn3.running_var", "layer2.0.prelu.weight", "layer2.0.bn3.weight", "layer2.0.bn3.bias", "layer2.0.bn3.running_mean", "layer2.0.bn3.running_var", "layer2.1.prelu.weight", "layer2.1.bn3.weight", "layer2.1.bn3.bias", "layer2.1.bn3.running_mean", "layer2.1.bn3.running_var", "layer2.2.prelu.weight", "layer2.2.bn3.weight", "layer2.2.bn3.bias", "layer2.2.bn3.running_mean", "layer2.2.bn3.running_var", "layer2.3.prelu.weight", "layer2.3.bn3.weight", "layer2.3.bn3.bias", "layer2.3.bn3.running_mean", "layer2.3.bn3.running_var", "layer3.0.prelu.weight", "layer3.0.bn3.weight", "layer3.0.bn3.bias", "layer3.0.bn3.running_mean", "layer3.0.bn3.running_var", "layer3.1.prelu.weight", "layer3.1.bn3.weight", "layer3.1.bn3.bias", "layer3.1.bn3.running_mean", "layer3.1.bn3.running_var", "layer3.2.prelu.weight", "layer3.2.bn3.weight", "layer3.2.bn3.bias", "layer3.2.bn3.running_mean", "layer3.2.bn3.running_var", "layer3.3.prelu.weight", "layer3.3.bn3.weight", "layer3.3.bn3.bias", "layer3.3.bn3.running_mean", "layer3.3.bn3.running_var", "layer3.4.prelu.weight", "layer3.4.bn3.weight", "layer3.4.bn3.bias", "layer3.4.bn3.running_mean", "layer3.4.bn3.running_var", "layer3.5.prelu.weight", "layer3.5.bn3.weight", "layer3.5.bn3.bias", "layer3.5.bn3.running_mean", "layer3.5.bn3.running_var", "layer4.0.prelu.weight", "layer4.0.bn3.weight", "layer4.0.bn3.bias", "layer4.0.bn3.running_mean", "layer4.0.bn3.running_var", "layer4.1.prelu.weight", "layer4.1.bn3.weight", "layer4.1.bn3.bias", "layer4.1.bn3.running_mean", "layer4.1.bn3.running_var", "layer4.2.prelu.weight", "layer4.2.bn3.weight", "layer4.2.bn3.bias", "layer4.2.bn3.running_mean", "layer4.2.bn3.running_var", "bn2.weight", "bn2.bias", "bn2.running_mean", "bn2.running_var", "features.weight", "features.bias", "features.running_mean", "features.running_var". size mismatch for conv1.weight: copying a param with shape torch.Size([64, 3, 7, 7]) from checkpoint, the shape in current model is torch.Size([64, 3, 3, 3]). size mismatch for layer2.0.bn1.weight: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for layer2.0.bn1.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for layer2.0.bn1.running_mean: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for layer2.0.bn1.running_var: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([64]). size mismatch for layer3.0.bn1.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for layer3.0.bn1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for layer3.0.bn1.running_mean: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for layer3.0.bn1.running_var: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for layer4.0.bn1.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for layer4.0.bn1.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for layer4.0.bn1.running_mean: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for layer4.0.bn1.running_var: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([256]). size mismatch for fc.weight: copying a param with shape torch.Size([1000, 512]) from checkpoint, the shape in current model is torch.Size([512, 25088]). size mismatch for fc.bias: copying a param with shape torch.Size([1000]) from checkpoint, the shape in current model is torch.Size([512]).
The error suggests there are missing keys in the state dictionary and size mismatches for certain parameters. I've attached the detailed list of discrepancies for your reference.
I'd greatly appreciate any insights or suggestions you might have to resolve this issue.
Thank you in advance for your time and assistance.
Best regards, Qi Guo
632922175 @.***
Original Email
Sender:"afm215"< @.*** >;
Sent Time:2023/9/4 20:41
To:"nizhib/pytorch-insightface"< @.*** >;
Cc recipient:"guoqi0531"< @. >;"Comment"< @. >;
Subject:Re: [nizhib/pytorch-insightface] SSL certificate have expired andTorch API outdated (Issue #11)
Seems that the urls are not valid anymore. I have collected the weights stored in my machine cache and made them available at these urls : model_urls = { 'iresnet34': 'https://cdn.matix-media.net/dd/09944308', 'iresnet50': 'https://cdn.matix-media.net/dd/6fd38627', 'iresnet100': 'https://cdn.matix-media.net/dd/15963a78', } you can change the corresponding lines in iresnet.py file and it should work. Normally the weights should be correct but don't hesitate to proceed with some tests to check that the resulting models have satisfying performances (I have only checked that no exceptions are raised). In particular, while the resnet34 and resnet50 are coming directly from my cache, I didn't have resnet100 weights, so I had to convert the corresponding weights from the insightface mxnet model , so if you aim to use it, you would likely want to make some tests to see if everything is allright.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
Hi Qi Guo, Unfortunately, I am not nizhib, the author of this repository. It would have certainly made things easier... I indeed have the same issue with Resnet 34, my apologies for not realizing it earlier. I have searched some workarounds but I could not succeed in making it work. It seems that the weights initially provided are not coming from the right model's architecture, and the original mxnet weights from insightface are nowhere to be found. The files might be under this link https://pan.baidu.com/s/1jKahEXw, but as a French person, I cannot download the files nor see the content... I suggest you use resnet50 or resnet 100 which are running correctly. You can also use the onnx version of resnet 34 provided by insightface, which means not using this library. All my apologies for not being able to solve this specific issue. Best regards, Alexandre
Dear Alexandre, I'm very sorry for getting your name wrong. Thank you for your help!
Best regards, Qi Guo
632922175 @.***
Original Email
Sender:"afm215"< @.*** >;
Sent Time:2023/9/5 19:45
To:"nizhib/pytorch-insightface"< @.*** >;
Cc recipient:"guoqi0531"< @. >;"Comment"< @. >;
Subject:Re: [nizhib/pytorch-insightface] SSL certificate have expired andTorch API outdated (Issue #11)
Hi Qi Guo, Unfortunately, I am not nizhib, the author of this repository. It would have certainly made things easier... I indeed have the same issue with Resnet 34, my apologies for not realizing it earlier. I have searched some workarounds but I could not succeed in making it work. It seems that the weights initially provided are not coming from the right model's architecture, and the original mxnet weights from insightface are nowhere to be found. The files might be under this link https://pan.baidu.com/s/1jKahEXw, but as a French person, I cannot download the files nor see the content... I suggest you use resnet50 or resnet 100 which are running correctly. You can also use the onnx version of resnet 34 provided by insightface, which means not using this library. All my apologies for not being able to solve this specific issue. Best regards, Alexandre
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
There are some issues with the load_state_dict_from_url function.
the current import won't work for torch 2.0. The API has evolved and the function is now within the torch.hub module. (line 3 of iresnet.py should be changed)
With this change being done, an SSL certificate error will still be risen. This is due to outdated certificates. Luckily, a temporary fix can be done by changing the model URLs , i.e. switching the https within the URLs to http.