0
$\begingroup$

I have seen this Project Larry-zx's Githubproject

It is used to create a .pth file which can differenciate between a bitmojis gender.

Now I have created that .pth file but no idea how to use it, please help as I want a simple print Male or Female for an image I input

$\endgroup$
0

1 Answer 1

1
$\begingroup$

This depends a bit on how the .pth file is created. Given that you're only saving the state dict you can create an instance of the corresponding model type (i.e. convnext, mobilenet, resnet etc., stored in the convnext.py and networks.py files in the model directory and load the weights using the load_state_dict method (see also the pytorch documentation). If the entire model is saved you can simply use torch.load to load the full model.

$\endgroup$
1
  • $\begingroup$ Thanks for you answer, I have made the default convnext model. I assume I need to use the weights convnext.py but it looks like the state dictionary that I am trying to load contains keys that are not present in the model's state dictionary $\endgroup$ Commented Jan 5, 2023 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.