Skip to content

Commit

Permalink
Caffe ClipParameter min/max (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Jan 4, 2019
1 parent a1fd83f commit ddd38ba
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
18 changes: 6 additions & 12 deletions src/caffe-proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -4941,10 +4941,6 @@
break;
}
}
if (!message.hasOwnProperty("min"))
throw $util.ProtocolError("missing required 'min'", { instance: message });
if (!message.hasOwnProperty("max"))
throw $util.ProtocolError("missing required 'max'", { instance: message });
return message;
};

Expand All @@ -4967,20 +4963,18 @@
break;
}
}
if (!message.hasOwnProperty("min"))
throw $util.ProtocolError("missing required 'min'", { instance: message });
if (!message.hasOwnProperty("max"))
throw $util.ProtocolError("missing required 'max'", { instance: message });
return message;
};

ClipParameter.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (typeof message.min !== "number")
return "min: number expected";
if (typeof message.max !== "number")
return "max: number expected";
if (message.min != null && message.hasOwnProperty("min"))
if (typeof message.min !== "number")
return "min: number expected";
if (message.max != null && message.hasOwnProperty("max"))
if (typeof message.max !== "number")
return "max: number expected";
return null;
};

Expand Down
1 change: 1 addition & 0 deletions src/sklearn.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ sklearn.ModelFactory = class {
constructorTable['sklearn.preprocessing.data.Binarizer'] = function() {};
constructorTable['sklearn.preprocessing.data.StandardScaler'] = function() {};
constructorTable['sklearn.preprocessing.label.LabelEncoder'] = function() {};
constructorTable['sklearn.svm.classes.LinearSVC'] = function() {};
constructorTable['sklearn.svm.classes.SVC'] = function() {};
constructorTable['sklearn.svm.classes.SVR'] = function() {};
constructorTable['sklearn.tree._tree.Tree'] = function(n_features, n_classes, n_outputs) {
Expand Down
7 changes: 7 additions & 0 deletions test/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,13 @@
"format": "Caffe v1",
"link": "http://places.csail.mit.edu/downloadCNN.html"
},
{
"type": "caffe",
"target": "pose_iter_584000.caffemodel",
"source": "http://posefs1.perception.cs.cmu.edu/OpenPose/models/pose/body_25/pose_iter_584000.caffemodel",
"format": "Caffe v2",
"link": "https://github.com/CMU-Perceptual-Computing-Lab/openpose"
},
{
"type": "caffe",
"target": "ResNet-18-deploy.prototxt",
Expand Down
6 changes: 5 additions & 1 deletion tools/caffe
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ sync() {

schema() {
bold "caffe schema"
${node_modules}/protobufjs/bin/pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --keep-case --decode-text -r caffe -o ${src}/caffe-proto.js ${third_party}/${identifier}/src/caffe/proto/caffe.proto
cp ${third_party}/${identifier}/src/caffe/proto/caffe.proto ${tools}
sed -i -e 's/required float min = 1;/optional float min = 1;/g' ${tools}/caffe.proto
sed -i -e 's/required float max = 2;/optional float max = 2;/g' ${tools}/caffe.proto
${node_modules}/protobufjs/bin/pbjs -t static-module -w closure --no-encode --no-delimited --no-comments --keep-case --decode-text -r caffe -o ${src}/caffe-proto.js ${tools}/caffe.proto
rm ${tools}/caffe.proto
node ${tools}/update_pbjs.js array ${src}/caffe-proto.js data float 1
}

Expand Down

0 comments on commit ddd38ba

Please sign in to comment.