Closed kazunaritakeichi closed 8 years ago
Hi,
I got the same issue here. I tried to break down the process and found out that it will get error at the third frame.
Do you have any update on this? Thanks.
Hi, @kaiyeh0913
The error was gpu overflow.
I added caffe.reset_all()
in the end of loop.
I don't get the error now.
The reason is that you load a new net for every frame inside applymodel
without releasing GPU memory. @ktak199 's solution works, however the net is still loaded and released multiple times, which is slow.
You can load the net only once by moving some code from applymodel
outside the while loop, and pass the net into the applymodel
function. This should be faster.
Feel free to reopen the issue if this doesn't work.
Hi, @shihenw I tried your solution. The program became faster.
Thank you.
Hi, @shihenw https://github.com/shihenw and @ktak199 https://github.com/ktak199
Thanks for the solution. I’ve worked out this problem with the same solution of yours.
Btw, @shihenw https://github.com/shihenw, as for the python version of the code, do you have a timeline for that? I’m really looking forward to see that. Thanks.
Best, Kai
ktak199 notifications@github.com 於 2016年7月13日 上午7:48 寫道:
Hi, @shihenw https://github.com/shihenw I tried your solution. The program became faster.
Thank you.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/shihenw/convolutional-pose-machines-release/issues/16#issuecomment-232379103, or mute the thread https://github.com/notifications/unsubscribe/AMsQJJBF0RTx7zBT7gVZ821UB7pvPmL_ks5qVPrVgaJpZM4JJcTO.
Hey @shihenw @kaiyeh0913 @ktak199 ! Can you show me what part of the code you moved outside the while loop? I tried only the net initialization part like follows-:
interestPart = 'Lwri'; % to look across stages. check available names in config.m v = VideoReader('sample_image/videos/dance.avi'); test_image = readFrame(v); model = param.model(param.modelID); net = caffe.Net(model.deployFile, model.caffemodel, 'test'); figure(1); imshow(test_image); hold on; title('Drag a bounding box'); rectangle = getrect(1); [heatMaps, prediction] = applyModel(test_image, param, rectangle, net); %% visualize, or extract variable heatMaps & prediction for your use visualize(test_image, heatMaps, prediction, param, rectangle, interestPart); caffe.reset_all();
But I'm getting the following error-:
Error using caffe_ Could not convert handle to pointer due to invalid initkey. The object might have been cleared. Error in caffe.Blob/shape (line 16) shape = caffe('blob_get_shape', self.hBlob_self); Error in caffe.Blob/check_data_size_matches (line 56) self_shape_extended = self.shape; Error in caffe.Blob/check_and_preprocess_data (line 46) self.check_data_size_matches(data); Error in caffe.Blob/set_data (line 26) data = self.check_and_preprocess_data(data); Error in caffe.Net/forward (line 96) self.blobs(self.inputs{n}).set_data(input_data{n}); Error in applyModel>applyDNN (line 107) net.forward(input_data); Error in applyModel (line 60) score(:,m) = applyDNN(imageToTest, net, nstage); Error in CPM_demo (line 46) [heatMaps, prediction] = applyModel(test_image, param, rectangle, net);
Hi, @CNiallDemensha .
You should move net = caffe.Net(model.deployFile, model.caffemodel, 'test')
outside the while loop and remove caffe.reset_all()
.
Thanks @ktak199 for the reply. It works fine now although it takes about 8-10 seconds for each frame. Is this about right since the demo shows it working smoothly on real time webcam feed. I saw other issues opened related to this but they were not answered. Thanks again!
For the speed issue please see #14 and this demo page.
I want to process video instead of image.
I encountered MATLAB system error on a few frame of video. Error is below.
I changed CPM_demo.m like below.
v = VideoReader('sample_image/videos/filename.avi');
while hasFrame(v)
test_image = readFrame(v);
%% core: apply model on the image, to get heat maps and prediction coordinates
figure(1);
imshow(test_image);
hold on;
title('Drag a bounding box');
rectangle = getrect(1);
[heatMaps, prediction] = applyModel(test_image, param, rectangle);
%% visualize, or extract variable heatMaps & prediction for your use
visualize(test_image, heatMaps, prediction, param, rectangle, interestPart);
end
Could you help me? Thank you in advance.