8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

pydotplus.graphviz 与 tensorflow 的 plot_model 存在问题

NMR 2月前

69 0

我正在尝试使用 plot_model 函数和 TensorFlow 绘制我的模型并将其保存到 Ubuntu 22.04 上的文件中。Pycharm 2024.1.3。python 3.12。Tensorflow 2.16.1。我假设 Pydotplus 和 Graphviz 是

我正在尝试使用 TensorFlow 中的 plot_model 函数来绘制我的模型并将其保存到 Ubuntu 22.04 上的文件中。Pycharm 2024.1.3。python 3.12。Tensorflow 2.16.1。我假设 Pydotplus 和 Graphviz 已正确安装,或者我遗漏了某些内容。文件已创建,但已损坏(0 字节)并且无法打开。

脚本以错误结尾:回溯(最近一次调用最后一次):文件 \'/home/linuxpc/PycharmProjects/Semen_project/temp.py\',第 314 行,在 create_model(model_parameters=model_par)文件 \'/home/linuxpc/PycharmProjects/Semen_project/temp.py\',第 224 行,在 create_modeltf.keras.utils.plot_model(文件 \'/home/linuxpc/PycharmProjects/Semen_project/.venv/lib/python3.12/site-packages/keras/src/utils/model_visualization.py\',第 456 行,在 plot_modeldot.write(to_file,format=extension)文件\'/home/linuxpc/PycharmProjects/Semen_project/.venv/lib/python3.12/site-packages/pydotplus/graphviz.py\',第 1919 行,在 writefobj.write(self.create(prog, format))^^^^^^^^^^^^^^^^^^^^^^^^^^^File \'/home/linuxpc/PycharmProjects/Semen_project/.venv/lib/python3.12/site-packages/pydotplus/graphviz.py\',第 2031 行,在 createraise InvocationException(pydotplus.graphviz.InvocationException: 程序终止,状态为:-6。stderr 如下:在节点 716[0]dot 处失败:maze.c:311:chkSgraph:断言`np->cells[0]'失败

脚本的模型创建部分:gobal_input_layer = tf.keras.layers.Input(shape=layer_size[0]['1'][0])

"""Model_1 to detect fibers"""
for lnum, layer in enumerate(layer_size[0]):
    if lnum == 0:
        for vnum, val in enumerate(layer_size[0][layer]):
            if vnum == 0:
                layer = tf.keras.layers.Identity()(gobal_input_layer)
            else:
                layer = tf.keras.layers.Dense(val[0],
                                              activation="sigmoid")(layer)
                if len(val) == 2:
                    layer = tf.keras.layers.Dropout(val[1])(layer)

            output_layer = tf.keras.layers.Dense(2,
                                                 activation="sigmoid")(layer)
            intermediate = tf.keras.layers.Reshape((2, 1), input_shape=(1, 2))(output_layer)
            first_half = tf.keras.layers.Cropping1D(cropping=(0, 1))(intermediate)
            first_half = tf.keras.layers.Reshape((1,), input_shape=(1, 1))(first_half)

            second_half = tf.keras.layers.Cropping1D(cropping=(0, 1))(intermediate)
            second_half = tf.keras.layers.Reshape((1,), input_shape=(1, 1))(second_half)
    elif lnum == 1:
        for vnum, val in enumerate(layer_size[0][layer]):
            if vnum == 0:
                layer_2 = tf.keras.layers.Concatenate()([gobal_input_layer, second_half])

                layer_2 = tf.keras.layers.Identity()(layer_2)
            else:
                layer_2 = tf.keras.layers.Dense(val[0],
                                                activation="sigmoid")(layer_2)
                if len(val) == 2:
                    layer_2 = tf.keras.layers.Dropout(val[1])(layer_2)

            output_layer_2 = tf.keras.layers.Dense(2,
                                                   activation="sigmoid")(layer_2)
    else:
        raise ValueError(f"The length of layers is than 2")

outputs = tf.keras.layers.Concatenate()([output_layer_2, output_layer])
outputs = tf.keras.layers.Identity()(outputs)
model = tf.keras.Model(inputs=gobal_input_layer,
                       outputs=outputs)
model.name = model_parameters["model_name"]
return model

