VisualComputingInstitute / triplet-reid

Code for reproducing the results of our "In Defense of the Triplet Loss for Person Re-Identification" paper.
https://arxiv.org/abs/1703.07737
MIT License
764 stars 216 forks source link

Add freezing functionality #57

Closed arcelien closed 6 years ago

arcelien commented 6 years ago

Hey! I needed to get a frozen version of the pretrained model, so I wrote some code that names the output embedding and freezes the model. Also included a small example of loading the model and a quick speed benchmark.

This seems like pretty generic functionality that others might find useful? Tried to follow the same structure as the original code. Thanks :)

lucasb-eyer commented 6 years ago

Hi, that's a pretty nice contribution, thank you!

I haven't tested it myself, but it looks like it shouldn't break any of the existing code, so I'm merging and knocking on wood ;-)

zhiweige commented 5 years ago

@arcelien hi, I use the code of freeze.py, when I run the code, there is error "AssertionError: head/emb is not in graph". Have you met this error? I printed the name of the nodes, the format of the node looked like "u'emb/biases', u'emb/biases/Assign', u'emb/biases/read', u'head/emb/MatMul', u'head/emb/BiasAdd', u'save/Const'". Thanks.

arcelien commented 5 years ago

I haven't run this code in a while, but freeze.py only queries head/out_emb, not head/emb. The names were added in the construction of the tf graph, so you could try renaming it if it's not working.

zhiweige commented 5 years ago

OK. thanks ^^