rbgirshick / rcnn

R-CNN: Regions with Convolutional Neural Network Features
BSD 2-Clause "Simplified" License
2.38k stars 979 forks source link

MATLAB compatibility #9

Open Felix-neko opened 10 years ago

Felix-neko commented 10 years ago

I could run RCNN demo only on Matlab R2012b. Matlab 2013a failed with the following error:

Invalid MEX-file '/home/felix/Projects/rcnn/external/caffe/matlab/caffe/caffe.mexa64': /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0: undefined symbol:

FT_Face_GetCharVariantIndex

And even with Matlab R2012b I had to change its simlink for libstdc++ to my default system one to make the demo run.

rbgirshick commented 10 years ago

I haven't been able to reproduce this error on my ubuntu 12.04 system. Has anyone else?

Felix-neko commented 10 years ago

I had Ubuntu 14.04

wuqiangch commented 10 years ago

@Felix-neko . Did you do this? Common issues: You may need to set an LD_LIBRARY_PATH before you start MATLAB. If you see a message like "Invalid MEX-file '/path/to/rcnn/external/caffe/matlab/caffe/caffe.mexa64': libmkl_rt.so: cannot open shared object file: No such file or directory" then make sure that CUDA and MKL are in your LD_LIBRARY_PATH. On my system, I use: export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64:/usr/local/cuda/lib64

wuqiangch commented 10 years ago

I have a problem .when I ran rcnn_demo('ILSVRC13',0),

Welcome to the ILSVRC13 demo
Running in CPU mode
(To run in GPU mode, call rcnn_demo(demo_choice, 1) instead)
Press any key to continue
Initializing R-CNN model (this might take a little while)
Warning: Could not find appropriate function on path loading function
handle
/home/rbg/working/rcnn-ilsvrc/imdb/imdb_from_ilsvrc13.m>@(i)fullfile(imdb.image_dir,[imdb.image_ids{i},'.',imdb.extension]) 
-------------------------------------------------------------------------------------------------
 when but I ran rcnn_demo('PASCAL',0), It's OK.But when I got the line 
% forward propagate batch of region images 
  f = caffe('forward', batches(j));
,the matlab would crash without information.
rbgirshick commented 10 years ago

Warning: Could not find appropriate function on path loading function handle /home/rbg/working/rcnn-ilsvrc/imdb/imdb_from_ilsvrc13.m>@(i)fullfile(imdb.image_dir,[imdb.image_ids{i},'.',imdb.extension])

That warning is safe to ignore.

On Wed, Jul 16, 2014 at 11:31 PM, wuqiangch notifications@github.com wrote:

@Felix-neko https://github.com/Felix-neko ,@rbgirshick https://github.com/rbgirshick I have the error ,yet. I run the rcnn_demo on MATLAB2013a. I had I had Ubuntu 13.04. I also have another error. when I run rcnn_demo('ILSVRC13',0),the Warning is below.But I run rcnn_demo('PASCAL',0),the warning would't happened. What's wrong?

Welcome to the ILSVRC13 demo Running in CPU mode (To run in GPU mode, call rcnn_demo(demo_choice, 1) instead) Press any key to continue Initializing R-CNN model (this might take a little while) Warning: Could not find appropriate function on path loading function handle /home/rbg/working/rcnn-ilsvrc/imdb/imdb_from_ilsvrc13.m>@(i)fullfile(imdb.image_dir,[imdb.image_ids{i},'.',imdb.extension])

— Reply to this email directly or view it on GitHub https://github.com/rbgirshick/rcnn/issues/9#issuecomment-49263420.

http://www.cs.berkeley.edu/~rbg/

rbgirshick commented 10 years ago

when but I ran rcnn_demo('PASCAL',0), It's OK.But when I got the line % forward propagate batch of region images f = caffe('forward', batches(j)); ,the matlab would crash without information.

Matlab always dumps information when it crashes, but that information may be going to a console that you're not seeing. Try running matlab from the terminal. Follow your steps to reproduce this issue and then paste the information output in the terminal when matlab crashes.