我尝试过 pydot、pydotplus 和 pydot-ng(从 pip 安装)——结果是一样的。Graphviz 可以通过 \'sudo apt install graphviz\' 或 \'pip install graphviz\' 安装。文件的扩展名无关紧要——我尝试过 jpg、png、pdf。安装 graphviz 后,PC 已重新启动。

Traceback 错误的最后一行没有给我任何信息,我陷入了困境。我发现 dot 出了问题,它生成了状态 [-6],但我不知道是什么问题。我猜是生成图像或/和将其写入文件时出了问题(因为崩溃后文件为空)。另一个想法是一个或多个层或模型本身无法转换为 dot。

有人能帮助我解决这个问题吗?或者建议我至少应该从哪里开始深入研究?我将不胜感激任何人提供的帮助。

帖子版权声明 1、本帖标题:pydotplus.graphviz 与 tensorflow 的 plot_model 存在问题
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由NMR在本站《ubuntu》版块原创发布, 转载请注明出处!
最新回复 (0)
  • 从旧信令服务器迁移到新信令服务器后,我尝试使用 Talk 时遇到问题,出现“无法建立信令连接。正在重试...”错误

    从旧信令服务器迁移到新信令服务器后,我尝试使用 Talk 时遇到了问题,在 Chrome 浏览器上收到“无法建立信令连接。正在重试...”错误,但 Firefox 或 Edge 等其他浏览器可以正常工作。

    从 nc 服务器 ping 和 telnet 信号成功。

    我尝试删除浏览器缓存和 Cookies,并重置 Chrome 扩展程序。

    我还尝试禁用 NC 和信令服务器上的 UFW 防火墙

    服务状态输出: 在此处输入图像描述

     janus.service - Janus WebRTC gateway
         Loaded: loaded (/usr/lib/systemd/system/janus.service; enabled; preset: enabled)
         Active: active (running) since Sat 2024-07-13 14:35:05 +04; 1h 59min ago
           Docs: https://janus.conf.meetecho.com/docs/index.html
        Process: 2609 ExecStart=/usr/bin/janus --disable-colors --daemon --log-stdout (code=exited, status=0/SUCCESS)
       Main PID: 2611 (janus)
          Tasks: 34 (limit: 18998)
         Memory: 8.6M (peak: 10.8M)
            CPU: 17.707s
         CGroup: /system.slice/janus.service
                 2611 /usr/bin/janus --disable-colors --daemon --log-stdout
    
    Jul 13 14:58:42 signaling2024 janus[2611]: [Sat Jul 13 14:58:42 2024] [WARN] [5024200445104679] Peer video fallback SSRC: 3531010713
    Jul 13 14:58:43 signaling2024 janus[2611]: [Sat Jul 13 14:58:43 2024] [5024200445104679] The DTLS handshake has been completed
    Jul 13 14:58:43 signaling2024 janus[2611]: [Sat Jul 13 14:58:43 2024] [janus.plugin.videoroom-0x722fa4001d90] WebRTC media is now available
    Jul 13 14:58:43 signaling2024 janus[2611]: [Sat Jul 13 14:58:43 2024] [ERR] [ice.c:janus_ice_outgoing_traffic_handle:4553] [5024200445104679] No candidates not gathered yet for stream??
    Jul 13 14:58:44 signaling2024 janus[2611]: [Sat Jul 13 14:58:44 2024] [WARN] [5024200445104679] Unknown SSRC, dropping packet (SSRC 2210285321)...
    Jul 13 14:58:46 signaling2024 janus[2611]: [Sat Jul 13 14:58:46 2024] [janus.plugin.videoroom-0x722fa4001d90] Data channel available
    Jul 13 14:58:50 signaling2024 janus[2611]: [Sat Jul 13 14:58:50 2024] [janus.plugin.videoroom-0x722fa4001d90] No WebRTC media anymore; 0x72302c006b30 0x72302c004170
    Jul 13 14:58:50 signaling2024 janus[2611]: [Sat Jul 13 14:58:50 2024] Detaching handle from JANUS VideoRoom plugin; 0x72302c006b30 0x722fa4001d90 0x72302c006b30 0x72302c004170
    Jul 13 14:58:50 signaling2024 janus[2611]: [Sat Jul 13 14:58:50 2024] [5024200445104679] WebRTC resources freed; 0x72302c006b30 0x628e6ca69390
    Jul 13 14:58:50 signaling2024 janus[2611]: [Sat Jul 13 14:58:50 2024] [5024200445104679] Handle and related resources freed; 0x72302c006b30 0x628e6ca69390
    
    
     coturn.service - coTURN STUN/TURN Server
         Loaded: loaded (/usr/lib/systemd/system/coturn.service; enabled; preset: enabled)
         Active: active (running) since Sat 2024-07-13 14:15:20 +04; 2h 21min ago
           Docs: man:coturn(1)
                 man:turnadmin(1)
                 man:turnserver(1)
       Main PID: 1155 (turnserver)
          Tasks: 195 (limit: 18998)
         Memory: 64.0M (peak: 65.0M)
            CPU: 17.229s
         CGroup: /system.slice/coturn.service
                 1155 /usr/bin/turnserver -c /etc/turnserver.conf --pidfile=
    
    Jul 13 14:15:20 signaling2024 turnserver[1155]: 0: : IO method (auth thread): epoll (with changelist)
    Jul 13 14:15:20 signaling2024 turnserver[1155]: 0: : IO method (auth thread): epoll (with changelist)
    Jul 13 14:15:20 signaling2024 turnserver[1155]: 0: : IO method (auth thread): epoll (with changelist)
    Jul 13 14:15:20 signaling2024 turnserver[1155]: 0: : IO method (auth thread): epoll (with changelist)
    Jul 13 14:15:20 signaling2024 turnserver[1155]: 0: : IO method (auth thread): epoll (with changelist)
    Jul 13 14:15:20 signaling2024 turnserver[1155]: 0: : IO method (auth thread): epoll (with changelist)
    Jul 13 14:15:20 signaling2024 turnserver[1155]: 0: : IO method (auth thread): epoll (with changelist)
    Jul 13 14:15:20 signaling2024 turnserver[1155]: 0: : IO method (auth thread): epoll (with changelist)
    Jul 13 14:15:20 signaling2024 turnserver[1155]: 0: : IO method (auth thread): epoll (with changelist)
    Jul 13 14:15:20 signaling2024 systemd[1]: Started coturn.service - coTURN STUN/TURN Server.
    
    
    signaling.service - Nextcloud Talk signaling server
         Loaded: loaded (/etc/systemd/system/signaling.service; enabled; preset: enabled)
         Active: active (running) since Sat 2024-07-13 14:15:20 +04; 2h 21min ago
       Main PID: 1881 (signaling)
          Tasks: 16 (limit: 18998)
         Memory: 29.7M (peak: 33.2M)
            CPU: 2.116s
         CGroup: /system.slice/signaling.service
                 1881 /usr/bin/signaling --config /etc/signaling/server.conf
    
    Jul 13 15:00:42 signaling2024 signaling[1881]: client.go:353: Client 8mw6HFRh3geAN-h2pvh23VHsizfy__d3dE116KDskkJ8VTRzNVRZT2hvX0RZTmlxZEtTdVZJLUUzUEozbXB4YUVfRTBPb0t2b0s2ek5ucFk0N0wwdkNPc2p>
    Jul 13 15:01:36 signaling2024 signaling[1881]: client.go:353: Client 8mw6HFRh3geAN-h2pvh23VHsizfy__d3dE116KDskkJ8VTRzNVRZT2hvX0RZTmlxZEtTdVZJLUUzUEozbXB4YUVfRTBPb0t2b0s2ek5ucFk0N0wwdkNPc2p>
    Jul 13 15:02:30 signaling2024 signaling[1881]: client.go:353: Client 8mw6HFRh3geAN-h2pvh23VHsizfy__d3dE116KDskkJ8VTRzNVRZT2hvX0RZTmlxZEtTdVZJLUUzUEozbXB4YUVfRTBPb0t2b0s2ek5ucFk0N0wwdkNPc2p>
    Jul 13 15:03:24 signaling2024 signaling[1881]: client.go:353: Client 8mw6HFRh3geAN-h2pvh23VHsizfy__d3dE116KDskkJ8VTRzNVRZT2hvX0RZTmlxZEtTdVZJLUUzUEozbXB4YUVfRTBPb0t2b0s2ek5ucFk0N0wwdkNPc2p>
    Jul 13 15:04:18 signaling2024 signaling[1881]: client.go:353: Client 8mw6HFRh3geAN-h2pvh23VHsizfy__d3dE116KDskkJ8VTRzNVRZT2hvX0RZTmlxZEtTdVZJLUUzUEozbXB4YUVfRTBPb0t2b0s2ek5ucFk0N0wwdkNPc2p>
    Jul 13 15:05:12 signaling2024 signaling[1881]: client.go:353: Client 8mw6HFRh3geAN-h2pvh23VHsizfy__d3dE116KDskkJ8VTRzNVRZT2hvX0RZTmlxZEtTdVZJLUUzUEozbXB4YUVfRTBPb0t2b0s2ek5ucFk0N0wwdkNPc2p>
    Jul 13 15:06:06 signaling2024 signaling[1881]: client.go:353: Client 8mw6HFRh3geAN-h2pvh23VHsizfy__d3dE116KDskkJ8VTRzNVRZT2hvX0RZTmlxZEtTdVZJLUUzUEozbXB4YUVfRTBPb0t2b0s2ek5ucFk0N0wwdkNPc2p>
    Jul 13 15:07:00 signaling2024 signaling[1881]: client.go:353: Client 8mw6HFRh3geAN-h2pvh23VHsizfy__d3dE116KDskkJ8VTRzNVRZT2hvX0RZTmlxZEtTdVZJLUUzUEozbXB4YUVfRTBPb0t2b0s2ek5ucFk0N0wwdkNPc2p>
    Jul 13 15:07:42 signaling2024 signaling[1881]: hub.go:951: Unregister 8mw6HFRh3geAN-h2pvh23VHsizfy__d3dE116KDskkJ8VTRzNVRZT2hvX0RZTmlxZEtTdVZJLUUzUEozbXB4YUVfRTBPb0t2b0s2ek5ucFk0N0wwdkNPc2>
    Jul 13 15:07:42 signaling2024 signaling[1881]: clientsession.go:511: Removed room session kWSDKNkYburIWOAeT09XZ4QenYWg+6guH+qDNWXYlTtXaSGYn6mpz/q724IvacWmlvDO9DypsuY502ga+go0WrsQvtK2OqikPj>
    
    
    
     nats-server.service - NATS messaging server
         Loaded: loaded (/usr/lib/systemd/system/nats-server.service; enabled; preset: enabled)
         Active: active (running) since Sat 2024-07-13 14:15:21 +04; 2h 22min ago
           Docs: https://docs.nats.io/nats-server/
       Main PID: 1893 (nats-server)
          Tasks: 12 (limit: 18998)
         Memory: 17.8M (peak: 21.0M)
            CPU: 2.418s
         CGroup: /system.slice/nats-server.service
                 1893 /usr/bin/nats-server --config /etc/nats/nats.conf
    
    Jul 13 14:15:21 signaling2024 systemd[1]: Started nats-server.service - NATS messaging server.
    Jul 13 14:15:21 signaling2024 nats-server[1893]: [1893] 2024/07/13 14:15:21.520477 [INF] Starting nats-server
    Jul 13 14:15:21 signaling2024 nats-server[1893]: [1893] 2024/07/13 14:15:21.520607 [INF]   Version:  2.10.16
    Jul 13 14:15:21 signaling2024 nats-server[1893]: [1893] 2024/07/13 14:15:21.520610 [INF]   Git:      [80e29794]
    Jul 13 14:15:21 signaling2024 nats-server[1893]: [1893] 2024/07/13 14:15:21.520613 [INF]   Name:     NA3PHTZKL4RJQV7TTMNOHQCIC6PHM4C3S5UUPYGMIBELGAQSVVASXZF4
    Jul 13 14:15:21 signaling2024 nats-server[1893]: [1893] 2024/07/13 14:15:21.520621 [INF]   ID:       NA3PHTZKL4RJQV7TTMNOHQCIC6PHM4C3S5UUPYGMIBELGAQSVVASXZF4
    Jul 13 14:15:21 signaling2024 nats-server[1893]: [1893] 2024/07/13 14:15:21.520642 [INF] Using configuration file: /etc/nats/nats.conf
    Jul 13 14:15:21 signaling2024 nats-server[1893]: [1893] 2024/07/13 14:15:21.521353 [INF] Listening for client connections on 127.0.0.1:4222
    Jul 13 14:15:21 signaling2024 nats-server[1893]: [1893] 2024/07/13 14:15:21.521384 [INF] Server is ready
    
    
    screenshot from the Chrome browser
    
返回
作者最近主题: