unable to execute python script from another python program

434 views
Skip to first unread message

Niko Gamulin

unread,
Feb 27, 2015, 8:16:24 AM2/27/15
to caffe...@googlegroups.com
Hi,

I have successfully tested the R-CNN example

the execution of the following program works fine and successfully generates det_output.h5 file:

./python/detect.py --crop_mode=selective_search --pretrained_model=models/bvlc_reference_rcnn_ilsvrc13/bvlc_reference_rcnn_ilsvrc13.caffemodel --model_def=models/bvlc_reference_rcnn_ilsvrc13/deploy.prototxt --gpu --raw_scale=255 _temp/det_input.txt _temp/det_output.h5

As I would like to automate some procedure, I have created own python script which is supposed to automate the whole procedure described in the example (first execute the above command and then observe the results in python). In order to do that, I have tried to add the following subprocess call into custom python script:


cmdShell = './python/detect.py --crop_mode=selective_search --pretrained_model=models/bvlc_reference_rcnn_ilsvrc13/bvlc_reference_rcnn_ilsvrc13.caffemodel --model_def=models/bvlc_reference_rcnn_ilsvrc13/deploy.prototxt --gpu --raw_scale=255 %s/det_input.txt %s/det_output.h5' % (dataFolder, dataFolder)
return_code
= subprocess.call(cmdShell, shell=True)

The execution unfortunately fails with the following error:
ImportError: No module named selective_search_ijcv_with_python
The execution fails at detector.py, line 113:
import selective_search_ijcv_with_python as selective_search
I have added the following line to ~/.bashrc:
export PYTHONPATH=$PYTHONPATH:/usr/local/caffe/selective_search_ijcv_with_python/
Does anyone know why the module cannot be imported when the command is executed from other python script whereas it can successfully be executed from console?
I would appreciate if anyone could help to solve this issue.

Thank you and best regards,
Niko

Niko Gamulin

unread,
Feb 27, 2015, 5:05:27 PM2/27/15
to caffe...@googlegroups.com
Actually the above python script works fine if executed from console. The problem is present when the script is launched from Eclipse because th Eclipse PYTHONPATH overwrites the system PYTHONPATH.

linzertling

unread,
Jun 22, 2015, 6:34:39 AM6/22/15
to caffe...@googlegroups.com
Hi,
  I cannot operate the experiment,can you tell me how to do to test the rcnn successfully?

在 2015年2月27日星期五 UTC+8下午9:16:24,Niko Gamulin写道:
Reply all
Reply to author
Forward
0 new messages