فهرست منبع

Caffe ClipParameter min/max (#165)

Lutz Roeder 7 سال پیش
والد
کامیت
ddd38ba2cd
4فایلهای تغییر یافته به همراه19 افزوده شده و 13 حذف شده
  1. 6 12
      src/caffe-proto.js
  2. 1 0
      src/sklearn.js
  3. 7 0
      test/models.json
  4. 5 1
      tools/caffe

+ 6 - 12
src/caffe-proto.js

@@ -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;
             };
     
@@ -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;
             };
     

+ 1 - 0
src/sklearn.js

@@ -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) {

+ 7 - 0
test/models.json

@@ -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",

+ 5 - 1
tools/caffe

@@ -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
 }