You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
I'd like to use the sparse resnet model. I have downloaded the model from "SkimCaffe/models/resnet/ResNet-50-model.caffemodel.bz2" and loaded it using caffe c++ interface. But when iterating the entry of convolution parameters, I find it seems no entry has the exact 0 value. Instead, the values are very small and close to 0.
So I'd like to know if there is some threasholds. Or I downloaded the wrong model.
Steps to reproduce
download the model from "SkimCaffe/models/resnet/ResNet-50-model.caffemodel.bz2" and unzip it.
load the model using caffe c++ interface
/**
* Parse the caffemodel based on the model path.
**/
bool ParseCaffeModel(const string&caffemodel_path, caffe::NetParameter¶m){
//use coded stream to increase the size limit.
int fd = open(caffemodel_path.c_str(), O_RDONLY);
if(fd == -1){
cerr<<"failed to parse caffemodel:"<<caffemodel_path<<endl;
return false;
}
ZeroCopyInputStream* raw_input = new FileInputStream(fd);
CodedInputStream* coded_input = new CodedInputStream(raw_input);
coded_input->SetTotalBytesLimit(1024*1024*512, 1024*1024*256);
param.ParseFromCodedStream(coded_input);
delete coded_input;
delete raw_input;
close(fd);
return true;
}
iterate the entries
//find convolution layers and get weight blob
caffe::BlobProto weights = layer.blobs(0);
for(int k=0; k<filter_number; k+=1){
const float*data = weights.mutable_data()->data()+k*filter_size;
for(int i=0; i<filter_size; i+=1){
float val = data[i];
cout<<"val "<<i<<":"<<val<<endl;
if( val == static_cast<float>(0) ){
zero_count += 1;
}else{
//record the coordinate
coos.push_back(make_pair(k,i));
}
}
}
//layer type information, layer name
cout<<layer.type()<<","<<layer.name()<<","<<zero_count<<endl;
Issue summary
I'd like to use the sparse resnet model. I have downloaded the model from "SkimCaffe/models/resnet/ResNet-50-model.caffemodel.bz2" and loaded it using caffe c++ interface. But when iterating the entry of convolution parameters, I find it seems no entry has the exact 0 value. Instead, the values are very small and close to 0.
So I'd like to know if there is some threasholds. Or I downloaded the wrong model.
Steps to reproduce
the nnz_count is zero.
Your system configuration
Operating system: Ubuntu 16.04
Compiler: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
The text was updated successfully, but these errors were encountered: