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 demo.py #62

Closed
gitrobin opened this issue Oct 14, 2017 · 10 comments
Closed

Error with demo.py #62

gitrobin opened this issue Oct 14, 2017 · 10 comments

Comments

@gitrobin
Copy link

when I ran python2 tools/demo.py --gpu 0, the following error was encountered.
I1014 13:40:42.606418 19932 net.cpp:1256] blob 159 name det_score data idx 0
I1014 13:40:42.606422 19932 net.cpp:1266] blob 159 name det_score diff idx 2
I1014 13:40:42.606426 19932 net.cpp:1256] blob 160 name pid_prob data idx -1
I1014 13:40:42.606431 19932 net.cpp:1266] blob 160 name pid_prob diff idx -1
I1014 13:40:42.606433 19932 net.cpp:1256] blob 161 name bbox_pred data idx -1
I1014 13:40:42.606437 19932 net.cpp:1266] blob 161 name bbox_pred diff idx -1
I1014 13:40:42.606442 19932 net.cpp:1256] blob 162 name feat_lowdim data idx 0
I1014 13:40:42.606446 19932 net.cpp:1266] blob 162 name feat_lowdim diff idx 0
I1014 13:40:42.606451 19932 net.cpp:1256] blob 163 name feat data idx -1
I1014 13:40:42.606454 19932 net.cpp:1266] blob 163 name feat diff idx -1
I1014 13:40:42.606457 19932 net.cpp:1272] storage memory slot 0 size 3211264
I1014 13:40:42.606462 19932 net.cpp:1272] storage memory slot 1 size 3211264
I1014 13:40:42.606465 19932 net.cpp:1272] storage memory slot 2 size 3211264
I1014 13:40:42.606468 19932 net.cpp:1272] storage memory slot 3 size 8192
I1014 13:40:42.606472 19932 net.cpp:1277] raw memory 304337048 opt memory 10848392
Init end
Traceback (most recent call last):
File "tools/demo.py", line 114, in
main(args)
File "tools/demo.py", line 42, in main
net = caffe.Net(args.probe_def, args.caffemodel, caffe.TEST)
RuntimeError: basic_string::append

please help me solve this problem。Thanks!

@Cysu
Copy link
Collaborator

Cysu commented Oct 14, 2017

That's weird. It seems that you have already compiled the caffe successfully. You may double check about it by running caffe/build/install/bin/caffe. It should print some help messages.

Did you modify anything to the code? Please check git status to see if there are any modified files.

@gitrobin
Copy link
Author

After the errror emerged,I "add printf("Init end\r\n")" in net class construcor in net.cpp to locate the problem.Even I remove this code, the problem remains。
I have run caffe/build/install/bin/caffe, get the following messages:
I1014 19:14:55.204969 20231 common.cpp:56] You are running caffe compiled with MPI support. Now it's running in non-parallel model
caffe: command line brew
usage: caffe

commands:
train train or finetune a model
test score a model
device_query show GPU diagnostic information
time benchmark model execution time

Flags from /root/person_search/caffe/tools/caffe.cpp:
-gpu (Run in GPU mode on given device ID.) type: int32 default: -1
-iterations (The number of iterations to run.) type: int32 default: 50
-model (The model definition protocol buffer text file..) type: string
default: ""
-snapshot (Optional; the snapshot solver state to resume training.)
type: string default: ""
-solver (The solver definition protocol buffer text file.) type: string
default: ""
-weights (Optional; the pretrained weights to initialize finetuning. Cannot
be set simultaneously with snapshot.) type: string default: ""

@Cysu
Copy link
Collaborator

Cysu commented Oct 14, 2017

Are there any Chinese characters in the directory path? I am not sure if they would cause the problem.

@gitrobin
Copy link
Author

No Chinese characters in the directory path. Thefull path is "/root/person_search". The cudnn library version is 5.1.2.
I have installed other version caffe on the system,but they are in different paths. It seems there is something wrong with python.

@Cysu
Copy link
Collaborator

Cysu commented Oct 14, 2017

I suspect it was the c++ code that caused the problem, because basic_string::append is a standard function for c++ string. The corresponding net initialization function is at here. Could you please add some printf functions to help find out where the problem is?

@gitrobin
Copy link
Author

I traced the code. Then I found
bool ReadProtoFromBinaryFile(const char* filename, Message* proto) {
int fd = open(filename, O_RDONLY);
CHECK_NE(fd, -1) << "File not found: " << filename;
ZeroCopyInputStream* raw_input = new FileInputStream(fd);
CodedInputStream* coded_input = new CodedInputStream(raw_input);
printf("code_input begin\r\n");
coded_input->SetTotalBytesLimit(kProtoReadBytesLimit, 536870912);
printf("code_input edn\r\n");
bool success = proto->ParseFromCodedStream(coded_input);
printf("parse end\r\n");
delete coded_input;
delete raw_input;
close(fd);
return success;
}
printf("parse end\r\n") is not run. I think there is something wrong with proto->ParseFromCodedStream(coded_input); But I cannot find the implemenation of ParseFromCodedStream. Maybe the trained model I have downloaded are corrupt.

@Cysu
Copy link
Collaborator

Cysu commented Oct 15, 2017

Could you please check if the md5 of the downloaded output/psdb_train/resnet50/resnet50_iter_50000.caffemodel equals to b696ecb6c11c21e86384fa96f92a14a0?

@gitrobin
Copy link
Author

I checked the md5 of the model ,it is correct. There must be something wrong with proto->ParseFromCodedStream(coded_input);

@gitrobin
Copy link
Author

in function ReadProtoFromBinaryFile, I added "if ( !proto ) printf("proto failed\r\n");". Then demo.py worked correctly. I guess some memory must be corrupt.

@Cysu
Copy link
Collaborator

Cysu commented Oct 15, 2017

Well, that's really weird. I have no idea about why it happened. Maybe the memory is corrupted as you said, or the gcc compiler has some bugs. But glad to know that the demo could work with your hack.

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

2 participants