We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hy guys I'm doing a prediction with code of https://gist.github.com/onauparc/dd80907401b26b602885
this a code:
int main(int argc, char** argv) { // Set GPU Caffe::set_mode(Caffe::GPU); int device_id = 0; Caffe::SetDevice(device_id); LOG(INFO) << "Using GPU";
// Load net Net net("/home/antonio/Models/Multipie/alexnet_test.prototxt", caffe::TEST);//<-- depends on caffe version
// Load pre-trained net net.CopyTrainedLayersFrom("/home/antonio/Models/Multipie/caffenet_train_iter_120000.caffemodel"); // Load image cv::Mat image = cv::imread("/home/antonio/multipie/test_complete/90_346_653212.png"); // or cat.jpg
// Set vector for image vectorcv::Mat imageVector; imageVector.push_back(image); // image is a cv::Mat, as I'm using #1416 //push_back()
// Set vector for label vector labelVector; labelVector.push_back(0);//push_back 0 for initialize purpose
// Net initialization float loss = 0.0;
shared_ptr<MemoryDataLayer > memory_data_layer;
memory_data_layer = boost::static_pointer_cast<MemoryDataLayer >(net.layer_by_name("data_n"));
memory_data_layer->AddMatVector(imageVector,labelVector);
// Run ForwardPrefilled vector<Blob*> results = net.ForwardPrefilled(&loss);
// Display result const shared_ptr<Blob >& probs = net.blob_by_name("prob"); const float* probs_out = probs->cpu_data();
for (int i = 0 ; i < 3 ; i++) { LOG(INFO) << "Prob" << i << ": " << probs_out[i]; }
LOG(INFO) << "Max element is: " << *max_element(probs_out,probs_out+3);
// Display result2 const float* argmaxs = results[1]->cpu_data();
for (int i = 0; i < results[1]->num(); i++) { for (int j = 0; j < results[1]->height(); j++) { LOG(INFO) << "Image: "<< i << " class:" << argmaxs[i*results[1]->height() + j]; } } return 0; }
and compile ok, but this is a resul when I run this code:
W0620 21:25:47.396652 30355 memory_data_layer.cpp:88] MemoryData does not transform array data on Reset() I0620 21:25:47.403425 30355 test_model.cpp:66] Prob0: 6.28324e-31 I0620 21:25:47.403463 30355 test_model.cpp:66] Prob1: 7.08585e-28 I0620 21:25:47.403467 30355 test_model.cpp:66] Prob2: 1.03385e-23 I0620 21:25:47.403471 30355 test_model.cpp:69] Max element is: 1.03385e-23 I0620 21:25:47.403475 30355 test_model.cpp:78] Image: 0 class:0
This is strange because my accuracy stay between 92% and 97%, and image and class is alway 0
Any Idea?
thanks.
The text was updated successfully, but these errors were encountered:
Thanks for sharing the problem. However, this tracker is for issues and bugs with Caffe. Please ask usage questions on the caffe-users list. https://groups.google.com/forum/#!forum/caffe-users
Sorry, something went wrong.
No branches or pull requests
Hy guys I'm doing a prediction with code of https://gist.github.com/onauparc/dd80907401b26b602885
this a code:
int main(int argc, char** argv)
{
// Set GPU
Caffe::set_mode(Caffe::GPU);
int device_id = 0;
Caffe::SetDevice(device_id);
LOG(INFO) << "Using GPU";
// Load net
Net net("/home/antonio/Models/Multipie/alexnet_test.prototxt", caffe::TEST);//<-- depends on caffe version
// Load pre-trained net
net.CopyTrainedLayersFrom("/home/antonio/Models/Multipie/caffenet_train_iter_120000.caffemodel");
// Load image
cv::Mat image = cv::imread("/home/antonio/multipie/test_complete/90_346_653212.png"); // or cat.jpg
// Set vector for image
vectorcv::Mat imageVector;
imageVector.push_back(image); // image is a cv::Mat, as I'm using #1416 //push_back()
// Set vector for label
vector labelVector;
labelVector.push_back(0);//push_back 0 for initialize purpose
// Net initialization
float loss = 0.0;
shared_ptr<MemoryDataLayer > memory_data_layer;
memory_data_layer = boost::static_pointer_cast<MemoryDataLayer >(net.layer_by_name("data_n"));
memory_data_layer->AddMatVector(imageVector,labelVector);
// Run ForwardPrefilled
vector<Blob*> results = net.ForwardPrefilled(&loss);
// Display result
const shared_ptr<Blob >& probs = net.blob_by_name("prob");
const float* probs_out = probs->cpu_data();
for (int i = 0 ; i < 3 ; i++)
{
LOG(INFO) << "Prob" << i << ": " << probs_out[i];
}
LOG(INFO) << "Max element is: " << *max_element(probs_out,probs_out+3);
// Display result2
const float* argmaxs = results[1]->cpu_data();
for (int i = 0; i < results[1]->num(); i++)
{
for (int j = 0; j < results[1]->height(); j++)
{
LOG(INFO) << "Image: "<< i << " class:" << argmaxs[i*results[1]->height() + j];
}
}
return 0;
}
and compile ok, but this is a resul when I run this code:
W0620 21:25:47.396652 30355 memory_data_layer.cpp:88] MemoryData does not transform array data on Reset()
I0620 21:25:47.403425 30355 test_model.cpp:66] Prob0: 6.28324e-31
I0620 21:25:47.403463 30355 test_model.cpp:66] Prob1: 7.08585e-28
I0620 21:25:47.403467 30355 test_model.cpp:66] Prob2: 1.03385e-23
I0620 21:25:47.403471 30355 test_model.cpp:69] Max element is: 1.03385e-23
I0620 21:25:47.403475 30355 test_model.cpp:78] Image: 0 class:0
This is strange because my accuracy stay between 92% and 97%, and image and class is alway 0
Any Idea?
thanks.
The text was updated successfully, but these errors were encountered: