hackingmaterials / pv-vision

Image analysis tool for solar modules, assisted by deep learning.
BSD 3-Clause "New" or "Revised" License
36 stars 11 forks source link

Which set of weights is used in tutorials/deeplab.ipynb? #10

Closed eccoope closed 1 year ago

eccoope commented 1 year ago

In cell #14 of deeplab.ipynb, pretrained model weights are loaded in with

model.load_state_dict(torch.load("output/weights_epoch14.pth"))

Which set of weights from the trained models available at https://datahub.duramat.org/dataset/neural-network-weights is this line loading in? Additionally, it appears that all of the state_dict keys associated with the available pretrained models are in a different format (i.e. different prefixes) than what is expected by the DeepLabHead resnet50 model. This makes it very difficult to load them into the model. Note - I am using torchvision==0.14.1 and pytorch==1.13.1. This configuration differs from the versions outlined in requirements.txt, but the line

from torchvision import transforms

in deeplab.ipynb requires pytorch>=1.8.0 and the line

from torchvision.models.segmentation import deeplabv3_resnet50

requires torchvision>=0.12.0. It would be great if a list of requirements for this specific notebook was provided.

X-Chen97 commented 1 year ago

The weights from the link you send are for UNet model. For deeplab I just used the pretrianed weights from pytorch.

The deeplab tutorial needs updates since the training was interrupted so that's why you see the "load epoch 14" code. I will fix that tutorial soon.

In the meanwhile, you can check the unet_prediction tutorial in which I show how to use the modelhandler, which is a new method I added recently to train the model.

eccoope commented 1 year ago

@X-Chen97 Thanks for letting me know. Would you still be able to publish a list of dependencies for the notebooks?

X-Chen97 commented 1 year ago

Hello, could you please be more specific? What kind of dependencies do you refer to here?

BTW the new tutorial for depplab training is published as modelhandler_train.ipynb in the tutorial.

eccoope commented 1 year ago

I'm referring to the package versions needed for the tutorials. The list in requirements.txt are not correct for the tutorials - specifically the commands used in these tutorials require torchvision>=0.12.0 and pytorch>=1.8.0. I would like to know what versions you are using for these tutorials.

X-Chen97 commented 1 year ago

Ok thanks for pointing this out. I will update the requirement soon

eccoope commented 1 year ago

Is there a tutorial for using the UNet model?

X-Chen97 commented 1 year ago

check modelhanlder_prediction.ipynb

X-Chen97 commented 1 year ago

I am going to close this issue. Feel free to open new issues if you have questions!