C+++-------------------->>>>将数据保存再txt文件中

//临时添加的生成txt文件,可以删除
std::cout<<"outputs[1].size: "<<outputs[1].size<<outputs_attr[1].n_elems * sizeof(float)<<std::endl;
ofstream outfile_odm_loc;
ofstream outfile_arm_loc;
ofstream outfile_arm_conf_flatten;
ofstream outfile_odm_conf_flatten;



int length = sizeof(caffe_odm_loc);///sizeof(caffe_odm_loc[1]);
std::cout<<length<<std::endl;
outfile_odm_loc.open("./outfile_odm_loc.txt");
if(!outfile_odm_loc) cout<<"error"<<endl;
for(int i=0;i<outputs[0].size/4;i++){

outfile_odm_loc<<caffe_odm_loc[i]<<std::endl;

}
outfile_odm_loc.close();
std::cout<<"fish1: "<<std::endl;



outfile_arm_loc.open("./outfile_arm_loc.txt");
if(!outfile_arm_loc) cout<<"error"<<endl;

for(int v=0;v<outputs[1].size/4;v++){

std::cout<<"sum_count: "<<v<< " "<<caffe_arm_loc[v]<<std::endl;
outfile_arm_loc<<caffe_arm_loc[v]<<std::endl;
}
outfile_arm_loc.close();
std::cout<<"fish2: "<<std::endl;


std::cout<<"fish3: "<<sizeof(caffe_arm_conf_flatten)<<std::endl;
outfile_arm_conf_flatten.open("./outfile_arm_conf_flatten.txt");
if(!outfile_arm_conf_flatten) cout<<"error"<<endl;
for(int k=0;k<outputs[2].size/4;k++){

outfile_arm_conf_flatten<<caffe_arm_conf_flatten[k]<<std::endl;
}
outfile_arm_conf_flatten.close();
std::cout<<"fish3: "<<std::endl;



outfile_odm_conf_flatten.open("./outfile_odm_conf_flatten11.txt");
if(!outfile_odm_conf_flatten) cout<<"error"<<endl;
for(int j=0;j<outputs[3].size/4;j++){

outfile_odm_conf_flatten<<caffe_odm_conf_flatten[j]<<std::endl;
}
outfile_odm_conf_flatten.close();
std::cout<<"fish4: "<<std::endl;

posted @ 2021-03-15 17:10  水木清扬  阅读(135)  评论(0编辑  收藏  举报