We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
main.py
origin code : for i in range(H * W): # cov[:, :, i] = LedoitWolf().fit(embedding_vectors[:, :, i].numpy()).covariance_ cov[:, :, i] = np.cov(embedding_vectors[:, :, i].numpy(), rowvar=False) + 0.01 * I # save learned distribution train_outputs = [mean, cov]
change to : for i in range(H * W): # cov[:, :, i] = LedoitWolf().fit(embedding_vectors[:, :, i].numpy()).covariance_ cov[:, :, i] = np.cov(embedding_vectors[:, :, i].numpy(), rowvar=False) + 0.01 * I # save learned distribution conv_inv = np.linalg.inv(cov.T).T train_outputs = [mean, cov, conv_inv]
how to using :
dist_list = [] for i in range(H * W): mean = train_outputs[0][:, i] #conv_inv = np.linalg.inv(train_outputs[1][:, :, i]) dist = [mahalanobis(sample[:, i], mean, train_outputs[2][:, :, i]) for sample in embedding_vectors] dist_list.append(dist)
in my opinion
The text was updated successfully, but these errors were encountered:
you do not need to save cov as well
//save only train_outputs = [mean, conv_inv]
Sorry, something went wrong.
No branches or pull requests
main.py
origin code :
for i in range(H * W):
# cov[:, :, i] = LedoitWolf().fit(embedding_vectors[:, :, i].numpy()).covariance_
cov[:, :, i] = np.cov(embedding_vectors[:, :, i].numpy(), rowvar=False) + 0.01 * I
# save learned distribution
train_outputs = [mean, cov]
change to :
for i in range(H * W):
# cov[:, :, i] = LedoitWolf().fit(embedding_vectors[:, :, i].numpy()).covariance_
cov[:, :, i] = np.cov(embedding_vectors[:, :, i].numpy(), rowvar=False) + 0.01 * I
# save learned distribution
conv_inv = np.linalg.inv(cov.T).T
train_outputs = [mean, cov, conv_inv]
how to using :
dist_list = []
for i in range(H * W):
mean = train_outputs[0][:, i]
#conv_inv = np.linalg.inv(train_outputs[1][:, :, i])
dist = [mahalanobis(sample[:, i], mean, train_outputs[2][:, :, i]) for sample in embedding_vectors]
dist_list.append(dist)
in my opinion
The text was updated successfully, but these errors were encountered: