-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to predict each class probability #28
Comments
Hi @farhantandia,
Sample code is following;
I hope it works in your situation. |
I implemented my own ArcFace. This works correctly and I believe this can solve your problem. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to predict the class probability? when I set the output to arcface output (softmax) w.r.t number of class, I got an error when run this model = Model(inputs=model.input[0], outputs=model.layers[-1].output) ,-1 instead of -3
`---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in
----> 1 model = Model(inputs=model.input[0], outputs=model.layers[-1].output)
~\anaconda3\envs\kaggle\lib\site-packages\tensorflow\python\keras\engine\training.py in new(cls, *args, **kwargs)
240 # Functional model
241 from tensorflow.python.keras.engine import functional # pylint: disable=g-import-not-at-top
--> 242 return functional.Functional(*args, **kwargs)
243 else:
244 return super(Model, cls).new(cls, *args, **kwargs)
~\anaconda3\envs\kaggle\lib\site-packages\tensorflow\python\training\tracking\base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
--> 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access
~\anaconda3\envs\kaggle\lib\site-packages\tensorflow\python\keras\engine\functional.py in init(self, inputs, outputs, name, trainable)
113 # 'arguments during initialization. Got an unexpected argument:')
114 super(Functional, self).init(name=name, trainable=trainable)
--> 115 self._init_graph_network(inputs, outputs)
116
117 @trackable.no_automatic_dependency_tracking
~\anaconda3\envs\kaggle\lib\site-packages\tensorflow\python\training\tracking\base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
--> 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access
~\anaconda3\envs\kaggle\lib\site-packages\tensorflow\python\keras\engine\functional.py in _init_graph_network(self, inputs, outputs)
189 # Keep track of the network's nodes and layers.
190 nodes, nodes_by_depth, layers, _ = _map_graph_network(
--> 191 self.inputs, self.outputs)
192 self._network_nodes = nodes
193 self._nodes_by_depth = nodes_by_depth
~\anaconda3\envs\kaggle\lib\site-packages\tensorflow\python\keras\engine\functional.py in _map_graph_network(inputs, outputs)
929 'The following previous layers '
930 'were accessed without issue: ' +
--> 931 str(layers_with_complete_input))
932 for x in nest.flatten(node.outputs):
933 computable_tensors.add(id(x))
ValueError: Graph disconnected: cannot obtain value for tensor Tensor("input_37:0", shape=(None, 51), dtype=float32) at layer "softmax_output". The following previous layers were accessed without issue:
[-1].output :
<tf.Tensor 'class_output/Softmax_3:0' shape=(None, 10) dtype=float32>
while [-3] return feature vectors which suitable for visualization.
thanks.
The text was updated successfully, but these errors were encountered: