-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ad6647
commit 3b527f2
Showing
11 changed files
with
913 additions
and
36 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,285 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head prefix="og: https://ogp.me/ns#"> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta name="color-scheme" content="light dark"> | ||
|
||
<title>深度学习框架 - Mr.K</title> | ||
|
||
<link rel="shortcut icon" href="/favicon.ico"> | ||
|
||
|
||
<link rel='manifest' href='/manifest.json'> | ||
|
||
|
||
|
||
|
||
|
||
<meta property="og:title" content="深度学习框架 - Mr.K" /> | ||
|
||
<meta property="og:type" content="article" /> | ||
|
||
<meta property="og:url" content="http://example.com/2023/11/07/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E6%A1%86%E6%9E%B6/index.html" /> | ||
|
||
<meta property="og:image" content="/favicon.ico" /> | ||
|
||
<meta property="og:article:published_time" content="2023-11-07T11:27:48.000Z" /> | ||
|
||
<meta property="og:article:author" content="Kjr" /> | ||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="/css/var.css"> | ||
|
||
|
||
<link rel="stylesheet" href="/css/main.css"> | ||
|
||
|
||
<link rel="stylesheet" href="/css/typography.css"> | ||
|
||
|
||
<link rel="stylesheet" href="/css/code-highlighting.css"> | ||
|
||
|
||
<link rel="stylesheet" href="/css/components.css"> | ||
|
||
|
||
<link rel="stylesheet" href="/css/nav.css"> | ||
|
||
|
||
<link rel="stylesheet" href="/css/paginator.css"> | ||
|
||
|
||
<link rel="stylesheet" href="/css/footer.css"> | ||
|
||
|
||
<link rel="stylesheet" href="/css/post-list.css"> | ||
|
||
|
||
|
||
<link rel="stylesheet" href="/css/rainbow-banner.css"> | ||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="/css/toc.css"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="/css/post.css"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<!-- hexo injector head_end start --> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"> | ||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/style.css"> | ||
<!-- hexo injector head_end end --><meta name="generator" content="Hexo 5.3.0"></head> | ||
<body | ||
data-color-scheme="auto" | ||
data-uppercase-categories="true" | ||
|
||
data-rainbow-banner="true" | ||
data-rainbow-banner-shown="auto" | ||
data-rainbow-banner-month="6" | ||
data-rainbow-banner-colors="#e50000,#ff8d00,#ffee00,#008121,#004cff,#760188" | ||
|
||
data-config-root="/" | ||
|
||
data-toc="true" | ||
data-toc-max-depth="2" | ||
|
||
|
||
> | ||
<nav id="theme-nav"> | ||
<div class="inner"> | ||
<a class="title" href="/">Blog</a> | ||
<div class="nav-arrow"></div> | ||
<div class="nav-items"> | ||
<a class="nav-item nav-item-home" href="/">Home</a> | ||
|
||
|
||
<a class="nav-item" href="/archives">Archives</a> | ||
|
||
|
||
|
||
<a class="nav-item" href="/tags">Tags</a> | ||
|
||
|
||
|
||
<a class="nav-item" href="/categories">Categories</a> | ||
|
||
|
||
|
||
<a class="nav-item" href="/about">About</a> | ||
|
||
|
||
|
||
<a class="nav-item" target="_blank" rel="noopener" href="https://space.bilibili.com/344213153?spm_id_from=333.1007.0.0">Bilibili.</a> | ||
|
||
|
||
|
||
<a class="nav-item nav-item-github nav-item-icon" href="https://github.com/kinferiority" target="_blank" aria-label="GitHub"> </a> | ||
|
||
|
||
|
||
<a class="nav-item nav-item-search nav-item-icon" href="/search" target="_blank" aria-label="Search"> </a> | ||
|
||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<article class="post"> | ||
<div class="meta"> | ||
|
||
<div class="categories text-uppercase"> | ||
|
||
<a href="/categories/DL/">DL</a> | ||
|
||
</div> | ||
|
||
|
||
|
||
<div class="date" id="date"> | ||
<span>November</span> | ||
<span>7,</span> | ||
<span>2023</span> | ||
</div> | ||
|
||
|
||
<h2 class="title">深度学习框架</h2> | ||
</div> | ||
|
||
<div class="divider"></div> | ||
|
||
<div class="content"> | ||
<h1 id="DL-Project(总目录)"><a href="#DL-Project(总目录)" class="headerlink" title="DL Project(总目录)"></a>DL Project(总目录)</h1><h2 id="models(子目录)"><a href="#models(子目录)" class="headerlink" title="models(子目录)"></a>models(子目录)</h2><p><code>存放所有模型</code></p> | ||
<h3 id="model1-py"><a href="#model1-py" class="headerlink" title="model1.py"></a>model1.py</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"># 存放配置参数 </span><br><span class="line">class Configure: </span><br><span class="line"> def__init__(self,)</span><br><span class="line"></span><br><span class="line"> </span><br><span class="line"> # 定义模型</span><br><span class="line"> class Model(nn.Module):</span><br><span class="line"> def __init__(self, config):</span><br><span class="line"> super(Model, self).__init__()</span><br><span class="line"> # 定义网络结构</span><br><span class="line"> </span><br><span class="line"> # 定义传播函数</span><br><span class="line"> def forward(self,x):</span><br><span class="line"> </span><br><span class="line"> return</span><br></pre></td></tr></table></figure> | ||
|
||
|
||
<h3 id="untils-py"><a href="#untils-py" class="headerlink" title="untils.py"></a>untils.py</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># 存放各种工具函数</span><br><span class="line">例如利用sklearn包中的from sklearn.model_selection import train_test_split进行数据集划分</span><br><span class="line">eg:X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)</span><br><span class="line">X 和 y 是特征矩阵和标签,test_size 设置为0.2表示将数据集分成80%的训练集和20%的测试集,random_state 用于确保每次运行时得到相同的随机分割结果。</span><br></pre></td></tr></table></figure> | ||
<h3 id="train-py"><a href="#train-py" class="headerlink" title="train.py"></a>train.py</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"># 损失函数</span><br><span class="line"># 优化器</span><br><span class="line"></span><br><span class="line"># 训练</span><br><span class="line"># 开启训练模式</span><br><span class="line"># 进入多轮迭代</span><br><span class="line"># 将数据放入模型,需要先将数据转化为张量</span><br><span class="line"># 计算loss</span><br><span class="line"># 对结果进行处理,是二分类还是多分类</span><br><span class="line"># loss反向传播</span><br><span class="line"># 优化器调优</span><br><span class="line"># 计算正确率或者画损失函数图像 抑或者调用sklearn包中的工具 </span><br><span class="line">例如from sklearn.metrics import confusion_matrix, classification_report accuracy_score</span><br><span class="line">accuracy_score(y_pre,y_true)</span><br><span class="line"># 在多轮训练后,仍然没有得到提升后,停止训练,保存参数</span><br><span class="line"></span><br><span class="line"># 测试</span><br><span class="line"># 进入测试模式</span><br><span class="line"># 加载模型</span><br><span class="line"># 调用评估函数</span><br><span class="line"></span><br><span class="line"># 评估函数 用于动态计算输入的数据集的评价指标</span><br><span class="line"></span><br></pre></td></tr></table></figure> | ||
<h3 id="run-py"><a href="#run-py" class="headerlink" title="run.py"></a>run.py</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">from importlib import import_module</span><br><span class="line">import argparse</span><br><span class="line"></span><br><span class="line"># 配置命令行脚本参数</span><br><span class="line">parser = argparse.ArgumentParser(description=' ')</span><br><span class="line">parser.add_argument()</span><br><span class="line">parser.add_argument()</span><br><span class="line">args = parser.parse_args() # argparse 解析用户在命令行中输入的参数,并将这些参数的值存储在 args 对象中</span><br><span class="line"></span><br><span class="line">if __name__ == '__main__':</span><br><span class="line"> # 通过import_module进行模型切换</span><br><span class="line"></span><br><span class="line"> x = import_module('models.' + model_name)</span><br><span class="line"> config = x.Config(dataset, )</span><br></pre></td></tr></table></figure> | ||
|
||
</div> | ||
|
||
|
||
<div class="about"> | ||
<h1>About this Post</h1> | ||
<div class="details"> | ||
<p>This post is written by Kjr, licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc/4.0">CC BY-NC 4.0</a>.</p> | ||
</div> | ||
|
||
<p class="tags"> | ||
|
||
<i class="icon"></i> | ||
<a href="/tags/框架/" class="tag">#框架</a> | ||
</p> | ||
|
||
</div> | ||
|
||
|
||
<div class="container post-prev-next"> | ||
<a class="next"></a> | ||
|
||
<a href="/2023/11/07/%E5%85%B3%E4%BA%8E%E4%BD%BF%E7%94%A8SVM%E8%BF%9B%E8%A1%8C%E5%9E%83%E5%9C%BE%E7%9F%AD%E4%BF%A1%E5%88%86%E7%B1%BB%E7%9A%84%E5%9B%9E%E9%A1%BE/" class="prev"> | ||
<div> | ||
<div class="text"> | ||
<p class="label">Previous</p> | ||
<h3 class="title">关于使用SVM进行垃圾短信分类的回顾</> | ||
</div> | ||
</div> | ||
</a> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
|
||
</article> | ||
|
||
<footer> | ||
<div class="inner"> | ||
<div class="links"> | ||
|
||
<div class="group"> | ||
<h2 class="title">Blog</h2> | ||
|
||
<a href="/" class="item">Blog</a> | ||
|
||
<a href="/archives" class="item">Archives</a> | ||
|
||
<a href="/tags" class="item">Tags</a> | ||
|
||
<a href="/categories" class="item">Categories</a> | ||
|
||
<a href="/search" class="item">Search</a> | ||
|
||
<a href="/about" class="item">About</a> | ||
|
||
</div> | ||
|
||
<div class="group"> | ||
<h2 class="title">Me</h2> | ||
|
||
<a target="_blank" rel="noopener" href="https://github.com/kinferiority" class="item">GitHub</a> | ||
|
||
<a href="mailto:[email protected]" class="item">Email</a> | ||
|
||
</div> | ||
|
||
</div> | ||
<span>© 2023 Kjr<br>Powered by <a href="http://hexo.io/" target="_blank">Hexo</a> </span> | ||
|
||
|
||
<br> | ||
<div class="color-scheme-toggle" role="radiogroup" id="theme-color-scheme-toggle"> | ||
<label> | ||
<input type="radio" value="light"> | ||
<span>Light</span> | ||
</label> | ||
<label> | ||
<input type="radio" value="dark"> | ||
<span>Dark</span> | ||
</label> | ||
<label> | ||
<input type="radio" value="auto"> | ||
<span>Auto</span> | ||
</label> | ||
</div> | ||
|
||
</div> | ||
</footer> | ||
|
||
|
||
|
||
<script src="/js/main.js"></script> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<script src="https://unpkg.com/scrollreveal"></script> | ||
<script> | ||
window.addEventListener('load', () => { | ||
ScrollReveal({ delay: 250, reset: true, easing: 'cubic-bezier(0, 0, 0, 1)' }) | ||
ScrollReveal().reveal('.post-list-item .cover-img img') | ||
ScrollReveal().reveal('.post-list-item, .card, .content p img, .content .block-large img', { distance: '60px', origin: 'bottom', duration: 800 }) | ||
}) | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.