Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pretrained_model #5

Open
CatchBeliF opened this issue Jun 29, 2020 · 13 comments
Open

pretrained_model #5

CatchBeliF opened this issue Jun 29, 2020 · 13 comments

Comments

@CatchBeliF
Copy link

Sorry for bother you again!
After you give the initialization code, we try to train with our own data. When we run the demo.py with our own initialization model, we find this question:
size mismatch for mix_model: copying a param with shape torch.Size([48, 512, 41, 91]) from checkpoint, the shape in current model is torch.Size([46, 512, 23, 31]).
size mismatch for pointwiseinference.mix_model: copying a param with shape torch.Size([48, 512, 41, 91]) from checkpoint, the shape in current model is torch.Size([46, 512, 23, 31]).
terminate called without an active exception

We guess the pretrained_model best.pth we download from your github may not mathcing with our model . Can you provide the code to generate this pretrained_model.
Thank you very much!

@AdamKortylewski
Copy link
Owner

The issue is that your initialization model is not compatible with the pretrained model. You can either not load the pretrained model and just use the initialization model, or you can train your model with the train.py script.

@CatchBeliF
Copy link
Author

Hi,
We run our own dataset with the initialization code you provided,however, we have encountered some problems.
We have some doubts in the code of clustering. Why is it that sometimes the result of clustering is 4 categories, sometimes less than 4 categories, is our data set not rich enough or another reason?
We are so sorry to bother you again!Look forward to your reply!

@YummyWaffle
Copy link

YummyWaffle commented Jan 29, 2021

The issue is that your initialization model is not compatible with the pretrained model. You can either not load the pretrained model and just use the initialization model, or you can train your model with the train.py script.

I'm sorry to bother you. I meet this problem also. I run initialization code and train from scratch and the size of mix_models seems not right and the score size is [1,11] which should be [1,12]

@AdamKortylewski
Copy link
Owner

I will look at this, but it may take a bit. Thanks

@YummyWaffle
Copy link

I will look at this, but it may take a bit. Thanks

thank you for you beautiful work, looking forward to your reply

@AdamKortylewski
Copy link
Owner

I cannot reproduce this error. Are you training on the pascal3d+ data?

@YummyWaffle
Copy link

I cannot reproduce this error. Are you training on the pascal3d+ data?

I run the initialize code on the dataset provided in 'Download models'.

@AdamKortylewski
Copy link
Owner

Are you computing the similarity matrices yourself? When you learn the mixture models, have you looked at the images that visualize each mixture? Do they look similar as in the papers?

@YummyWaffle
Copy link

yes i compute the similarity matrices myself. do you mean the images in cluster_images_pool5_512? the cluster results are not quite satisfactory.

@AdamKortylewski
Copy link
Owner

Can you try using the similarity matrices we provide for download?

@YummyWaffle
Copy link

YummyWaffle commented Feb 10, 2021

that one can work, but i am trying to use compositional net for different types of dataset, so i'am trying to run this program from the very beginning.

@gspell
Copy link

gspell commented Aug 31, 2021

I have found myself having similar difficulty as @YummyWaffle. To be clear, I have tried to run the three pretraining/initialization scripts in succession -- vMF_clustering.py, comptSimMat.py, Learn_mix_model_vMF_view.py -- for the Pascal3D+ Vehicles dataset that you have kindly put together. After doing this, if I try to train a CompositionalNet from the yielded initialization, it seems that the mixture models initialization does not have the correct size/shape: some categories only have 3 mixtures instead of the M=4 that other categories have. My understanding is that this problem arises during the spectral clustering in Learn_mix_model_vMF_view.py, as the clustering does not yield 4 clusters for each category. It seems that one could try to simply lower the spectral split threshold parameter to force 4 clusters/category, or perhaps there are other factors affecting the number of clusters in the pretraining that I don't fully understand.

Would it be possible for you to tell us what some of the "pretraining parameters" were for obtaining the initialization? The candidates that I mostly see from your provided pretraining code are:
A) number of images per category for vMF clustering (set to 1000 in the provided code)
B) number of images per category for the similarity matrix computation (set to 5000 in the code)
C) The spectral split threshold for mixture model view clustering (set to 0.1 in the code)

I'm afraid that running the pretraining code with the provided settings doesn't quite yield an initialization that allows the training code to run, but I am very interested in your work and would love to ensure that I can replicate it as I try to incorporate CompositionalNets into my own work.

Thanks!
Greg

@AdamKortylewski
Copy link
Owner

Hi Greg,

I have not experienced this issue before, but it seems that you are not the only one experiencing this issue. For what categories does the model only have three mixtures? It could happen during the ML updates (starting line 186 in Learn_mix_model_vMF_view.py) that one of the clusters is not assigned any data. You could try to skip the ML updates and just use the model directly after the spectral clustering?

Best Adam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants