cdoersch / elementdiscovery

Author's implementation of "Visual Element Discovery as Discriminative Mode Seeking," Doersch, Gupta & Efros, NIPS 2013
http://graphics.cs.cmu.edu/projects/discriminativeModeSeeking/
MIT License
20 stars 5 forks source link

I am getting an error in line number 45 of file 'autoclust_optimize.m' #1

Open praveenkul opened 10 years ago

praveenkul commented 10 years ago

In line number 45 of file 'autoclust_optimize.m' which contains below code [~,candidatepatches]=ismember(mydetrs,prevdets(:,6),'R2012a'); I am getting an Error: MATLAB:ISMEMBER:UnknownFlag

I am using the Matlab version number R2009b. So the flag 'R2012a' is unknown. If I try to remove the flag or use the 'legacy' option, I get the error as 'classperbatch wrong' at line number 47. What would be the alternate line of code to make it work on R2009b.

Thanks Praveen

cdoersch commented 10 years ago

Recent versions of Matlab have changed how ismember works; the second output returned the last index that matched; however, since R2012a, it returns the first. I've been meaning to rewrite the code to not rely on this behavior, but it's a fairly large job since I use ismember a lot.

A simple fix is to replace the line you posted with the following code (which will break the code in R2012a and later):

[~,candidatepatches]=ismember(mydetrs,prevdets(end:-1:1,6));
candidatepatches=size(prevdets,1)-candidatepatches+1;

However, I can't guarantee that nothing else will break when you use R2009b; I think all the times when I rely on R2012a behavior are marked with the R2012a flag, but I've never tested with such an old version of matlab.

praveenkul commented 10 years ago

Thanks for reply I have relaunched the code with the fix you mentioned. I searched in complete directory but I did not find any other place where the flag R2012a is being set. So I hope code will not break with other ismember functions.

cdoersch commented 9 years ago

Hey praveen,

Could you open a new issue for this? It doesn't seem related to the last issue.

It sounds to me like you either don't have the statistics toolbox (the linkage2 function is actually a patched version of the statistics toolbox function, and relies on some of its internal functions), or there's something that's changed with your version of the stats toolbox. If the stats toolbox functions aren't available, you can alter findOverlapping3 to return a trivial clustering (i.e. each element in the same cluster), which will theoretically make the code behave like the 'no inter-element communication' version in the paper.