From f6e469cc3cd5d9f79e3554d43dcd68f4ef31c016 Mon Sep 17 00:00:00 2001 From: Lutz Roeder Date: Sun, 27 Jan 2019 23:19:39 -0800 Subject: [PATCH] Caffe2 .pbtxt detection (#223) --- src/caffe2.js | 6 ++++-- src/view.js | 2 +- test/models.json | 9 ++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/caffe2.js b/src/caffe2.js index 43d25745eb..60f85e55c0 100644 --- a/src/caffe2.js +++ b/src/caffe2.js @@ -43,8 +43,10 @@ caffe2.ModelFactory = class { } } } - if (identifier.endsWith('predict_net.pbtxt') || identifier.endsWith('predict_net.prototxt') || - identifier.endsWith('init_net.pbtxt') || identifier.endsWith('init_net.prototxt')) { + if (extension == 'pbtxt' || extension == 'prototxt') { + if (identifier.endsWith('predict_net.pbtxt') || identifier.endsWith('predict_net.prototxt')) { + return true; + } tags = context.tags('pbtxt'); if (tags.op) { return true; diff --git a/src/view.js b/src/view.js index f4ba5b6bdc..1a172ac3a9 100644 --- a/src/view.js +++ b/src/view.js @@ -369,7 +369,7 @@ view.View = class { setTimeout(() => { if (graph && graph != this._activeGraph) { var nodes = graph.nodes; - if (nodes.length > 1500) { + if (nodes.length > 1400) { if (!this._host.confirm('Large model detected.', 'This graph contains a large number of nodes and might take a long time to render. Do you want to continue?')) { this._host.event('Graph', 'Render', 'Skip', nodes.length); this.show(null); diff --git a/test/models.json b/test/models.json index 799f68fd84..19d3b5d724 100644 --- a/test/models.json +++ b/test/models.json @@ -667,7 +667,6 @@ "format": "Caffe2", "link": "https://github.com/jolibrain/deepdetect/tree/master/templates/caffe2" }, - { "type": "caffe2", "target": "bvlc_alexnet/predict_net.pb,bvlc_alexnet/init_net.pb", @@ -731,6 +730,14 @@ "format": "Caffe2", "link": "https://github.com/zyddawn/caffe2-models" }, + { + "type": "caffe2", + "target": "generalized_rcnn/net.pbtxt", + "source": "https://github.com/lutzroeder/netron/files/2801714/net.pbtxt.txt", + "format": "Caffe2", + "render": "skip", + "link": "https://github.com/lutzroeder/netron/issues/223" + }, { "type": "caffe2", "target": "inception_v1/predict_net.pb,inception_v1/init_net.pb",