简体   繁体   English

tensorflow keras 中的 CRF?

[英]CRF in tensorflow keras?

I know that Keras-contrib is deprecated and has been migrated to tensorflow/addons, but I don't understand how can I add a CRF layer using this new library.我知道 Keras-contrib 已被弃用并已迁移到 tensorflow/addons,但我不明白如何使用这个新库添加 CRF 层。

Does anyone know which tensorflow/addons feature is the equivalent to the keras-contrib CRF layer?有谁知道哪个 tensorflow/addons 功能相当于 keras-contrib CRF 层?

You can use TensorFlow Addons( tfa ).您可以使用 TensorFlow 插件( tfa )。 In your case use tfa.layers.CRF .在您的情况下使用tfa.layers.CRF

To use the above, first you have to install the latest version as shown below要使用上述内容,首先您必须安装最新版本,如下所示

pip install tensorflow-addons

You can use addons as shown below您可以使用插件,如下所示

import tensorflow as tf
import tensorflow_addons as tfa
from tensorflow_addons.layers import CRF

For more information you can refer here有关更多信息,您可以参考这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM