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

Dropout Rate #2

Open
Neltherion opened this issue Jun 20, 2018 · 2 comments
Open

Dropout Rate #2

Neltherion opened this issue Jun 20, 2018 · 2 comments

Comments

@Neltherion
Copy link

Neltherion commented Jun 20, 2018

Hi

Thanks for this Simple and Clean implementation.

I have a question about the Dropout Rate: What is its use? I didn't see something like this in the original implementation (at least I think I didn't see such parameter).

When I change it from 0.5 to 0.1 and then to 0.01 the predictions become more accurate.
I'm not sure what value I should choose for it.

Here's my Code:

model = base_server.BaseServer(model_fp=configs.face_describer_model_fp,
                               input_tensor_names=configs.face_describer_input_tensor_names,
                               output_tensor_names=configs.face_describer_output_tensor_names,
                               device=configs.face_describer_device)

# Define input tensors feed to session graph
dropout_rate = 0.1

first_image = cv2.imread('./Images/1.jpg')
first_image = cv2.resize(first_image, (112, 112))
input_data = [np.expand_dims(first_image, axis=0), dropout_rate]
face_descriptor1 = model.inference(data=input_data)
embedding1 = preprocessing.normalize(face_descriptor1[0])

second_image = cv2.imread('./Images/4.jpg')
second_image = cv2.resize(second_image, (112, 112))
input_data = [np.expand_dims(second_image, axis=0), dropout_rate]
face_descriptor2 = model.inference(data=input_data)
embedding2 = preprocessing.normalize(face_descriptor2[0])

dist = np.sum(np.square(embedding1 - embedding2))
print("Distance => %s" % dist)

sim = np.dot(embedding1, embedding2.T)
print("Similarity => %s" % sim)

Thanks

@KleinYuan
Copy link
Contributor

  1. It's in the graph and I found this while freeze the model, check this out

  2. Currently, I got the inference model from this repo and if you see the link there, they put droupout_rate as a tf placeholder, which means you need to provide the value necessarily.

--> To your question, the value could be 1.0

@yippeesoft
Copy link

test_img = cv2.imread('tests/test.jpg')
test_img2 = cv2.imread('tests/obama.jpg')

Similarity => [[0.9402864]]

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

3 participants