C++ little errors , Big problem

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

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

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

[email protected]:~/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 :

[email protected]:~$ 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 .

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

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

 

时间: 2016-01-16
Tags: type

C++ little errors , Big problem的相关文章

JavaCore extends Plugin

/******************************************************************************* 2 * Copyright (c) 2000, 2007 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of t

【OH】Glossary Oracle词汇表(中)

Glossary [OH]Glossary Oracle词汇表(中) Oracle? Database Net Services Administrator's Guide 11g Release 2 (11.2) E41945-02 Glossary ● access control list (ACL) The group of access directives that you define. The directives grant levels of access to specif

linux下c程序调用reboot函数实现直接重启【转】

转自:http://www.blog.chinaunix.net/uid-20564848-id-73878.html linux下c程序调用reboot函数实现直接重启   当然你也可以直接调用system("reboot"),但是这里完全基于库函数来实现,不依赖于/sbin/reboot这个外部程序这里reboot()的其他命令,比如RB_POWER_OFF,并不能保证关闭计算机电源. #include <unistd.h>#include <sys/reboot

Fetching Across Commits: Where Is the Source of the Problem?

Fetching Across Commits: Where Is the Source of the Problem? By Boris Milrud Fetching across commits is a common and accepted practice in the Oracle programming world. However, it is not an ANSI-supported operation. According to the ANSI standard, a

use pyffmpeg install on win7,but has errors

问题描述 use pyffmpeg install on win7,but has errors Hello . I use this pyffmpeg and install it on windows 64 bit operating system,but it reported the errors al follows: Remember: Edit at first ffmpegpath within setup.py Traceback (most recent call last)

R12.2克隆patch fs报错——Rapid Clone completed successfully , but the AutoConfig run recorded some errors

根据同事提供的网址,参考文档:http://ermanarslan.blogspot.jp/2014/07/ebs-122-cloning-real-life-example.html 解决: INFO :  Rapid Clone completed successfully , but the AutoConfig run recorded  some errors.  Please review the AutoConfig section in the logfile.  and Re-

oracle提示Alert Log Errors: 12170 TNS-12535/TNS-00505: Operation Timed Out

客户反馈系统经常报会话超时,导致应用测试无法正常进行,经检查alert日志发现 Fatal NI connect error 12170.     VERSION INFORMATION:         TNS for HPUX: Version 11.2.0.4.0 - Production         Oracle Bequeath NT Protocol Adapter for HPUX: Version 11.2.0.4.0 - Production         TCP/IP

解决Eclipse报errors running builder ‘javascript validator’ on project

今天导入jquery的js到项目中,Eclipse老是动不动就报错: errors running builder 'javascript validator' on project 如图: 解决办法: 右击项目名–Properties–Builders–将JavaScript Validator前面的勾去掉即可.

ZOJ Problem Set - 3713

题意:给定一个字符串,用字符串ASC2码16进制数输出 ,并在前面输出字符串长度的16进制,输出长度的规则是 先输出长度的二进制数的后七位的十六进制(如果左边还有1 则这在后七位前面加上个1再输出  然后二进制数右移动七位,直到左边没有1)   注:所有16数都必须为两位! 解题思路:对长度进行输出处理 解题代码: #include<stdio.h> #include<string.h> #include<stdlib.h> #include<time.h>