Sfoglia il codice sorgente

Core ML customModel support

Lutz Roeder 6 anni fa
parent
commit
d72b66de11
2 ha cambiato i file con 14 aggiunte e 0 eliminazioni
  1. 7 0
      src/coreml.js
  2. 7 0
      test/models.json

+ 7 - 0
src/coreml.js

@@ -408,6 +408,13 @@ coreml.Graph = class {
             this._updateClassifierOutput(group, model.kNearestNeighborsClassifier);
             return 'kNearestNeighborsClassifier';
         }
+        else if (model.customModel) {
+            this._createNode(scope, group, 'customModel', null,
+                { className: model.customModel.className, parameters: model.customModel.parameters },
+                [ model.description.input[0].name ],
+                [ model.description.output[0].name ]);
+            return 'customModel';
+        }
         throw new coreml.Error("Unknown model type '" + JSON.stringify(Object.keys(model)) + "'.");
     }
 

+ 7 - 0
test/models.json

@@ -1211,6 +1211,13 @@
     "format": "Core ML v3",
     "link":   "https://developer.apple.com/machine-learning/models"
   },
+  {
+    "type":   "coreml",
+    "target": "EnvSceneClassification.mlmodel",
+    "source": "https://github.com/anujdutt9/iOS-Audio-Classification/blob/cdf5b72dc351a83168369d0afbd0eeba9ecae448/RealTimeSoundClassifier/RealTimeSoundClassifier/EnvSceneClassification.mlmodel?raw=true",
+    "format": "Core ML v3",
+    "link":   "https://github.com/anujdutt9/iOS-Audio-Classification"
+  },
   {
     "type":   "coreml",
     "target": "coreml_invalid_file.mlmodel",