当前位置: 首页 > article >正文

使用PlotNeuralNet绘制ResNet50模型

一、下载所需软件

1、下载MikTex

作用:将.tex文件转换为PDF文件

下载官网链接:Getting MiKTeX

2、下载Git

作用:将PlotNeuralNet库从GitHub上下载下来,在cmd使用命令行:

git clone https://github.com/SamuraiBUPT/PlotNeuralNet-Windows.git

就可以将PlotNeuralNet库克隆到当前文件夹中

下载官网链接:Git - Downloads

二、使用PlotNeuralNet绘制ResNet50模型

1、模型代码

import sys
sys.path.append('../')
from PlotNeuralNet.pycore.tikzeng import *
from PlotNeuralNet.pycore.blocks import *

#------------------------------------------------------------------------------
# 1) 定义一个函数,将真实 (H, C) 映射为 PlotNeuralNet 的 (height, depth, width)
#------------------------------------------------------------------------------
def dims(H, C):
    # 让 height、depth 随着 H 变化,但不少于 4
    h = 25 + H * 0.3
    d = 25 + H * 0.3
    w = 2 + C * 0.005
    return (h, d, w)

# conve1
h1, d1, w1 = dims(112,64)

# maxpool1
h2, d2, w2 = dims(56, 64)

# conve2_x
h3, d3, w3 = dims(56, 64)
h4, d4, w4 = dims(56, 64)
h5, d5, w5 = dims(56, 256)

# conve3_x
h6, d6, w6 = dims(56, 128)
h7, d7, w7 = dims(28, 128)
h8, d8, w8 = dims(28, 512)

# conve4_x
h9, d9, w9 = dims(28, 256)
h10, d10, w10 = dims(14, 256)
h11, d11, w11 = dims(14, 1024)

# conve5_x
h12, d12, w12 = dims(14, 512)
h13, d13, w13 = dims(7, 512)
h14, d14, w14 = dims(7, 2048)

# avgpool
h15, d15, w15 = dims(1, 2048)

#--------------------------------------------------------------------------------------------
# 2) 构建 ResNet-50 的网络结构 (arch),并为每个阶段指

http://www.kler.cn/a/596258.html

相关文章:

  • Prometheus Exporter系列-Mysql_Exporter一键部署
  • 面试中JVM常被问到的问题以及对应的答案
  • 优化广告投放算法
  • php的用途和基础语法【初学者进】
  • unity npc射线检测碰撞
  • 《前端秘籍:JS语法+DOM操作,从新手到高手》
  • 代码随想录算法训练营第十五天 | 数组 |长度最小的子数组和螺旋矩阵II
  • 【ESP32】虚拟机Ubuntu20.04下ESP32环境搭建
  • 基于deepseek的智能语音客服【第二讲】后端异步接口调用封装
  • 在 Elasticsearch 中扩展后期交互模型 - 第 2 部分 - 8.18
  • CTF题目《easy_tornado》(护网杯 2018)Write Up
  • Flink相关面试题
  • 分析K8S中Node状态为`NotReady`问题
  • C++进阶(一)
  • (C语言)理解 回调函数 和 qsort函数
  • 【Redis】Redis中的热点key问题如何解决?
  • 阿里云服务器环境部署 四 MySQL主从配置
  • ubuntu忘记密码问题解决。进入恢复模式修改密码
  • MySQL和Oracle所学的知识点相通吗?
  • 零基础入门机器学习:用Scikit-learn实现鸢尾花分类