Lutz Roeder 4 роки тому
батько
коміт
e62ded361b
4 змінених файлів з 674 додано та 264 видалено
  1. 46 0
      source/coreml-metadata.json
  2. 617 259
      source/coreml.js
  3. 4 5
      source/view.js
  4. 7 0
      test/models.json

+ 46 - 0
source/coreml-metadata.json

@@ -415,5 +415,51 @@
       { "name": "locations" },
       { "name": "lengths" }
     ]
+  },
+  {
+    "name": "program:conv",
+    "category": "Layer",
+    "inputs": [
+      { "name": "x" },
+      { "name": "weight" },
+      { "name": "bias" }
+    ]
+  },
+  {
+    "name": "program:linear",
+    "category": "Layer",
+    "inputs": [
+      { "name": "x" },
+      { "name": "weight" },
+      { "name": "bias" }
+    ]
+  },
+  {
+    "name": "program:pad",
+    "category": "Tensor"
+  },
+  {
+    "name": "program:transpose",
+    "category": "Transform"
+  },
+  {
+    "name": "program:sigmoid",
+    "category": "Activation"
+  },
+  {
+    "name": "program:softmax",
+    "category": "Activation"
+  },
+  {
+    "name": "program:relu",
+    "category": "Activation"
+  },
+  {
+    "name": "program:relu6",
+    "category": "Activation"
+  },
+  {
+    "name": "program:reshape",
+    "category": "Shape"
   }
 ]

Різницю між файлами не показано, бо вона завелика
+ 617 - 259
source/coreml.js


+ 4 - 5
source/view.js

@@ -1228,7 +1228,8 @@ view.ModelContext = class {
                 case 'json': {
                     try {
                         reset = true;
-                        const reader = json.TextReader.create(this.stream.peek());
+                        const buffer = this.stream.peek();
+                        const reader = json.TextReader.create(buffer);
                         const obj = reader.read();
                         this._content.set(type, obj);
                     }
@@ -1378,9 +1379,7 @@ view.ArchiveContext = class {
             for (const entry of entries) {
                 if (entry.name.startsWith(rootFolder)) {
                     const name = entry.name.substring(rootFolder.length);
-                    if (name.length > 0 && (name.indexOf('/') === -1 || name.startsWith('MAR-INF/'))) {
-                        this._entries[name] = entry;
-                    }
+                    this._entries[name] = entry;
                 }
             }
         }
@@ -1432,7 +1431,7 @@ view.ModelFactoryService = class {
         this.register('./pytorch', [ '.pt', '.pth', '.pt1', '.pyt', '.pkl', '.pickle', '.h5', '.t7', '.model', '.dms', '.tar', '.ckpt', '.chkpt', '.tckpt', '.bin', '.pb', '.zip', '.nn', '.torchmodel' ]);
         this.register('./onnx', [ '.onnx', '.onn', '.pb', '.pbtxt', '.prototxt', '.model', '.pt', '.pth', '.pkl' ]);
         this.register('./mxnet', [ '.json', '.params' ]);
-        this.register('./coreml', [ '.mlmodel' ]);
+        this.register('./coreml', [ '.mlmodel', 'manifest.json', 'metadata.json', 'featuredescriptions.json' ]);
         this.register('./caffe', [ '.caffemodel', '.pbtxt', '.prototxt', '.pt', '.txt' ]);
         this.register('./caffe2', [ '.pb', '.pbtxt', '.prototxt' ]);
         this.register('./torch', [ '.t7' ]);

+ 7 - 0
test/models.json

@@ -1100,6 +1100,13 @@
     "format": "Core ML v3",
     "link":   "https://developer.apple.com/machine-learning/models"
   },
+  {
+    "type":   "coreml",
+    "target": "EfficientNetB0.mlpackage.zip",
+    "source": "https://github.com/lutzroeder/netron/files/6636195/EfficientNetB0.mlpackage.zip",
+    "format": "Core ML Package v6",
+    "link":   "https://github.com/lutzroeder/netron/issues/751"
+  },
   {
     "type":   "coreml",
     "target": "EnvSceneClassification.mlmodel",

Деякі файли не було показано, через те що забагато файлів було змінено