KaiyangZhou / deep-person-reid

Torchreid: Deep learning person re-identification in PyTorch.
https://kaiyangzhou.github.io/deep-person-reid/
MIT License
4.18k stars 1.13k forks source link

Model Size bigger than expect #362

Open bryanlinnan opened 3 years ago

bryanlinnan commented 3 years ago

Hi Kaiyang, I trained mobilenetv2 which should be about 12M size, but the output model "model.pth.tar-50" is about 40M, is this normal? the output model seems to contain more than just model weights.

KaiyangZhou commented 3 years ago

that's a bit weird

so if you save the pure weights of mobilenetv2, it'd be around 9M

the 12M size might count the oprimizer's and scheduler's states

but anyway, which dataset are you using? I'd be curious if the large weights come from a heavy classification layer (say you have many many IDs)

bryanlinnan commented 3 years ago

my trainset data has 575 class, i think it's not the root cause, i wonder how can i save the pure '.pth' model?

KaiyangZhou commented 3 years ago

what do you mean by how to save the .pth model? isn't it as simple as using torch.save?

bryanlinnan commented 3 years ago

sorry, i thought the model size bigger than expectation is due to the model saved some other things, but it seems nothing else after i checked the code, so the question is still why the model size is such big? 500 classes will cause this?