senlinuc / caffe_ocr

主流ocr算法研究实验性的项目,目前实现了CNN+BLSTM+CTC架构
1.26k stars 535 forks source link

选择哪块显卡运行ocr_test #104

Open HouBiaoLiu opened 5 years ago

HouBiaoLiu commented 5 years ago

我在进行ocr_test测试时,使用第0块显卡;现在我想通过命令行参数传递使用哪块选卡,于是做了如下修改 bool Classifier::Init(const string& model_path, int gpu_id) { const string trained_file = model_path + "/model.caffemodel"; const string model_file = model_path + "/deploy.prototxt"; string mean_file = model_path + "/mean.binaryproto"; const string mean_value_file = model_path + "/mean_values.txt"; const string label_file = model_path + "/label.txt";

if (!CheckFileExist(mean_file.c_str())) mean_file = mean_value_file; if (-1 == gpu_id) { LOG(INFO) << "Use CPU."; Caffe::set_mode(Caffe::CPU); } else { LOG(INFO) << "Use GPU with device ID " << gpu_id; cudaDeviceProp device_prop; cudaGetDeviceProperties(&device_prop, gpu_id); LOG(INFO) << "GPU device name: " << device_prop.name; Caffe::SetDevice(gpu_id); Caffe::set_mode(Caffe::GPU); } 重新编译运行时,选择第3块显卡,结果第0块和第三块显卡一起在跑,请问什么原因啊 但是我跑这种./build/tools/caffe test却是正常的