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

Error with evaluation of Market1501 matlab code using feat_query.mat and feat_test.mat #86

Open
scrantonstranglerr opened this issue Jan 4, 2021 · 0 comments

Comments

@scrantonstranglerr
Copy link

I got a matrix dimmension error when I try to evaluate the performance of the model.
How can I solve it? What should be the size of the dist ?

I used the following code for the evaluation of market1501 : https://codeload.github.com/HejaBVB09/Market1501Evaluation/zip/master
A repository for that code: https://github.com/DemacianPrince/Market1501Evaluation

My feat_query mat has size 18732128 and feat_test. has size 3368128

Error:

Error using  * 
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches
the number of rows in the second matrix. To perform elementwise multiplication, use '.*'.

Error in sqdist (line 22)
  m = repmat(qmag, pn, 1) + repmat(pmag', 1, qn) - 2*p'*q;

Error in market_evaluation (line 91)
dist = sqdist(Hist_test, Hist_query); % distance calculate with single query. Note that Euclidean distance is
equivalent to cosine distance if vectors are l2-normalized

I tried to take the transpose of the matrixes to solve it but it didn't work.

The sqdist function does the following:

`function m = sqdist(p, q, A)
% SQDIST      Squared Euclidean or Mahalanobis distance.
% SQDIST(p,q)   returns m(i,j) = (p(:,i) - q(:,j))'*(p(:,i) - q(:,j)).
% SQDIST(p,q,A) returns m(i,j) = (p(:,i) - q(:,j))'*A*(p(:,i) - q(:,j)).
% The Lightspeed Matlab toolbox
% Written by Tom Minka

[d, pn] = size(p);
[d, qn] = size(q);

if pn == 0 || qn == 0
  m = zeros(pn,qn);
  return
end

if nargin == 2
  
  pmag = col_sum(p .* p);
  qmag = col_sum(q .* q);
  

  m = repmat(qmag, pn, 1) + repmat(pmag', 1, qn) - 2*p'*q; 
% m = ones(pn,1)*qmag + pmag'*ones(1,qn) - 2*p'*q;
  
else

  Ap = A*p;
  Aq = A*q;
  pmag = col_sum(p .* Ap);
  qmag = col_sum(q .* Aq);
  m = repmat(qmag, pn, 1) + repmat(pmag', 1, qn) - 2*p'*Aq;
  
end

`
Anything helps, thank you

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

1 participant