omoindrot / tensorflow-triplet-loss

Implementation of triplet loss in TensorFlow
https://omoindrot.github.io/triplet-loss
MIT License
1.12k stars 284 forks source link

Utilize mobilenet v2 #36

Closed batrlatom closed 5 years ago

batrlatom commented 5 years ago

Hello, this is more question than a problem. I would like to utilize mobilenet v2 with pretrained weights to use features learned by this great model and also to have small footprint since I would like to use it on mobile phone. Is it possible?

I tried to use mobilenet v2 with your code, but I am unable to make it work for now.

batrlatom commented 5 years ago

I solved it with this code:


def build_model(is_training, images, params):
    import tensorflow_hub as hub
    module = hub.Module(params.network_url)
    #features = {'images': tf.placeholder(tf.float32, [None, 224, 224, 3], name="images")}

    tf_model = module(images)
    with tf.variable_scope('fc_1'):
        tf_model = tf.layers.dense(tf_model, params.embedding_size)
    return tf_model
austin8081 commented 4 years ago

Hello. I tried to use mobilenet v2 with triplet lose code, But I do n’t know how to modify. what I need to do? Thank you.