apple / apple/coremltools

Converting Facenet Model (NotImplementedError: Conversion for TF op 'FIFOQueueV2' not implemented.)

Open
#737 0 comments 0 reactions 0 assignees View on GitHub
missing layer type tf1.x
Dominant language
Python
Stars
5.4k
Forks
850
Avg merge
4d 5h
Merged PRs (30d)
10

Description

## ❓Question
I try to convert frozen graph of the facenet model. I guess it gives error because it is not exported for inference and includes training nodes. Is there a way coremltools can delete these nodes so I don't need to solve it with tensorflow?
The code I use
```
!pip install coremltools==4.0b1
import coremltools as ct

mlmodel = ct.convert('drive/My Drive/facenetPb/20180402-114759.pb')
mlmodel.save(frozen_graph_file.replace("pb","mlmodel"))
```
The [model](https://drive.google.com/open?id=1EXPBSXwTaqrSC0OhUdXNmKSh9qJUQ55-) I use from David Sandberg's [Repo](https://github.com/davidsandberg/facenet)

The error I receive:
```

Running TensorFlow Graph Passes: 0%| | 0/6 [00:00 MIL Ops: 0%| | 0/5636 [00:00 in ()
1 import coremltools as ct
2
----> 3 mlmodel = ct.convert('drive/My Drive/facenetPb/20180402-114759.pb')
4 mlmodel.save(frozen_graph_file.replace("pb","mlmodel"))

7 frames
/usr/local/lib/python3.6/dist-packages/coremltools/converters/mil/frontend/tensorflow/convert_utils.py in convert_graph(context, graph, outputs)
178 node.op, node.original_node
179 )
--> 180 raise NotImplementedError(msg)
181 _add_op(context, node)
182

NotImplementedError: Conversion for TF op 'FIFOQueueV2' not implemented.

name: "batch_join/fifo_queue"
op: "FIFOQueueV2"
attr {
key: "_output_shapes"
value {
list {
shape {
}
}
}
}
attr {
key: "capacity"
value {
i: 1440
}
}
attr {
key: "component_types"
value {
list {
type: DT_FLOAT
type: DT_INT32
}
}
}
attr {
key: "container"
value {
s: ""
}
}
attr {
key: "shapes"
value {
list {
shape {
dim {
size: 160
}
dim {
size: 160
}
dim {
size: 3
}
}
shape {
}
}
}
}
attr {
key: "shared_name"
value {
s: ""
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the frozen Facenet graph and the TensorFlow frontend path shown in usr/local/lib/python3.6/site-packages/coremltools/converters/mil/frontend/tensorflow/convert_utils.py, then reproduce the conversion to isolate batch_join/fifo_queue. Done means the graph can be converted without the FIFOQueueV2 NotImplementedError, or the issue clearly documents that preprocessing or training nodes must be removed first.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.