http://www.cs.berkeley.edu/~rbg/

peerajak commented 9 years ago

I have similar problem. I try 2.4.10 but not work.

matcaffe_demo Invalid MEX-file '/home/Feature/caffe-master/matlab/caffe/caffe.mexa64': /usr/local/lib/libopencv_highgui.so.2.4: undefined symbol: _ZNK9QCheckBox15minimumSizeHintEv Error in matcaffe_init (line 19) if caffe('is_initialized') == 0 Error in matcaffe_demo (line 53) matcaffe_init();

I checked my LD_LIBRARY_PATH already set. getenv('LD_LIBRARY_PATH') ans = /usr/local/MATLAB/R2012b/sys/os/glnxa64:/usr/local/MATLAB/R2012b/bin/glnxa64:/usr/local/MATLAB/R2012b/extern/lib/glnxa64:/usr/local/MATLAB/R2012b/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/R2012b/sys/java/jre/glnxa64/jre/lib/amd64/server:/usr/local/MATLAB/R2012b/sys/java/jre/glnxa64/jre/lib/amd64:/usr/local/lib:/usr/local/cuda-6.5/lib:/usr/local/cuda-6.5/targets/x86_64-linux/lib:/usr/local/cuda/cudnn:/usr/lib/x86_64-linux-gnu:/usr/local/MATLAB/R2012b/bin/glnxa64

Please help.

peerajak commented 9 years ago

I can run Caffe matlab_demo now. Here is what I did.

After Install Caffe http://caffe.berkeleyvision.org/ on my Linux Machine Linux Mint based on Ubuntu 14.04

I am trying to use matlab interface mex file. Here is what I got

>>matcaffe_demo

Invalid MEX-file
'/home/Feature/caffe-master/matlab/caffe/caffe.mexa64':
/usr/local/lib/libopencv_highgui.so.2.4: undefined symbol:
_ZNK9QCheckBox15minimumSizeHintEv
Error in matcaffe_init (line 19)
if caffe('is_initialized') == 0
Error in matcaffe_demo (line 53)
matcaffe_init();

What I did to solve this problem was to check ldd between matlab and linux in Linux Command Line

ldd matlab/caffe/caffe.mexa64

on Matlab

!ldd matlab/caffe/caffe.mexa64

There are many library of which when running mex file in Matlab points to matlab provided libraries (via symbolic links) instead of native library. so I change all of that by

ln -s   <lib.so name in native> <symbolic link lib.so name found on Matlab>

If the destination symbolic links are already exist, one must delete them before ln.

For example, two of those symbolic links are qtGui.so and qtCore.so. One may just

 sudo rm /usr/local/MATLAB/R2012b/bin/glnxa64/libQtGui.so.4
 sudo ln -s /usr/lib/x86_64-linux-gnu/libQtGui.so.4 /usr/local/MATLAB/R2012b/bin/glnxa64/libQtGui.so.4
 sudo rm  /usr/local/MATLAB/R2012b/bin/glnxa64/libQtCore.so.4
sudo ln -s /usr/lib/x86_64-linux-gnu/libQtCore.so.4  /usr/local/MATLAB/R2012b/bin/glnxa64/libQtCore.so.4

The way around this is to launch matlab with

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libQtCore.so:/usr/lib/x86_64-linux-gnu/libQtGui.so matlab
TorosFanny commented 9 years ago

I got a easier way to resolve this issue:

When running the code, if you get an error saying: /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0: undefined symbol: FT_Face_GetCharVariantIndex, try adding /usr/lib/x86_64-linux- gnu/libfreetype.so.6(or the equivalent library that your system may have) to the LD_PRELOAD environment variable before starting MATLAB.

Copied from https://github.com/bharath272/sds_eccv2014

dangkhoasdc commented 8 years ago

@TorosFanny thank you for your comment, It really help me solve the problem.

chenxinhua commented 7 years ago

matlab crashed after execute rcnn_demo,my matlab version is 2014a,in centos7.