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 in esvm_compile #56

Open
CoolNaCl opened this issue Feb 22, 2012 · 10 comments
Open

error in esvm_compile #56

CoolNaCl opened this issue Feb 22, 2012 · 10 comments

Comments

@CoolNaCl
Copy link

I have downloaded the most recent code from the git, I use linux(ubuntu11.10) and Matlab2010b, and have finished mex -setup.
I read Readme in exemplarsvm folder and in libsvm folder, and I set the Matlab path in Makefile in libsvm folder.
but when I run esvm_compile in Matlab, it didn't work. The errors follow.

In file included from svm_model_matlab.c:3:0:
svm.h:49:1: 错误: expected identifier or ‘(’ before ‘/’ token
svm.h:97:1: 错误: expected identifier or ‘(’ before ‘/’ token
svm_model_matlab.c: 在函数‘model_to_matlab_structure’中:
svm_model_matlab.c:37:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:40:16: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:41:16: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:42:16: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:43:16: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:44:16: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:47:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:50:16: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:53:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:56:16: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:59:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:64:17: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:67:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:79:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:91:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:103:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:115:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:118:22: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:119:23: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:120:17: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:120:33: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:123:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c: 在函数‘matlab_matrix_to_model’中:
svm_model_matlab.c:216:10: 错误: ‘sizeof’不能用于不完全的类型‘struct svm_model’
svm_model_matlab.c:217:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:218:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:219:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:220:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:221:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:222:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:222:22: 错误: expected expression before ‘/’ token
svm_model_matlab.c:225:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:226:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:227:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:228:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:229:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:233:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:237:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:240:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:242:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:245:8: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:248:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:258:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:268:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:278:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:288:2: 错误: expected expression before ‘/’ token
svm_model_matlab.c:290:7: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:290:43: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:291:21: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:292:8: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:292:46: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:293:22: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:294:23: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:295:9: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:295:39: 错误: 提领指向不完全类型的指针
svm_model_matlab.c:298:2: 错误: expected expression before ‘/’ token
mex: compile of ' "svm_model_matlab.c"' failed.
??? Error using ==> mex at 208
Unable to complete successfully.
Error in ==> libsvm_compile at 4
mex -largeArrayDims -O -c svm_model_matlab.c
Error in ==> esvm_compile at 24
libsvm_compile

How can I fix it?
Thank you!
Liang Yan

@quantombone
Copy link
Owner

Hi Liang,

Sorry I haven't been able to get to you sooner, but lots of us vision hackers are busy with tomorrow's ECCV submission deadline. I suspect that this compilation issue is related to something in the Makefile. I would recommend trying to get a fresh install of libsvm and trying to compile that. If you are having an issue compiling libsvm, then whatever you do to fix that problem you should be able to incorporate into the exemplarsvm libsvm subfolder.

Let me know if you are still having problems, and I can look into this once the ECCV deadline is over.
--Tomasz

@CoolNaCl
Copy link
Author

Hi Tomasz,
I have fix it by replace "/" to "/" and "/", then everything ok.
In this days, I train and evaluate my own Ensemble, and effect is very goog! Thank you for opening this code!
Now, I want to run it in video, and the Readme in Video folder is so simple that I can't know how to run it in video.
I just run: bgg=get_movie_bg('/home/ly/Documents/movie/AVSS_AB_Easy_Divx.avi')
and error:
Attempted to access commas(1); index out
of bounds because numel(commas)=0.

Error in ==> get_movie_bg at 25
commas = commas(1);
I have set the path of ffmpeg, and I run a single-step debug, I find that the code :[tmp,lenstring] = unix(instring); in my computer is
[tmp,lenstring] = unix('/usr/bin/ffmpeg -i "/home/ly/Documents/movie/AVSS_AB_Easy_Divx.avi" 2>&1 | grep Duration')
the return value is tmp = 1 lenstring = '' , lenstring is Empty. Is thar right?
And when I jues run"/usr/bin/ffmpeg -i "/home/ly/Documents/movie/AVSS_AB_Easy_Divx.avi" 2>&1 | grep Duration" in terminal, the result is " Duration: 00:03:38.96, start: 0.000000, bitrate: 4005 kb/s".
This error has blocked me 5 days, I really need your help!
Thank you!
Liang Yan

@quantombone
Copy link
Owner

Hi Liang,

I'm glad you got libsvm compiled. I ran into the same exact error when I had to use libsvm for some experiment just a couple of days ago. It ends up that linux complains about c++ style comments in c files. I added the gcc flag to the libsvm_compile.m script as follows:

mex CFLAGS="$CFLAGS -std=c99" -largeArrayDims -O -c svm.cpp

Regarding videos, you should be able to call get_movie_bg and it should work. What sometimes happens in that on different machines and on different videos, ffmpeg returns slightly different output. I parse those strings inside matlab to get the duration of the video, but then each time you call convert_to_I(bg{i}), it will call ffmpeg to extract that frame. This method is nice because you don't have to extract all of the frames beforehand, but if you're going to be doing lots of work with the video, it is faster to extract the frames from the video, and then do the following

fg = list_files_in_directory('~/directory_of_images','images');
I = convert_to_I(fg{i});

You seem to be debugging correctly, lenstring should not be empty and the Matlab call to unix should output the same thing as on the command line.

@CoolNaCl
Copy link
Author

Hi Tomasz
Thank you so much for your help, I have finish the call of ffmpeg in matlab, it needs to:
ln -s /usr/lib/libraw1394.so.11.01 /usr/local/MATLAB/R2010b/sys/os/glnx86/libraw1394.so.8
I can run get_movie_bg successfully, and return bg, a 200*1 cell,
result:
bg =

[function_handle]
[function_handle]
[function_handle]
[function_handle]
[function_handle]
[function_handle]
[function_handle]
[function_handle]

............................
[function_handle]
each is @()(get_movie_frame(mname,get_movie_string(chunks(i))))
Is that right? If I want to detect bus in a vedio, what should I do first? and after? ......
Liang Yan

@CoolNaCl
Copy link
Author

And when I run get_movie_frame('/home/ly/Documents/movie/AVSS_AB_Easy_Divx.avi',00:00:00), and debug in step.
In line 13: [tmp,randstring]=unix(sprintf('md5 -qs %s',randstring));
I don't find the command 'md5 -qs' in both matlab and linux, this confuse me so much....
Thank you for your help.

@quantombone
Copy link
Owner

Hi Liang,

When dealing with a video, you will get a cell array of function handles, so when you call "I=convert_to_I(bg{i})", it will call ffmpeg on the fly. md5 is just a tool to get a unique string given some data, you can do the randomization step another way or just install md5 on your system.

Remember that it is actually faster to extract all frames from a video using ffmpeg first, then doing the experiments. The video frame reading code lets you quickly experiment with videos, but is not as efficient because it calls ffmpeg on the fly.

--Tomasz

@ZZUO1
Copy link

ZZUO1 commented Jun 4, 2012

Hi Tomasz,

Do you have a version of this code which works on Windows? As I'm not able to compile the c files in this code to mex files in my current Windows OS.

How can I fix it?
Thank you!

-- Zhen

@quantombone
Copy link
Owner

Hi Zhen,

I unfortunately don't even have access to a Windows machine. I know there have been some requests for a windows version, but none of the researchers I'm around use this OS. I'm not sure what the difficulty in compiling the C file is, but without a windows installation nearby I cannot help much.

--Tomasz

@bjorgvino
Copy link

I got the code to compile on Windows 7 64 bit with a few modifications. Unfortunately pthreads aren't fully supported on Win64 so I've disabled threading in features/fconvblas.cc. Also, bzero is not supported in Visual C++ so I've used memset instead. Visual C++ doesn't seem to have the round() function so I've added one where needed. And finally, when compiling libsvm in MATLAB on Windows the object files have a .obj extension and not .o so the libsvm_compile.m script had to be modified.

Note: I've not done any tests on the correctness of these changes, but they do pass all the tests from test_compiled() in esvm_compile.m. Also, removing the threading from features/fconvblas.cc impacts the speed and scalability of the code.

The fork can be found here: https://github.com/bjorgvino/exemplarsvm-win64

@quantombone
Copy link
Owner

Thanks a lot for looking into this!

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

4 participants