C++ little errors , Big problem

简介: ------------------------------------------------------------------------------------------------------------------------------------------------------...

------------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------------

Q1. compile caffe .cpp file ,   come out an error :

d302@d302-MS-7816-04:~/wangxiao/spl-caffe-master$ make -j8
NVCC src/caffe/layers/euclidean_loss_layer.cu
src/caffe/layers/euclidean_loss_layer.cu(43): error: a value of type "const float *" cannot be used to initialize an entity of type "float *"
          detected during instantiation of "void caffe::EuclideanLossLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype> *, std::allocator<caffe::Blob<Dtype> *>> &, const std::vector<__nv_bool, std::allocator<__nv_bool>> &, const std::vector<caffe::Blob<Dtype> *, std::allocator<caffe::Blob<Dtype> *>> &) [with Dtype=float]"
(105): here

the original code is :

 

 1             Dtype* diff_cpu_data = bottom[i]->mutable_cpu_diff();
 2       const Dtype* label_data = bottom[1]->cpu_data();    // label data: 0 or 1
 3       const Dtype* predict_data = bottom[0]->cpu_data();  // predict data
 4        
 5       int spl_num = 0;
 6       int al_num = 0;
 7 
 8       for(int id = 0; id < bottom[i]->count(); ++id) {    // 35*12=420 
 9         
10         // Self Paced Learning 
11         if (label_data[id]==0){  
12           // negative samples ... do nothing 
13         }
14         else{
15           if(predict_data[id]>0.7 && label_data[id]==1 ) {
16               spl_num ++ ;
17             // if the condition is met,  transmit the gradient  
18             // else  make the gradient equal to zero...
19           } 
20           else {
21             diff_cpu_data[id] = 0;
22             // bottom[i]->mutable_cpu_diff()[id] = 0;
23           }
24         }
25 
26 
27         // Active Learning 
28         if (0.4 < predict_data[id] && predict_data[id] < 0.5){
29            
30           if (label_data[id] == 1){
31 
32             predict_data[id] = 1 ;
33           }else
34           if (label_data[id] == 0){
35             predict_data[id] = 0 ;
36           }
37 
38           al_num++;
39           
40         }

 

 

 

 

Solution 1: No solution, because the char* can not give to const char*, and the value of const char* can not be changed .  and in my problem, we don't need change the predict score at all.

 

------------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------------

Q2. when trained a AlexNet caffe model, and use the Matlab Interface to extract Features or predicted Scores , However it tell me errors like the following :

d302@d302-MS-7816-04:~$ matlab
libprotobuf ERROR google/protobuf/text_format.cc:172] Error parsing text-format caffe.NetParameter: 339:2: Expected identifier.
WARNING: Logging before InitGoogleLogging() is written to STDERR
F0116 15:34:34.112346 25564 upgrade_proto.cpp:928] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: ../../models/bvlc_alexnet/alex_hat_deploy.prototxt
*** Check failure stack trace: ***
Killed


Solution 2: layer 6 was repaired when I train my model , i.e.

layer {
  name: "fc6_wx"
  type: "InnerProduct"
  bottom: "pool5"
  top: "fc6_wx"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 0.1
    }
  }
}

change the name: "fc6_wx"  into name: "fc6", and it will be OK .

------------------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------------------

 

相关文章
|
6月前
|
人工智能
Big Water Problem
Big Water Problem
37 0
Performance problem during saving - activating big form
Performance problem during saving - activating big form
|
传感器 关系型数据库 PostgreSQL
Real-time Monitoring and Alerts for Senior Citizens - Big Data for Healthcare
This article discusses Alibaba Cloud PostgreSQL best practices for healthcare applications. In particular, we will explore how Big Data can be applied.
2504 0
Real-time Monitoring and Alerts for Senior Citizens - Big Data for Healthcare
|
程序员 PHP 区块链
Error: the tx doesn't have the correct nonce.TestRPC/Ganache无法获取nonce
做一个truffle相关的项目,每次尝试创建交易时,总会有以下的一个错误提示: the tx doesn’t have the correct nonce 完整的一般是这样: Error: the tx doesn't have the correct nonce.
2642 0
Error saving your changes: Description control characters are not allowed
在修改 GitHub 上的仓库描述时出现此提示信息:Error saving your changes: Description control characters are not allowed 开始以为是 Fork 来的没有修改权限,但之前没有遇到这样的情况,提示信息说的也不是这个意思。
2381 0
|
JavaScript 前端开发
|
安全 Java C++
Note
开发分布式应用distributed;强类型机制 异常处理exception except 垃圾的自动收集java对通过网络下载的类具有安全防范机制通过网络下载的类有一个安全防范机制;classLoader;分配不同的名字空间以防替代本地的同名类,字节代码检查,并提供安全管理机制SecurityMa...
1067 0
Common mistakes to avoid while using big data in risk management
Managing risk is a challenging enterprise, and errors are often made which can lead to catastrophic consequences.
1671 0
Three industries you didn't realize are benefitting from big data
Big data and analytics have long since transitioned from being buzzwords to delivering tangible business results.
1884 0