diff --git a/.gitignore b/.gitignore index 1a0d5b67..adf34231 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ .ipynb_checkpoints .DS_Store -.gitignore *.ipynb +.idea +.vscode +.history +node_modules +.vitepress/cache +.vitepress/dist \ No newline at end of file diff --git a/.nojekyll b/.nojekyll deleted file mode 100644 index e69de29b..00000000 diff --git a/.vitepress/config/en-us.ts b/.vitepress/config/en-us.ts new file mode 100644 index 00000000..1f645b2c --- /dev/null +++ b/.vitepress/config/en-us.ts @@ -0,0 +1,45 @@ +import { type DefaultTheme, defineConfig } from "vitepress" + +export default defineConfig({ + lang: "en-us", + title: "Deep Learning 500 Questions", + themeConfig: { + + sidebar: { + "/en-us/": { base: "/en-us/", items: sidebarGuide() }, + }, + + editLink: { + pattern: "https://github.com/scutan90/DeepLearning-500-questions/edit/master/:path", + text: "Edit this page on GitHub", + }, + + docFooter: { + prev: "Last Page", + next: "Next Page", + }, + + footer: { + message: "Released under the MIT License.", + copyright: "Copyright © 2018-present scutan90", + }, + + lastUpdated: { + text: "Last updated at", + formatOptions: { + dateStyle: "short", + timeStyle: "medium", + }, + }, + }, +}) + +export function sidebarGuide(): DefaultTheme.SidebarItem[] { + return [ + { text: "guide", link: "README" }, + { text: "Chapter 1", link: "ch01_MathematicalBasis/MathematicalBasis" }, + { text: "Chapter 2", link: "ch02_MachineLearningFoundation/TheBasisOfMachineLearning" }, + { text: "Chapter 3", link: "ch03_DeepLearningFoundation/DeepLearningFoundation" }, + { text: "Chapter 4", link: "ch04_ClassicNetwork/ClassicNetwork" }, + ] +} diff --git a/.vitepress/config/index.ts b/.vitepress/config/index.ts new file mode 100644 index 00000000..09862fb1 --- /dev/null +++ b/.vitepress/config/index.ts @@ -0,0 +1,19 @@ +import { defineConfig } from "vitepress" +import shared from "./shared" +import en_us, { sidebarGuide as EN_side } from "./en-us" +import zh_cn, { sidebarGuide as ZH_side } from "./zh-cn" +import handleRewrites from "../utils/rewrites" + +const en = { lang: "en-us", list: EN_side() } +const zh = { lang: "zh-cn", list: ZH_side() } +const rewrites = handleRewrites(en, zh) +// console.log(rewrites) + +export default defineConfig({ + ...shared, + locales: { + "en-us": { label: "English", ...en_us }, + root: { label: "简体中文", ...zh_cn }, + }, + // rewrites, +}) diff --git a/.vitepress/config/shared.ts b/.vitepress/config/shared.ts new file mode 100644 index 00000000..b8752842 --- /dev/null +++ b/.vitepress/config/shared.ts @@ -0,0 +1,27 @@ +import { defineConfig } from "vitepress" + +export default defineConfig({ + title: "深度学习500问", + + lastUpdated: true, + cleanUrls: true, + metaChunk: true, + + markdown: { + math: true, + }, + ignoreDeadLinks: true, + + themeConfig: { + socialLinks: [ + { icon: "github", link: "https://github.com/scutan90/DeepLearning-500-questions" }, + ], + }, + head: [ + ["meta", { property: "og:locale", content: "zh" }], + ], + + vite: { + assetsInclude: ["**/*.jpg", "**/*.jpeg", "**/*.bmp", "**/*.JPEG"], + }, +}) \ No newline at end of file diff --git a/.vitepress/config/zh-cn.ts b/.vitepress/config/zh-cn.ts new file mode 100644 index 00000000..9f39f762 --- /dev/null +++ b/.vitepress/config/zh-cn.ts @@ -0,0 +1,73 @@ +import { type DefaultTheme, defineConfig } from "vitepress" + +export default defineConfig({ + lang: "zh-cn", + themeConfig: { + + sidebar: { + "/": { base: "/", items: sidebarGuide() }, + }, + + editLink: { + pattern: "https://github.com/scutan90/DeepLearning-500-questions/edit/master/:path", + text: "在 GitHub 上编辑此页面", + }, + + docFooter: { + prev: "上一页", + next: "下一页", + }, + + footer: { + message: "基于 MIT 许可发布", + copyright: `版权所有 © 2018-${new Date().getFullYear()} scutan90`, + }, + + outline: { + label: "页面导航", + }, + + lastUpdated: { + text: "最后更新于", + formatOptions: { + dateStyle: "short", + timeStyle: "medium", + }, + }, + + langMenuLabel: "多语言", + returnToTopLabel: "回到顶部", + sidebarMenuLabel: "菜单", + darkModeSwitchLabel: "主题", + lightModeSwitchTitle: "切换到浅色模式", + darkModeSwitchTitle: "切换到深色模式", + }, +}) + +export function sidebarGuide(): DefaultTheme.SidebarItem[] { + return [ + { text: "简介", link: "README" }, + { text: "第一章", link: "ch01_数学基础/第一章_数学基础" }, + { text: "第二章", link: "ch02_机器学习基础/第二章_机器学习基础" }, + { text: "第三章", link: "ch03_深度学习基础/第三章_深度学习基础" }, + { text: "第四章", link: "ch04_经典网络/第四章_经典网络" }, + { text: "第五章", link: "ch05_卷积神经网络(CNN)/第五章_卷积神经网络(CNN)" }, + { text: "第六章", link: "ch06_循环神经网络(RNN)/第六章_循环神经网络(RNN)" }, + { text: "第七章", link: "ch07_生成对抗网络(GAN)/ch7" }, + { text: "第八章", link: "ch08_目标检测/第八章_目标检测" }, + { text: "第九章", link: "ch09_图像分割/第九章_图像分割" }, + { text: "第十章", link: "ch10_强化学习/第十章_强化学习" }, + { text: "第十一章", link: "ch11_迁移学习/第十一章_迁移学习" }, + { text: "第十二章", link: "ch12_网络搭建及训练/第十二章_网络搭建及训练" }, + { text: "第十三章", link: "ch13_优化算法/第十三章_优化算法" }, + { text: "第十四章", link: "ch14_超参数调整/第十四章_超参数调整" }, + { text: "第十五章", link: "ch15_GPU和框架选型/第十五章_异构运算、GPU及框架选型" }, + { text: "第十六章", link: "ch16_自然语言处理(NLP)/第十六章_NLP" }, + { text: "第十七章", link: "ch17_模型压缩、加速及移动端部署/第十七章_模型压缩、加速及移动端部署" }, + { text: "第十八章", link: "ch18_后端架构选型、离线及实时计算/第十八章_后端架构选型、离线及实时计算" }, + { text: "第十八章", link: "ch18_后端架构选型及应用场景/第十八章_后端架构选型及应用场景" }, + { text: "第十九章", link: "ch19_软件专利申请及权利保护/第十九章_软件专利申请及权利保护" }, + ] +} + + diff --git a/.vitepress/theme/custom.css b/.vitepress/theme/custom.css new file mode 100644 index 00000000..cf2596a3 --- /dev/null +++ b/.vitepress/theme/custom.css @@ -0,0 +1,7 @@ +pre, mjx-container { + overflow-x: auto; +} + +mjx-container { + position: static!important; +} \ No newline at end of file diff --git a/.vitepress/theme/index.js b/.vitepress/theme/index.js new file mode 100644 index 00000000..bb95ad62 --- /dev/null +++ b/.vitepress/theme/index.js @@ -0,0 +1,4 @@ +import DefaultTheme from "vitepress/theme" +import "./custom.css" + +export default DefaultTheme diff --git a/.vitepress/utils/rewrites.ts b/.vitepress/utils/rewrites.ts new file mode 100644 index 00000000..67cfaabc --- /dev/null +++ b/.vitepress/utils/rewrites.ts @@ -0,0 +1,25 @@ +import { DefaultTheme } from "vitepress" + +type Sidebars = DefaultTheme.SidebarItem[] + +interface ISides { + lang: string + list: Sidebars +} + +export default function rewrites(froms: ISides, tos: ISides) { + const from = froms.list.map(({ link }) => link) + const to = tos.list.map(({ link }) => link) + + const rewrites: Record = {} + + from.forEach((item, i) => { + rewrites[`${froms.lang}/${item}.md`] = `${froms.lang}/${to[i]}.md` + }) + + to.forEach((item, i) => { + rewrites[`${item}.md`] = `${from[i]}.md` + }) + + return rewrites +} diff --git a/English version/README.md b/English version/README.md deleted file mode 100644 index 4cd14414..00000000 --- a/English version/README.md +++ /dev/null @@ -1,1046 +0,0 @@ -# 500 Deep Learning Questions - -

- A comprehensive body of knowledge on Deep learning and Artificial Intelligence -

- -`500 Deep Learning Questions` is a collection of articles on the mathematical and technical aspects of Deep Learning and Artificial Intelligence that will help you build a strong foundation of knowledge in this domain. - -**Notes** -- Please help us improve this resource as mentioned in the [section on contributing](#contributing) -- Please respect the authors' intellectual property rights, and copyright. Piracy will be investigated - - Feel free to share the location of this content with others or fork the repository for contributing, but please ask for permission before copying and forwarding this content - -2018/06/27 TanJiyong, 2020/10/28 Arjun Krishna-University of Waterloo - -This was translated with Google Translate and partial human translation. Please help translate more of this resource to English as mentioned in the [section on contributing](#contributing) - -**Please star and share this project if you like it!** - -# Sections of README - -1. [Sections of README](#sections-of-readme) -2. [How to use this Resource](#how-to-use-this-resource) -3. [Contributing](#contributing) - 1. [How to help](#how-to-help) - 2. [Notes on contributing](#notes-on-contributing) -4. [Communication](#communication) -5. [Table of Contents](#table-of-contents) - - -# How to Use This Resource - -1. Go to the Language section that you are most comfortable with (e.g. English ) -2. Look at the Table of Contents and go the topics that you are most interested in or start from Chapter 1 -3. The best way to truly learn something is to apply it in practice - 1. If you have just read the section on Recurrent Neural Networks, ask yourself this: - 1. In what situations would I apply this? - 1. Speech recognition - 2. Translation - 2. What benefits does this machine learning technique have over others? - 3. What disdvantages does it have? - 4. Code a recurrent neural network in MatLab, or using Tensorflow or PyTorch - -# Contributing - -## How to help - -1. Translate articles (especially to English) -2. Edit previous translations for grammar and technical errors -3. Suggest or create new articles -4. Share this project with your friends who want to contribute -5. It is recommended to use the typora-Markdown reader: https://typora.io/ as mentioned in Notes on Contributing - -## Steps to contribute - -1. Fork the project -2. Make changes - 1. Reflect your name and affiliation when contributing in the format of 'Name-Affiliation' - - eg: Daxie-West Lake University, or Arjun Krishna-University of Waterloo -3. Review your changes for grammatical or technical errors -4. Preview formatting using the Typora Markdown Editor and Reader - 1. Recommended settings are in the section [Notes on Contributing](##notes-on-contributing) -5. Commit changes to your fork of the project -6. Create a pull request, clearly state what changes you made and why -7. Your changes will be reviewed -8. Congratulations! - -## Notes on contributing - -- We recommend that you use the Typora Markdown Editor and Reader to preview your changes before you create a pull request - - Recommended settings for Typora - - Setting: - - File->Preference - - - Syntax Support - - Inline Math - - Subscript - - Superscript - - Highlight - - Diagrams - - -## Example Contribution - - ### 3.3.2 How to find the optimal value of the hyperparameter? (Contributor: Daxie - Stanford University) - - There are always some difficult hyperparameters when using machine learning algorithms. For example, weight attenuation size, Gaussian kernel width, and so on. The algorithm does not set these parameters, but instead requires you to set their values. The set value has a large effect on the result. Common practices for setting hyperparameters are: - - 1. Guess and check: Select parameters based on experience or intuition, and iterate over. - 2. Grid Search: Let the computer try to evenly distribute a set of values within a certain range. - 3. Random search: Let the computer randomly pick a set of values. - 4. Bayesian optimization: Using Bayesian optimization of hyperparameters, it is difficult to meet the Bayesian optimization algorithm itself. - 5. Perform local optimization with good initial guessing: this is the MITIE method, which uses the BOBYQA algorithm and has a carefully chosen starting point. Since BOBYQA only looks for the nearest local optimal solution, the success of this method depends largely on whether there is a good starting point. In the case of MITIE, we know a good starting point, but this is not a universal solution, because usually you won't know where the good starting point is. On the plus side, this approach is well suited to finding local optimal solutions. I will discuss this later. - 6. The latest global optimization method for LIPO. This method has no parameters and is proven to be better than a random search method. - -## Communication - -1. Create an issue using the Github Bug Tracker -2. Email the project at: scutjy2015@163.com -3. Join the project's WeChat: - 1. It is easier to enter the group if you have made contributions and they have been integrated into this project - 2. "Deep Learning 500 Questions" - 1. please add WeChat Client 1: HQJ199508212176 Client 2: Xuwumin1203 Client 3: tianyuzy - -# Table of Contents - -Chapter 1 Mathematical Foundation 1 - -1.1 The relationship between scalars, vectors, and tensors 1 - -1.2 What is the difference between a tensor and matrix? 1 - -1.3 Matrix and vector multiplication results 1 - -1.4 Vector and matrix norm induction 1 - -1.5 How to judge a matrix to be positive? 2 - -1.6 Derivative Bias Calculation 3 - -1.7 What is the difference between 1.7 derivatives and partial derivatives? 3 - -1.8 Eigenvalue decomposition and feature vector 3 - -1.9 What is the relationship between singular values and eigenvalues? 4 - -1.10 Why should machine learning use probabilities? 4 - -1.11 What is the difference between a variable and a random variable? 4 - -1.12 Common probability distribution? 5 - -1.13 Example Understanding Conditional Probability 9 - -1.14 What is the difference between joint probability and edge probability? 10 - -1.15 Chain Law of Conditional Probability 10 - -1.16 Independence and conditional independence 11 - -1.17 Summary of Expectations, Variances, Covariances, Correlation Coefficients 11 - -Chapter 2 Fundamentals of Machine Learning 14 - -2.1 Various common algorithm illustrations 14 - -2.2 What is supervised learning, unsupervised learning, semi-supervised learning, and weak supervised learning? 15 - -2.3 What are the steps insupervised learning? 16 - -2.4 What is multi-instance learning? 17 - -2.5 What is the difference between classification networks and regression? 17 - -2.6 What is a neural network? 17 - -2.7 Advantages and Disadvantages of Common Classification Algorithms? 18 - -2.8 Is the correct rate good for evaluating classification algorithms? 20 - -2.9 How to evaluate a classification algorithm? 20 - -2.10 What kind of classifier is the best? 22 - -2.11 The relationship between big data and deep learning 22 - -2.12 Understanding Local Optimization and Global Optimization 23 - -2.13 Understanding Logistic Regression 24 - -2.14 What is the difference between logistic regression and a Naive Bayes Classifier? twenty four - -2.15 Why do you need a cost function? 25 - -2.16 Principle of the function of the cost function 25 - -2.17 Why is the cost function non-negative? 26 - -2.18 Common cost function? 26 - -2.19 Why use cross entropy instead of quadratic cost function? 28 - -2.20 What is a loss function? 28 - -2.21 Common loss function 28 - -2.22 Why does logistic regression use a logarithmic loss function? 30 - -2.22 How does the logarithmic loss function measure loss? 31 - -2.23 Why do gradients need to be reduced in machine learning? 32 - -2.24 What are the disadvantages of the gradient descent method? 32 - -2.25 Gradient descent method intuitive understanding? 32 - -2.23 What is the description of the gradient descent algorithm? 33 - -2.24 How to tune the gradient descent method? 35 - -2.25 What is the difference between random gradients and batch gradients? 35 - -2.26 Performance Comparison of Various Gradient Descent Methods 37 - -2.27 How to calculate the derivative calculation diagram of a graph? 37 - -2.28 Summary of thoughts on Linear Discriminant Analysis (LDA) 39 - -2.29 Ideas on Graphical LDA Core 39 - -2.30 What are the principles of the second class LDA algorithm? 40 - -2.30 LDA algorithm flow summary 41 - -2.31 What is the difference between LDA and PCA? 41 - -2.32 LDA advantages and disadvantages 41 - -2.33 Summary of thoughts on Principal Component Analysis (PCA) 42 - -2.34 Graphical PCA Core Ideas 42 - -2.35 PCA algorithm reasoning 43 - -2.36 Summary of PCA Algorithm Flow 44 - -2.37 Main advantages and disadvantages of PCA algorithm 45 - -2.38 Necessity and purpose of dimensionality reduction 45 - -2.39 What is the difference between KPCA and PCA? 46 - -2.40 Model Evaluation 47 - -2.40.1 Common methods for model evaluation? 47 - -2.40.2 Empirical error and generalization error 47 - -2.40.3 Graphic under-fitting, over-fitting 48 - -2.40.4 How to solve over-fitting and under-fitting? 49 - -2.40.5 The main role of cross-validation? 50 - -2.40.6 k fold cross validation? 50 - -2.40.7 Confusion Matrix 50 - -2.40.8 Error Rate and Accuracy 51 - -2.40.9 Precision and recall rate 51 - -2.40.10 ROC and AUC 52 - -2.40.11 How to draw ROC curve? 53 - -2.40.12 How to calculate TPR, FPR? 54 - -2.40.13 How to calculate Auc? 56 - -2.40.14 Why use Roc and Auc to evaluate the classifier? 56 - -2.40.15 Intuitive understanding of AUC 56 - -2.40.16 Cost-sensitive error rate and cost curve 57 - -2.40.17 What are the comparison test methods for the model 59 - -2.40.18 Deviation and variance 59 - -2.40.19 Why use standard deviation? 60 - -2.40.20 Point Estimation Thoughts 61 - -2.40.21 Point Estimation Goodness Principle 61 - -2.40.22 The connection between point estimation, interval estimation, and central limit theorem? 62 - -2.40.23 What causes the category imbalance? 62 - -2.40.24 Common Category Unbalance Problem Resolution 62 - -2.41 Decision Tree 64 - -2.41.1 Basic Principles of Decision Trees 64 - -2.41.2 Three elements of the decision tree? 64 - -2.41.3 Decision Tree Learning Basic Algorithm 65 - -2.41.4 Advantages and Disadvantages of Decision Tree Algorithms 65 - -2.40.5 Concept of entropy and understanding 66 - -2.40.6 Understanding of Information Gain 66 - -2.40.7 The role and strategy of pruning treatment? 67 - -2.41 Support Vector Machine 67 - -2.41.1 What is a support vector machine 67 - -2.25.2 What problems are solved by the support vector machine? 68 - -2.25.2 What doesthe kernel function do? 69 - -2.25.3 What is the Dual Problem? 69 - -2.25.4 Understanding Support Vector Regression 69 - -2.25.5 Understanding SVM (Nuclear Function) 69 - -2.25.6 What are common kernel functions? 69 - -2.25.6 Soft Interval and Regularization 73 - -2.25.7 Main features and disadvantages of SVM 73 - -2.26 Bayesian 74 - -2.26.1 Graphical Maximum Likelihood Estimate 74 - -2.26.2 What is the difference between a naive Bayes classifier and a general Bayesian classifier? 76 - -2.26.4 Plain and semi-simple Bayesian classifiers 76 - -2.26.5 Three typical structures of Bayesian network 76 - -2.26.6 What is the Bayesian error rate 76 - -2.26.7 What is the Bayesian optimal error rate? 76 - -2.27 EM algorithm to solve problems and implementation process 76 - -2.28 Why is there a dimensionality disaster? 78 - -2.29 How to avoid dimension disasters 82 - -2.30 What is the difference and connection between clustering and dimension reduction? 82 - -2.31 Differences between GBDT and random forests 83 - -2.32 Comparison of four clustering methods 84 - -Chapter 3 Fundamentals of Deep Learning 88 - -3.1 Basic Concepts 88 - -3.1.1 Neural network composition? 88 - -3.1.2 What are the common model structures of neural networks? 90 - -3.1.3 How to choose a deep learning development platform? 92 - -3.1.4 Why use deep representation? 92 - -3.1.5 Why is a deep neural network difficult to train? 93 - -3.1.6 What is the difference between deep learning and machine learning? 94 - -3.2 Network Operations and Calculations 95 - -3.2.1 Forward Propagation and Back Propagation 95 - -3.2.2 How to calculate the output of the neural network? 97 - -3.2.3 How to calculate the convolutional neural network output value? 98 - -3.2.4 How do I calculate the output value of the Pooling layer? 101 - -3.2.5 Example to help understand back propagation 102 - -3.3 Superparameters 105 - -3.3.1 What is a hyperparameter? 105 - -3.3.2 How to find the optimal value of the hyperparameter? 105 - -3.3.3 General procedure to find the optimal hyperparameter106 - -3.4 Activation function 106 - -3.4.1 Why do I need a nonlinear activation function? 106 - -3.4.2 Common Activation Functions and Images 107 - -3.4.3 Derivative calculation of common activation functions?109 - -3.4.4 What are the properties of the activation function? 110 - -3.4.5 How do I choose an activation function? 110 - -3.4.6 Advantages of using the ReLu activation function? 111 - -3.4.7 When can I use the linear activation function? 111 - -3.4.8 How to understand that Relu (<0) is a nonlinear activation function? 111 - -3.4.9 How does the Softmax function be applied to multiple classifications? 112 - -3.5 Batch_Size 113 - -3.5.1 Why do I need Batch_Size? 113 - -3.5.2 Selection of Batch_Size Values 114 - -3.5.3 What are the benefits of increasing Batch_Size within a reasonable range? 114 - -3.5.4 What is the disadvantage of blindly increasing Batch_Size? 114 - -3.5.5 What is the impact of Batch_Size on the training effect? 114 - -3.6 Normalization 115 - -3.6.1 What is the meaning of normalization? 115 - -3.6.2 Why Normalize?115 - -3.6.3 How can normalization improve the speed of training? 115 - -3.6.4 3D illustration of a non-normalized training set 116 - -3.6.5 What types of normalization are there? 117 - -3.6.6 Local response normalization - -Effect 117 - -3.6.7 Understanding the local response normalization formula 117 - -3.6.8 What is Batch Normalization 118 - -3.6.9 Advantages of the Batch Normalization (BN) Algorithm 119 - -3.6.10 Batch normalization (BN) algorithm flow 119 - -3.6.11 Batch normalization and group normalization 120 - -3.6.12 Weight Normalization and Batch Normalization 120 - -3.7 Pre-training and fine tuning 121 - -3.7.1 How can unsupervised pre-training help deep learning? 121 - -3.7.2 What is the model fine tuning fine tuning 121 - -3.7.3 Is the network parameter updated when fine tuning? 122 - -3.7.4 Three states of the fine-tuning model 122 - -3.8 Weight Deviation Initialization 122 - -3.8.1 All initialized to 0 122 - -3.8.2 All initialized to the same value 123 - -3.8.3 Initializing to a Small Random Number 124 - -3.8.4 Calibrating the variance with 1/sqrt(n) 125 - -3.8.5 Sparse Initialization (Sparse Initialazation) 125 - -3.8.6 Initialization deviation 125 - -3.9 Softmax 126 - -3.9.1 Softmax Definition and Function 126 - -3.9.2 Softmax Derivation 126 - -3.10 Understand the principles and functions of One Hot Encodeing? 126 - -3.11 What are the commonly used optimizers? 127 - -3.12 Dropout Series Issues 128 - -3.12.1 Choice of dropout rate 128 - -3.27 Padding Series Issues 128 - -Chapter 4 Classic Network 129 - -4.1 LetNet5 129 - -4.1.1 Model Structure 129 - -4.1.2 Model Structure 129 - -4.1.3 Model characteristics 131 - -4.2 AlexNet 131 - -4.2.1 Model structure 131 - -4.2.2 Model Interpretation 131 - -4.2.3 Model characteristics 135 - -4.3 Visualization ZFNet-Deconvolution 135 - -4.3.1 Basic ideas and processes 135 - -4.3.2 Convolution and Deconvolution 136 - -4.3.3 Convolution Visualization 137 - -4.3.4 Comparison of ZFNe and AlexNet 139 - -4.4 VGG 140 - -4.1.1 Model Structure 140 - -4.1.2 Model Features 140 - -4.5 Network in Network 141 - -4.5.1 Model Structure 141 - -4.5.2 Model Innovation Points 141 - -4.6 GoogleNet 143 - -4.6.1 Model Structure 143 - -4.6.2 Inception Structure 145 - -4.6.3 Model hierarchy 146 - -4.7 Inception Series 148 - -4.7.1 Inception v1 148 - -4.7.2 Inception v2 150 - -4.7.3 Inception v3 153 - -4.7.4 Inception V4 155 - -4.7.5 Inception-ResNet-v2 157 - -4.8 ResNet and its variants 158 - -4.8.1 Reviewing ResNet 159 - -4.8.2 residual block 160 - -4.8.3 ResNet Architecture 162 - -4.8.4 Variants of residual blocks 162 - -4.8.5 ResNeXt 162 - -4.8.6 Densely Connected CNN 164 - -4.8.7 ResNet as a combination of small networks 165 - -4.8.8 Features of Paths in ResNet 166 - -4.9 Why are the current CNN models adjusted on GoogleNet, VGGNet or AlexNet? 167 - -Chapter 5 Convolutional Neural Network (CNN) 170 - -5.1 Constitutive layers of convolutional neural networks 170 - -5.2 How does convolution detect edge information? 171 - -5.2 Several basic definitions of convolution? 174 - -5.2.1 Convolution kernel size 174 - -5.2.2 Step size of the convolution kernel 174 - -5.2.3 Edge Filling 174 - -5.2.4 Input and Output Channels 174 - -5.3 Convolution network type classification? 174 - -5.3.1 Ordinary Convolution 174 - -5.3.2 Expansion Convolution 175 - -5.3.3 Transposition Convolution 176 - -5.3.4 Separable Convolution 177 - -5.3 Schematic of 12 different types of 2D convolution? 178 - -5.4 What is the difference between 2D convolution and 3D convolution? 181 - -5.4.1 2D Convolution 181 - -5.4.2 3D Convolution 182 - -5.5 What are pooling methods? 183 - -5.5.1 General Pooling 183 - -5.5.2 Overlapping Pooling (OverlappingPooling) 184 - -5.5.3 Spatial Pyramid Pooling 184 - -5.6 1x1 convolution? 186 - -5.7 What is the difference between the convolutional layer and the pooled layer? 187 - -5.8 Does a larger convolution kernel, improve the kernel? 189 - -5.9 Can each convolution use only one size of convolution kernel? 189 - -5.10 How can I reduce the amount of convolutional parameters? 190 - -5.11 Must convolution operations consider both channels and zones? 191 - -5.12 What are the benefits of using wide convolution? 192 - -5.12.1 Narrow Convolution and Wide Convolution 192 - -5.12.2 Why use wide convolution? 192 - -5.13 Which depth of the convolutional layer output is the same as the number of parts? 192 - -5.14 How do I get the depth of the convolutional layer output? 193 - -5.15 Is the activation function usually placed after the operation of the convolutional neural network? 194 - -5.16 How do you understand that the maximum pooling layer is a little smaller? 194 - -5.17 Understanding Image Convolution and Deconvolution 194 - -5.17.1 Image Convolution 194 - -5.17.2 Image Deconvolution 196 - -5.18 Image Size Calculation after Different Convolutions? 198 - -5.18.1 Type division 198 - -5.18.2 Calculation formula 199 - -5.19 Step size, fill size and input and output relationship summary? 199 - -5.19.1 No 0 padding, unit step size 200 - -5.19.2 Zero fill, unit step size 200 - -5.19.3 Not filled, non-unit step size 202 - -5.19.4 Zero padding, non-unit step size 202 - -5.20 Understanding deconvolution and checkerboard effects 204 - -5.20.1 Why does the board phenomenon appear? 204 - -5.20.2 What methods can avoid the checkerboard effect? 205 - -5.21 CNN main calculation bottleneck? 207 - -5.22 CNN parameter experience setting 207 - -5.23 Summary of methods for improving generalization ability 208 - -5.23.1 Main methods 208 - -5.23.2 Experimental proof 208 - -5.24 What are the connections and differences between CNN and CLP? 213 - -5.24.1 Contact 213 - -5.24.2 Differences 213 - -5.25 Does CNN highlight commonality? 213 - -5.25.1 Local connection 213 - -5.25.2 Weight sharing 214 - -5.25.3 Pooling Operations 215 - -5.26 Similarities and differences between full convolution and Local-Conv 215 - -5.27 Example Understanding the Role of Local-Conv 215 - -5.28 Brief History of Convolutional Neural Networks 216 - -Chapter 6 Cyclic Neural Network (RNN) 218 - -6.1 What is the difference between RNNs and FNNs? 218 - -6.2 Typical characteristics of RNNs? 218 - -6.3 What can RNNs do? 219 - -6.4 Typical applications of RNNs in NLP? 220 - -6.5 What are the similarities and differences between RNNs training and traditional ANN training? 220 - -6.6 Common RNNs Extensions and Improvement Models 221 - -6.6.1 Simple RNNs (SRNs) 221 - -6.6.2 Bidirectional RNNs 221 - -6.6.3 Deep(Bidirectional) RNNs 222 - -6.6.4 Echo State Networks (ESNs) 222 - -6.6.5 Gated Recurrent Unit Recurrent Neural Networks 224 - -6.6.6 LSTM Netwoorks 224 - -6.6.7 Clockwork RNNs (CW-RNNs) 225 - -Chapter 7 Target Detection 228 - -7.1 Candidate-based target detector 228 - -7.1.1 Sliding Window Detector 228 - -7.1.2 Selective Search 229 - -7.1.3 R-CNN 230 - -7.1.4 Boundary Box Regressor 230 - -7.1.5 Fast R-CNN 231 - -7.1.6 ROI Pooling 233 - -7.1.7 Faster R-CNN 233 - -7.1.8 Candidate Area Network 234 - -7.1.9 Performance of the R-CNN method 236 - -7.2 Area-based full convolutional neural network (R-FCN) 237 - -7.3 Single Target Detector 240 - -7.3.1 Single detector 241 - -7.3.2 Sliding window for prediction 241 - -7.3.3 SSD 243 - -7.4 YOLO Series 244 - -7.4.1 Introduction to YOLOv1 244 - -7.4.2 What are the advantages and disadvantages of the YOLOv1 model? 252 - -7.4.3 YOLOv2 253 - -7.4.4 YOLOv2 Improvement Strategy 254 - -7.4.5 Training of YOLOv2 261 - -7.4.6 YOLO9000 261 - -7.4.7 YOLOv3 263 - -7.4.8 YOLOv3 Improvements 264 - -Chapter 8 Image Segmentation 269 - -8.1 What are the disadvantages of traditional CNN-based segmentation methods? 269 - -8.1 FCN 269 - -8.1.1 How has the FCN changed? 269 - -8.1.2 FCN network structure 270 - -8.1.3 Example of a full convolution network 271 - -8.1.4 Why is it difficult for CNN to classify pixels? 271 - -8.1.5 How do the fully connected and convolved layers transform each other? 272 - -8.1.6 Why can the input picture of the FCN be any size? 272 - -8.1.7 What are the benefits of reshaping the weight of the fully connected layer into a convolutional layer filter? 273 - -8.1.8 Deconvolutional Understanding 275 - -8.1.9 Skip structure 276 - -8.1.10 Model Training 277 - -8.1.11 FCN Disadvantages 280 - -8.2 U-Net 280 - -8.3 SegNet 282 - -8.4 Dilated Convolutions 283 - -8.4 RefineNet 285 - -8.5 PSPNet 286 - -8.6 DeepLab Series 288 - -8.6.1 DeepLabv1 288 - -8.6.2 DeepLabv2 289 - -8.6.3 DeepLabv3 289 - -8.6.4 DeepLabv3+ 290 - -8.7 Mask-R-CNN 293 - -8.7.1 Schematic diagram of the network structure of Mask-RCNN 293 - -8.7.2 RCNN pedestrian detection framework 293 - -8.7.3 Mask-RCNN Technical Highlights 294 - -8.8 Application of CNN in Image Segmentation Based on Weak Supervised Learning 295 - -8.8.1 Scribble tag 295 - -8.8.2 Image Level Marking 297 - -8.8.3 DeepLab+bounding box+image-level labels 298 - -8.8.4 Unified framework 299 - -Chapter IX Reinforcement Learning 301 - -9.1 Main features of intensive learning? 301 - -9.2 Reinforced Learning Application Examples 302 - -9.3 Differences between reinforcement learning and supervised learning and unsupervised learning 303 - -9.4 What are the main algorithms for reinforcement learning? 305 - -9.5 Deep Migration Reinforcement Learning Algorithm 305 - -9.6 Hierarchical Depth Reinforcement Learning Algorithm 306 - -9.7 Deep Memory Reinforcement Learning Algorithm 306 - -9.8 Multi-agent deep reinforcement learning algorithm 307 - -9.9 Strong depth - -Summary of learning algorithms 307 - -Chapter 10 Migration Learning 309 - -10.1 What is migration learning? 309 - -10.2 What is multitasking? 309 - -10.3 What is the significance of multitasking? 309 - -10.4 What is end-to-end deep learning? 311 - -10.5 End-to-end depth learning example? 311 - -10.6 What are the challenges of end-to-end deep learning? 311 - -10.7 End-to-end deep learning advantages and disadvantages? 312 - -Chapter 13 Optimization Algorithm 314 - -13.1 What is the difference between CPU and GPU? 314 - -13.2 What to do if you don't have enough training samples? 315 - -13.3 What sample sets are not suitable for deep learning? 315 - -13.4 Is it possible to find a better algorithm than the known algorithm? 316 - -13.5 What is collinearity and is there a correlation with the fit? 316 - -13.6 How is the generalized linear model applied in deep learning? 316 - -13.7 What causes the gradient to disappear? 317 - -13.8 What are the weight initialization methods? 317 - -13.9 How to avoid falling into the local optimal solution and move towards the global maximum in the heuristic optimization algorithm? 318 - -13.10 How to improve the Gradient Descent method in convex optimization to prevent locking in to a local optimal solution 319 - -13.11 What are some common loss functions? 319 - -13.14 How to select features 321 - -13.14.1 How to approacj feature selection 321 - -13.14.2 Classification of feature selection methods 321 - -13.14.3 Feature selection purpose 322 - -13.15 Gradient disappearance / Gradient explosion causes, and solutions 322 - -13.15.1 Why use gradient update rules? 322 - -13.15.2 Does the gradient disappear and what is the cause of the explosion? 323 - -13.15.3 Solutions for Gradient Disappearance and Explosion 324 - -13.16 Why does deep learning not use second-order optimization? - -13.17 How to optimize a deep learning system? 326 - -13.18 Why set a single numerical evaluation indicator? 326 - -13.19 Satisfiying and optimizing metrics 327 - -13.20 How to divide a dataset into training, development and test sets 328 - -13.21 How to set Development/Test Set Size 329 - -13.22 When should I change development and test sets and metrics? 329 - -13.23 What is the significance of setting the evaluation indicators? 330 - -13.24 What is the avoidance of deviation? 331 - -13.25 What is the TOP5 error rate? 331 - -13.26 What is the human error rate? 332 - -13.27 Can we avoid the relationship between deviation and several error rates? 332 - -13.28 How to choose to avoid deviation and Bayesian error rate? 332 - -13.29 How to reduce the variance? 333 - -13.30 Best estimate of Bayesian error rate 333 - -13.31 How many examples of machine learning are required before the algorithm surpasses human performance? 334 - -13.32 How can I improve my model? 334 - -13.33 Understanding Error Analysis 335 - -13.34 Why is it worth the time to look at the error flag data? 336 - -13.35 What is the significance of quickly setting up the initial system? 336 - -13.36 Why should I train and test on different divisions? 337 - -13.37 How to solve the data mismatch problem? 338 - -13.38 Gradient Test Considerations? 340 - -13.39 What is the random gradient drop? 341 - -13.40 What is the batch gradient drop? 341 - -13.41 What is the small batch gradient drop? 341 - -13.42 How to configure the mini-batch gradient to drop 342 - -13.43 Locally Optimal Problems 343 - -13.44 Improving Algorithm Performance Ideas 346 - -Chapter 14 Super Parameter Adjustment 358 - -14.1 Debugging Processing 358 - -14.2 What are the hyperparameters? 359 - -14.3 How do I choose a debug value? 359 - -14.4 Choosing the right range for hyperparameters 359 - -14.5 How do I search for hyperparameters? 359 - -Chapter 15 Heterogeneous Computing, GPU and Frame Selection Guide 361 - -15.1 What is heterogeneous computing? 361 - -15.2 What is a GPU? 361 - -15.3 Introduction to GPU Architecture 361 - - 15.3.1 Why use a GPU? - - 15.3.2 What is the core of CUDA? - - 15.3.3 What is the role of the tensor core in the new Turing architecture for deep learning? - - 15.3.4 What is the connection between GPU memory architecture and application performance? - -15.4 CUDA framework - - 15.4.1 Is it difficult to do CUDA programming? - - 15.4.2 cuDNN - -15.5 GPU hardware environment configuration recommendation - - 15.5.1 GPU Main Performance Indicators - - 15.5.2 Purchase Proposal - -15.6 Software Environment Construction - - 15.6.1 Operating System Selection - - 15.6.2 Is the native installation still using docker? - - 15.6.3 GPU Driver Issues - -15.7 Frame Selection - - 15.7.1 Comparison of mainstream frameworks - - 15.7.2 Framework details - - 15.7.3 Which frameworks are friendly to the deployment environment? - - 15.7.4 How to choose the framework of the mobile platform? - -15.8 Other - - 15.8.1 Configuration of a Multi-GPU Environment - - 15.8.2 Is it possible to distribute training? - - 15.8.3 Can I train or deploy a model in a SPARK environment? - - 15.8.4 How to further optimize performance? - - 15.8.5 What is the difference between TPU and GPU? - - 15.8.6 What is the impact of future quantum computing on AI technology such as deep learning? - -References 366 - -Thanks for reading this far. - -Hey! you look like a cool developer, - -Please help translate this project to English. Thanks! diff --git a/English version/ch04_ClassicNetwork/img/ch4/image21.jpeg b/English version/ch04_ClassicNetwork/img/ch4/image21.jpeg deleted file mode 100644 index 6afa65c4..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image21.jpeg and /dev/null differ diff --git a/English version/ch04_ClassicNetwork/img/ch4/image23.jpeg b/English version/ch04_ClassicNetwork/img/ch4/image23.jpeg deleted file mode 100644 index 5aa4af00..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image23.jpeg and /dev/null differ diff --git a/English version/ch04_ClassicNetwork/img/ch4/image31.png b/English version/ch04_ClassicNetwork/img/ch4/image31.png deleted file mode 100644 index 5d238865..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image31.png and /dev/null differ diff --git a/English version/ch04_ClassicNetwork/img/ch4/image32.png b/English version/ch04_ClassicNetwork/img/ch4/image32.png deleted file mode 100644 index 7b463dae..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image32.png and /dev/null differ diff --git a/English version/ch04_ClassicNetwork/img/ch4/image34.png b/English version/ch04_ClassicNetwork/img/ch4/image34.png deleted file mode 100644 index 95016085..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image34.png and /dev/null differ diff --git a/English version/ch04_ClassicNetwork/img/ch4/image35.png b/English version/ch04_ClassicNetwork/img/ch4/image35.png deleted file mode 100644 index 083675ca..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image35.png and /dev/null differ diff --git a/English version/ch04_ClassicNetwork/img/ch4/image36.png b/English version/ch04_ClassicNetwork/img/ch4/image36.png deleted file mode 100644 index 404390cf..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image36.png and /dev/null differ diff --git a/English version/ch04_ClassicNetwork/img/ch4/image37.png b/English version/ch04_ClassicNetwork/img/ch4/image37.png deleted file mode 100644 index 6f163002..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image37.png and /dev/null differ diff --git a/English version/ch04_ClassicNetwork/img/ch4/image38.png b/English version/ch04_ClassicNetwork/img/ch4/image38.png deleted file mode 100644 index 2bed01bc..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image38.png and /dev/null differ diff --git a/English version/ch04_ClassicNetwork/img/ch4/image46.png b/English version/ch04_ClassicNetwork/img/ch4/image46.png deleted file mode 100644 index 3dbb5118..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image46.png and /dev/null differ diff --git a/English version/ch04_ClassicNetwork/img/ch4/image47.png b/English version/ch04_ClassicNetwork/img/ch4/image47.png deleted file mode 100644 index adcebabd..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image47.png and /dev/null differ diff --git a/English version/ch04_ClassicNetwork/img/ch4/image63.png b/English version/ch04_ClassicNetwork/img/ch4/image63.png deleted file mode 100644 index 38167b0c..00000000 Binary files a/English version/ch04_ClassicNetwork/img/ch4/image63.png and /dev/null differ diff --git a/README.md b/README.md index d2d0a582..2d8be79a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,25 @@ +- [vitepress](https://vitepress.dev) + +## Installation +- **Node.js:** [Home Page](https://nodejs.org) +- **pnpm?:** [Home Page](https://pnpm.io/zh/) + +```bash +npm install -g pnpm +pnpm install +``` + +## Run +```bash +pnpm dev +``` + +## Preview +```bash +pnpm preview +``` + # 京东售卖链接:https://item.jd.com/12785031.html # 京东商城100多家书店有现货。 diff --git a/_sidebar.md b/_sidebar.md deleted file mode 100644 index 77912157..00000000 --- a/_sidebar.md +++ /dev/null @@ -1,22 +0,0 @@ -* [简介]() -* [1. 第一章 数学基础](ch01_数学基础/第一章_数学基础.md) -* [2. 第二章 机器学习基础](ch02_机器学习基础/第二章_机器学习基础.md) -* [3. 第三章 深度学习基础](ch03_深度学习基础/第三章_深度学习基础.md) -* [4. 第四章 经典网络](ch04_经典网络/第四章_经典网络.md) -* [5. 第五章 卷积神经网络(CNN)](ch05_卷积神经网络(CNN)/第五章_卷积神经网络(CNN).md) -* [6. 第六章 循环神经网络(RNN)](ch06_循环神经网络(RNN)/第六章_循环神经网络(RNN).md) -* [7. 第七章 生成对抗网络(GAN)](ch07_生成对抗网络(GAN)/ch7.md) -* [8. 第八章 目标检测](ch08_目标检测/第八章_目标检测.md) -* [9. 第九章 图像分割](ch09_图像分割/第九章_图像分割.md) -* [10. 第十章 强化学习](ch10_强化学习/第十章_强化学习.md) -* [11. 第十一章 迁移学习](ch11_迁移学习/第十一章_迁移学习.md) -* [12. 第十二章 网络搭建及训练](ch12_网络搭建及训练/第十二章_网络搭建及训练.md) -* [13. 第十三章 优化算法](ch13_优化算法/第十三章_优化算法.md) -* [14. 第十四章 超参数调整](ch14_超参数调整/第十四章_超参数调整.md) -* [15. 第十五章 异构运算、GPU及框架选型](ch15_GPU和框架选型/第十五章_异构运算、GPU及框架选型.md) -* [16. 第十六章 自然语言处理](ch16_自然语言处理(NLP)/第十六章_NLP.md) -* [17. 第十七章 模型压缩、加速及移动端部署](ch17_模型压缩、加速及移动端部署/第十七章_模型压缩、加速及移动端部署.md) -* [18. 第十八章 后端架构选型、离线及实时计算](ch18_后端架构选型、离线及实时计算/第十八章_后端架构选型、离线及实时计算.md) -* [19. 第十八章 后端架构选型及应用场景](ch18_后端架构选型及应用场景/第十八章_后端架构选型及应用场景.md) -* [20. 第十九章 软件专利申请及权利保护](ch19_软件专利申请及权利保护/第十九章_软件专利申请及权利保护.md) - diff --git "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/conditional_probability.jpg" "b/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/conditional_probability.jpg" deleted file mode 100644 index 549310d0..00000000 Binary files "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/conditional_probability.jpg" and /dev/null differ diff --git "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_1.png" "b/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_1.png" deleted file mode 100644 index 308c16de..00000000 Binary files "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_1.png" and /dev/null differ diff --git "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_2.png" "b/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_2.png" deleted file mode 100644 index 19515432..00000000 Binary files "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_2.png" and /dev/null differ diff --git "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_3.png" "b/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_3.png" deleted file mode 100644 index 4303cd9d..00000000 Binary files "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_3.png" and /dev/null differ diff --git "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_4.png" "b/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_4.png" deleted file mode 100644 index 2533f214..00000000 Binary files "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_4.png" and /dev/null differ diff --git "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_5.png" "b/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_5.png" deleted file mode 100644 index 5c5e6544..00000000 Binary files "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_5.png" and /dev/null differ diff --git "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_6.png" "b/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_6.png" deleted file mode 100644 index 8946ebc5..00000000 Binary files "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_6.png" and /dev/null differ diff --git "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_7.png" "b/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_7.png" deleted file mode 100644 index 7b637f0b..00000000 Binary files "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/img/ch1/prob_distribution_7.png" and /dev/null differ diff --git "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/\347\254\254\344\270\200\347\253\240_\346\225\260\345\255\246\345\237\272\347\241\200.md" "b/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/\347\254\254\344\270\200\347\253\240_\346\225\260\345\255\246\345\237\272\347\241\200.md" index 7243dae1..3e8afe71 100644 --- "a/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/\347\254\254\344\270\200\347\253\240_\346\225\260\345\255\246\345\237\272\347\241\200.md" +++ "b/ch01_\346\225\260\345\255\246\345\237\272\347\241\200/\347\254\254\344\270\200\347\253\240_\346\225\260\345\255\246\345\237\272\347\241\200.md" @@ -313,7 +313,7 @@ $$ P(A|B) = P(A\cap B) / P(B) $$ 说明:在同一个样本空间$\Omega$中的事件或者子集$A$与$B$,如果随机从$\Omega$中选出的一个元素属于$B$,那么下一个随机选择的元素属于$A$ 的概率就定义为在$B$的前提下$A$的条件概率。条件概率文氏图示意如图1.1所示。 -![条件概率](img/ch1/conditional_probability.jpg) +![条件概率](/assets/ch1/conditional_probability.jpg) 图1.1 条件概率文氏图示意 diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-1.png" deleted file mode 100644 index 38d1b589..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-10.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-10.png" deleted file mode 100644 index ab9b095c..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-10.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-11.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-11.png" deleted file mode 100644 index 5ab57c87..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-11.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-12.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-12.png" deleted file mode 100644 index 38f9b1a6..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-12.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-13.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-13.png" deleted file mode 100644 index d0317d33..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-13.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-14.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-14.png" deleted file mode 100644 index 53cb70ed..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-14.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-15.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-15.png" deleted file mode 100644 index fbbd76af..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-15.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-16.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-16.png" deleted file mode 100644 index 614c3872..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-16.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-17.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-17.png" deleted file mode 100644 index e00c9b63..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-17.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-18.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-18.jpg" deleted file mode 100644 index 3438ca2e..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-18.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-19.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-19.jpg" deleted file mode 100644 index b5e4f7c7..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-19.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-2.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-2.png" deleted file mode 100644 index 8bbc66cd..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-2.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-20.gif" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-20.gif" deleted file mode 100644 index 3b8fbfdb..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-20.gif" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-21.gif" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-21.gif" deleted file mode 100644 index 2bca00e1..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-21.gif" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-22.gif" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-22.gif" deleted file mode 100644 index bc986b15..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-22.gif" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-4.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-4.png" deleted file mode 100644 index 72282893..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-4.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-5.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-5.png" deleted file mode 100644 index 40111f8f..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-5.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-6.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-6.png" deleted file mode 100644 index f555a6b6..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-6.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-7.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-7.png" deleted file mode 100644 index a472df88..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-7.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-8.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-8.png" deleted file mode 100644 index be239e6f..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-8.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-9.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-9.png" deleted file mode 100644 index 31e457fc..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2-9.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/1.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/1.jpg" deleted file mode 100644 index 13d8e28d..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/1.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/10.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/10.jpg" deleted file mode 100644 index ccd1eeda..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/10.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/12.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/12.jpg" deleted file mode 100644 index d62b27bc..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/12.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/2.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/2.jpg" deleted file mode 100644 index c158a94d..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/2.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/3.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/3.jpg" deleted file mode 100644 index 918b8bb2..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/3.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/4.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/4.png" deleted file mode 100644 index ddc43d47..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/4.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/5.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/5.jpg" deleted file mode 100644 index 3f93149f..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/5.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/6.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/6.jpg" deleted file mode 100644 index f91f6259..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/6.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/7.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/7.jpg" deleted file mode 100644 index d4d1281f..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/7.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/8.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/8.jpg" deleted file mode 100644 index 6ccddac2..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/8.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/9.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/9.png" deleted file mode 100644 index 19201b56..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.1/9.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.17-1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.17-1.png" deleted file mode 100644 index 83915ea4..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.17-1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.17-2.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.17-2.png" deleted file mode 100644 index ca5e2c41..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.17-2.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.17-3.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.17-3.png" deleted file mode 100644 index 511492ce..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.17-3.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.18.1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.18.1.png" deleted file mode 100644 index 23b150ed..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.18.1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.20.1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.20.1.png" deleted file mode 100644 index acc95fb4..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.20.1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.4.1.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.4.1.jpg" deleted file mode 100644 index 51a16bcb..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.4.1.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.4.2.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.4.2.png" deleted file mode 100644 index d74817f7..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.4.2.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.4.3.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.4.3.png" deleted file mode 100644 index 42e4cee4..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16.4.3.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16/1.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16/1.jpg" deleted file mode 100644 index 64794617..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16/1.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16/2.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16/2.jpg" deleted file mode 100644 index e8e8f9ce..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.16/2.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.18/1.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.18/1.jpg" deleted file mode 100644 index a14454c4..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.18/1.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.1.1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.1.1.png" deleted file mode 100644 index 3fd7fd8f..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.1.1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.5A.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.5A.jpg" deleted file mode 100644 index a6c5feb7..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.5A.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.5B.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.5B.jpg" deleted file mode 100644 index ad455db6..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.5B.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.5C.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.5C.png" deleted file mode 100644 index 5e499e4e..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.19.5C.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.09.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.09.png" deleted file mode 100644 index 94e91922..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.09.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.10.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.10.png" deleted file mode 100644 index c8b9935b..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.10.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.11.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.11.png" deleted file mode 100644 index 750c2e34..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.11.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.12.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.12.png" deleted file mode 100644 index 9357b0a4..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.12.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.4.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.4.png" deleted file mode 100644 index e1e166dc..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.4.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.8.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.8.png" deleted file mode 100644 index 234f4d18..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.2.8.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.20.1.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.20.1.jpg" deleted file mode 100644 index efb4f6fc..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.20.1.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.1.png" deleted file mode 100644 index b6205fa9..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.2.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.2.png" deleted file mode 100644 index ef734236..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.2.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.3.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.3.png" deleted file mode 100644 index 246ec05e..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.3.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.4.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.4.png" deleted file mode 100644 index 70a1d786..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.4.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.5.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.5.png" deleted file mode 100644 index 61bd081e..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.5.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.6.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.6.png" deleted file mode 100644 index 620857bb..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.6.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.6a.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.6a.png" deleted file mode 100644 index 85755d61..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.6a.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.7.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.7.png" deleted file mode 100644 index 40fbf900..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.1.7.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.3.1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.3.1.png" deleted file mode 100644 index 1b7c8051..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.21.3.1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.25/1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.25/1.png" deleted file mode 100644 index b736f4d8..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.25/1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.27/1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.27/1.png" deleted file mode 100644 index 27440a49..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.27/1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.27/2.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.27/2.png" deleted file mode 100644 index fd3465ef..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.27/2.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.29/1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.29/1.png" deleted file mode 100644 index a3c751d1..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.29/1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.34/1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.34/1.png" deleted file mode 100644 index fff539b7..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.34/1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.10/1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.10/1.png" deleted file mode 100644 index 04e82ec7..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.10/1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.11/1.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.11/1.jpg" deleted file mode 100644 index c928da5d..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.11/1.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.15/1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.15/1.png" deleted file mode 100644 index 2bf0c1d8..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.15/1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/1.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/1.jpg" deleted file mode 100644 index 51a16bcb..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/1.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/1.png" deleted file mode 100644 index 0a1fa4a3..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/2.20.1.jpg" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/2.20.1.jpg" deleted file mode 100644 index 05e9ebe2..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/2.20.1.jpg" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/2.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/2.png" deleted file mode 100644 index d74817f7..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/2.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/3.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/3.png" deleted file mode 100644 index 42e4cee4..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.40.3/3.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.5.1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.5.1.png" deleted file mode 100644 index 3eb29bcd..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.5.1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.6/1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.6/1.png" deleted file mode 100644 index 94f75b0c..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.6/1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.7.3.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.7.3.png" deleted file mode 100644 index 98257154..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.7.3.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.9/1.png" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.9/1.png" deleted file mode 100644 index 7a93ae57..00000000 Binary files "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/img/ch2/2.9/1.png" and /dev/null differ diff --git "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/\347\254\254\344\272\214\347\253\240_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200.md" "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/\347\254\254\344\272\214\347\253\240_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200.md" index 9c2116e2..17e48f77 100644 --- "a/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/\347\254\254\344\272\214\347\253\240_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200.md" +++ "b/ch02_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200/\347\254\254\344\272\214\347\253\240_\346\234\272\345\231\250\345\255\246\344\271\240\345\237\272\347\241\200.md" @@ -28,7 +28,7 @@ **神经网络架构** ​ 图2-1就是一个神经网络系统,它由很多层组成。输入层负责接收信息,比如一只猫的图片。输出层是计算机对这个输入信息的判断结果,它是不是猫。隐藏层就是对输入信息的传递和加工处理。 -![图2-2 神经网络系统](img/ch2/2.5.1.png) +![图2-2 神经网络系统](/assets/ch2/2.5.1.png) ​ 图2-1 神经网络系统 @@ -38,19 +38,19 @@ | 回归算法 | 聚类算法 | 正则化方法 | | :----------------------: | :----------------------: | :----------------------: | -| ![](img/ch2/2.1/1.jpg) | ![](img/ch2/2.1/2.jpg) | ![](img/ch2/2.1/3.jpg) | +| ![](/assets/ch2/2.1/1.jpg) | ![](/assets/ch2/2.1/2.jpg) | ![](/assets/ch2/2.1/3.jpg) | | 决策树学习 | 贝叶斯方法 | 基于核的算法 | | :----------------------: | :----------------------: | :----------------------: | -| ![](img/ch2/2.2.4.png) | ![](img/ch2/2.1/5.jpg) | ![](img/ch2/2.1/6.jpg) | +| ![](/assets/ch2/2.2.4.png) | ![](/assets/ch2/2.1/5.jpg) | ![](/assets/ch2/2.1/6.jpg) | | 聚类算法 | 关联规则学习 | 人工神经网络 | | :----------------------: | :----------------------: | :-----------------------: | -| ![](img/ch2/2.1/7.jpg) | ![](img/ch2/2.2.8.png) | ![](img/ch2/2.2.09.png) | +| ![](/assets/ch2/2.1/7.jpg) | ![](/assets/ch2/2.2.8.png) | ![](/assets/ch2/2.2.09.png) | | 深度学习 | 降低维度算法 | 集成算法 | | :-----------------------: | :-----------------------: | :-----------------------: | -| ![](img/ch2/2.2.10.png) | ![](img/ch2/2.2.11.png) | ![](img/ch2/2.2.12.png) | +| ![](/assets/ch2/2.2.10.png) | ![](/assets/ch2/2.2.11.png) | ![](/assets/ch2/2.2.12.png) | ​ 图2-2 各种常见算法图示 @@ -58,7 +58,7 @@ ​ 计算图导数计算是反向传播,利用链式法则和隐式函数求导。 -​ 假设 $z = f(u,v)$ 在点 $(u,v)$ 处偏导连续,$(u,v)$是关于 $t$ 的函数,在 $t$ 点可导,求 $z$ 在 $t$ 点的导数。 +​ 假设$z = f(u,v)$在点$(u,v)$处偏导连续,$(u,v)$是关于$t$的函数,在$t$点可导,求$z$在$t$点的导数。 根据链式法则有 $$ @@ -207,7 +207,7 @@ $$ ​ 表2-2 四个术语的混淆矩阵 -![图2-3 术语的混淆矩阵](img/ch2/2.9/1.png) +![图2-3 术语的混淆矩阵](/assets/ch2/2.9/1.png) 表2-2是这四个术语的混淆矩阵,做以下说明: 1)P=TP+FN表示实际为正例的样本个数。 @@ -251,9 +251,9 @@ $$ - **ROC曲线和PR曲线** - 如图2-3,ROC曲线是(Receiver Operating Characteristic Curve,受试者工作特征曲线)的简称,是以灵敏度(真阳性率)为纵坐标,以1减去特异性(假阳性率)为横坐标绘制的性能评价曲线。可以将不同模型对同一数据集的ROC曲线绘制在同一笛卡尔坐标系中,ROC曲线越靠近左上角,说明其对应模型越可靠。也可以通过ROC曲线下面的面积(Area Under Curve, AUC)来评价模型,AUC越大,模型越可靠。 - -![](img/ch2/2.7.3.png) + 如图2-3,ROC曲线是(Receiver Operating Characteristic Curve,受试者工作特征曲线)的简称,是以灵敏度(真阳性率)为纵坐标,以1减去特异性(假阳性率)为横坐标绘制的性能评价曲线。 + 可以将不同模型对同一数据集的ROC曲线绘制在同一笛卡尔坐标系中,ROC曲线越靠近左上角,说明其对应模型越可靠。也可以通过ROC曲线下面的面积(Area Under Curve, AUC)来评价模型,AUC越大,模型越可靠。 + ![](/assets/ch2/2.7.3.png) ​ 图2-3 ROC曲线 @@ -308,15 +308,15 @@ $$ 举例: -判别式模型举例:要确定一个羊是山羊还是绵羊,用判别模型的方法是从历史数据中学习到模型,然后通过提取这只羊的特征来预测出这只羊是山羊的概率,是绵羊的概率。 +- 判别式模型举例:要确定一个羊是山羊还是绵羊,用判别模型的方法是从历史数据中学习到模型,然后通过提取这只羊的特征来预测出这只羊是山羊的概率,是绵羊的概率。 -生成式模型举例:利用生成模型是根据山羊的特征首先学习出一个山羊的模型,然后根据绵羊的特征学习出一个绵羊的模型,然后从这只羊中提取特征,放到山羊模型中看概率是多少,在放到绵羊模型中看概率是多少,哪个大就是哪个。 +- 生成式模型举例:利用生成模型是根据山羊的特征首先学习出一个山羊的模型,然后根据绵羊的特征学习出一个绵羊的模型,然后从这只羊中提取特征,放到山羊模型中看概率是多少,在放到绵羊模型中看概率是多少,哪个大就是哪个。 联系和区别: - 生成方法的特点:上面说到,生成方法学习联合概率密度分布P(X,Y),所以就可以从统计的角度表示数据的分布情况,能够反映同类数据本身的相似度。但它不关心到底划分各类的那个分类边界在哪。生成方法可以还原出联合概率分布P(Y,X),而判别方法不能。生成方法的学习收敛速度更快,即当样本容量增加的时候,学到的模型可以更快的收敛于真实模型,当存在隐变量时,仍可以用生成方法学习。此时判别方法就不能用。 +- 生成方法的特点:上面说到,生成方法学习联合概率密度分布P(X,Y),所以就可以从统计的角度表示数据的分布情况,能够反映同类数据本身的相似度。但它不关心到底划分各类的那个分类边界在哪。生成方法可以还原出联合概率分布P(Y,X),而判别方法不能。生成方法的学习收敛速度更快,即当样本容量增加的时候,学到的模型可以更快的收敛于真实模型,当存在隐变量时,仍可以用生成方法学习。此时判别方法就不能用。 - 判别方法的特点:判别方法直接学习的是决策函数Y=f(X)或者条件概率分布P(Y|X)。不能反映训练数据本身的特性。但它寻找不同类别之间的最优分类面,反映的是异类数据之间的差异。直接面对预测,往往学习的准确率更高。由于直接学习P(Y|X)或P(X),可以对数据进行各种程度上的抽象、定义特征并使用特征,因此可以简化学习问题。 +- 判别方法的特点:判别方法直接学习的是决策函数Y=f(X)或者条件概率分布P(Y|X)。不能反映训练数据本身的特性。但它寻找不同类别之间的最优分类面,反映的是异类数据之间的差异。直接面对预测,往往学习的准确率更高。由于直接学习P(Y|X)或P(X),可以对数据进行各种程度上的抽象、定义特征并使用特征,因此可以简化学习问题。 ​ 最后,由生成模型可以得到判别模型,但由判别模型得不到生成模型。 @@ -336,7 +336,7 @@ $$ 线性回归与逻辑回归的区别如下描述: -(1)线性回归的样本的输出,都是连续值,$ y\in (-\infty ,+\infty )$,而逻辑回归中$y\in (0,1)$,只能取0和1。 +(1)线性回归的样本的输出,都是连续值,$y\in (-\infty ,+\infty )$,而逻辑回归中$y\in (0,1)$,只能取0和1。 (2)对于拟合函数也有本质上的差别: @@ -351,10 +351,10 @@ $$ ​ $\theta ^{T}x=0$就相当于是1类和0类的决策边界: -​ 当$\theta ^{T}x>0$,则y>0.5;若$\theta ^{T}x\rightarrow +\infty $,则$y \rightarrow 1 $,即y为1类; +​ 当$\theta ^{T}x>0$,则y>0.5;若$\theta ^{T}x\rightarrow +\infty$,则$y \rightarrow 1$,即y为1类; -​ 当$\theta ^{T}x<0$,则y<0.5;若$\theta ^{T}x\rightarrow -\infty $,则$y \rightarrow 0 $,即y为0类; +​ 当$\theta ^{T}x<0$,则y<0.5;若$\theta ^{T}x\rightarrow -\infty$,则$y \rightarrow 0$,即y为0类; 这个时候就能看出区别,在线性回归中$\theta ^{T}x$为预测值的拟合函数;而在逻辑回归中$\theta ^{T}x$为决策边界。下表2-3为线性回归和逻辑回归的区别。 @@ -363,7 +363,7 @@ $$ | | 线性回归 | 逻辑回归 | |:-------------:|:-------------:|:-----:| | 目的 | 预测 |分类 | -| $y^{(i)}$ | 未知 | (0,1)| +| $y^{(i)}$ | 未知 | (0,1)| | 函数 | 拟合函数 | 预测函数 | | 参数计算方式| 最小二乘法 | 极大似然估计 | @@ -383,9 +383,9 @@ $$ ### 2.10.2 代价函数作用原理 ​ 在回归问题中,通过代价函数来求解最优解,常用的是平方误差代价函数。假设函数图像如图2-4所示,当参数发生变化时,假设函数状态也会随着变化。 -![](img/ch2/2.16/1.jpg) +![](/assets/ch2/2.16/1.jpg) -​ 图2-4 $h(x) = A + Bx$函数示意图 +​ 图2-4 $h(x) = A + Bx$函数示意图 ​ 想要拟合图中的离散点,我们需要尽可能找到最优的$A$和$B$来使这条直线更能代表所有数据。如何找到最优解呢,这就需要使用代价函数来求解,以平方误差代价函数为例,假设函数为$h(x)=\theta_0x$。 ​ **平方误差代价函数的主要思想**就是将实际数据给出的值与拟合出的线的对应值做差,求出拟合出的直线与实际的差距。在实际应用中,为了避免因个别极端数据产生的影响,采用类似方差再取二分之一的方式来减小个别数据的影响。因此,引出代价函数: @@ -396,7 +396,7 @@ $$ ​ **最优解即为代价函数的最小值**$\min J(\theta_0, \theta_1)$。如果是1个参数,代价函数一般通过二维曲线便可直观看出。如果是2个参数,代价函数通过三维图像可看出效果,参数越多,越复杂。 当参数为2个时,代价函数是三维图像,如下图2-5所示。 -![](img/ch2/2.16/2.jpg) +![](/assets/ch2/2.16/2.jpg) ​ 图2-5 代价函数三维图像 @@ -424,7 +424,7 @@ $$ *注*:神经网络常用的激活函数为sigmoid函数,该函数的曲线如下图2-6所示: -![](img/ch2/2.18/1.jpg) +![](/assets/ch2/2.18/1.jpg) ​ 图2-6 sigmoid函数曲线 @@ -455,14 +455,13 @@ $$ 与sigmoid搭配使用的交叉熵函数:`tf.nn.sigmoid_cross_entropy_with_logits()`。 与softmax搭配使用的交叉熵函数:`tf.nn.softmax_cross_entropy_with_logits()`。 在pytorch中: - 与sigmoid搭配使用的交叉熵函数:`torch.nn.BCEWithLogitsLoss()`。 + 与sigmoid搭配使用的交叉熵函数:`torch.nn.BCEWithLogitsLoss()`。 与softmax搭配使用的交叉熵函数:`torch.nn.CrossEntropyLoss()`。 对数似然函数: - -​ 我们将似然函数作为机器学习模型的损失函数,并且用在分类问题中。这时似然函数是直接作用于模型的输出的(损失函数就是为了衡量当前参数下model的预测值predict距离真实值label的大小,所以似然函数用作损失函数时当然也是为了完成该任务),所以对于似然函数来说,这里的样本集就成了label集(而不是机器学习意义上的样本集X了),这里的参数也不是机器学习model 的参数,而是predict值。 + 我们将似然函数作为机器学习模型的损失函数,并且用在分类问题中。这时似然函数是直接作用于模型的输出的(损失函数就是为了衡量当前参数下model的预测值predict距离真实值label的大小,所以似然函数用作损失函数时当然也是为了完成该任务),所以对于似然函数来说,这里的样本集就成了label集(而不是机器学习意义上的样本集X了),这里的参数也不是机器学习model 的参数,而是predict值。 其实作为损失函数的似然函数并不关心你当前的机器学习model的参数是怎样的,毕竟它此时所接收的输入只有两部分:**1、predict。2、label 。3、分布模型(predict服从的分布)**。 @@ -589,7 +588,7 @@ $$ L(Y, P(Y|X)) = -\log{P(Y|X)}=-\frac{1}{N}\sum_{i=1}^N\sum_{j=1}^M y_{ij}log(p_{ij}) $$ -​ 其中, Y 为输出变量, X为输入变量, L 为损失函数. N为输入样本量, M为可能的类别数, $y_{ij}$ 是一个二值指标, 表示类别 j 是否是输入实例 xi 的真实类别. $p_{ij}$ 为模型或分类器预测输入实例 xi 属于类别 j 的概率. +​ 其中, Y 为输出变量, X为输入变量, L 为损失函数. N为输入样本量, M为可能的类别数,$y_{ij}$是一个二值指标, 表示类别 j 是否是输入实例 xi 的真实类别.$p_{ij}$为模型或分类器预测输入实例 xi 属于类别 j 的概率. 常见的逻辑回归使用的就是对数损失函数,有很多人认为逻辑回归的损失函数是平方损失,其实不然。逻辑回归它假设样本服从伯努利分布(0-1分布),进而求得满足该分布的似然函数,接着取对数求极值等。逻辑回归推导出的经验风险函数是最小化负的似然函数,从损失函数的角度看,就是对数损失函数。形式上等价于二分类的交叉熵损失函数。 @@ -747,7 +746,7 @@ $$ ### 2.12.3 梯度下降法直观理解 梯度下降法经典图示如下图2.7所示: -![](img/ch2/2.25/1.png) +![](/assets/ch2/2.25/1.png) ​ 图2.7 梯度下降法经典图示 @@ -783,11 +782,11 @@ $$ $$ (2)相关参数初始化。 -​ 主要初始化${\theta}_i$、算法迭代步长${\alpha} $、终止距离${\zeta} $。初始化时可以根据经验初始化,即${\theta} $初始化为0,步长${\alpha} $初始化为1。当前步长记为${\varphi}_i $。当然,也可随机初始化。 +​ 主要初始化${\theta}_i$、算法迭代步长${\alpha}$、终止距离${\zeta}$。初始化时可以根据经验初始化,即${\theta}$初始化为0,步长${\alpha}$初始化为1。当前步长记为${\varphi}_i$。当然,也可随机初始化。 (3)迭代计算。 -​ 1)计算当前位置时损失函数的梯度,对${\theta}_i $,其梯度表示为: +​ 1)计算当前位置时损失函数的梯度,对${\theta}_i$,其梯度表示为: $$ \frac{\partial}{\partial \theta_i}J({\theta}_0,{\theta}_1,...,{\theta}_n)=\frac{1}{2m}\sum^{m}_{j=0}(h_\theta (x^{(j)}_0 ,x^{(j)}_1,...,x^{(j)}_n)-y_j)^2 @@ -807,7 +806,7 @@ $$ ,x^{(j)}_1,...,x^{(j)}_n)-y_j)x^{(j)}_i $$ ​ 5)令上式$x^{(j)}_0=1$,更新完毕后转入1)。 -​ 由此,可看出,当前位置的梯度方向由所有样本决定,上式中 $\frac{1}{m}​$、$\alpha \frac{1}{m}​$ 的目的是为了便于理解。 +​ 由此,可看出,当前位置的梯度方向由所有样本决定,上式中$\frac{1}{m}​$、$\alpha \frac{1}{m}​$的目的是为了便于理解。 ### 2.12.5 如何对梯度下降法进行调优 实际使用梯度下降法时,各项参数指标不能一步就达到理想状态,对梯度下降法调优主要体现在以下几个方面: @@ -837,12 +836,12 @@ $$ 其中,$m​$为样本个数,$j​$为参数个数。 1、 **批量梯度下降的求解思路如下:** -a) 得到每个$ \theta ​$对应的梯度: +a) 得到每个$\theta ​$对应的梯度: $$ \frac{\partial}{\partial \theta_i}J({\theta}_0,{\theta}_1,...,{\theta}_n)=\frac{1}{m}\sum^{m}_{j=0}(h_\theta (x^{j}_0 ,x^{j}_1,...,x^{j}_n)-y^j)x^{j}_i $$ -b) 由于是求最小化风险函数,所以按每个参数 $ \theta ​$ 的梯度负方向更新 $ \theta_i ​$ : +b) 由于是求最小化风险函数,所以按每个参数$\theta$的梯度负方向更新$\theta_i$: $$ \theta_i=\theta_i - \frac{1}{m} \sum^{m}_{j=0}(h_\theta (x^{j}_0 ,x^{j}_1,...,x^{j}_n)-y^j)x^{j}_i @@ -859,7 +858,7 @@ J(\theta_0, \theta_1, ... , \theta_n) = ,x^{j}_1,...,x^{j}_n))^2 = \frac{1}{m} \sum^{m}_{j=0} cost(\theta,(x^j,y^j)) $$ -b)对每个参数 $ \theta​$ 按梯度方向更新 $ \theta​$: +b)对每个参数$\theta​$按梯度方向更新$\theta​$: $$ \theta_i = \theta_i + (y^j - h_\theta (x^{j}_0, x^{j}_1, ... ,x^{j}_n)) $$ @@ -869,10 +868,10 @@ c) 随机梯度下降是通过每个样本来迭代更新一次。 **小结:** 随机梯度下降法、批量梯度下降法相对来说都比较极端,简单对比如下: -| 方法 | 特点 | -| :----------: | :----------------------------------------------------------- | -| 批量梯度下降 | a)采用所有数据来梯度下降。
b)批量梯度下降法在样本量很大的时候,训练速度慢。 | -| 随机梯度下降 | a)随机梯度下降用一个样本来梯度下降。
b)训练速度很快。
c)随机梯度下降法仅仅用一个样本决定梯度方向,导致解有可能不是全局最优。
d)收敛速度来说,随机梯度下降法一次迭代一个样本,导致迭代方向变化很大,不能很快的收敛到局部最优解。 | +| 方法 | 特点 | +| :----------: |:--------------------------------------------------------------------------------------------------------------------------------------| +| 批量梯度下降 | a)采用所有数据来梯度下降。
b)批量梯度下降法在样本量很大的时候,训练速度慢。 | +| 随机梯度下降 | a)随机梯度下降用一个样本来梯度下降。
b)训练速度很快。
c)随机梯度下降法仅仅用一个样本决定梯度方向,导致解有可能不是全局最优。
d)收敛速度来说,随机梯度下降法一次迭代一个样本,导致迭代方向变化很大,不能很快的收敛到局部最优解。 | 下面介绍能结合两种方法优点的小批量梯度下降法。 @@ -980,7 +979,7 @@ LDA分类思想简单总结如下: ### 2.14.2 图解LDA核心思想 ​ 假设有红、蓝两类数据,这些数据特征均为二维,如下图所示。我们的目标是将这些数据投影到一维,让每一类相近的数据的投影点尽可能接近,不同类别数据尽可能远,即图中红色和蓝色数据中心之间的距离尽可能大。 -![](img/ch2/2.29/1.png) +![](/assets/ch2/2.29/1.png) 左图和右图是两种不同的投影方式。 @@ -993,24 +992,24 @@ LDA分类思想简单总结如下: ​ 以上例子是基于数据是二维的,分类后的投影是一条直线。如果原始数据是多维的,则投影后的分类面是一低维的超平面。 ### 2.14.3 二类LDA算法原理 -​ 输入:数据集 $D=\{(\boldsymbol x_1,\boldsymbol y_1),(\boldsymbol x_2,\boldsymbol y_2),...,(\boldsymbol x_m,\boldsymbol y_m)\}​$,其中样本 $\boldsymbol x_i ​$ 是n维向量,$\boldsymbol y_i \epsilon \{0, 1\}​$,降维后的目标维度 $d​$。定义 +​ 输入:数据集$D=\{(\boldsymbol x_1,\boldsymbol y_1),(\boldsymbol x_2,\boldsymbol y_2),...,(\boldsymbol x_m,\boldsymbol y_m)\}​$,其中样本$\boldsymbol x_i ​$是n维向量,$\boldsymbol y_i \epsilon \{0, 1\}​$,降维后的目标维度$d​$。定义 -​ $N_j(j=0,1)$ 为第 $j$ 类样本个数; +​ $N_j(j=0,1)$为第$j$类样本个数; -​ $X_j(j=0,1)$ 为第 $j$ 类样本的集合; +​ $X_j(j=0,1)$为第$j$类样本的集合; -​ $u_j(j=0,1)​$ 为第 $j​$ 类样本的均值向量; +​ $u_j(j=0,1)​$为第$j​$类样本的均值向量; -​ $\sum_j(j=0,1)$ 为第 $j$ 类样本的协方差矩阵。 +​ $\sum_j(j=0,1)$为第$j$类样本的协方差矩阵。 ​ 其中 $$ u_j = \frac{1}{N_j} \sum_{\boldsymbol x\epsilon X_j}\boldsymbol x(j=0,1), \sum_j = \sum_{\boldsymbol x\epsilon X_j}(\boldsymbol x-u_j)(\boldsymbol x-u_j)^T(j=0,1) $$ -​ 假设投影直线是向量 $\boldsymbol w$,对任意样本 $\boldsymbol x_i$,它在直线 $w$上的投影为 $\boldsymbol w^Tx_i$,两个类别的中心点 $u_0$, $u_1 $在直线 $w$ 的投影分别为 $\boldsymbol w^Tu_0$ 、$\boldsymbol w^Tu_1$。 +​ 假设投影直线是向量$\boldsymbol w$,对任意样本$\boldsymbol x_i$,它在直线$w$上的投影为$\boldsymbol w^Tx_i$,两个类别的中心点$u_0$,$u_1$在直线$w$的投影分别为$\boldsymbol w^Tu_0$、$\boldsymbol w^Tu_1$。 -​ LDA的目标是让两类别的数据中心间的距离 $\| \boldsymbol w^Tu_0 - \boldsymbol w^Tu_1 \|^2_2$ 尽量大,与此同时,希望同类样本投影点的协方差$\boldsymbol w^T \sum_0 \boldsymbol w$、$\boldsymbol w^T \sum_1 \boldsymbol w$ 尽量小,最小化 $\boldsymbol w^T \sum_0 \boldsymbol w + \boldsymbol w^T \sum_1 \boldsymbol w​$ 。 +​ LDA的目标是让两类别的数据中心间的距离$\| \boldsymbol w^Tu_0 - \boldsymbol w^Tu_1 \|^2_2$尽量大,与此同时,希望同类样本投影点的协方差$\boldsymbol w^T \sum_0 \boldsymbol w$、$\boldsymbol w^T \sum_1 \boldsymbol w$尽量小,最小化$\boldsymbol w^T \sum_0 \boldsymbol w + \boldsymbol w^T \sum_1 \boldsymbol w​$。 ​ 定义 ​ 类内散度矩阵 $$ @@ -1018,7 +1017,7 @@ S_w = \sum_0 + \sum_1 = \sum_{\boldsymbol x\epsilon X_0}(\boldsymbol x-u_0)(\boldsymbol x-u_0)^T + \sum_{\boldsymbol x\epsilon X_1}(\boldsymbol x-u_1)(\boldsymbol x-u_1)^T $$ -​ 类间散度矩阵 $S_b = (u_0 - u_1)(u_0 - u_1)^T$ +​ 类间散度矩阵$S_b = (u_0 - u_1)(u_0 - u_1)^T$ ​ 据上分析,优化目标为 $$ @@ -1026,23 +1025,23 @@ $$ \frac{\boldsymbol w^T(u_0-u_1)(u_0-u_1)^T\boldsymbol w}{\boldsymbol w^T(\sum_0 + \sum_1)\boldsymbol w} = \frac{\boldsymbol w^TS_b\boldsymbol w}{\boldsymbol w^TS_w\boldsymbol w} $$ -​ 根据广义瑞利商的性质,矩阵 $S^{-1}_{w} S_b$ 的最大特征值为 $J(\boldsymbol w)$ 的最大值,矩阵 $S^{-1}_{w} S_b$ 的最大特征值对应的特征向量即为 $\boldsymbol w$。 +​ 根据广义瑞利商的性质,矩阵$S^{-1}_{w} S_b$的最大特征值为$J(\boldsymbol w)$的最大值,矩阵$S^{-1}_{w} S_b$的最大特征值对应的特征向量即为$\boldsymbol w$。 ### 2.14.4 LDA算法流程总结 LDA算法降维流程如下: -​ 输入:数据集 $D = \{ (x_1,y_1),(x_2,y_2), ... ,(x_m,y_m) \}$,其中样本 $x_i $ 是n维向量,$y_i \epsilon \{C_1, C_2, ..., C_k\}$,降维后的目标维度 $d$ 。 +​ 输入:数据集$D = \{ (x_1,y_1),(x_2,y_2), ... ,(x_m,y_m) \}$,其中样本$x_i$是n维向量,$y_i \epsilon \{C_1, C_2, ..., C_k\}$,降维后的目标维度$d$。 -​ 输出:降维后的数据集 $\overline{D} $ 。 +​ 输出:降维后的数据集$\overline{D}$。 步骤: -1. 计算类内散度矩阵 $S_w$。 -2. 计算类间散度矩阵 $S_b​$ 。 -3. 计算矩阵 $S^{-1}_wS_b​$ 。 -4. 计算矩阵 $S^{-1}_wS_b$ 的最大的 d 个特征值。 +1. 计算类内散度矩阵$S_w$。 +2. 计算类间散度矩阵$S_b​$。 +3. 计算矩阵$S^{-1}_wS_b​$。 +4. 计算矩阵$S^{-1}_wS_b$的最大的 d 个特征值。 5. 计算 d 个特征值对应的 d 个特征向量,记投影矩阵为 W 。 -6. 转化样本集的每个样本,得到新样本 $P_i = W^Tx_i​$ 。 -7. 输出新样本集 $\overline{D} = \{ (p_1,y_1),(p_2,y_2),...,(p_m,y_m) \}​$ +6. 转化样本集的每个样本,得到新样本$P_i = W^Tx_i​$。 +7. 输出新样本集$\overline{D} = \{ (p_1,y_1),(p_2,y_2),...,(p_m,y_m) \}​$ ### 2.14.5 LDA和PCA区别 @@ -1078,7 +1077,7 @@ LDA算法降维流程如下: ​ 假设数据集是m个n维,$(\boldsymbol x^{(1)}, \boldsymbol x^{(2)}, \cdots, \boldsymbol x^{(m)})$。如果$n=2$,需要降维到$n'=1$,现在想找到某一维度方向代表这两个维度的数据。下图有$u_1, u_2$两个向量方向,但是哪个向量才是我们所想要的,可以更好代表原始数据集的呢? -![](img/ch2/2.34/1.png) +![](/assets/ch2/2.34/1.png) 从图可看出,$u_1$比$u_2$好,为什么呢?有以下两个主要评价指标: 1. 样本点到这个直线的距离足够近。 @@ -1091,13 +1090,13 @@ LDA算法降维流程如下: ### 2.15.3 PCA算法推理 下面以基于最小投影距离为评价指标推理: -​ 假设数据集是m个n维,$(x^{(1)}, x^{(2)},...,x^{(m)})$,且数据进行了中心化。经过投影变换得到新坐标为 ${w_1,w_2,...,w_n}$,其中 $w$ 是标准正交基,即 $\| w \|_2 = 1$,$w^T_iw_j = 0$。 +​ 假设数据集是m个n维,$(x^{(1)}, x^{(2)},...,x^{(m)})$,且数据进行了中心化。经过投影变换得到新坐标为${w_1,w_2,...,w_n}$,其中$w$是标准正交基,即$\| w \|_2 = 1$,$w^T_iw_j = 0$。 -​ 经过降维后,新坐标为 $\{ w_1,w_2,...,w_n \}$,其中 $n'$ 是降维后的目标维数。样本点 $x^{(i)}$ 在新坐标系下的投影为 $z^{(i)} = \left(z^{(i)}_1, z^{(i)}_2, ..., z^{(i)}_{n'} \right)$,其中 $z^{(i)}_j = w^T_j x^{(i)}$ 是 $x^{(i)} ​$ 在低维坐标系里第 j 维的坐标。 +​ 经过降维后,新坐标为$\{ w_1,w_2,...,w_n \}$,其中$n'$是降维后的目标维数。样本点$x^{(i)}$在新坐标系下的投影为$z^{(i)} = \left(z^{(i)}_1, z^{(i)}_2, ..., z^{(i)}_{n'} \right)$,其中$z^{(i)}_j = w^T_j x^{(i)}$是$x^{(i)} ​$在低维坐标系里第 j 维的坐标。 -​ 如果用 $z^{(i)} $ 去恢复 $x^{(i)} $ ,则得到的恢复数据为 $\widehat{x}^{(i)} = \sum^{n'}_{j=1} x^{(i)}_j w_j = Wz^{(i)}$,其中 $W$为标准正交基组成的矩阵。 +​ 如果用$z^{(i)}$去恢复$x^{(i)}$,则得到的恢复数据为$\widehat{x}^{(i)} = \sum^{n'}_{j=1} x^{(i)}_j w_j = Wz^{(i)}$,其中$W$为标准正交基组成的矩阵。 -​ 考虑到整个样本集,样本点到这个超平面的距离足够近,目标变为最小化 $\sum^m_{i=1} \| \hat{x}^{(i)} - x^{(i)} \|^2_2$ 。对此式进行推理,可得: +​ 考虑到整个样本集,样本点到这个超平面的距离足够近,目标变为最小化$\sum^m_{i=1} \| \hat{x}^{(i)} - x^{(i)} \|^2_2$。对此式进行推理,可得: $$ \sum^m_{i=1} \| \hat{x}^{(i)} - x^{(i)} \|^2_2 = \sum^m_{i=1} \| Wz^{(i)} - x^{(i)} \|^2_2 \\ @@ -1115,8 +1114,8 @@ $$ + \sum^m_{i=1} \left( x^{(i)} \right)^T x^{(i)} $$ -​ 在推导过程中,分别用到了 $\overline{x}^{(i)} = Wz^{(i)}$ ,矩阵转置公式 $(AB)^T = B^TA^T$,$W^TW = I$,$z^{(i)} = W^Tx^{(i)}$ 以及矩阵的迹,最后两步是将代数和转为矩阵形式。 -​ 由于 $W$ 的每一个向量 $w_j$ 是标准正交基,$\sum^m_{i=1} x^{(i)} \left( x^{(i)} \right)^T$ 是数据集的协方差矩阵,$\sum^m_{i=1} \left( x^{(i)} \right)^T x^{(i)} $ 是一个常量。最小化 $\sum^m_{i=1} \| \hat{x}^{(i)} - x^{(i)} \|^2_2$ 又可等价于 +​ 在推导过程中,分别用到了$\overline{x}^{(i)} = Wz^{(i)}$,矩阵转置公式$(AB)^T = B^TA^T$,$W^TW = I$,$z^{(i)} = W^Tx^{(i)}$以及矩阵的迹,最后两步是将代数和转为矩阵形式。 +​ 由于$W$的每一个向量$w_j$是标准正交基,$\sum^m_{i=1} x^{(i)} \left( x^{(i)} \right)^T$是数据集的协方差矩阵,$\sum^m_{i=1} \left( x^{(i)} \right)^T x^{(i)}$是一个常量。最小化$\sum^m_{i=1} \| \hat{x}^{(i)} - x^{(i)} \|^2_2$又可等价于 $$ \underbrace{\arg \min}_W - tr \left( W^TXX^TW \right) s.t.W^TW = I $$ @@ -1124,25 +1123,25 @@ $$ $$ J(W) = -tr(W^TXX^TW) + \lambda(W^TW - I) $$ -​ 对 $W$ 求导,可得 $-XX^TW + \lambda W = 0 $ ,也即 $ XX^TW = \lambda W $ 。 $ XX^T $ 是 $ n' $ 个特征向量组成的矩阵,$\lambda$ 为$ XX^T $ 的特征值。$W$ 即为我们想要的矩阵。 -​ 对于原始数据,只需要 $z^{(i)} = W^TX^{(i)}$ ,就可把原始数据集降维到最小投影距离的 $n'$ 维数据集。 +​ 对$W$求导,可得$-XX^TW + \lambda W = 0$,也即$XX^TW = \lambda W$。$XX^T$是$n'$个特征向量组成的矩阵,$\lambda$为$XX^T$的特征值。$W$即为我们想要的矩阵。 +​ 对于原始数据,只需要$z^{(i)} = W^TX^{(i)}$,就可把原始数据集降维到最小投影距离的$n'$维数据集。 ​ 基于最大投影方差的推导,这里就不再赘述,有兴趣的同仁可自行查阅资料。 ### 2.15.4 PCA算法流程总结 -输入:$n​$ 维样本集 $D = \left( x^{(1)},x^{(2)},...,x^{(m)} \right)​$ ,目标降维的维数 $n'​$ 。 +输入:$n​$维样本集$D = \left( x^{(1)},x^{(2)},...,x^{(m)} \right)​$,目标降维的维数$n'​$。 -输出:降维后的新样本集 $D' = \left( z^{(1)},z^{(2)},...,z^{(m)} \right)$ 。 +输出:降维后的新样本集$D' = \left( z^{(1)},z^{(2)},...,z^{(m)} \right)$。 主要步骤如下: -1. 对所有的样本进行中心化,$ x^{(i)} = x^{(i)} - \frac{1}{m} \sum^m_{j=1} x^{(j)} $ 。 -2. 计算样本的协方差矩阵 $XX^T​$ 。 -3. 对协方差矩阵 $XX^T$ 进行特征值分解。 -4. 取出最大的 $n' $ 个特征值对应的特征向量 $\{ w_1,w_2,...,w_{n'} \}$ 。 -5. 标准化特征向量,得到特征向量矩阵 $W$ 。 -6. 转化样本集中的每个样本 $z^{(i)} = W^T x^{(i)}$ 。 -7. 得到输出矩阵 $D' = \left( z^{(1)},z^{(2)},...,z^{(n)} \right)​$ 。 -*注*:在降维时,有时不明确目标维数,而是指定降维到的主成分比重阈值 $k(k \epsilon(0,1])​$ 。假设 $n​$ 个特征值为 $\lambda_1 \geqslant \lambda_2 \geqslant ... \geqslant \lambda_n​$ ,则 $n'​$ 可从 $\sum^{n'}_{i=1} \lambda_i \geqslant k \times \sum^n_{i=1} \lambda_i ​$ 得到。 +1. 对所有的样本进行中心化,$x^{(i)} = x^{(i)} - \frac{1}{m} \sum^m_{j=1} x^{(j)}$。 +2. 计算样本的协方差矩阵$XX^T​$。 +3. 对协方差矩阵$XX^T$进行特征值分解。 +4. 取出最大的$n'$个特征值对应的特征向量$\{ w_1,w_2,...,w_{n'} \}$。 +5. 标准化特征向量,得到特征向量矩阵$W$。 +6. 转化样本集中的每个样本$z^{(i)} = W^T x^{(i)}$。 +7. 得到输出矩阵$D' = \left( z^{(1)},z^{(2)},...,z^{(n)} \right)​$。 +*注*:在降维时,有时不明确目标维数,而是指定降维到的主成分比重阈值$k(k \epsilon(0,1])​$。假设$n​$个特征值为$\lambda_1 \geqslant \lambda_2 \geqslant ... \geqslant \lambda_n​$,则$n'​$可从$\sum^{n'}_{i=1} \lambda_i \geqslant k \times \sum^n_{i=1} \lambda_i ​$得到。 ### 2.15.5 PCA算法主要优缺点 |优缺点|简要说明| @@ -1166,13 +1165,13 @@ $$ 6. 降低算法运算开销。 ### 2.15.7 KPCA与PCA的区别 -​ 应用PCA算法前提是假设存在一个线性超平面,进而投影。那如果数据不是线性的呢?该怎么办?这时候就需要KPCA,数据集从 $n$ 维映射到线性可分的高维 $N >n$,然后再从 $N$ 维降维到一个低维度 $n'(n'n$,然后再从$N$维降维到一个低维度$n'(n' ![](img/ch2/2.16.20.1.png) -> +> ![](/assets/ch2/2.16.20.1.png) ### 2.16.3 经验误差与泛化误差 @@ -1253,7 +1251,7 @@ $$ 根据不同的坐标方式,欠拟合与过拟合图解不同。 1. **横轴为训练样本数量,纵轴为误差** -![](img/ch2/2.16.4.1.jpg) +![](/assets/ch2/2.16.4.1.jpg) 如上图所示,我们可以直观看出欠拟合和过拟合的区别: @@ -1265,7 +1263,7 @@ $$ 2. **横轴为模型复杂程度,纵轴为误差** -![](img/ch2/2.16.4.2.png) +![](/assets/ch2/2.16.4.2.png) ​ 红线为测试集上的Error,蓝线为训练集上的Error @@ -1277,7 +1275,7 @@ $$ 3. **横轴为正则项系数,纵轴为误差** -![](img/ch2/2.16.4.3.png) +![](/assets/ch2/2.16.4.3.png) ​ 红线为测试集上的Error,蓝线为训练集上的Error @@ -1372,7 +1370,7 @@ $$ ​ 对于分类器,或者说分类算法,评价指标主要有Precision,Recall,F-score。下图是一个ROC曲线的示例。 -![](img/ch2/2.40.10/1.png) +![](/assets/ch2/2.40.10/1.png) ROC曲线的横坐标为False Positive Rate(FPR),纵坐标为True Positive Rate(TPR)。其中 $$ @@ -1397,7 +1395,7 @@ $$ 3、每次选取一个不同的threshold,得到一组FPR和TPR,即ROC曲线上的一点。以此共得到20组FPR和TPR的值。 4、根据3、中的每个坐标点,画图。 -![](img/ch2/2.40.11/1.jpg) +![](/assets/ch2/2.40.11/1.jpg) ### 2.16.13 如何计算TPR,FPR 1、分析数据 @@ -1466,7 +1464,7 @@ TPR = TP/(TP+FN) = 0.5; FPR = FP/(TN+FP) = 0; ### 2.16.14 如何计算AUC - 将坐标点按照横坐标FPR排序 。 -- 计算第$i$个坐标点和第$i+1$个坐标点的间距$dx$ 。 +- 计算第$i$个坐标点和第$i+1$个坐标点的间距$dx$。 - 获取第$i$或者$i+1$个坐标点的纵坐标y。 - 计算面积微元$ds=ydx$。 - 对面积微元进行累加,得到AUC。 @@ -1478,26 +1476,26 @@ TPR = TP/(TP+FN) = 0.5; FPR = FP/(TN+FP) = 0; ### 2.16.16 直观理解AUC ​ 下图展现了三种AUC的值: -![](img/ch2/2.40.15/1.png) +![](/assets/ch2/2.40.15/1.png) ​ AUC是衡量二分类模型优劣的一种评价指标,表示正例排在负例前面的概率。其他评价指标有精确度、准确率、召回率,而AUC比这三者更为常用。 ​ 一般在分类模型中,预测结果都是以概率的形式表现,如果要计算准确率,通常都会手动设置一个阈值来将对应的概率转化成类别,这个阈值也就很大程度上影响了模型准确率的计算。 ​ 举例: ​ 现在假设有一个训练好的二分类器对10个正负样本(正例5个,负例5个)预测,得分按高到低排序得到的最好预测结果为[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],即5个正例均排在5个负例前面,正例排在负例前面的概率为100%。然后绘制其ROC曲线,由于是10个样本,除去原点我们需要描10个点,如下: -![](img/ch2/2.16.17-1.png) +![](/assets/ch2/2.16.17-1.png) ​ 描点方式按照样本预测结果的得分高低从左至右开始遍历。从原点开始,每遇到1便向y轴正方向移动y轴最小步长1个单位,这里是1/5=0.2;每遇到0则向x轴正方向移动x轴最小步长1个单位,这里也是0.2。不难看出,上图的AUC等于1,印证了正例排在负例前面的概率的确为100%。 ​ 假设预测结果序列为[1, 1, 1, 1, 0, 1, 0, 0, 0, 0]。 -![](img/ch2/2.16.17-2.png) +![](/assets/ch2/2.16.17-2.png) ​ 计算上图的AUC为0.96与计算正例与排在负例前面的概率0.8 × 1 + 0.2 × 0.8 = 0.96相等,而左上角阴影部分的面积则是负例排在正例前面的概率0.2 × 0.2 = 0.04。 ​ 假设预测结果序列为[1, 1, 1, 0, 1, 0, 1, 0, 0, 0]。 -![](img/ch2/2.16.17-3.png) +![](/assets/ch2/2.16.17-3.png) ​ 计算上图的AUC为0.88与计算正例与排在负例前面的概率0.6 × 1 + 0.2 × 0.8 + 0.2 × 0.6 = 0.88相等,左上角阴影部分的面积是负例排在正例前面的概率0.2 × 0.2 × 3 = 0.12。 @@ -1505,9 +1503,9 @@ TPR = TP/(TP+FN) = 0.5; FPR = FP/(TN+FP) = 0; 不同的错误会产生不同代价。以二分法为例,设置代价矩阵如下: -![](img/ch2/2-1.png) +![](/assets/ch2/2-1.png) -当判断正确的时候,值为0,不正确的时候,分别为$Cost_{01}​$和$Cost_{10}​$ 。 +当判断正确的时候,值为0,不正确的时候,分别为$Cost_{01}​$和$Cost_{10}​$。 $Cost_{10}$:表示实际为反例但预测成正例的代价。 @@ -1539,7 +1537,7 @@ $$ 例如,ROC上(TPR,FPR),计算出FNR=1-TPR,在代价平面上绘制一条从(0,FPR)到(1,FNR)的线段,面积则为该条件下期望的总体代价。所有线段下界面积,所有条件下学习器的期望总体代价。 -![](img/ch2/2.16.18.1.png) +![](/assets/ch2/2.16.18.1.png) ### 2.16.18 模型有哪些比较检验方法 正确性分析:模型稳定性分析,稳健性分析,收敛性分析,变化趋势分析,极值分析等。 @@ -1630,7 +1628,7 @@ $$ ### 2.17.3 决策树学习基本算法 -![](img/ch2/2-5.png) +![](/assets/ch2/2-5.png) ### 2.17.4 决策树算法优缺点 @@ -1671,7 +1669,7 @@ $$ $$ H(X)=-\sum_{i=1}^{n}p_{i}log_{2}p_{i} $$ -​ 对于样本集合,假设样本有k个类别,每个类别的概率为$\frac{|C_{k}|}{|D|}$,其中 ${|C_{k}|}{|D|}$为类别为k的样本个数,$|D|​$为样本总数。样本集合D的熵为: +​ 对于样本集合,假设样本有k个类别,每个类别的概率为$\frac{|C_{k}|}{|D|}$,其中${|C_{k}|}{|D|}$为类别为k的样本个数,$|D|​$为样本总数。样本集合D的熵为: $$ H(D)=-\sum_{k=1}^{k}\frac{|C_{k}|}{|D|}log_{2}\frac{|C_{k}|}{|D|} $$ @@ -1687,7 +1685,7 @@ $$ ​ *注:*在决策树构建的过程中我们总是希望集合往最快到达纯度更高的子集合方向发展,因此我们总是选择使得信息增益最大的特征来划分当前数据集D。 ​ 思想:计算所有特征划分数据集D,得到多个特征划分数据集D的信息增益,从这些信息增益中选择最大的,因而当前结点的划分特征便是使信息增益最大的划分所使用的特征。 ​ 另外这里提一下信息增益比相关知识: -​ $信息增益比=惩罚参数\times信息增益$ +​ $信息增益比=惩罚参数\times信息增益$ ​ 信息增益比本质:在信息增益的基础之上乘上一个惩罚参数。特征个数较多时,惩罚参数较小;特征个数较少时,惩罚参数较大。 ​ 惩罚参数:数据集D以特征A作为随机变量的熵的倒数。 @@ -1711,7 +1709,7 @@ $$ ​ 在一个二维环境中,其中点R,S,G点和其它靠近中间黑线的点可以看作为支持向量,它们可以决定分类器,即黑线的具体参数。 -![](img/ch2/2-6.png) +![](/assets/ch2/2-6.png) ​ 支持向量机是一种二分类模型,它的目的是寻找一个超平面来对样本进行分割,分割的原则是边界最大化,最终转化为一个凸二次规划问题来求解。由简至繁的模型包括: @@ -1813,7 +1811,7 @@ $p^*$为原问题的最小值,对应的$w,b$分别为$w^*,b^*$,则对于任意 $$ p^* = \frac{1}{2}||\boldsymbol w^*||^2 \geqslant L(\boldsymbol w^*, b,\boldsymbol a) \geqslant \min_{\boldsymbol w, b} L(\boldsymbol w, b,\boldsymbol a) $$ -则 $\min_{\boldsymbol w, b} L(\boldsymbol w, b,\boldsymbol a)$是问题(1)的一个下界。 +则$\min_{\boldsymbol w, b} L(\boldsymbol w, b,\boldsymbol a)$是问题(1)的一个下界。 此时,取最大值即可求得好的下界,即 $$ @@ -1823,13 +1821,13 @@ $$ ### 2.18.7 常见的核函数有哪些 | 核函数 | 表达式 | 备注 | | ---------------------------- | ------------------------------------------------------------ | ----------------------------------- | -| Linear Kernel线性核 | $k(x,y)=x^{t}y+c$ | | -| Polynomial Kernel多项式核 | $k(x,y)=(ax^{t}y+c)^{d}$ | $d\geqslant1$为多项式的次数 | -| Exponential Kernel指数核 | $k(x,y)=exp(-\frac{\left \|x-y \right \|}{2\sigma ^{2}})$ | $\sigma>0$ | -| Gaussian Kernel高斯核 | $k(x,y)=exp(-\frac{\left \|x-y \right \|^{2}}{2\sigma ^{2}})$ | $\sigma$为高斯核的带宽,$\sigma>0$, | -| Laplacian Kernel拉普拉斯核 | $k(x,y)=exp(-\frac{\left \|x-y \right \|}{\sigma})$ | $\sigma>0$ | -| ANOVA Kernel | $k(x,y)=exp(-\sigma(x^{k}-y^{k})^{2})^{d}$ | | -| Sigmoid Kernel | $k(x,y)=tanh(ax^{t}y+c)$ | $tanh$为双曲正切函数,$a>0,c<0$ | +| Linear Kernel线性核 |$k(x,y)=x^{t}y+c$ | | +| Polynomial Kernel多项式核 |$k(x,y)=(ax^{t}y+c)^{d}$ |$d\geqslant1$为多项式的次数 | +| Exponential Kernel指数核 |$k(x,y)=exp(-\frac{\left \|x-y \right \|}{2\sigma ^{2}})$ |$\sigma>0$ | +| Gaussian Kernel高斯核 |$k(x,y)=exp(-\frac{\left \|x-y \right \|^{2}}{2\sigma ^{2}})$|$\sigma$为高斯核的带宽,$\sigma>0$, | +| Laplacian Kernel拉普拉斯核 |$k(x,y)=exp(-\frac{\left \|x-y \right \|}{\sigma})$ |$\sigma>0$ | +| ANOVA Kernel |$k(x,y)=exp(-\sigma(x^{k}-y^{k})^{2})^{d}$ | | +| Sigmoid Kernel |$k(x,y)=tanh(ax^{t}y+c)$ |$tanh$为双曲正切函数,$a>0,c<0$ | ### 2.18.9 SVM主要特点 @@ -1913,7 +1911,7 @@ $$ 极大似然估计的原理,用一张图片来说明,如下图所示: -![](img/ch2/2.19.1.1.png) +![](/assets/ch2/2.19.1.1.png) ​ 例:有两个外形完全相同的箱子,1号箱有99只白球,1只黑球;2号箱有1只白球,99只黑球。在一次实验中,取出的是黑球,请问是从哪个箱子中取出的? @@ -2160,7 +2158,7 @@ $$ $$ Q_i(z^{(i)}) = \frac{P(x^{(i)}, z^{(i)};\theta)}{\sum\limits_{z}P(x^{(i)}, z^{(i)};\theta)} = \frac{P(x^{(i)}, z^{(i)};\theta)}{P(x^{(i)};\theta)} = P( z^{(i)}|x^{(i)};\theta) $$ -如果$Q_i(z^{(i)}) = P( z^{(i)}|x^{(i)};\theta)$ ,则第(1)式是我们的包含隐藏数据的对数似然的一个下界。如果我们能极大化这个下界,则也在尝试极大化我们的对数似然。即我们需要最大化下式: +如果$Q_i(z^{(i)}) = P( z^{(i)}|x^{(i)};\theta)$,则第(1)式是我们的包含隐藏数据的对数似然的一个下界。如果我们能极大化这个下界,则也在尝试极大化我们的对数似然。即我们需要最大化下式: $$ \mathop{\arg\max}_\theta \sum\limits_{i=1}^m \sum\limits_{z^{(i)}}Q_i(z^{(i)})log\frac{P(x^{(i)}, z^{(i)};\theta)}{Q_i(z^{(i)})} $$ @@ -2168,21 +2166,21 @@ $$ $$ \mathop{\arg\max}_\theta \sum\limits_{i=1}^m \sum\limits_{z^{(i)}}Q_i(z^{(i)})log{P(x^{(i)}, z^{(i)};\theta)} $$ -以上即为EM算法的M步,$\sum\limits_{z^{(i)}}Q_i(z^{(i)})log{P(x^{(i)}, z^{(i)};\theta)}​$可理解为$logP(x^{(i)}, z^{(i)};\theta) $基于条件概率分布$Q_i(z^{(i)}) $的期望。以上即为EM算法中E步和M步的具体数学含义。 +以上即为EM算法的M步,$\sum\limits_{z^{(i)}}Q_i(z^{(i)})log{P(x^{(i)}, z^{(i)};\theta)}​$可理解为$logP(x^{(i)}, z^{(i)};\theta)$基于条件概率分布$Q_i(z^{(i)})$的期望。以上即为EM算法中E步和M步的具体数学含义。 ### 2.20.3 图解EM算法 ​ 考虑上一节中的(a)式,表达式中存在隐变量,直接找到参数估计比较困难,通过EM算法迭代求解下界的最大值到收敛为止。 -![](img/ch2/2.20.1.jpg) +![](/assets/ch2/2.20.1.jpg) -​ 图片中的紫色部分是我们的目标模型$p(x|\theta)$,该模型复杂,难以求解析解,为了消除隐变量$z^{(i)}$的影响,我们可以选择一个不包含$z^{(i)}$的模型$r(x|\theta)$,使其满足条件$r(x|\theta) \leqslant p(x|\theta) $。 +​ 图片中的紫色部分是我们的目标模型$p(x|\theta)$,该模型复杂,难以求解析解,为了消除隐变量$z^{(i)}$的影响,我们可以选择一个不包含$z^{(i)}$的模型$r(x|\theta)$,使其满足条件$r(x|\theta) \leqslant p(x|\theta)$。 求解步骤如下: (1)选取$\theta_1$,使得$r(x|\theta_1) = p(x|\theta_1)$,然后对此时的$r$求取最大值,得到极值点$\theta_2$,实现参数的更新。 -(2)重复以上过程到收敛为止,在更新过程中始终满足$r \leqslant p $. +(2)重复以上过程到收敛为止,在更新过程中始终满足$r \leqslant p$. ### 2.20.4 EM算法流程 @@ -2217,23 +2215,23 @@ $$ -![](img/ch2/2.21.1.1.png) +![](/assets/ch2/2.21.1.1.png) ​ 图2.21.1.a ​ 从上图可看到,如果仅仅只有一个特征进行分类,三角形和圆几乎是均匀分布在这条线段上,很难将10张照片线性分类。那么,增加一个特征后的情况会怎么样: -![](img/ch2/2.21.1.2.png) +![](/assets/ch2/2.21.1.2.png) ​ 图2.21.1.b 增加一个特征后,我们发现仍然无法找到一条直线将猫和狗分开。所以,考虑需要再增加一个特征: -![](img/ch2/2.21.1.3.png) +![](/assets/ch2/2.21.1.3.png) ​ 图2.21.1.c -![](img/ch2/2.21.1.4.png) +![](/assets/ch2/2.21.1.4.png) ​ 图2.21.1.d @@ -2243,33 +2241,33 @@ $$ ​ (1)一个特征时,假设特征空间时长度为5的线段,则样本密度为$10 \div 5 = 2$。 -​ (2)两个特征时,特征空间大小为$ 5\times5 = 25$,样本密度为$10 \div 25 = 0.4$。 +​ (2)两个特征时,特征空间大小为$5\times5 = 25$,样本密度为$10 \div 25 = 0.4$。 -​ (3)三个特征时,特征空间大小是$ 5\times5\times5 = 125$,样本密度为$10 \div 125 = 0.08$。 +​ (3)三个特征时,特征空间大小是$5\times5\times5 = 125$,样本密度为$10 \div 125 = 0.08$。 ​ 以此类推,如果继续增加特征数量,样本密度会越来越稀疏,此时,更容易找到一个超平面将训练样本分开。当特征数量增长至无限大时,样本密度就变得非常稀疏。 ​ 下面看一下将高维空间的分类结果映射到低维空间时,会出现什么情况? -![](img/ch2/2.21.1.5.png) +![](/assets/ch2/2.21.1.5.png) ​ 图2.21.1.e ​ 上图是将三维特征空间映射到二维特征空间后的结果。尽管在高维特征空间时训练样本线性可分,但是映射到低维空间后,结果正好相反。事实上,增加特征数量使得高维空间线性可分,相当于在低维空间内训练一个复杂的非线性分类器。不过,这个非线性分类器太过“聪明”,仅仅学到了一些特例。如果将其用来辨别那些未曾出现在训练样本中的测试样本时,通常结果不太理想,会造成过拟合问题。 -![](img/ch2/2.21.1.6a.png) +![](/assets/ch2/2.21.1.6a.png) ​ 图2.21.1.f ​ 上图所示的只采用2个特征的线性分类器分错了一些训练样本,准确率似乎没有图2.21.1.e的高,但是,采用2个特征的线性分类器的泛化能力比采用3个特征的线性分类器要强。因为,采用2个特征的线性分类器学习到的不只是特例,而是一个整体趋势,对于那些未曾出现过的样本也可以比较好地辨别开来。换句话说,通过减少特征数量,可以避免出现过拟合问题,从而避免“维数灾难”。 -![](img/ch2/2.21.1.6.png) +![](/assets/ch2/2.21.1.6.png) ​ 上图从另一个角度诠释了“维数灾难”。假设只有一个特征时,特征的值域是0到1,每一个三角形和圆的特征值都是唯一的。如果我们希望训练样本覆盖特征值值域的20%,那么就需要三角形和圆总数的20%。我们增加一个特征后,为了继续覆盖特征值值域的20%就需要三角形和圆总数的45%($0.452^2\approx0.2$)。继续增加一个特征后,需要三角形和圆总数的58%($0.583^3\approx0.2$)。随着特征数量的增加,为了覆盖特征值值域的20%,就需要更多的训练样本。如果没有足够的训练样本,就可能会出现过拟合问题。 ​ 通过上述例子,我们可以看到特征数量越多,训练样本就会越稀疏,分类器的参数估计就会越不准确,更加容易出现过拟合问题。“维数灾难”的另一个影响是训练样本的稀疏性并不是均匀分布的。处于中心位置的训练样本比四周的训练样本更加稀疏。 -![](img/ch2/2.21.1.7.png) +![](/assets/ch2/2.21.1.7.png) ​ 假设有一个二维特征空间,如上图所示的矩形,在矩形内部有一个内切的圆形。由于越接近圆心的样本越稀疏,因此,相比于圆形内的样本,那些位于矩形四角的样本更加难以分类。当维数变大时,特征超空间的容量不变,但单位圆的容量会趋于0,在高维空间中,大多数训练数据驻留在特征超空间的角落。散落在角落的数据要比处于中心的数据难于分类。 @@ -2291,13 +2289,13 @@ Lassio缩减系数法、小波分析法、 ​ 1)在一些推荐系统中需确定新用户的类型,但定义“用户类型”却可能不太容易,此时往往可先对原有的用户数据进行聚类,根据聚类结果将每个簇定义为一个类,然后再基于这些类训练分类模型,用于判别新用户的类型。 -![](img/ch2/2.21.3.1.png) +![](/assets/ch2/2.21.3.1.png) ​ 2)而降维则是为了缓解维数灾难的一个重要方法,就是通过某种数学变换将原始高维属性空间转变为一个低维“子空间”。其基于的假设就是,虽然人们平时观测到的数据样本虽然是高维的,但是实际上真正与学习任务相关的是个低维度的分布。从而通过最主要的几个特征维度就可以实现对数据的描述,对于后续的分类很有帮助。比如对于Kaggle(数据分析竞赛平台之一)上的泰坦尼克号生还问题。通过给定一个乘客的许多特征如年龄、姓名、性别、票价等,来判断其是否能在海难中生还。这就需要首先进行特征筛选,从而能够找出主要的特征,让学习到的模型有更好的泛化性。 ​ 聚类和降维都可以作为分类等问题的预处理步骤。 -![](img/ch2/2-19.jpg) +![](/assets/ch2/2-19.jpg) ​ 但是他们虽然都能实现对数据的约减。但是二者适用的对象不同,聚类针对的是数据点,而降维则是对于数据的特征。另外它们有着很多种实现方法。聚类中常用的有K-means、层次聚类、基于密度的聚类等;降维中常用的则PCA、Isomap、LLE等。 diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-1.png" deleted file mode 100644 index 5b065bc9..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-10.jpg" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-10.jpg" deleted file mode 100644 index 526dfa3b..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-10.jpg" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-11.jpg" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-11.jpg" deleted file mode 100644 index d671beb2..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-11.jpg" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-12.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-12.png" deleted file mode 100644 index af6b11a4..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-12.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-13.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-13.png" deleted file mode 100644 index 6d8799c6..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-13.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-14.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-14.png" deleted file mode 100644 index 124af841..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-14.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-15.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-15.png" deleted file mode 100644 index a32940e4..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-15.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-16.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-16.png" deleted file mode 100644 index 856802fc..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-16.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-17.gif" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-17.gif" deleted file mode 100644 index ba665c65..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-17.gif" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-18.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-18.png" deleted file mode 100644 index c17ecad8..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-18.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-19.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-19.png" deleted file mode 100644 index cd20e854..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-19.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-2.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-2.png" deleted file mode 100644 index 3dbddcb4..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-2.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-20.gif" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-20.gif" deleted file mode 100644 index 308e93d3..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-20.gif" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-21.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-21.png" deleted file mode 100644 index c4403e78..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-21.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-22.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-22.png" deleted file mode 100644 index 05be6684..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-22.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-23.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-23.png" deleted file mode 100644 index 2e4c9b21..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-23.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-24.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-24.png" deleted file mode 100644 index fbec6c04..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-24.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-25.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-25.png" deleted file mode 100644 index cd2f64ce..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-25.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-26.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-26.png" deleted file mode 100644 index 9d67734e..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-26.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-27.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-27.png" deleted file mode 100644 index 9678e96a..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-27.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-28.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-28.png" deleted file mode 100644 index ea2a6f96..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-28.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-29.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-29.png" deleted file mode 100644 index 1d589b63..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-29.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-3.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-3.png" deleted file mode 100644 index c7178b54..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-3.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-30.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-30.png" deleted file mode 100644 index 0296411e..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-30.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-31.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-31.png" deleted file mode 100644 index 4c757ad3..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-31.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-32.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-32.png" deleted file mode 100644 index ea2a6f96..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-32.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-33.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-33.png" deleted file mode 100644 index 9798bf81..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-33.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-34.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-34.png" deleted file mode 100644 index 71edbcc1..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-34.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-35.jpg" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-35.jpg" deleted file mode 100644 index 5bb87c99..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-35.jpg" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-36.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-36.png" deleted file mode 100644 index 5b90a4e3..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-36.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-37.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-37.png" deleted file mode 100644 index 087ae7b7..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-37.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-38.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-38.png" deleted file mode 100644 index 731c159e..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-38.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-39.jpg" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-39.jpg" deleted file mode 100644 index 50fe309f..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-39.jpg" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-4.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-4.png" deleted file mode 100644 index a6f322cd..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-4.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-40.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-40.png" deleted file mode 100644 index 2303937c..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-40.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-41.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-41.png" deleted file mode 100644 index a16e2651..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-41.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-5.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-5.png" deleted file mode 100644 index d094c2c9..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-5.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-6.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-6.png" deleted file mode 100644 index 10ac6d41..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-6.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-7.jpg" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-7.jpg" deleted file mode 100644 index 3cdfc2d1..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-7.jpg" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-8.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-8.png" deleted file mode 100644 index dd13a29c..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-8.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-9.jpg" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-9.jpg" deleted file mode 100644 index 49d4e00f..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3-9.jpg" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.1.1.5.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.1.1.5.png" deleted file mode 100644 index dde211ce..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.1.1.5.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.1.1.6.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.1.1.6.png" deleted file mode 100644 index 1bd76971..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.1.1.6.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.1.6.1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.1.6.1.png" deleted file mode 100644 index e0ce77d9..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.1.6.1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.12.2.1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.12.2.1.png" deleted file mode 100644 index 34f2d8b6..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.12.2.1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.12.2.2.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.12.2.2.png" deleted file mode 100644 index ad3d4bd6..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.12.2.2.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.1.1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.1.1.png" deleted file mode 100644 index 160cf461..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.1.1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.1.2.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.1.2.png" deleted file mode 100644 index fec7b5b1..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.1.2.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.2.1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.2.1.png" deleted file mode 100644 index 02dbca08..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.2.1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.1.png" deleted file mode 100644 index 1c4dacd9..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.2.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.2.png" deleted file mode 100644 index 09f4d9e2..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.2.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.4.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.4.png" deleted file mode 100644 index 03f1c6a9..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.4.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.5.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.5.png" deleted file mode 100644 index 56443fd2..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.5.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.6.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.6.png" deleted file mode 100644 index bda9c5cb..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.3.6.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.4.1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.4.1.png" deleted file mode 100644 index f91e8ab4..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.4.1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.1.png" deleted file mode 100644 index 1236163e..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.2.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.2.png" deleted file mode 100644 index c36f3bfd..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.2.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.3.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.3.png" deleted file mode 100644 index d53c8ea8..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.3.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.4.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.4.png" deleted file mode 100644 index f00cca44..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.2.5.4.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.4.9.1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.4.9.1.png" deleted file mode 100644 index 3e126ba7..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.4.9.1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.4.9.2.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.4.9.2.png" deleted file mode 100644 index ea9b0c34..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.4.9.2.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.4.9.3.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.4.9.3.png" deleted file mode 100644 index fe1d7779..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.4.9.3.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.6.3.1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.6.3.1.png" deleted file mode 100644 index d091389e..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.6.3.1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.6.7.1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.6.7.1.png" deleted file mode 100644 index 4b98c00e..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.6.7.1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.8.2.1.png" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.8.2.1.png" deleted file mode 100644 index 1236163e..00000000 Binary files "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/3.8.2.1.png" and /dev/null differ diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/\347\254\254\344\270\211\347\253\240_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200.md" "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/\347\254\254\344\270\211\347\253\240_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200.md" index 1543ba3e..4d54a249 100644 --- "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/\347\254\254\344\270\211\347\253\240_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200.md" +++ "b/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/\347\254\254\344\270\211\347\253\240_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200.md" @@ -14,62 +14,56 @@ 简单的感知机如下图所示: -![](img/ch3/3-1.png) +![](/assets/ch3/3-1.png) 其中$x_1$,$x_2$,$x_3$为感知机的输入,其输出为: -$$ -output = \left\{ +$$ output = \left\{ \begin{aligned} 0, \quad if \ \ \sum_i w_i x_i \leqslant threshold \\ 1, \quad if \ \ \sum_i w_i x_i > threshold \end{aligned} -\right. -$$ +\right. $$ -假如把感知机想象成一个加权投票机制,比如 3 位评委给一个歌手打分,打分分别为$ 4 $分、$1$ 分、$-3 $分,这$ 3$ 位评分的权重分别是 $1、3、2$,则该歌手最终得分为 $4 \times 1 + 1 \times 3 + (-3) \times 2 = 1$ 。按照比赛规则,选取的 $threshold$ 为 $3$,说明只有歌手的综合评分大于$ 3$ 时,才可顺利晋级。对照感知机,该选手被淘汰,因为: +假如把感知机想象成一个加权投票机制,比如 3 位评委给一个歌手打分,打分分别为$4$分、$1$ 分、$-3$分,这$3$ 位评分的权重分别是 $1、3、2$,则该歌手最终得分为 $4 \times 1 + 1 \times 3 + (-3) \times 2 = 1$ 。按照比赛规则,选取的 $threshold$ 为 $3$,说明只有歌手的综合评分大于$3$ 时,才可顺利晋级。对照感知机,该选手被淘汰,因为: -$$ -\sum_i w_i x_i < threshold=3, output = 0 -$$ +$$ \sum_i w_i x_i < threshold=3, output = 0 $$ -用 $-b$ 代替 $threshold$,输出变为: +用$-b$ 代替 $threshold$,输出变为: -$$ -output = \left\{ +$$ output = \left\{ \begin{aligned} 0, \quad if \ \ \boldsymbol{w} \cdot \boldsymbol{x} + b \leqslant 0 \\ 1, \quad if \ \ \boldsymbol{w} \cdot \boldsymbol{x} + b > 0 \end{aligned} -\right. -$$ +\right. $$ 设置合适的 $\boldsymbol{x}$ 和 $b$ ,一个简单的感知机单元的与非门表示如下: -![](img/ch3/3-2.png) +![](/assets/ch3/3-2.png) -当输入为 $0$,$1$ 时,感知机输出为 $ 0 \times (-2) + 1 \times (-2) + 3 = 1$。 +当输入为 $0$,$1$ 时,感知机输出为$0 \times (-2) + 1 \times (-2) + 3 = 1$。 复杂一些的感知机由简单的感知机单元组合而成: -![](img/ch3/3-3.png) +![](/assets/ch3/3-3.png) **多层感知机** -多层感知机由感知机推广而来,最主要的特点是有多个神经元层,因此也叫深度神经网络。相比于单独的感知机,多层感知机的第 $ i $ 层的每个神经元和第 $ i-1 $ 层的每个神经元都有连接。 +多层感知机由感知机推广而来,最主要的特点是有多个神经元层,因此也叫深度神经网络。相比于单独的感知机,多层感知机的第$i$层的每个神经元和第$i-1$层的每个神经元都有连接。 -![](img/ch3/3.1.1.5.png) +![](/assets/ch3/3.1.1.5.png) -输出层可以不止有$ 1$ 个神经元。隐藏层可以只有$ 1$ 层,也可以有多层。输出层为多个神经元的神经网络例如下图所示: +输出层可以不止有$1$ 个神经元。隐藏层可以只有$1$ 层,也可以有多层。输出层为多个神经元的神经网络例如下图所示: -![](img/ch3/3.1.1.6.png) +![](/assets/ch3/3.1.1.6.png) ### 3.1.2 神经网络有哪些常用模型结构? 下图包含了大部分常用的模型: -![](img/ch3/3-7.jpg) +![](/assets/ch3/3-7.jpg) ### 3.1.3 如何选择深度学习开发平台? @@ -108,7 +102,7 @@ $$ ​ 梯度消失的原因受到多种因素影响,例如学习率的大小,网络参数的初始化,激活函数的边缘效应等。在深层神经网络中,每一个神经元计算得到的梯度都会传递给前一层,较浅层的神经元接收到的梯度受到之前所有层梯度的影响。如果计算得到的梯度值非常小,随着层数增多,求出的梯度更新信息将会以指数形式衰减,就会发生梯度消失。下图是不同隐含层的学习速率: -![](img/ch3/3-8.png) +![](/assets/ch3/3-8.png) 2. 梯度爆炸 在深度网络或循环神经网络(Recurrent Neural Network, RNN)等网络结构中,梯度可在网络更新的过程中不断累积,变成非常大的梯度,导致网络权重值的大幅更新,使得网络不稳定;在极端情况下,权重值甚至会溢出,变为$NaN$值,再也无法更新。 @@ -117,7 +111,7 @@ $$ ​ 参数空间中学习的退化速度减慢,导致减少了模型的有效维数,网络的可用自由度对学习中梯度范数的贡献不均衡,随着相乘矩阵的数量(即网络深度)的增加,矩阵的乘积变得越来越退化。在有硬饱和边界的非线性网络中(例如 ReLU 网络),随着深度增加,退化过程会变得越来越快。Duvenaud等人2014年的论文里展示了关于该退化过程的可视化: -![](img/ch3/3-9.jpg) +![](/assets/ch3/3-9.jpg) 随着深度的增加,输入空间(左上角所示)会在输入空间中的每个点处被扭曲成越来越细的单丝,只有一个与细丝正交的方向影响网络的响应。沿着这个方向,网络实际上对变化变得非常敏感。 @@ -131,9 +125,9 @@ $$ -![](img/ch3/3.1.6.1.png) +![](/assets/ch3/3.1.6.1.png) -![](img/ch3/3-11.jpg) +![](/assets/ch3/3-11.jpg) ## 3.2 网络操作与计算 @@ -143,197 +137,165 @@ $$ **前向传播** -![](img/ch3/3.2.1.1.png) +![](/assets/ch3/3.2.1.1.png) -假设上一层结点 $ i,j,k,... $ 等一些结点与本层的结点 $ w $ 有连接,那么结点 $ w $ 的值怎么算呢?就是通过上一层的 $ i,j,k,... $ 等结点以及对应的连接权值进行加权和运算,最终结果再加上一个偏置项(图中为了简单省略了),最后在通过一个非线性函数(即激活函数),如 $ReLu$,$sigmoid$ 等函数,最后得到的结果就是本层结点 $ w $ 的输出。 +假设上一层结点 $i,j,k,...$等一些结点与本层的结点$w$有连接,那么结点$w$的值怎么算呢?就是通过上一层的$i,j,k,...$等结点以及对应的连接权值进行加权和运算,最终结果再加上一个偏置项(图中为了简单省略了),最后在通过一个非线性函数(即激活函数),如 $ReLu$,$sigmoid$ 等函数,最后得到的结果就是本层结点$w$的输出。 最终不断的通过这种方法一层层的运算,得到输出层结果。 **反向传播** -![](img/ch3/3.2.1.2.png) +![](/assets/ch3/3.2.1.2.png) 由于我们前向传播最终得到的结果,以分类为例,最终总是有误差的,那么怎么减少误差呢,当前应用广泛的一个算法就是梯度下降算法,但是求梯度就要求偏导数,下面以图中字母为例讲解一下: -设最终误差为 $ E $且输出层的激活函数为线性激活函数,对于输出那么 $ E $ 对于输出节点 $ y_l $ 的偏导数是 $ y_l - t_l $,其中 $ t_l $ 是真实值,$ \frac{\partial y_l}{\partial z_l} $ 是指上面提到的激活函数,$ z_l $ 是上面提到的加权和,那么这一层的 $ E $ 对于 $ z_l $ 的偏导数为 $ \frac{\partial E}{\partial z_l} = \frac{\partial E}{\partial y_l} \frac{\partial y_l}{\partial z_l} $。同理,下一层也是这么计算,只不过 $ \frac{\partial E}{\partial y_k} $ 计算方法变了,一直反向传播到输入层,最后有 $ \frac{\partial E}{\partial x_i} = \frac{\partial E}{\partial y_j} \frac{\partial y_j}{\partial z_j} $,且 $ \frac{\partial z_j}{\partial x_i} = w_i j $。然后调整这些过程中的权值,再不断进行前向传播和反向传播的过程,最终得到一个比较好的结果。 +设最终误差为 $E$ 且输出层的激活函数为线性激活函数,对于输出那么$E$对于输出节点 $y_l$ 的偏导数是 $y_l - t_l$ ,其中 $t_l$ 是真实值,$\frac{\partial y_l}{\partial z_l}$是指上面提到的激活函数,$z_l$是上面提到的加权和,那么这一层的$E$对于$z_l$的偏导数为$\frac{\partial E}{\partial z_l} = \frac{\partial E}{\partial y_l} \frac{\partial y_l}{\partial z_l}$。同理,下一层也是这么计算,只不过$\frac{\partial E}{\partial y_k}$计算方法变了,一直反向传播到输入层,最后有$\frac{\partial E}{\partial x_i} = \frac{\partial E}{\partial y_j} \frac{\partial y_j}{\partial z_j}$,且$\frac{\partial z_j}{\partial x_i} = w_i j$。然后调整这些过程中的权值,再不断进行前向传播和反向传播的过程,最终得到一个比较好的结果。 ### 3.2.2 如何计算神经网络的输出? -![](img/ch3/3.2.2.1.png) +![](/assets/ch3/3.2.2.1.png) -如上图,输入层有三个节点,我们将其依次编号为 1、2、3;隐藏层的 4 个节点,编号依次为 4、5、6、7;最后输出层的两个节点编号为 8、9。比如,隐藏层的节点 4,它和输入层的三个节点 1、2、3 之间都有连接,其连接上的权重分别为是 $ w_{41}, w_{42}, w_{43} $。 +如上图,输入层有三个节点,我们将其依次编号为 1、2、3;隐藏层的 4 个节点,编号依次为 4、5、6、7;最后输出层的两个节点编号为 8、9。比如,隐藏层的节点 4,它和输入层的三个节点 1、2、3 之间都有连接,其连接上的权重分别为是$w_{41}, w_{42}, w_{43}$。 -为了计算节点 4 的输出值,我们必须先得到其所有上游节点(也就是节点 1、2、3)的输出值。节点 1、2、3 是输入层的节点,所以,他们的输出值就是输入向量本身。按照上图画出的对应关系,可以看到节点 1、2、3 的输出值分别是 $ x_1, x_2, x_3 $。 +为了计算节点 4 的输出值,我们必须先得到其所有上游节点(也就是节点 1、2、3)的输出值。节点 1、2、3 是输入层的节点,所以,他们的输出值就是输入向量本身。按照上图画出的对应关系,可以看到节点 1、2、3 的输出值分别是$x_1, x_2, x_3$。 -$$ -a_4 = \sigma(w^T \cdot a) = \sigma(w_{41}x_4 + w_{42}x_2 + w_{43}a_3 + w_{4b}) -$$ +$$ a_4 = \sigma(w^T \cdot a) = \sigma(w_{41}x_4 + w_{42}x_2 + w_{43}a_3 + w_{4b}) $$ -其中 $ w_{4b} $ 是节点 4 的偏置项。 +其中$w_{4b}$是节点 4 的偏置项。 -同样,我们可以继续计算出节点 5、6、7 的输出值 $ a_5, a_6, a_7 $。 +同样,我们可以继续计算出节点 5、6、7 的输出值$a_5, a_6, a_7$。 -计算输出层的节点 8 的输出值 $ y_1 $: +计算输出层的节点 8 的输出值$y_1$: -$$ -y_1 = \sigma(w^T \cdot a) = \sigma(w_{84}a_4 + w_{85}a_5 + w_{86}a_6 + w_{87}a_7 + w_{8b}) -$$ +$$ y_1 = \sigma(w^T \cdot a) = \sigma(w_{84}a_4 + w_{85}a_5 + w_{86}a_6 + w_{87}a_7 + w_{8b}) $$ -其中 $ w_{8b} $ 是节点 8 的偏置项。 +其中$w_{8b}$是节点 8 的偏置项。 -同理,我们还可以计算出 $ y_2 $。这样输出层所有节点的输出值计算完毕,我们就得到了在输入向量 $ x_1, x_2, x_3, x_4 $ 时,神经网络的输出向量 $ y_1, y_2 $ 。这里我们也看到,输出向量的维度和输出层神经元个数相同。 +同理,我们还可以计算出$y_2$。这样输出层所有节点的输出值计算完毕,我们就得到了在输入向量$x_1, x_2, x_3, x_4$时,神经网络的输出向量$y_1, y_2$。这里我们也看到,输出向量的维度和输出层神经元个数相同。 ### 3.2.3 如何计算卷积神经网络输出值? 假设有一个 5\*5 的图像,使用一个 3\*3 的 filter 进行卷积,想得到一个 3\*3 的 Feature Map,如下所示: -![](img/ch3/3.2.3.1.png) +![](/assets/ch3/3.2.3.1.png) -$ x_{i,j} $ 表示图像第 $ i $ 行第 $ j $ 列元素。$ w_{m,n} $ 表示 filter​ 第 $ m $ 行第 $ n $ 列权重。 $ w_b $ 表示 $filter$ 的偏置项。 表$a_i,_j$示 feature map 第 $ i$ 行第 $ j $ 列元素。 $f$ 表示激活函数,这里以$ ReLU$ 函数为例。 +$x_{i,j}$表示图像第 $i$行第$j$列元素。$w_{m,n}$表示 filter​ 第$m$行第$n$列权重。$w_b$表示 $filter$ 的偏置项。 表$a_i,_j$示 feature map 第$i$ 行第$j$列元素。 $f$ 表示激活函数,这里以$ReLU$ 函数为例。 卷积计算公式如下: -$$ -a_{i,j} = f(\sum_{m=0}^2 \sum_{n=0}^2 w_{m,n} x_{i+m, j+n} + w_b ) -$$ +$$ a_{i,j} = f(\sum_{m=0}^2 \sum_{n=0}^2 w_{m,n} x_{i+m, j+n} + w_b ) $$ -当步长为 $1$ 时,计算 feature map 元素 $ a_{0,0} $ 如下: +当步长为 $1$ 时,计算 feature map 元素$a_{0,0}$如下: -$$ -a_{0,0} = f(\sum_{m=0}^2 \sum_{n=0}^2 w_{m,n} x_{0+m, 0+n} + w_b ) +$$ a_{0,0} = f(\sum_{m=0}^2 \sum_{n=0}^2 w_{m,n} x_{0+m, 0+n} + w_b ) = relu(w_{0,0} x_{0,0} + w_{0,1} x_{0,1} + w_{0,2} x_{0,2} + w_{1,0} x_{1,0} + \\w_{1,1} x_{1,1} + w_{1,2} x_{1,2} + w_{2,0} x_{2,0} + w_{2,1} x_{2,1} + w_{2,2} x_{2,2}) \\ = 1 + 0 + 1 + 0 + 1 + 0 + 0 + 0 + 1 \\ -= 4 -$$ += 4 $$ 其计算过程图示如下: -![](img/ch3/3.2.3.2.png) +![](/assets/ch3/3.2.3.2.png) 以此类推,计算出全部的Feature Map。 -![](img/ch3/3.2.3.4.png) +![](/assets/ch3/3.2.3.4.png) 当步幅为 2 时,Feature Map计算如下 -![](img/ch3/3.2.3.5.png) +![](/assets/ch3/3.2.3.5.png) 注:图像大小、步幅和卷积后的Feature Map大小是有关系的。它们满足下面的关系: -$$ -W_2 = (W_1 - F + 2P)/S + 1\\ -H_2 = (H_1 - F + 2P)/S + 1 -$$ +$$ W_2 = (W_1 - F + 2P)/S + 1\\H_2 = (H_1 - F + 2P)/S + 1 $$ +​ 其中$W_2$, 是卷积后 Feature Map 的宽度;$W_1$是卷积前图像的宽度;$F$是 filter 的宽度;$P$是 Zero Padding 数量,Zero Padding 是指在原始图像周围补几圈 $0$,如果 $P$ 的值是 $1$,那么就补 $1$ 圈 $0$;$S$ 是步幅;$H_2$卷积后 Feature Map 的高度;$H_1$是卷积前图像的宽度。 -​ 其中 $ W_2 $, 是卷积后 Feature Map 的宽度;$ W_1 $ 是卷积前图像的宽度;$ F $ 是 filter 的宽度;$ P $ 是 Zero Padding 数量,Zero Padding 是指在原始图像周围补几圈 $0$,如果 $P$ 的值是 $1$,那么就补 $1$ 圈 $0$;$S$ 是步幅;$ H_2 $ 卷积后 Feature Map 的高度;$ H_1 $ 是卷积前图像的宽度。 +​ 举例:假设图像宽度$W_1 = 5$,filter 宽度$F=3$,Zero Padding$P=0$,步幅$S=2$,$Z$则 -​ 举例:假设图像宽度 $ W_1 = 5 $,filter 宽度 $ F=3 $,Zero Padding $ P=0 $,步幅 $ S=2 $,$ Z $ 则 - -$$ -W_2 = (W_1 - F + 2P)/S + 1 - -= (5-3+0)/2 + 1 - -= 2 -$$ +$$ W_2 = (W_1 - F + 2P)/S + 1= (5-3+0)/2 + 1= 2 $$ ​ 说明 Feature Map 宽度是2。同样,我们也可以计算出 Feature Map 高度也是 2。 -如果卷积前的图像深度为 $ D $,那么相应的 filter 的深度也必须为 $ D $。深度大于 1 的卷积计算公式: +如果卷积前的图像深度为$D$,那么相应的 filter 的深度也必须为$D$。深度大于 1 的卷积计算公式: -$$ -a_{i,j} = f(\sum_{d=0}^{D-1} \sum_{m=0}^{F-1} \sum_{n=0}^{F-1} w_{d,m,n} x_{d,i+m,j+n} + w_b) -$$ +$$ a_{i,j} = f(\sum_{d=0}^{D-1} \sum_{m=0}^{F-1} \sum_{n=0}^{F-1} w_{d,m,n} x_{d,i+m,j+n} + w_b) $$ -​ 其中,$ D $ 是深度;$ F $ 是 filter 的大小;$ w_{d,m,n} $ 表示 filter 的第 $ d $ 层第 $ m $ 行第 $ n $ 列权重;$ a_{d,i,j} $ 表示 feature map 的第 $ d $ 层第 $ i $ 行第 $ j $ 列像素;其它的符号含义前面相同,不再赘述。 +​ 其中,$D$是深度;$F$是 filter 的大小;$w_{d,m,n}$表示 filter 的第$d$层第$m$行第$n$列权重;$a_{d,i,j}$表示 feature map 的第$d$层第$i$行第$j$列像素;其它的符号含义前面相同,不再赘述。 ​ 每个卷积层可以有多个 filter。每个 filter 和原始图像进行卷积后,都可以得到一个 Feature Map。卷积后 Feature Map 的深度(个数)和卷积层的 filter 个数相同。下面的图示显示了包含两个 filter 的卷积层的计算。$7*7*3$ 输入,经过两个 $3*3*3$ filter 的卷积(步幅为 $2$),得到了 $3*3*2$ 的输出。图中的 Zero padding 是 $1$,也就是在输入元素的周围补了一圈 $0$。 -![](img/ch3/3.2.3.6.png) +![](/assets/ch3/3.2.3.6.png) -​ 以上就是卷积层的计算方法。这里面体现了局部连接和权值共享:每层神经元只和上一层部分神经元相连(卷积计算规则),且 filter 的权值对于上一层所有神经元都是一样的。对于包含两个 $ 3 * 3 * 3 $ 的 fitler 的卷积层来说,其参数数量仅有 $ (3 * 3 * 3+1) * 2 = 56 $ 个,且参数数量与上一层神经元个数无关。与全连接神经网络相比,其参数数量大大减少了。 +​ 以上就是卷积层的计算方法。这里面体现了局部连接和权值共享:每层神经元只和上一层部分神经元相连(卷积计算规则),且 filter 的权值对于上一层所有神经元都是一样的。对于包含两个$3 * 3 * 3$的 fitler 的卷积层来说,其参数数量仅有$(3 * 3 * 3+1) * 2 = 56$个,且参数数量与上一层神经元个数无关。与全连接神经网络相比,其参数数量大大减少了。 ### 3.2.4 如何计算 Pooling 层输出值输出值? ​ Pooling 层主要的作用是下采样,通过去掉 Feature Map 中不重要的样本,进一步减少参数数量。Pooling 的方法很多,最常用的是 Max Pooling。Max Pooling 实际上就是在 n\*n 的样本中取最大值,作为采样后的样本值。下图是 2\*2 max pooling: -![](img/ch3/3.2.4.1.png) +![](/assets/ch3/3.2.4.1.png) ​ 除了 Max Pooing 之外,常用的还有 Average Pooling ——取各样本的平均值。 -​ 对于深度为 $ D $ 的 Feature Map,各层独立做 Pooling,因此 Pooling 后的深度仍然为 $ D $。 +​ 对于深度为$D$的 Feature Map,各层独立做 Pooling,因此 Pooling 后的深度仍然为$D$。 ### 3.2.5 实例理解反向传播 ​ 一个典型的三层神经网络如下所示: -![](img/ch3/3.2.5.1.png) +![](/assets/ch3/3.2.5.1.png) -​ 其中 Layer $ L_1 $ 是输入层,Layer $ L_2 $ 是隐含层,Layer $ L_3 $ 是输出层。 +​ 其中 Layer$L_1$是输入层,Layer$L_2$是隐含层,Layer$L_3$是输出层。 -​ 假设输入数据集为 $ D={x_1, x_2, ..., x_n} $,输出数据集为 $ y_1, y_2, ..., y_n $。 +​ 假设输入数据集为$D={x_1, x_2, ..., x_n}$,输出数据集为$y_1, y_2, ..., y_n$。 ​ 如果输入和输出是一样,即为自编码模型。如果原始数据经过映射,会得到不同于输入的输出。 假设有如下的网络层: -![](img/ch3/3.2.5.2.png) +![](/assets/ch3/3.2.5.2.png) -​ 输入层包含神经元 $ i_1, i_2 $,偏置 $ b_1 $;隐含层包含神经元 $ h_1, h_2 $,偏置 $ b_2 $,输出层为 $ o_1, o_2 $,$ w_i $ 为层与层之间连接的权重,激活函数为 $sigmoid$ 函数。对以上参数取初始值,如下图所示: +​ 输入层包含神经元$i_1, i_2$,偏置$b_1$;隐含层包含神经元$h_1, h_2$,偏置$b_2$,输出层为 $o_1, o_2$,$w_i$为层与层之间连接的权重,激活函数为 $sigmoid$ 函数。对以上参数取初始值,如下图所示: -![](img/ch3/3.2.5.3.png) +![](/assets/ch3/3.2.5.3.png) 其中: -- 输入数据 $ i1=0.05, i2 = 0.10 $ -- 输出数据 $ o1=0.01, o2=0.99 $; -- 初始权重 $ w1=0.15, w2=0.20, w3=0.25,w4=0.30, w5=0.40, w6=0.45, w7=0.50, w8=0.55 $ -- 目标:给出输入数据 $ i1,i2 $ ( $0.05$和$0.10$ ),使输出尽可能与原始输出 $ o1,o2 $,( $0.01$和$0.99$)接近。 +- 输入数据$i1=0.05, i2 = 0.10$ +- 输出数据$o1=0.01, o2=0.99$; +- 初始权重$w1=0.15, w2=0.20, w3=0.25,w4=0.30, w5=0.40, w6=0.45, w7=0.50, w8=0.55$ +- 目标:给出输入数据$i1,i2$($0.05$和$0.10$),使输出尽可能与原始输出$o1,o2$,($0.01$和$0.99$)接近 **前向传播** 1. 输入层 --> 输出层 -计算神经元 $ h1 $ 的输入加权和: +计算神经元$h1$的输入加权和: -$$ -net_{h1} = w_1 * i_1 + w_2 * i_2 + b_1 * 1\\ +$$ net_{h1} = w_1 * i_1 + w_2 * i_2 + b_1 * 1\\ -net_{h1} = 0.15 * 0.05 + 0.2 * 0.1 + 0.35 * 1 = 0.3775 -$$ +net_{h1} = 0.15 * 0.05 + 0.2 * 0.1 + 0.35 * 1 = 0.3775 $$ -神经元 $ h1 $ 的输出 $ o1 $ :(此处用到激活函数为 sigmoid 函数): +神经元$h1$的输出$o1$:(此处用到激活函数为 sigmoid 函数): -$$ -out_{h1} = \frac{1}{1 + e^{-net_{h1}}} = \frac{1}{1 + e^{-0.3775}} = 0.593269992 -$$ +$$ out_{h1} = \frac{1}{1 + e^{-net_{h1}}} = \frac{1}{1 + e^{-0.3775}} = 0.593269992 $$ -同理,可计算出神经元 $ h2 $ 的输出 $ o1 $: +同理,可计算出神经元$h2$的输出$o1$: -$$ -out_{h2} = 0.596884378 -$$ +$$ out_{h2} = 0.596884378 $$ 2. 隐含层-->输出层:    -计算输出层神经元 $ o1 $ 和 $ o2 $ 的值: +计算输出层神经元$o1$和$o2$的值: -$$ -net_{o1} = w_5 * out_{h1} + w_6 * out_{h2} + b_2 * 1 -$$ +$$ net_{o1} = w_5 * out_{h1} + w_6 * out_{h2} + b_2 * 1 $$ -$$ -net_{o1} = 0.4 * 0.593269992 + 0.45 * 0.596884378 + 0.6 * 1 = 1.105905967 -$$ +$$ net_{o1} = 0.4 * 0.593269992 + 0.45 * 0.596884378 + 0.6 * 1 = 1.105905967 $$ -$$ -out_{o1} = \frac{1}{1 + e^{-net_{o1}}} = \frac{1}{1 + e^{1.105905967}} = 0.75136079 -$$ +$$ out_{o1} = \frac{1}{1 + e^{-net_{o1}}} = \frac{1}{1 + e^{1.105905967}} = 0.75136079 $$ -这样前向传播的过程就结束了,我们得到输出值为 $ [0.75136079 , 0.772928465] $,与实际值 $ [0.01 , 0.99] $ 相差还很远,现在我们对误差进行反向传播,更新权值,重新计算输出。 +这样前向传播的过程就结束了,我们得到输出值为$[0.75136079 , 0.772928465]$,与实际值$[0.01 , 0.99]$相差还很远,现在我们对误差进行反向传播,更新权值,重新计算输出。 **反向传播 ** @@ -341,11 +303,9 @@ $$ 总误差:(这里使用Square Error) -$$ -E_{total} = \sum \frac{1}{2}(target - output)^2 -$$ +$$ E_{total} = \sum \frac{1}{2}(target - output)^2 $$ -但是有两个输出,所以分别计算 $ o1 $ 和 $ o2 $ 的误差,总误差为两者之和: +但是有两个输出,所以分别计算$o1$和$o2$的误差,总误差为两者之和: $E_{o1} = \frac{1}{2}(target_{o1} - out_{o1})^2 = \frac{1}{2}(0.01 - 0.75136507)^2 = 0.274811083$. @@ -356,15 +316,13 @@ $E_{total} = E_{o1} + E_{o2} = 0.274811083 + 0.023560026 = 0.298371109$. ​ 2.隐含层 --> 输出层的权值更新: -以权重参数 $ w5 $ 为例,如果我们想知道 $ w5 $ 对整体误差产生了多少影响,可以用整体误差对 $ w5 $ 求偏导求出:(链式法则) +以权重参数$w5$为例,如果我们想知道$w5$对整体误差产生了多少影响,可以用整体误差对$w5$求偏导求出:(链式法则) -$$ -\frac{\partial E_{total}}{\partial w5} = \frac{\partial E_{total}}{\partial out_{o1}} * \frac{\partial out_{o1}}{\partial net_{o1}} * \frac{\partial net_{o1}}{\partial w5} -$$ +$$ \frac{\partial E_{total}}{\partial w5} = \frac{\partial E_{total}}{\partial out_{o1}} * \frac{\partial out_{o1}}{\partial net_{o1}} * \frac{\partial net_{o1}}{\partial w5} $$ 下面的图可以更直观的看清楚误差是怎样反向传播的: -![](img/ch3/3.2.5.4.png) +![](/assets/ch3/3.2.5.4.png) ### 3.2.6 神经网络更“深”有什么意义? @@ -432,52 +390,52 @@ $$ 1. sigmoid 激活函数 - 函数的定义为:$ f(x) = \frac{1}{1 + e^{-x}} $,其值域为 $ (0,1) $。 + 函数的定义为:$f(x) = \frac{1}{1 + e^{-x}}$,其值域为$(0,1)$。 函数图像如下: -![](img/ch3/3-26.png) +![](/assets/ch3/3-26.png) 2. tanh激活函数 - 函数的定义为:$ f(x) = tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}} $,值域为 $ (-1,1) $。 + 函数的定义为:$f(x) = tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}}$,值域为$(-1,1)$。 函数图像如下: -![](img/ch3/3-27.png) +![](/assets/ch3/3-27.png) 3. Relu激活函数 - 函数的定义为:$ f(x) = max(0, x) $ ,值域为 $ [0,+∞) $; + 函数的定义为:$f(x) = max(0, x)$ ,值域为$[0,+∞)$; 函数图像如下: -![](img/ch3/3-28.png) +![](/assets/ch3/3-28.png) 4. Leak Relu 激活函数 - 函数定义为: $ f(x) = \left\{ + 函数定义为:$f(x) = \left\{ \begin{aligned} ax, \quad x<0 \\ x, \quad x>0 \end{aligned} - \right. $,值域为 $ (-∞,+∞) $。 + \right.$,值域为$(-∞,+∞)$。 - 图像如下($ a = 0.5 $): + 图像如下($a = 0.5$): -![](img/ch3/3-29.png) +![](/assets/ch3/3-29.png) 5. SoftPlus 激活函数 - 函数的定义为:$ f(x) = ln( 1 + e^x) $,值域为 $ (0,+∞) $。 + 函数的定义为:$f(x) = ln( 1 + e^x)$,值域为$(0,+∞)$。 函数图像如下: -![](img/ch3/3-30.png) +![](/assets/ch3/3-30.png) 6. softmax 函数 - 函数定义为: $ \sigma(z)_j = \frac{e^{z_j}}{\sum_{k=1}^K e^{z_k}} $。 + 函数定义为:$\sigma(z)_j = \frac{e^{z_j}}{\sum_{k=1}^K e^{z_k}}$。 Softmax 多用于多分类神经网络输出。 @@ -487,16 +445,16 @@ $$ | 原函数 | 函数表达式 | 导数 | 备注 | | --------------- | -------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| Sigmoid激活函数 | $f(x)=\frac{1}{1+e^{-x}}$ | $f^{'}(x)=\frac{1}{1+e^{-x}}\left( 1- \frac{1}{1+e^{-x}} \right)=f(x)(1-f(x))$ | 当$x=10$,或$x=-10​$,$f^{'}(x) \approx0​$,当$x=0​$$f^{'}(x) =0.25​$ | -| Tanh激活函数 | $f(x)=tanh(x)=\frac{e^x-e^{-x}}{e^x+e^{-x}}$ | $f^{'}(x)=-(tanh(x))^2$ | 当$x=10$,或$x=-10$,$f^{'}(x) \approx0$,当$x=0$$f^{`}(x) =1$ | -| Relu激活函数 | $f(x)=max(0,x)$ | $c(u)=\begin{cases} 0,x<0 \\ 1,x>0 \\ undefined,x=0\end{cases}$ | 通常$x=0$时,给定其导数为1和0 | +| Sigmoid激活函数 | $f(x)=\frac{1}{1+e^{-x}}$ | $f^{'}(x)=\frac{1}{1+e^{-x}}\left( 1- \frac{1}{1+e^{-x}} \right)=f(x)(1-f(x))$| 当$x=10$,或$x=-10​$,$f^{'}(x) \approx0​$,当$x=0​$$f^{'}(x) =0.25​$ | +| Tanh激活函数 | $f(x)=tanh(x)=\frac{e^x-e^{-x}}{e^x+e^{-x}}$| $f^{'}(x)=-(tanh(x))^2$ | 当$x=10$,或$x=-10$,$f^{'}(x) \approx0$,当$x=0$$f^{`}(x) =1$ | +| Relu激活函数 | $f(x)=max(0,x)$ | $c(u)=\begin{cases} 0,x<0 \\ 1,x>0 \\ undefined,x=0\end{cases}$| 通常$x=0$时,给定其导数为1和0 | ### 3.4.4 激活函数有哪些性质? -1. 非线性: 当激活函数是非线性的,一个两层的神经网络就可以基本上逼近所有的函数。但如果激活函数是恒等激活函数的时候,即 $ f(x)=x $,就不满足这个性质,而且如果 MLP 使用的是恒等激活函数,那么其实整个网络跟单层神经网络是等价的; +1. 非线性: 当激活函数是非线性的,一个两层的神经网络就可以基本上逼近所有的函数。但如果激活函数是恒等激活函数的时候,即$f(x)=x$,就不满足这个性质,而且如果 MLP 使用的是恒等激活函数,那么其实整个网络跟单层神经网络是等价的; 2. 可微性: 当优化方法是基于梯度的时候,就体现了该性质; 3. 单调性: 当激活函数是单调的时候,单层网络能够保证是凸函数; -4. $ f(x)≈x $: 当激活函数满足这个性质的时候,如果参数的初始化是随机的较小值,那么神经网络的训练将会很高效;如果不满足这个性质,那么就需要详细地去设置初始值; +4. $f(x)≈x$: 当激活函数满足这个性质的时候,如果参数的初始化是随机的较小值,那么神经网络的训练将会很高效;如果不满足这个性质,那么就需要详细地去设置初始值; 5. 输出值的范围: 当激活函数输出值是有限的时候,基于梯度的优化方法会更加稳定,因为特征的表示受有限权值的影响更显著;当激活函数的输出是无限的时候,模型的训练会更加高效,不过在这种情况下,一般需要更小的 Learning Rate。 ### 3.4.5 如何选择激活函数? @@ -528,7 +486,7 @@ $$ Relu 激活函数图像如下: -![](img/ch3/3-32.png) +![](/assets/ch3/3-32.png) 根据图像可看出具有如下特点: @@ -542,49 +500,46 @@ Relu 激活函数图像如下: 因为有了这单侧抑制,才使得神经网络中的神经元也具有了稀疏激活性。 - **稀疏激活性**:从信号方面来看,即神经元同时只对输入信号的少部分选择性响应,大量信号被刻意的屏蔽了,这样可以提高学习的精度,更好更快地提取稀疏特征。当 $ x<0 $ 时,ReLU 硬饱和,而当 $ x>0 $ 时,则不存在饱和问题。ReLU 能够在 $ x>0 $ 时保持梯度不衰减,从而缓解梯度消失问题。 + **稀疏激活性**:从信号方面来看,即神经元同时只对输入信号的少部分选择性响应,大量信号被刻意的屏蔽了,这样可以提高学习的精度,更好更快地提取稀疏特征。当$x<0$时,ReLU 硬饱和,而当$x>0$时,则不存在饱和问题。ReLU 能够在$x>0$时保持梯度不衰减,从而缓解梯度消失问题。 ### 3.4.9 Softmax 定义及作用 -Softmax 是一种形如下式的函数: -$$ -P(i) = \frac{exp(\theta_i^T x)}{\sum_{k=1}^{K} exp(\theta_i^T x)} -$$ -​ 其中,$ \theta_i $ 和 $ x $ 是列向量,$ \theta_i^T x $ 可能被换成函数关于 $ x $ 的函数 $ f_i(x) $ +Softmax 是一种形如下式的函数: +$$ P(i)= \frac{exp(\theta_i^T x)} {\sum_{k=1}^{K} exp(\theta_i^T x)} $$ +​ 其中,$\theta_i$和$x$是列向量,$\theta_i^T x$可能被换成函数关于$x$的函数$f_i(x)$ -​ 通过 softmax 函数,可以使得 $ P(i) $ 的范围在 $ [0,1] $ 之间。在回归和分类问题中,通常 $ \theta $ 是待求参数,通过寻找使得 $ P(i) $ 最大的 $ \theta_i $ 作为最佳参数。 +​ 通过 softmax 函数,可以使得$P(i)$的范围在$[0,1]$之间。在回归和分类问题中,通常$\theta$是待求参数,通过寻找使得$P(i)$最大的$\theta_i$作为最佳参数。 -​ 但是,使得范围在 $ [0,1] $ 之间的方法有很多,为啥要在前面加上以 $ e $ 的幂函数的形式呢?参考 logistic 函数: -$$ -P(i) = \frac{1}{1+exp(-\theta_i^T x)} -$$ -​ 这个函数的作用就是使得 $ P(i) $ 在负无穷到 0 的区间趋向于 0, 在 0 到正无穷的区间趋向 1,。同样 softmax 函数加入了 $ e $ 的幂函数正是为了两极化:正样本的结果将趋近于 1,而负样本的结果趋近于 0。这样为多类别提供了方便(可以把 $ P(i) $ 看做是样本属于类别的概率)。可以说,Softmax 函数是 logistic 函数的一种泛化。 +​ 但是,使得范围在$[0,1]$ 之间的方法有很多,为啥要在前面加上以$e$的幂函数的形式呢?参考 logistic 函数: +$$ P(i) = \frac{1}{1+exp(-\theta_i^T x)} $$ + +​ 这个函数的作用就是使得$P(i)$在负无穷到 0 的区间趋向于 0, 在 0 到正无穷的区间趋向 1,。 +同样 softmax 函数加入了$e$的幂函数正是为了两极化:正样本的结果将趋近于 1,而负样本的结果趋近于 0。 +这样为多类别提供了方便(可以把$P(i)$看做是样本属于类别的概率)。可以说,Softmax 函数是 logistic 函数的一种泛化。 ​ softmax 函数可以把它的输入,通常被称为 logits 或者 logit scores,处理成 0 到 1 之间,并且能够把输出归一化到和为 1。这意味着 softmax 函数与分类的概率分布等价。它是一个网络预测多酚类问题的最佳输出激活函数。 ### 3.4.10 Softmax 函数如何应用于多分类? -​ softmax 用于多分类过程中,它将多个神经元的输出,映射到 $ (0,1) $ 区间内,可以看成概率来理解,从而来进行多分类! +​ softmax 用于多分类过程中,它将多个神经元的输出,映射到$(0,1)$区间内,可以看成概率来理解,从而来进行多分类! -​ 假设我们有一个数组,$ V_i $ 表示 $ V $ 中的第 $ i $ 个元素,那么这个元素的 softmax 值就是 +​ 假设我们有一个数组,$V_i$表示$V$ 中的第$i$个元素,那么这个元素的 softmax 值就是 -$$ -S_i = \frac{e^{V_i}}{\sum_j e^{V_j}} -$$ +$$ S_i = \frac{e^{V_i}}{\sum_j e^{V_j}} $$ -​ 从下图看,神经网络中包含了输入层,然后通过两个特征层处理,最后通过 softmax 分析器就能得到不同条件下的概率,这里需要分成三个类别,最终会得到 $ y=0, y=1, y=2 $ 的概率值。 +​ 从下图看,神经网络中包含了输入层,然后通过两个特征层处理,最后通过 softmax 分析器就能得到不同条件下的概率,这里需要分成三个类别,最终会得到$y=0, y=1, y=2$的概率值。 -![](img/ch3/3.4.9.1.png) +![](/assets/ch3/3.4.9.1.png) -继续看下面的图,三个输入通过 softmax 后得到一个数组 $ [0.05 , 0.10 , 0.85] $,这就是 soft 的功能。 +继续看下面的图,三个输入通过 softmax 后得到一个数组$[0.05 , 0.10 , 0.85]$,这就是 soft 的功能。 -![](img/ch3/3.4.9.2.png) +![](/assets/ch3/3.4.9.2.png) 更形象的映射过程如下图所示: -![****](img/ch3/3.4.9.3.png) +![****](/assets/ch3/3.4.9.3.png) -​ softmax 直白来说就是将原来输出是 $ 3,1,-3 $ 通过 softmax 函数一作用,就映射成为 $ (0,1) $ 的值,而这些值的累和为 $ 1 $(满足概率的性质),那么我们就可以将它理解成概率,在最后选取输出结点的时候,我们就可以选取概率最大(也就是值对应最大的)结点,作为我们的预测目标! +​ softmax 直白来说就是将原来输出是$3,1,-3$通过 softmax 函数一作用,就映射成为$(0,1)$的值,而这些值的累和为$1$(满足概率的性质),那么我们就可以将它理解成概率,在最后选取输出结点的时候,我们就可以选取概率最大(也就是值对应最大的)结点,作为我们的预测目标! ### 3.4.11 交叉熵代价函数定义及其求导推导 @@ -611,7 +566,7 @@ $C=-\frac{1}{n}\sum[ylna+(1-y)ln(1-a)]$ $\begin{eqnarray}\frac{\partial C}{\partial w_{j}}&=&-\frac{1}{n}\sum \frac{\partial }{\partial w_{j}}[ylna+(1-y)ln(1-a)]\\&=&-\frac{1}{n}\sum \frac{\partial }{\partial a}[ylna+(1-y)ln(1-a)]*\frac{\partial a}{\partial w_{j}}\\&=&-\frac{1}{n}\sum (\frac{y}{a}-\frac{1-y}{1-a})*\frac{\partial a}{\partial w_{j}}\\&=&-\frac{1}{n}\sum (\frac{y}{\varsigma(z)}-\frac{1-y}{1-\varsigma(z)})\frac{\partial \varsigma(z)}{\partial w_{j}}\\&=&-\frac{1}{n}\sum (\frac{y}{\varsigma(z)}-\frac{1-y}{1-\varsigma(z)}){\varsigma}'(z)x_{j}\end{eqnarray}$ -​ 根据$\varsigma(z)=\frac{1}{1+e^{-z}}$ 的定义,和⼀些运算,我们可以得到 ${\varsigma}'(z)=\varsigma(z)(1-\varsigma(z))$。化简后可得: +​ 根据$\varsigma(z)=\frac{1}{1+e^{-z}}$的定义,和⼀些运算,我们可以得到${\varsigma}'(z)=\varsigma(z)(1-\varsigma(z))$。化简后可得: $\frac{\partial C}{\partial w_{j}}=\frac{1}{n}\sum x_{j}({\varsigma}(z)-y)$ @@ -652,16 +607,13 @@ $s^{,}(x)=s(x)*(1-s(x))\in (0,\frac{1}{4}]$ $L_{C} = \frac{1}{2}\sum^{m}_{i=1}||x_{i}-c_{y_{i}}||^{2}_{2}$ -其中$x_{i}$表示FCN(全连接层)之前的特征, $c_{y_{i}}$表示第$y_{i} $个类别的特征中心, $m$表示mini-batch的大小. 我们很清楚的看到$L_{C}$的终极目标为最小化每个特征与其特征中心的方差, 即最小化类内距离. 其迭代公式为: +其中$x_{i}$表示FCN(全连接层)之前的特征, $c_{y_{i}}$表示第$y_{i}$个类别的特征中心, $m$表示mini-batch的大小. 我们很清楚的看到$L_{C}$的终极目标为最小化每个特征与其特征中心的方差, 即最小化类内距离. 其迭代公式为: $\frac{\partial L_{C}}{\partial x_{i}}=x_{i}-c_{y_{i}}$ $\Delta{c_{j}} = \frac{\sum^{m}_{i=1}\delta(y_{i}=j)\cdot(c_{j}-x_{i})}{1+\sum^{m}_{i=1}\delta(y_{i}=j)}$ -其中$ \delta(condition)=\left\{ -\begin{array}{rcl} -1 & & {condition\ is\ True}\\ -0 & & {otherwise}\\ \end{array} \right.$ +其中 $\delta(condition)=\left\{\begin{array}{rcl}1 & & {condition\ is\ True}\\0 & & {otherwise}\\ \end{array} \right.$ 结合Softmax, 我们可以搭配二者使用, 适当平衡这两种监督信号. 在Softmax拉开类间距离的同时, 利用Center Loss最小化类内距离. 例如: @@ -716,11 +668,11 @@ Batch的选择,首先决定的是下降的方向。 ### 3.6.1 归一化含义? -1. 归纳统一样本的统计分布性。归一化在 $ 0-1$ 之间是统计的概率分布,归一化在$ -1--+1$ 之间是统计的坐标分布。 +1. 归纳统一样本的统计分布性。归一化在$0-1$ 之间是统计的概率分布,归一化在$-1--+1$ 之间是统计的坐标分布。 2. 无论是为了建模还是为了计算,首先基本度量单位要同一,神经网络是以样本在事件中的统计分别几率来进行训练(概率计算)和预测,且 sigmoid 函数的取值是 0 到 1 之间的,网络最后一个节点的输出也是如此,所以经常要对样本的输出归一化处理。 -3. 归一化是统一在 $ 0-1 $ 之间的统计概率分布,当所有样本的输入信号都为正值时,与第一隐含层神经元相连的权值只能同时增加或减小,从而导致学习速度很慢。 +3. 归一化是统一在$0-1$之间的统计概率分布,当所有样本的输入信号都为正值时,与第一隐含层神经元相连的权值只能同时增加或减小,从而导致学习速度很慢。 4. 另外在数据中常存在奇异样本数据,奇异样本数据存在所引起的网络训练时间增加,并可能引起网络无法收敛。为了避免出现这种情况及后面数据处理的方便,加快网络学习速度,可以对输入信号进行归一化,使得所有样本的输入信号其均值接近于 0 或与其均方差相比很小。 @@ -734,7 +686,7 @@ Batch的选择,首先决定的是下降的方向。 ### 3.6.3 为什么归一化能提高求解最优解速度? -![](img/ch3/3.6.3.1.png) +![](/assets/ch3/3.6.3.1.png) ​ 上图是代表数据是否均一化的最优解寻解过程(圆圈可以理解为等高线)。左图表示未经归一化操作的寻解过程,右图表示经过归一化后的寻解过程。 @@ -746,19 +698,17 @@ Batch的选择,首先决定的是下降的方向。 例子: -​ 假设 $ w1 $ 的范围在 $ [-10, 10] $,而 $ w2 $ 的范围在 $ [-100, 100] $,梯度每次都前进 1 单位,那么在 $ w1 $ 方向上每次相当于前进了 $ 1/20 $,而在 $ w2 $ 上只相当于 $ 1/200 $!某种意义上来说,在 $ w2 $ 上前进的步长更小一些,而 $ w1 $ 在搜索过程中会比 $ w2 $ “走”得更快。 +​ 假设$w1$的范围在$[-10, 10]$,而$w2$的范围在$[-100, 100]$,梯度每次都前进 1 单位,那么在$w1$方向上每次相当于前进了$1/20$,而在$w2$上只相当于$1/200$!某种意义上来说,在$w2$上前进的步长更小一些,而$w1$在搜索过程中会比$w2$“走”得更快。 -​ 这样会导致,在搜索过程中更偏向于 $ w1 $ 的方向。走出了“L”形状,或者成为“之”字形。 +​ 这样会导致,在搜索过程中更偏向于$w1$的方向。走出了“L”形状,或者成为“之”字形。 -![](img/ch3/3-37.png) +![](/assets/ch3/3-37.png) ### 3.6.5 归一化有哪些类型? 1. 线性归一化 -$$ -x^{\prime} = \frac{x-min(x)}{max(x) - min(x)} -$$ +$$ x^{\prime} = \frac{x-min(x)}{max(x) - min(x)} $$ ​ 适用范围:比较适用在数值比较集中的情况。 @@ -766,15 +716,13 @@ $$ 2. 标准差标准化 -$$ -x^{\prime} = \frac{x-\mu}{\sigma} -$$ +$$ x^{\prime} = \frac{x-\mu}{\sigma} $$ -​ 含义:经过处理的数据符合标准正态分布,即均值为 0,标准差为 1 其中 $ \mu $ 为所有样本数据的均值,$ \sigma $ 为所有样本数据的标准差。 +​ 含义:经过处理的数据符合标准正态分布,即均值为 0,标准差为 1 其中$\mu$为所有样本数据的均值,$\sigma$为所有样本数据的标准差。 3. 非线性归一化 - 适用范围:经常用在数据分化比较大的场景,有些数值很大,有些很小。通过一些数学函数,将原始值进行映射。该方法包括 $ log $、指数,正切等。 + 适用范围:经常用在数据分化比较大的场景,有些数值很大,有些很小。通过一些数学函数,将原始值进行映射。该方法包括$log$、指数,正切等。 ### 3.6.6 局部响应归一化作用 @@ -786,33 +734,31 @@ $$ ​ 局部响应归一化原理是仿造生物学上活跃的神经元对相邻神经元的抑制现象(侧抑制),其公式如下: -$$ -b_{x,y}^i = a_{x,y}^i / (k + \alpha \sum_{j=max(0, i-n/2)}^{min(N-1, i+n/2)}(a_{x,y}^j)^2 )^\beta -$$ +$$ b_{x,y}^i = a_{x,y}^i / (k + \alpha \sum_{j=max(0, i-n/2)}^{min(N-1, i+n/2)}(a_{x,y}^j)^2 )^\beta $$ 其中, -1) $ a $:表示卷积层(包括卷积操作和池化操作)后的输出结果,是一个四维数组[batch,height,width,channel]。 +1)$a$:表示卷积层(包括卷积操作和池化操作)后的输出结果,是一个四维数组[batch,height,width,channel]。 - batch:批次数(每一批为一张图片)。 - height:图片高度。 - width:图片宽度。 - channel:通道数。可以理解成一批图片中的某一个图片经过卷积操作后输出的神经元个数,或理解为处理后的图片深度。 -2) $ a_{x,y}^i $ 表示在这个输出结构中的一个位置 $ [a,b,c,d] $,可以理解成在某一张图中的某一个通道下的某个高度和某个宽度位置的点,即第 $ a $ 张图的第 $ d $ 个通道下的高度为b宽度为c的点。 +2)$a_{x,y}^i$表示在这个输出结构中的一个位置$[a,b,c,d]$,可以理解成在某一张图中的某一个通道下的某个高度和某个宽度位置的点,即第$a$张图的第$d$个通道下的高度为b宽度为c的点。 -3) $ N $:论文公式中的 $ N $ 表示通道数 (channel)。 +3)$N$:论文公式中的$N$表示通道数 (channel)。 -4) $ a $,$ n/2 $, $ k $ 分别表示函数中的 input,depth_radius,bias。参数 $ k, n, \alpha, \beta $ 都是超参数,一般设置 $ k=2, n=5, \alpha=1*e-4, \beta=0.75 $ +4)$a$,$n/2$,$k$分别表示函数中的 input,depth_radius,bias。参数$k, n, \alpha, \beta$都是超参数,一般设置$k=2, n=5, \alpha=1*e-4, \beta=0.75$ -5) $ \sum $:$ \sum $ 叠加的方向是沿着通道方向的,即每个点值的平方和是沿着 $ a $ 中的第 3 维 channel 方向的,也就是一个点同方向的前面 $ n/2 $ 个通道(最小为第 $ 0 $ 个通道)和后 $ n/2 $ 个通道(最大为第 $ d-1 $ 个通道)的点的平方和(共 $ n+1 $ 个点)。而函数的英文注解中也说明了把 input 当成是 $ d $ 个 3 维的矩阵,说白了就是把 input 的通道数当作 3 维矩阵的个数,叠加的方向也是在通道方向。 +5)$\sum$:$\sum$叠加的方向是沿着通道方向的,即每个点值的平方和是沿着$a$中的第 3 维 channel 方向的,也就是一个点同方向的前面$n/2$个通道(最小为第$0$个通道)和后$n/2$个通道(最大为第$d-1$个通道)的点的平方和(共$n+1$个点)。而函数的英文注解中也说明了把 input 当成是$d$个 3 维的矩阵,说白了就是把 input 的通道数当作 3 维矩阵的个数,叠加的方向也是在通道方向。 简单的示意图如下: -![](img/ch3/3.6.7.1.png) +![](/assets/ch3/3.6.7.1.png) ### 3.6.8 什么是批归一化(Batch Normalization) -​ 以前在神经网络训练中,只是对输入层数据进行归一化处理,却没有在中间层进行归一化处理。要知道,虽然我们对输入数据进行了归一化处理,但是输入数据经过 $ \sigma(WX+b) $ 这样的矩阵乘法以及非线性运算之后,其数据分布很可能被改变,而随着深度网络的多层运算之后,数据分布的变化将越来越大。如果我们能在网络的中间也进行归一化处理,是否对网络的训练起到改进作用呢?答案是肯定的。 +​ 以前在神经网络训练中,只是对输入层数据进行归一化处理,却没有在中间层进行归一化处理。要知道,虽然我们对输入数据进行了归一化处理,但是输入数据经过$\sigma(WX+b)$这样的矩阵乘法以及非线性运算之后,其数据分布很可能被改变,而随着深度网络的多层运算之后,数据分布的变化将越来越大。如果我们能在网络的中间也进行归一化处理,是否对网络的训练起到改进作用呢?答案是肯定的。 ​ 这种在神经网络中间层也进行归一化处理,使训练效果更好的方法,就是批归一化Batch Normalization(BN)。 @@ -829,41 +775,33 @@ $$ 下面给出 BN 算法在训练时的过程 -输入:上一层输出结果 $ X = {x_1, x_2, ..., x_m} $,学习参数 $ \gamma, \beta $ +输入:上一层输出结果$X = {x_1, x_2, ..., x_m}$,学习参数$\gamma, \beta$ 算法流程: 1. 计算上一层输出数据的均值 -$$ -\mu_{\beta} = \frac{1}{m} \sum_{i=1}^m(x_i) -$$ +$$ \mu_{\beta} = \frac{1}{m} \sum_{i=1}^m(x_i) $$ -其中,$ m $ 是此次训练样本 batch 的大小。 +其中,$m$是此次训练样本 batch 的大小。 2. 计算上一层输出数据的标准差 -$$ -\sigma_{\beta}^2 = \frac{1}{m} \sum_{i=1}^m (x_i - \mu_{\beta})^2 -$$ +$$ \sigma_{\beta}^2 = \frac{1}{m} \sum_{i=1}^m (x_i - \mu_{\beta})^2 $$ 3. 归一化处理,得到 -$$ -\hat x_i = \frac{x_i + \mu_{\beta}}{\sqrt{\sigma_{\beta}^2} + \epsilon} -$$ +$$ \hat x_i = \frac{x_i + \mu_{\beta}}{\sqrt{\sigma_{\beta}^2} + \epsilon} $$ -其中 $ \epsilon $ 是为了避免分母为 0 而加进去的接近于 0 的很小值 +其中$\epsilon$是为了避免分母为 0 而加进去的接近于 0 的很小值 4. 重构,对经过上面归一化处理得到的数据进行重构,得到 -$$ -y_i = \gamma \hat x_i + \beta -$$ +$$ y_i = \gamma \hat x_i + \beta $$ -其中,$ \gamma, \beta $ 为可学习参数。 +其中,$\gamma, \beta$为可学习参数。 -注:上述是 BN 训练时的过程,但是当在投入使用时,往往只是输入一个样本,没有所谓的均值 $ \mu_{\beta} $ 和标准差 $ \sigma_{\beta}^2 $。此时,均值 $ \mu_{\beta} $ 是计算所有 batch $ \mu_{\beta} $ 值的平均值得到,标准差 $ \sigma_{\beta}^2 $ 采用每个batch $ \sigma_{\beta}^2 $ 的无偏估计得到。 +注:上述是 BN 训练时的过程,但是当在投入使用时,往往只是输入一个样本,没有所谓的均值$\mu_{\beta}$和标准差$\sigma_{\beta}^2$。此时,均值$\mu_{\beta}$是计算所有 batch$\mu_{\beta}$值的平均值得到,标准差$\sigma_{\beta}^2$采用每个batch$\sigma_{\beta}^2$ 的无偏估计得到。 ### 3.6.11 批归一化和群组归一化比较 @@ -877,7 +815,7 @@ $$ ​ Weight Normalization 和 Batch Normalization 都属于参数重写(Reparameterization)的方法,只是采用的方式不同。 -​ Weight Normalization 是对网络权值$ W $ 进行 normalization,因此也称为 Weight Normalization; +​ Weight Normalization 是对网络权值$W$进行 normalization,因此也称为 Weight Normalization; ​ Batch Normalization 是对网络某一层输入数据进行 normalization。 @@ -885,7 +823,7 @@ $$ 1. Weight Normalization 通过重写深度学习网络的权重W的方式来加速深度学习网络参数收敛,没有引入 minbatch 的依赖,适用于 RNN(LSTM)网络(Batch Normalization 不能直接用于RNN,进行 normalization 操作,原因在于:1) RNN 处理的 Sequence 是变长的;2) RNN 是基于 time step 计算,如果直接使用 Batch Normalization 处理,需要保存每个 time step 下,mini btach 的均值和方差,效率低且占内存)。 -2. Batch Normalization 基于一个 mini batch 的数据计算均值和方差,而不是基于整个 Training set 来做,相当于进行梯度计算式引入噪声。因此,Batch Normalization 不适用于对噪声敏感的强化学习、生成模型(Generative model:GAN,VAE)使用。相反,Weight Normalization 对通过标量 $ g $ 和向量 $ v $ 对权重 $ W $ 进行重写,重写向量 $ v $ 是固定的,因此,基于 Weight Normalization 的 Normalization 可以看做比 Batch Normalization 引入更少的噪声。 +2. Batch Normalization 基于一个 mini batch 的数据计算均值和方差,而不是基于整个 Training set 来做,相当于进行梯度计算式引入噪声。因此,Batch Normalization 不适用于对噪声敏感的强化学习、生成模型(Generative model:GAN,VAE)使用。相反,Weight Normalization 对通过标量$g$和向量$v$对权重$W$进行重写,重写向量$v$是固定的,因此,基于 Weight Normalization 的 Normalization 可以看做比 Batch Normalization 引入更少的噪声。 3. 不需要额外的存储空间来保存 mini batch 的均值和方差,同时实现 Weight Normalization 时,对深度学习网络进行正向信号传播和反向梯度计算带来的额外计算开销也很小。因此,要比采用 Batch Normalization 进行 normalization 操作时,速度快。 但是 Weight Normalization 不具备 Batch Normalization 把网络每一层的输出 Y 固定在一个变化范围的作用。因此,采用 Weight Normalization 进行 Normalization 时需要特别注意参数初始值的选择。 @@ -958,64 +896,48 @@ $$ ​ 以一个三层网络为例: 首先看下结构 -![](img/ch3/3.8.2.1.png) +![](/assets/ch3/3.8.2.1.png) 它的表达式为: -$$ -a_1^{(2)} = f(W_{11}^{(1)} x_1 + W_{12}^{(1)} x_2 + W_{13}^{(1)} x_3 + b_1^{(1)}) -$$ +$$ a_1^{(2)} = f(W_{11}^{(1)} x_1 + W_{12}^{(1)} x_2 + W_{13}^{(1)} x_3 + b_1^{(1)}) $$ -$$ -a_2^{(2)} = f(W_{21}^{(1)} x_1 + W_{22}^{(1)} x_2 + W_{23}^{(1)} x_3 + b_2^{(1)}) -$$ +$$ a_2^{(2)} = f(W_{21}^{(1)} x_1 + W_{22}^{(1)} x_2 + W_{23}^{(1)} x_3 + b_2^{(1)}) $$ -$$ -a_3^{(2)} = f(W_{31}^{(1)} x_1 + W_{32}^{(1)} x_2 + W_{33}^{(1)} x_3 + b_3^{(1)}) -$$ +$$ a_3^{(2)} = f(W_{31}^{(1)} x_1 + W_{32}^{(1)} x_2 + W_{33}^{(1)} x_3 + b_3^{(1)}) $$ -$$ -h_{W,b}(x) = a_1^{(3)} = f(W_{11}^{(2)} a_1^{(2)} + W_{12}^{(2)} a_2^{(2)} + W_{13}^{(2)} a_3^{(2)} + b_1^{(2)}) -$$ +$$ h_{W,b}(x) = a_1^{(3)} = f(W_{11}^{(2)} a_1^{(2)} + W_{12}^{(2)} a_2^{(2)} + W_{13}^{(2)} a_3^{(2)} + b_1^{(2)}) $$ -$$ -xa_1^{(2)} = f(W_{11}^{(1)} x_1 + W_{12}^{(1)} x_2 + W_{13}^{(1)} x_3 + b_1^{(1)})a_2^{(2)} = f(W_{21}^{(1)} x_1 + W_{22}^{(1)} x_2 + W_{23}^{(1)} x_3 + -$$ +$$ xa_1^{(2)} = f(W_{11}^{(1)} x_1 + W_{12}^{(1)} x_2 + W_{13}^{(1)} x_3 + b_1^{(1)})a_2^{(2)} = f(W_{21}^{(1)} x_1 + W_{22}^{(1)} x_2 + W_{23}^{(1)} x_3 + $$ -如果每个权重都一样,那么在多层网络中,从第二层开始,每一层的输入值都是相同的了也就是$ a1=a2=a3=.... $,既然都一样,就相当于一个输入了,为啥呢?? +如果每个权重都一样,那么在多层网络中,从第二层开始,每一层的输入值都是相同的了也就是$a1=a2=a3=....$,既然都一样,就相当于一个输入了,为啥呢?? 如果是反向传递算法(如果这里不明白请看上面的连接),其中的偏置项和权重项的迭代的偏导数计算公式如下 -$$ -\frac{\partial}{\partial W_{ij}^{(l)}} J(W,b;x,y) = a_j^{(l)} \delta_i^{(l+1)} +$$ \frac{\partial}{\partial W_{ij}^{(l)}} J(W,b;x,y) = a_j^{(l)} \delta_i^{(l+1)} -\frac{\partial}{\partial b_{i}^{(l)}} J(W,b;x,y) = \delta_i^{(l+1)} -$$ +\frac{\partial}{\partial b_{i}^{(l)}} J(W,b;x,y) = \delta_i^{(l+1)} $$ -$ \delta $ 的计算公式 +$\delta$的计算公式 -$$ -\delta_i^{(l)} = (\sum_{j=1}^{s_{t+1}} W_{ji}^{(l)} \delta_j^{(l+1)} ) f^{\prime}(z_i^{(l)}) -$$ +$$ \delta_i^{(l)} = (\sum_{j=1}^{s_{t+1}} W_{ji}^{(l)} \delta_j^{(l+1)} ) f^{\prime}(z_i^{(l)}) $$ 如果用的是 sigmoid 函数 -$$ -f^{\prime}(z_i^{(l)}) = a_i^{(l)}(1-a_i^{(l)}) -$$ +$$ f^{\prime}(z_i^{(l)}) = a_i^{(l)}(1-a_i^{(l)}) $$ 把后两个公式代入,可以看出所得到的梯度下降法的偏导相同,不停的迭代,不停的相同,不停的迭代,不停的相同......,最后就得到了相同的值(权重和截距)。 ### 3.8.3 初始化为小的随机数 -​ 将权重初始化为很小的数字是一个普遍的打破网络对称性的解决办法。这个想法是,神经元在一开始都是随机的、独一无二的,所以它们会计算出不同的更新,并将自己整合到整个网络的各个部分。一个权重矩阵的实现可能看起来像 $ W=0.01∗np.random.randn(D,H) $,其中 randn 是从均值为 0 的单位标准高斯分布进行取样。通过这个公式(函数),每个神经元的权重向量初始化为一个从多维高斯分布取样的随机向量,所以神经元在输入空间中指向随机的方向(so the neurons point in random direction in the input space). 应该是指输入空间对于随机方向有影响)。其实也可以从均匀分布中来随机选取小数,但是在实际操作中看起来似乎对最后的表现并没有太大的影响。 +​ 将权重初始化为很小的数字是一个普遍的打破网络对称性的解决办法。这个想法是,神经元在一开始都是随机的、独一无二的,所以它们会计算出不同的更新,并将自己整合到整个网络的各个部分。一个权重矩阵的实现可能看起来像$W=0.01∗np.random.randn(D,H)$,其中 randn 是从均值为 0 的单位标准高斯分布进行取样。通过这个公式(函数),每个神经元的权重向量初始化为一个从多维高斯分布取样的随机向量,所以神经元在输入空间中指向随机的方向(so the neurons point in random direction in the input space). 应该是指输入空间对于随机方向有影响)。其实也可以从均匀分布中来随机选取小数,但是在实际操作中看起来似乎对最后的表现并没有太大的影响。 ​ 备注:并不是数字越小就会表现的越好。比如,如果一个神经网络层的权重非常小,那么在反向传播算法就会计算出很小的梯度(因为梯度 gradient 是与权重成正比的)。在网络不断的反向传播过程中将极大地减少“梯度信号”,并可能成为深层网络的一个需要注意的问题。 -### 3.8.4 用 $ 1/\sqrt n $ 校准方差 +### 3.8.4 用$1/\sqrt n$校准方差 -​ 上述建议的一个问题是,随机初始化神经元的输出的分布有一个随输入量增加而变化的方差。结果证明,我们可以通过将其权重向量按其输入的平方根(即输入的数量)进行缩放,从而将每个神经元的输出的方差标准化到 1。也就是说推荐的启发式方法 (heuristic) 是将每个神经元的权重向量按下面的方法进行初始化: $ w=np.random.randn(n)/\sqrt n $,其中 n 表示输入的数量。这保证了网络中所有的神经元最初的输出分布大致相同,并在经验上提高了收敛速度。 +​ 上述建议的一个问题是,随机初始化神经元的输出的分布有一个随输入量增加而变化的方差。结果证明,我们可以通过将其权重向量按其输入的平方根(即输入的数量)进行缩放,从而将每个神经元的输出的方差标准化到 1。也就是说推荐的启发式方法 (heuristic) 是将每个神经元的权重向量按下面的方法进行初始化:$w=np.random.randn(n)/\sqrt n$,其中 n 表示输入的数量。这保证了网络中所有的神经元最初的输出分布大致相同,并在经验上提高了收敛速度。 ### 3.8.5 稀疏初始化(Sparse Initialazation) @@ -1053,73 +975,59 @@ $$ ​ 分段常数衰减需要事先定义好的训练次数区间,在对应区间置不同的学习率的常数值,一般情况刚开始的学习率要大一些,之后要越来越小,要根据样本量的大小设置区间的间隔大小,样本量越大,区间间隔要小一点。下图即为分段常数衰减的学习率变化图,横坐标代表训练次数,纵坐标代表学习率。 -![](img/ch3/learnrate1.png) +![](/assets/ch3/learnrate1.png) ### 3.9.4 指数衰减 ​ 以指数衰减方式进行学习率的更新,学习率的大小和训练次数指数相关,其更新规则为: -$$ -decayed{\_}learning{\_}rate =learning{\_}rate*decay{\_}rate^{\frac{global{\_step}}{decay{\_}steps}} -$$ +$$ decayed{\_}learning{\_}rate =learning{\_}rate*decay{\_}rate^{\frac{global{\_step}}{decay{\_}steps}} $$ + ​ 这种衰减方式简单直接,收敛速度快,是最常用的学习率衰减方式,如下图所示,绿色的为学习率随 训练次数的指数衰减方式,红色的即为分段常数衰减,它在一定的训练区间内保持学习率不变。 -![](img/ch3/learnrate2.png) +![](/assets/ch3/learnrate2.png) ### 3.9.5 自然指数衰减 ​ 它与指数衰减方式相似,不同的在于它的衰减底数是$e$,故而其收敛的速度更快,一般用于相对比较 -容易训练的网络,便于较快的收敛,其更新规则如下 -$$ -decayed{\_}learning{\_}rate =learning{\_}rate*e^{\frac{-decay{\_rate}}{global{\_}step}} -$$ +容易训练的网络,便于较快的收敛,其更新规则如下 +$$ decayed{\_}learning{\_}rate =learning{\_}rate*e^{\frac{-decay{\_rate}}{global{\_}step}} $$ + ​ 下图为为分段常数衰减、指数衰减、自然指数衰减三种方式的对比图,红色的即为分段常数衰减图,阶梯型曲线。蓝色线为指数衰减图,绿色即为自然指数衰减图,很明可以看到自然指数衰减方式下的学习率衰减程度要大于一般指数衰减方式,有助于更快的收敛。 -![](img/ch3/learnrate3.png) +![](/assets/ch3/learnrate3.png) ### 3.9.6 多项式衰减 ​ 应用多项式衰减的方式进行更新学习率,这里会给定初始学习率和最低学习率取值,然后将会按照 -给定的衰减方式将学习率从初始值衰减到最低值,其更新规则如下式所示。 -$$ -global{\_}step=min(global{\_}step,decay{\_}steps) -$$ - -$$ -decayed{\_}learning{\_}rate =(learning{\_}rate-end{\_}learning{\_}rate)* \left( 1-\frac{global{\_step}}{decay{\_}steps}\right)^{power} \\ - +end{\_}learning{\_}rate -$$ - -​ 需要注意的是,有两个机制,降到最低学习率后,到训练结束可以一直使用最低学习率进行更新,另一个是再次将学习率调高,使用 decay_steps 的倍数,取第一个大于 global_steps 的结果,如下式所示.它是用来防止神经网络在训练的后期由于学习率过小而导致的网络一直在某个局部最小值附近震荡,这样可以通过在后期增大学习率跳出局部极小值。 -$$ -decay{\_}steps = decay{\_}steps*ceil \left( \frac{global{\_}step}{decay{\_}steps}\right) -$$ +给定的衰减方式将学习率从初始值衰减到最低值,其更新规则如下式所示。 + +$$ global{\_}step=min(global{\_}step,decay{\_}steps) $$ + +$$ decayed{\_}learning{\_}rate =(learning{\_}rate-end{\_}learning{\_}rate)* \left( 1-\frac{global{\_step}}{decay{\_}steps}\right)^{power} \\ +end{\_}learning{\_}rate $$ + +​ 需要注意的是,有两个机制,降到最低学习率后,到训练结束可以一直使用最低学习率进行更新,另一个是再次将学习率调高,使用 decay_steps 的倍数,取第一个大于 global_steps 的结果,如下式所示.它是用来防止神经网络在训练的后期由于学习率过小而导致的网络一直在某个局部最小值附近震荡,这样可以通过在后期增大学习率跳出局部极小值。 +$$ decay{\_}steps = decay{\_}steps*ceil \left( \frac{global{\_}step}{decay{\_}steps}\right) $$ + ​ 如下图所示,红色线代表学习率降低至最低后,一直保持学习率不变进行更新,绿色线代表学习率衰减到最低后,又会再次循环往复的升高降低。 -![](img/ch3/learnrate4.png) +![](/assets/ch3/learnrate4.png) ### 3.9.7 余弦衰减 -​ 余弦衰减就是采用余弦的相关方式进行学习率的衰减,衰减图和余弦函数相似。其更新机制如下式所示: -$$ -global{\_}step=min(global{\_}step,decay{\_}steps) -$$ +​ 余弦衰减就是采用余弦的相关方式进行学习率的衰减,衰减图和余弦函数相似。其更新机制如下式所示: + +$$ global{\_}step=min(global{\_}step,decay{\_}steps) $$ -$$ -cosine{\_}decay=0.5*\left( 1+cos\left( \pi* \frac{global{\_}step}{decay{\_}steps}\right)\right) -$$ +$$ cosine{\_}decay=0.5*\left( 1+cos\left( \pi* \frac{global{\_}step}{decay{\_}steps}\right)\right) $$ -$$ -decayed=(1-\alpha)*cosine{\_}decay+\alpha -$$ +$$ decayed=(1-\alpha)*cosine{\_}decay+\alpha $$ -$$ -decayed{\_}learning{\_}rate=learning{\_}rate*decayed -$$ +$$ decayed{\_}learning{\_}rate=learning{\_}rate*decayed $$ ​ 如下图所示,红色即为标准的余弦衰减曲线,学习率从初始值下降到最低学习率后保持不变。蓝色的线是线性余弦衰减方式曲线,它是学习率从初始学习率以线性的方式下降到最低学习率值。绿色噪声线性余弦衰减方式。 -![](img/ch3/learnrate5.png) +![](/assets/ch3/learnrate5.png) ## 3.12 Dropout 系列问题 @@ -1129,8 +1037,8 @@ $$ ### 3.12.2 为什么正则化有利于预防过拟合? -![](img/ch3/3.12.2.1.png) -![](img/ch3/3.12.2.2.png) +![](/assets/ch3/3.12.2.1.png) +![](/assets/ch3/3.12.2.2.png) 左图是高偏差,右图是高方差,中间是Just Right,这几张图我们在前面课程中看到过。 @@ -1143,10 +1051,10 @@ $$ 1. 经过交叉验证,隐含节点 dropout 率等于 0.5 的时候效果最好,原因是 0.5 的时候 dropout 随机生成的网络结构最多。 2. dropout 也可以被用作一种添加噪声的方法,直接对 input 进行操作。输入层设为更接近 1 的数。使得输入变化不会太大(0.8) -3. 对参数 $ w $ 的训练进行球形限制 (max-normalization),对 dropout 的训练非常有用。 -4. 球形半径 $ c $ 是一个需要调整的参数,可以使用验证集进行参数调优。 +3. 对参数$w$的训练进行球形限制 (max-normalization),对 dropout 的训练非常有用。 +4. 球形半径$c$是一个需要调整的参数,可以使用验证集进行参数调优。 5. dropout 自己虽然也很牛,但是 dropout、max-normalization、large decaying learning rates and high momentum 组合起来效果更好,比如 max-norm regularization 就可以防止大的learning rate 导致的参数 blow up。 -6. 使用 pretraining 方法也可以帮助 dropout 训练参数,在使用 dropout 时,要将所有参数都乘以 $ 1/p $。 +6. 使用 pretraining 方法也可以帮助 dropout 训练参数,在使用 dropout 时,要将所有参数都乘以$1/p$。 ### 3.12.5 dropout有什么缺点? diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/LeNet-5.jpg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/LeNet-5.jpg" deleted file mode 100644 index fb65aedd..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/LeNet-5.jpg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/alexnet.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/alexnet.png" deleted file mode 100644 index 1a954ca5..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/alexnet.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/featureMap.jpg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/featureMap.jpg" deleted file mode 100644 index 2e077ef9..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/featureMap.jpg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image10.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image10.png" deleted file mode 100644 index ef7ed01d..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image10.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image11.GIF" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image11.GIF" deleted file mode 100644 index ab72b16f..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image11.GIF" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image12.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image12.png" deleted file mode 100644 index a8428209..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image12.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image13.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image13.png" deleted file mode 100644 index 56c7a125..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image13.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image14.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image14.png" deleted file mode 100644 index 0f52f559..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image14.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image15.jpeg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image15.jpeg" deleted file mode 100644 index 2ea99b40..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image15.jpeg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image18.jpeg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image18.jpeg" deleted file mode 100644 index ba94f6c7..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image18.jpeg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image19.jpeg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image19.jpeg" deleted file mode 100644 index 920f056f..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image19.jpeg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image2.jpeg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image2.jpeg" deleted file mode 100644 index 284e36e2..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image2.jpeg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image20.jpeg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image20.jpeg" deleted file mode 100644 index 48f8eb45..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image20.jpeg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image22.jpeg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image22.jpeg" deleted file mode 100644 index 4a46634e..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image22.jpeg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image24.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image24.png" deleted file mode 100644 index 538640e7..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image24.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image25.jpeg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image25.jpeg" deleted file mode 100644 index 536e6551..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image25.jpeg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image26.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image26.png" deleted file mode 100644 index 51c7d189..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image26.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image27.jpeg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image27.jpeg" deleted file mode 100644 index 6e526ee1..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image27.jpeg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image28.jpeg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image28.jpeg" deleted file mode 100644 index 931a1d64..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image28.jpeg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image3.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image3.png" deleted file mode 100644 index aeedc2de..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image3.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image33.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image33.png" deleted file mode 100644 index 43d7908f..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image33.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image39.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image39.png" deleted file mode 100644 index 66c49a23..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image39.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image4.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image4.png" deleted file mode 100644 index 37193778..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image4.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image40.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image40.png" deleted file mode 100644 index 8643e43e..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image40.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image41.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image41.png" deleted file mode 100644 index 32bf30da..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image41.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image42.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image42.png" deleted file mode 100644 index 233128ec..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image42.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image43.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image43.png" deleted file mode 100644 index 43713358..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image43.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image44.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image44.png" deleted file mode 100644 index c1da2658..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image44.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image45.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image45.png" deleted file mode 100644 index f5257d08..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image45.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image48.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image48.png" deleted file mode 100644 index 97801f04..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image48.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image49.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image49.png" deleted file mode 100644 index 883bc7b3..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image49.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image5.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image5.png" deleted file mode 100644 index 6c518d67..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image5.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image50.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image50.png" deleted file mode 100644 index e265b45a..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image50.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image51.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image51.png" deleted file mode 100644 index 34133a06..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image51.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image52.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image52.png" deleted file mode 100644 index a6ed65ba..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image52.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image53.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image53.png" deleted file mode 100644 index ec92de40..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image53.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image54.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image54.png" deleted file mode 100644 index 3558da80..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image54.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image55.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image55.png" deleted file mode 100644 index 963436a2..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image55.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image56.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image56.png" deleted file mode 100644 index c07aed22..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image56.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image6.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image6.png" deleted file mode 100644 index f1509b8b..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image6.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image60.jpeg" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image60.jpeg" deleted file mode 100644 index 5f45a372..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image60.jpeg" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image61.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image61.png" deleted file mode 100644 index dd7b1283..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image61.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image62.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image62.png" deleted file mode 100644 index 221fb4bd..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image62.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image7.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image7.png" deleted file mode 100644 index 0c5fe01f..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image7.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image8.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image8.png" deleted file mode 100644 index 20a6a5d2..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image8.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image9.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image9.png" deleted file mode 100644 index b2fc2e73..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image9.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/vgg16.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/vgg16.png" deleted file mode 100644 index 3dca57d1..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/vgg16.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/zfnet-layer1.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/zfnet-layer1.png" deleted file mode 100644 index 7fb93f7f..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/zfnet-layer1.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/zfnet-layer2.png" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/zfnet-layer2.png" deleted file mode 100644 index c2e2f6c7..00000000 Binary files "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/zfnet-layer2.png" and /dev/null differ diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/\347\254\254\345\233\233\347\253\240_\347\273\217\345\205\270\347\275\221\347\273\234.md" "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/\347\254\254\345\233\233\347\253\240_\347\273\217\345\205\270\347\275\221\347\273\234.md" index 9747bb68..04358af4 100644 --- "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/\347\254\254\345\233\233\347\253\240_\347\273\217\345\205\270\347\275\221\347\273\234.md" +++ "b/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/\347\254\254\345\233\233\347\253\240_\347\273\217\345\205\270\347\275\221\347\273\234.md" @@ -9,7 +9,7 @@ ### 4.1.2 模型结构 -![](img/ch4/image1.png) +![](/assets/ch4/image1.png) ​ 图4.1 LeNet-5网络结构图 @@ -31,7 +31,7 @@ > > ​ $^*$ $C_3$卷积层可训练参数并未直接连接$S_2$中所有的特征图(Feature Map),而是采用如图4.2所示的采样特征方式进行连接(稀疏连接),生成的16个通道特征图中分别按照相邻3个特征图、相邻4个特征图、非相邻4个特征图和全部6个特征图进行映射,得到的参数个数计算公式为$6\times(25\times3+1)+6\times(25\times4+1)+3\times(25\times4+1)+1\times(25\times6+1)=1516$,在原论文中解释了使用这种采样方式原因包含两点:限制了连接数不至于过大(当年的计算能力比较弱);强制限定不同特征图的组合可以使映射得到的特征图学习到不同的特征模式。 -![FeatureMap](img/ch4/featureMap.jpg) +![FeatureMap](/assets/ch4/featureMap.jpg) ​ 图4.2 $S_2$与$C_3$之间的特征图稀疏连接 @@ -49,11 +49,12 @@ ### 4.2.1 模型介绍 -​ AlexNet是由$Alex$ $Krizhevsky $提出的首个应用于图像分类的深层卷积神经网络,该网络在2012年ILSVRC(ImageNet Large Scale Visual Recognition Competition)图像分类竞赛中以15.3%的top-5测试错误率赢得第一名$^{[2]}$。AlexNet使用GPU代替CPU进行运算,使得在可接受的时间范围内模型结构能够更加复杂,它的出现证明了深层卷积神经网络在复杂模型下的有效性,使CNN在计算机视觉中流行开来,直接或间接地引发了深度学习的热潮。 +​ AlexNet是由$Alex$ $Krizhevsky$提出的首个应用于图像分类的深层卷积神经网络,该网络在2012年ILSVRC(ImageNet Large Scale Visual Recognition Competition)图像分类竞赛中以15.3%的top-5测试错误率赢得第一名$^{[2]}$。 +AlexNet使用GPU代替CPU进行运算,使得在可接受的时间范围内模型结构能够更加复杂,它的出现证明了深层卷积神经网络在复杂模型下的有效性,使CNN在计算机视觉中流行开来,直接或间接地引发了深度学习的热潮。 ### 4.2.2 模型结构 -![](img/ch4/alexnet.png) +![](/assets/ch4/alexnet.png) ​ 图4.3 AlexNet网络结构图 @@ -100,17 +101,17 @@ ### 4.3.2 模型结构 -![](img/ch4/image21.png) +![](/assets/ch4/image21.png) -![](img/ch4/image21.jpeg) +![](/assets/ch4/image21.jpeg) ​ 图4.4 ZFNet网络结构图(原始结构图与AlexNet风格结构图) ​ 如图4.4所示,ZFNet与AlexNet类似,都是由8层网络组成的卷积神经网络,其中包含5层卷积层和3层全连接层。两个网络结构最大的不同在于,ZFNet第一层卷积采用了$7\times7\times3/2$的卷积核替代了AlexNet中第一层卷积核$11\times11\times3/4$的卷积核。图4.5中ZFNet相比于AlexNet在第一层输出的特征图中包含更多中间频率的信息,而AlexNet第一层输出的特征图大多是低频或高频的信息,对中间频率特征的缺失导致后续网络层次如图4.5(c)能够学习到的特征不够细致,而导致这个问题的根本原因在于AlexNet在第一层中采用的卷积核和步长过大。 -![](img/ch4/zfnet-layer1.png) +![](/assets/ch4/zfnet-layer1.png) -![](img/ch4/zfnet-layer2.png) +![](/assets/ch4/zfnet-layer2.png) ​ 图4.5 (a)ZFNet第一层输出的特征图(b)AlexNet第一层输出的特征图(c)AlexNet第二层输出的特征图(d)ZFNet第二层输出的特征图 @@ -150,7 +151,7 @@ ### 4.4.2 模型结构 -![](img/ch4/image23.png) +![](/assets/ch4/image23.png) ​ 图 4.6 NIN网络结构图 ​ NIN由三层的多层感知卷积层(MLPConv Layer)构成,每一层多层感知卷积层内部由若干层的局部全连接层和非线性激活函数组成,代替了传统卷积层中采用的线性卷积核。在网络推理(inference)时,这个多层感知器会对输入特征图的局部特征进行划窗计算,并且每个划窗的局部特征图对应的乘积的权重是共享的,这两点是和传统卷积操作完全一致的,最大的不同在于多层感知器对局部特征进行了非线性的映射,而传统卷积的方式是线性的。NIN的网络参数配置表4.4所示(原论文并未给出网络参数,表中参数为编者结合网络结构图和CIFAR-100数据集以$3\times3$卷积为例给出)。 @@ -183,7 +184,7 @@ ### 4.5.2 模型结构 -![](img/ch4/vgg16.png) +![](/assets/ch4/vgg16.png) ​ 图 4.7 VGG16网络结构图 @@ -228,40 +229,40 @@ ​ GoogLeNet作为2014年ILSVRC在分类任务上的冠军,以6.65%的错误率力压VGGNet等模型,在分类的准确率上面相比过去两届冠军ZFNet和AlexNet都有很大的提升。从名字**GoogLe**Net可以知道这是来自谷歌工程师所设计的网络结构,而名字中Goog**LeNet**更是致敬了LeNet$^{[0]}$。GoogLeNet中最核心的部分是其内部子网络结构Inception,该结构灵感来源于NIN,至今已经经历了四次版本迭代(Inception$_{v1-4}$)。 -![](img/ch4/img_inception_01.png) +![](/assets/ch4/img_inception_01.png) ​ 图 4.8 Inception性能比较图 ### 4.6.2 模型结构 -![](img/ch4/image25.jpeg) +![](/assets/ch4/image25.jpeg) ​ 图 4.9 GoogLeNet网络结构图 ​ 如图4.9中所示,GoogLeNet相比于以前的卷积神经网络结构,除了在深度上进行了延伸,还对网络的宽度进行了扩展,整个网络由许多块状子网络的堆叠而成,这个子网络构成了Inception结构。图4.9为Inception的四个版本:$Inception_{v1}​$在同一层中采用不同的卷积核,并对卷积结果进行合并;$Inception_{v2}​$组合不同卷积核的堆叠形式,并对卷积结果进行合并;$Inception_{v3}​$则在$v_2​$基础上进行深度组合的尝试;$Inception_{v4}​$结构相比于前面的版本更加复杂,子网络中嵌套着子网络。 $Inception_{v1}$ -![](img/ch4/image27.png) +![](/assets/ch4/image27.png) -![](img/ch4/image28.png) +![](/assets/ch4/image28.png) $Inception_{v2}$ -![](img/ch4/image34.png) +![](/assets/ch4/image34.png) -![](img/ch4/image36.png) +![](/assets/ch4/image36.png) -![](img/ch4/image38.png) +![](/assets/ch4/image38.png) $Inception_{v3}$ -![](img/ch4/image37.png) +![](/assets/ch4/image37.png) $Inception_{v4}$ -![](img/ch4/image46.png) +![](/assets/ch4/image46.png) -![](img/ch4/image47.png) +![](/assets/ch4/image47.png) -![](img/ch4/image63.png) +![](/assets/ch4/image63.png) ​ 图 4.10 Inception$_{v1-4}$结构图 diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/\347\254\254\344\272\224\347\253\240_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN).md" "b/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/\347\254\254\344\272\224\347\253\240_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN).md" index 6d28c7ae..ec19da90 100644 --- "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/\347\254\254\344\272\224\347\253\240_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN).md" +++ "b/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/\347\254\254\344\272\224\347\253\240_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN).md" @@ -30,7 +30,7 @@ ### 5.1.2 卷积层 ​ 卷积层(Convolution Layer)通常用作对输入层输入数据进行特征提取,通过卷积核矩阵对原始数据中隐含关联性的一种抽象。卷积操作原理上其实是对两张像素矩阵进行点乘求和的数学操作,其中一个矩阵为输入的数据矩阵,另一个矩阵则为卷积核(滤波器或特征矩阵),求得的结果表示为原始图像中提取的特定局部特征。图5.1表示卷积操作过程中的不同填充策略,上半部分采用零填充,下半部分采用有效卷积(舍弃不能完整运算的边缘部分)。 -​ ![conv-same](img/ch5/convolution.png) +​ ![conv-same](/assets/ch5/convolution.png) ​ 图5.1 卷积操作示意图 ### 5.1.3 激活层 @@ -67,12 +67,12 @@ $$ | 卷积作用 | 卷积核 | 卷积后图像 | | :----------------------: | :----------------------------------------------------------: | :-----------------------------------------------: | -| 输出原图 | $\begin{bmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{bmatrix}$ | ![origin_img](img/ch5/cat.jpg) | -| 边缘检测(突出边缘差异) | $\begin{bmatrix} 1 & 0 & -1 \\ 0 & 0 & 0 \\ -1 & 0 & 1 \end{bmatrix}$ | ![edgeDetect-1](img/ch5/cat-edgeDetect.jpg) | -| 边缘检测(突出中间值) | $\begin{bmatrix} -1 & -1 & -1 \\ -1 & 8 & -1 \\ -1 & -1 & -1 \end{bmatrix}$ | ![edgeDetect-2](img/ch5/cat-edgeDetect-2.jpg) | -| 图像锐化 | $\begin{bmatrix} 0 & -1 & 0 \\ -1 & 5 & -1 \\ 0 & -1 & 0 \end{bmatrix}$ | ![sharpen_img](img/ch5/cat-sharpen.jpg) | -| 方块模糊 | $\begin{bmatrix} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{bmatrix} \times \frac{1}{9}$ | ![box_blur](img/ch5/cat-boxblur.jpg) | -| 高斯模糊 | $\begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{bmatrix} \times \frac{1}{16}$ | ![gaussian_blur](img/ch5/cat-blur-gaussian.jpg) | +| 输出原图 | $\begin{bmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{bmatrix}$ | ![origin_img](/assets/ch5/cat.jpg) | +| 边缘检测(突出边缘差异) | $\begin{bmatrix} 1 & 0 & -1 \\ 0 & 0 & 0 \\ -1 & 0 & 1 \end{bmatrix}$ | ![edgeDetect-1](/assets/ch5/cat-edgeDetect.jpg) | +| 边缘检测(突出中间值) | $\begin{bmatrix} -1 & -1 & -1 \\ -1 & 8 & -1 \\ -1 & -1 & -1 \end{bmatrix}$ | ![edgeDetect-2](/assets/ch5/cat-edgeDetect-2.jpg) | +| 图像锐化 | $\begin{bmatrix} 0 & -1 & 0 \\ -1 & 5 & -1 \\ 0 & -1 & 0 \end{bmatrix}$ | ![sharpen_img](/assets/ch5/cat-sharpen.jpg) | +| 方块模糊 | $\begin{bmatrix} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{bmatrix} \times \frac{1}{9}$ | ![box_blur](/assets/ch5/cat-boxblur.jpg) | +| 高斯模糊 | $\begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{bmatrix} \times \frac{1}{16}$ | ![gaussian_blur](/assets/ch5/cat-blur-gaussian.jpg) | ## 5.3 卷积层有哪些基本参数? @@ -101,22 +101,22 @@ $$ | 卷积类别 | 示意图 | 作用 | | :----------------------------: | :---------------------------: | :----------------------------------------------------------- | -| 标准卷积 | ![image](img/ch5/img7.png) | 最常用的卷积核,连续紧密的矩阵形式可以提取图像区域中的相邻像素之间的关联关系,$3\times3$的卷积核可以获得$3\times3$像素范围的感受视野 | -| 扩张卷积(带孔卷积或空洞卷积) | ![image](img/ch5/img8.png) | 引入一个称作扩张率(Dilation Rate)的参数,使同样尺寸的卷积核可以获得更大的感受视野,相应的在相同感受视野的前提下比普通卷积采用更少的参数。同样是$3\times3$的卷积核尺寸,扩张卷积可以提取$5\times5$范围的区域特征,在实时图像分割领域广泛应用 | -| 转置卷积 | ![image](img/ch5/img10.png) | 先对原始特征矩阵进行填充使其维度扩大到适配卷积目标输出维度,然后进行普通的卷积操作的一个过程,其输入到输出的维度变换关系恰好与普通卷积的变换关系相反,但这个变换并不是真正的逆变换操作,通常称为转置卷积(Transpose Convolution)而不是反卷积(Deconvolution)。转置卷积常见于目标检测领域中对小目标的检测和图像分割领域还原输入图像尺度。 | -| 可分离卷积 | ![image](img/ch5/img11.png) | 标准的卷积操作是同时对原始图像$H\times W\times C$三个方向的卷积运算,假设有$K$个相同尺寸的卷积核,这样的卷积操作需要用到的参数为$H\times W\times C\times K$个;若将长宽与深度方向的卷积操作分离出变为$H\times W$与$C$的两步卷积操作,则同样的卷积核个数$K$,只需要$(H\times W + C)\times K$个参数,便可得到同样的输出尺度。可分离卷积(Seperable Convolution)通常应用在模型压缩或一些轻量的卷积神经网络中,如MobileNet$^{[1]}$、Xception$^{[2]}$等 | +| 标准卷积 | ![image](/assets/ch5/img7.png) | 最常用的卷积核,连续紧密的矩阵形式可以提取图像区域中的相邻像素之间的关联关系,$3\times3$的卷积核可以获得$3\times3$像素范围的感受视野 | +| 扩张卷积(带孔卷积或空洞卷积) | ![image](/assets/ch5/img8.png) | 引入一个称作扩张率(Dilation Rate)的参数,使同样尺寸的卷积核可以获得更大的感受视野,相应的在相同感受视野的前提下比普通卷积采用更少的参数。同样是$3\times3$的卷积核尺寸,扩张卷积可以提取$5\times5$范围的区域特征,在实时图像分割领域广泛应用 | +| 转置卷积 | ![image](/assets/ch5/img10.png) | 先对原始特征矩阵进行填充使其维度扩大到适配卷积目标输出维度,然后进行普通的卷积操作的一个过程,其输入到输出的维度变换关系恰好与普通卷积的变换关系相反,但这个变换并不是真正的逆变换操作,通常称为转置卷积(Transpose Convolution)而不是反卷积(Deconvolution)。转置卷积常见于目标检测领域中对小目标的检测和图像分割领域还原输入图像尺度。 | +| 可分离卷积 | ![image](/assets/ch5/img11.png) | 标准的卷积操作是同时对原始图像$H\times W\times C$三个方向的卷积运算,假设有$K$个相同尺寸的卷积核,这样的卷积操作需要用到的参数为$H\times W\times C\times K$个;若将长宽与深度方向的卷积操作分离出变为$H\times W$与$C$的两步卷积操作,则同样的卷积核个数$K$,只需要$(H\times W + C)\times K$个参数,便可得到同样的输出尺度。可分离卷积(Seperable Convolution)通常应用在模型压缩或一些轻量的卷积神经网络中,如MobileNet$^{[1]}$、Xception$^{[2]}$等 | ## 5.5 二维卷积与三维卷积有什么区别? - **二维卷积** 二维卷积操作如图5.3所示,为了更直观的说明,分别展示在单通道和多通道输入中,对单个通道输出的卷积操作。在单通道输入的情况下,若输入卷积核尺寸为 $(k_h, k_w, 1)​$,卷积核在输入图像的空间维度上进行滑窗操作,每次滑窗和 $(k_h, k_w)​$窗口内的值进行卷积操作,得到输出图像中的一个值。在多通道输入的情况下,假定输入图像特征通道数为3,卷积核尺寸则为$(k_h, k_w, 3)​$,每次滑窗与3个通道上的$(k_h, k_w)​$窗口内的所有值进行卷积操作,得到输出图像中的一个值。 -![image](img/ch5/5.6.1.png) +![image](/assets/ch5/5.6.1.png) - **三维卷积** 3D卷积操作如图所示,同样分为单通道和多通道,且假定只使用1个卷积核,即输出图像仅有一个通道。对于单通道输入,与2D卷积不同之处在于,输入图像多了一个深度(depth)维度,卷积核也多了一个$k_d​$维度,因此3D卷积核的尺寸为$(k_h, k_w, k_d)​$,每次滑窗与$(k_h, k_w, k_d)​$窗口内的值进行相关操作,得到输出3D图像中的一个值。对于多通道输入,则与2D卷积的操作一样,每次滑窗与3个channels上的$(k_h, k_w, k_d)​$窗口内的所有值进行相关操作,得到输出3D图像中的一个值。 -![image](img/ch5/5.6.2.png) +![image](/assets/ch5/5.6.2.png) ## 5.7 有哪些池化方法? @@ -125,9 +125,9 @@ $$ | 池化类型 | 示意图 | 作用 | | :-----------------------------------------: | :-----------------------------------------------: | :----------------------------------------------------------- | -| 一般池化(General Pooling) | ![max_pooling](img/ch5/general_pooling.png) | 通常包括最大池化(Max Pooling)和平均池化(Mean Pooling)。以最大池化为例,池化范围$(2\times2)$和滑窗步长$(stride=2)$ 相同,仅提取一次相同区域的范化特征。 | -| 重叠池化(Overlapping Pooling) | ![overlap_pooling](img/ch5/overlap_pooling.png) | 与一般池化操作相同,但是池化范围$P_{size}$与滑窗步长$stride$关系为$P_{size}>stride$,同一区域内的像素特征可以参与多次滑窗提取,得到的特征表达能力更强,但计算量更大。 | -| 空间金字塔池化$^*$(Spatial Pyramid Pooling) | ![spatial_pooling](img/ch5/spatial_pooling.png) | 在进行多尺度目标的训练时,卷积层允许输入的图像特征尺度是可变的,紧接的池化层若采用一般的池化方法会使得不同的输入特征输出相应变化尺度的特征,而卷积神经网络中最后的全连接层则无法对可变尺度进行运算,因此需要对不同尺度的输出特征采样到相同输出尺度。 | +| 一般池化(General Pooling) | ![max_pooling](/assets/ch5/general_pooling.png) | 通常包括最大池化(Max Pooling)和平均池化(Mean Pooling)。以最大池化为例,池化范围$(2\times2)$和滑窗步长$(stride=2)$ 相同,仅提取一次相同区域的范化特征。 | +| 重叠池化(Overlapping Pooling) | ![overlap_pooling](/assets/ch5/overlap_pooling.png) | 与一般池化操作相同,但是池化范围$P_{size}$与滑窗步长$stride$关系为$P_{size}>stride$,同一区域内的像素特征可以参与多次滑窗提取,得到的特征表达能力更强,但计算量更大。 | +| 空间金字塔池化$^*$(Spatial Pyramid Pooling) | ![spatial_pooling](/assets/ch5/spatial_pooling.png) | 在进行多尺度目标的训练时,卷积层允许输入的图像特征尺度是可变的,紧接的池化层若采用一般的池化方法会使得不同的输入特征输出相应变化尺度的特征,而卷积神经网络中最后的全连接层则无法对可变尺度进行运算,因此需要对不同尺度的输出特征采样到相同输出尺度。 | > SPPNet$^{[3]}$就引入了空间池化的组合,对不同输出尺度采用不同的滑窗大小和步长以确保输出尺度相同$(win_{size}=\lceil \frac{in}{out}\rceil; stride=\lfloor \frac{in}{out}\rfloor; )$,同时用如金字塔式叠加的多种池化尺度组合,以提取更加丰富的图像特征。常用于多尺度训练和目标检测中的区域提议网络(Region Proposal Network)的兴趣区域(Region of Interest)提取 @@ -139,7 +139,7 @@ $$ ​ GoogLeNet$^{[5]}​$则采用$1\times1​$卷积核来减少模型的参数量。在原始版本的Inception模块中,由于每一层网络采用了更多的卷积核,大大增加了模型的参数量。此时在每一个较大卷积核的卷积层前引入$1\times1​$卷积,可以通过分离通道与宽高卷积来减少模型参数量。以图5.2为例,在不考虑参数偏置项的情况下,若输入和输出的通道数为$C_1=16​$,则左半边网络模块所需的参数为$(1\times1+3\times3+5\times5+0)\times C_1\times C_1=8960​$;假定右半边网络模块采用的$1\times1​$卷积通道数为$C_2=8​$$(满足C_1>C_2)​$,则右半部分的网络结构所需参数量为$(1\times1\times (3C_1+C_2)+3\times3\times C_2 +5\times5\times C_2)\times C_1=5248​$ ,可以在不改变模型表达能力的前提下大大减少所使用的参数量。 -![image](img/ch5/5.8-1.png) +![image](/assets/ch5/5.8-1.png) ​ 图5.2 Inception模块 @@ -163,7 +163,7 @@ $$ ## 5.10 卷积核是否一定越大越好? -​ 在早期的卷积神经网络中(如LeNet-5、AlexNet),用到了一些较大的卷积核($11\times11$和$5\times 5$),受限于当时的计算能力和模型结构的设计,无法将网络叠加得很深,因此卷积网络中的卷积层需要设置较大的卷积核以获取更大的感受域。但是这种大卷积核反而会导致计算量大幅增加,不利于训练更深层的模型,相应的计算性能也会降低。后来的卷积神经网络(VGG、GoogLeNet等),发现通过堆叠2个$3\times 3$卷积核可以获得与$5\times 5$卷积核相同的感受视野,同时参数量会更少($3×3×2+1$ < $ 5×5×1+1$),$3\times 3$卷积核被广泛应用在许多卷积神经网络中。因此可以认为,在大多数情况下通过堆叠较小的卷积核比直接采用单个更大的卷积核会更加有效。 +​ 在早期的卷积神经网络中(如LeNet-5、AlexNet),用到了一些较大的卷积核($11\times11$和$5\times 5$),受限于当时的计算能力和模型结构的设计,无法将网络叠加得很深,因此卷积网络中的卷积层需要设置较大的卷积核以获取更大的感受域。但是这种大卷积核反而会导致计算量大幅增加,不利于训练更深层的模型,相应的计算性能也会降低。后来的卷积神经网络(VGG、GoogLeNet等),发现通过堆叠2个$3\times 3$卷积核可以获得与$5\times 5$卷积核相同的感受视野,同时参数量会更少($3×3×2+1$ < $5×5×1+1$),$3\times 3$卷积核被广泛应用在许多卷积神经网络中。因此可以认为,在大多数情况下通过堆叠较小的卷积核比直接采用单个更大的卷积核会更加有效。 ​ 但是,这并不是表示更大的卷积核就没有作用,在某些领域应用卷积神经网络时仍然可以采用较大的卷积核。譬如在自然语言处理领域,由于文本内容不像图像数据可以对特征进行很深层的抽象,往往在该领域的特征提取只需要较浅层的神经网络即可。在将卷积神经网络应用在自然语言处理领域时,通常都是较为浅层的卷积层组成,但是文本特征有时又需要有较广的感受域让模型能够组合更多的特征(如词组和字符),此时直接采用较大的卷积核将是更好的选择。 @@ -175,7 +175,7 @@ $$ ​ 经典的神经网络一般都属于层叠式网络,每层仅用一个尺寸的卷积核,如VGG结构中使用了大量的$3×3$卷积层。事实上,同一层特征图可以分别使用多个不同尺寸的卷积核,以获得不同尺度的特征,再把这些特征结合起来,得到的特征往往比使用单一卷积核的要好,如GoogLeNet、Inception系列的网络,均是每层使用了多个卷积核结构。如图5.3所示,输入的特征在同一层分别经过$1×1$、$3×3$和$5×5$三种不同尺寸的卷积核,再将分别得到的特征进行整合,得到的新特征可以看作不同感受域提取的特征组合,相比于单一卷积核会有更强的表达能力。 -![image](img/ch5/5.11-1.png) +![image](/assets/ch5/5.11-1.png) ​ 图5.3 Inception模块结构 @@ -194,13 +194,13 @@ $$ ​ 标准卷积中,采用区域与通道同时处理的操作,如下图所示: -![image](img/ch5/5.13-1.png) +![image](/assets/ch5/5.13-1.png) ​ 这样做可以简化卷积层内部的结构,每一个输出的特征像素都由所有通道的同一个区域提取而来。 ​ 但是这种方式缺乏灵活性,并且在深层的网络结构中使得运算变得相对低效,更为灵活的方式是使区域和通道的卷积分离开来,通道分离(深度分离)卷积网络由此诞生。如下图所示,Xception网络可解决上述问题。 -![image](img/ch5/5.13-2.png) +![image](/assets/ch5/5.13-2.png) ​ 我们首先对每一个通道进行各自的卷积操作,有多少个通道就有多少个过滤器。得到新的通道特征矩阵之后,再对这批新通道特征进行标准的$1×1​$跨通道卷积操作。 @@ -211,7 +211,7 @@ $$ ​ 比如下图左部分为窄卷积。注意到越在边缘的位置被卷积的次数越少。宽卷积可以看作在卷积之前在边缘用0补充,常见有两种情况,一个是全补充,如下图右部分,这样输出大于输入的维度。另一种常用的方法是补充一一部分0值,使得输出和输入的维度一致。 -![image](img/ch5/5.14.1.png) +![image](/assets/ch5/5.14.1.png) ## 5.15 理解转置卷积与棋盘效应 @@ -221,19 +221,19 @@ $$ 首先给出一个输入输出结果 -![image](img/ch5/img32.png) +![image](/assets/ch5/img32.png) 那是怎样计算的呢? 卷积的时候需要对卷积核进行180的旋转,同时卷积核中心与需计算的图像像素对齐,输出结构为中心对齐像素的一个新的像素值,计算例子如下: -![image](img/ch5/5.19.1-2.png) +![image](/assets/ch5/5.19.1-2.png) 这样计算出左上角(即第一行第一列)像素的卷积后像素值。 给出一个更直观的例子,从左到右看,原像素经过卷积由1变成-8。 -![image](img/ch5/5.19.1-3.png) +![image](/assets/ch5/5.19.1-3.png) 通过滑动卷积核,就可以得到整张图片的卷积结果。 @@ -241,7 +241,7 @@ $$ 图像的deconvolution过程如下: -![image](img/ch5/5.19.2-5.png) +![image](/assets/ch5/5.19.2-5.png) 输入:2x2, 卷积核:4x4, 滑动步长:3, 输出:7x7 @@ -271,16 +271,16 @@ $$ ​ 卷积神经网络与其他类型的神经网络类似,在采用反向传播进行训练的过程中比较依赖输入的数据分布,当数据分布较为极端的情况下容易导致模型欠拟合或过拟合,表XX记录了提高卷积网络泛化能力的方法。 ​ 表XX 提高卷积网络化能力的方法 -| 方法 | 说明 | -| :---: | :--- | -| 使用更多数据 | 在有条件的前提下,尽可能多地获取训练数据是最理想的方法,更多的数据可以让模型得到充分的学习,也更容易提高泛化能力 | -| 使用更大批次 | 在相同迭代次数和学习率的条件下,每批次采用更多的数据将有助于模型更好的学习到正确的模式,模型输出结果也会更加稳定 | -| 调整数据分布 | 大多数场景下的数据分布是不均匀的,模型过多地学习某类数据容易导致其输出结果偏向于该类型的数据,此时通过调整输入的数据分布可以一定程度提高泛化能力 | -| 调整目标函数 | 在某些情况下,目标函数的选择会影响模型的泛化能力,如目标函数$f(y,y')=|y-y'|$在某类样本已经识别较为准确而其他样本误差较大的侵害概况下,不同类别在计算损失结果的时候距离权重是相同的,若将目标函数改成$f(y,y')=(y-y')^2$则可以使误差小的样本计算损失的梯度比误差大的样本更小,进而有效地平衡样本作用,提高模型泛化能力 | -| 调整网络结构 | 在浅层卷积神经网络中,参数量较少往往使模型的泛化能力不足而导致欠拟合,此时通过叠加卷积层可以有效地增加网络参数,提高模型表达能力;在深层卷积网络中,若没有充足的训练数据则容易导致模型过拟合,此时通过简化网络结构减少卷积层数可以起到提高模型泛化能力的作用 | -| 数据增强 | 数据增强又叫数据增广,在有限数据的前提下通过平移、旋转、加噪声等一些列变换来增加训练数据,同类数据的表现形式也变得更多样,有助于模型提高泛化能力,需要注意的是数据变化应尽可能不破坏元数数据的主体特征(如在图像分类任务中对图像进行裁剪时不能将分类主体目标裁出边界)。 | -| 权值正则化 | 权值正则化就是通常意义上的正则化,一般是在损失函数中添加一项权重矩阵的正则项作为惩罚项,用来惩罚损失值较小时网络权重过大的情况,此时往往是网络权值过拟合了数据样本(如$Loss=f(WX+b,y')+\frac{\lambda}{\eta}\sum{|W|}$)。 | -| 屏蔽网络节点 | 该方法可以认为是网络结构上的正则化,通过随机性地屏蔽某些神经元的输出让剩余激活的神经元作用,可以使模型的容错性更强。 | +| 方法 | 说明 | +|:------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 使用更多数据 | 在有条件的前提下,尽可能多地获取训练数据是最理想的方法,更多的数据可以让模型得到充分的学习,也更容易提高泛化能力 | +| 使用更大批次 | 在相同迭代次数和学习率的条件下,每批次采用更多的数据将有助于模型更好的学习到正确的模式,模型输出结果也会更加稳定 | +| 调整数据分布 | 大多数场景下的数据分布是不均匀的,模型过多地学习某类数据容易导致其输出结果偏向于该类型的数据,此时通过调整输入的数据分布可以一定程度提高泛化能力 | +| 调整目标函数 | 在某些情况下,目标函数的选择会影响模型的泛化能力,如目标函数 $f(y,y')=\|y-y\|$ 在某类样本已经识别较为准确而其他样本误差较大的侵害概况下,不同类别在计算损失结果的时候距离权重是相同的,若将目标函数改成$f(y,y')=(y-y')^2$则可以使误差小的样本计算损失的梯度比误差大的样本更小,进而有效地平衡样本作用,提高模型泛化能力 | +| 调整网络结构 | 在浅层卷积神经网络中,参数量较少往往使模型的泛化能力不足而导致欠拟合,此时通过叠加卷积层可以有效地增加网络参数,提高模型表达能力;在深层卷积网络中,若没有充足的训练数据则容易导致模型过拟合,此时通过简化网络结构减少卷积层数可以起到提高模型泛化能力的作用 | +| 数据增强 | 数据增强又叫数据增广,在有限数据的前提下通过平移、旋转、加噪声等一些列变换来增加训练数据,同类数据的表现形式也变得更多样,有助于模型提高泛化能力,需要注意的是数据变化应尽可能不破坏元数数据的主体特征(如在图像分类任务中对图像进行裁剪时不能将分类主体目标裁出边界)。 | +| 权值正则化 | 权值正则化就是通常意义上的正则化,一般是在损失函数中添加一项权重矩阵的正则项作为惩罚项,用来惩罚损失值较小时网络权重过大的情况,此时往往是网络权值过拟合了数据样本(如$Loss=f(WX+b,y')+\frac{\lambda}{\eta}\sum{\|W \|}$)。 | +| 屏蔽网络节点 | 该方法可以认为是网络结构上的正则化,通过随机性地屏蔽某些神经元的输出让剩余激活的神经元作用,可以使模型的容错性更强。 | > 对大多数神经网络模型同样通用 @@ -289,9 +289,9 @@ $$ ​ 表XX 卷积神经网络不同领域的应用 | 应用领域 | 输入数据图示 | 说明 | | :-----: | :----------: | :-- | -| 图像处理 | ![image_process](img/ch5/Image-process.png) | 卷积神经网络在图像处理领域有非常广泛的应用,这是因为图像数据本身具有的局部完整性非常 | -| 自然语言处理 | ![NLP](img/ch5/NLP.png) | | -| 语音处理 | ![audio_process](img/ch5/audio-recognition.png) | | +| 图像处理 | ![image_process](/assets/ch5/Image-process.png) | 卷积神经网络在图像处理领域有非常广泛的应用,这是因为图像数据本身具有的局部完整性非常 | +| 自然语言处理 | ![NLP](/assets/ch5/NLP.png) | | +| 语音处理 | ![audio_process](/assets/ch5/audio-recognition.png) | | ### 5.18.1 联系 @@ -313,7 +313,7 @@ $$ 在图像卷积操作中,神经元在空间维度上是局部连接,但在深度上是全连接。局部连接的思想,是受启发于生物学里的视觉系统结构,视觉皮层的神经元就是仅用局部接受信息。对于二维图像,局部像素关联性较强。这种局部连接保证了训练后的滤波器能够对局部特征有最强的响应,使神经网络可以提取数据的局部特征; 下图是一个很经典的图示,左边是全连接,右边是局部连接。 -![image](img/ch5/5.27.1.png) +![image](/assets/ch5/5.27.1.png) 对于一个1000 × 1000的输入图像而言,如果下一个隐藏层的神经元数目为10^6个,采用全连接则有1000 × 1000 × 10^6 = 10^12个权值参数,如此巨大的参数量几乎难以训练;而采用局部连接,隐藏层的每个神经元仅与图像中10 × 10的局部图像相连接,那么此时的权值参数数量为10 × 10 × 10^6 = 10^8,将直接减少4个数量级。 @@ -323,7 +323,7 @@ $$ 需要注意的是,权重只是对于同一深度切片的神经元是共享的。在卷积层中,通常采用多组卷积核提取不同的特征,即对应的是不同深度切片的特征,而不同深度切片的神经元权重是不共享。相反,偏置这一权值对于同一深度切片的所有神经元都是共享的。 权值共享带来的好处是大大降低了网络的训练难度。如下图,假设在局部连接中隐藏层的每一个神经元连接的是一个10 × 10的局部图像,因此有10 × 10个权值参数,将这10 × 10个权值参数共享给剩下的神经元,也就是说隐藏层中10^6个神经元的权值参数相同,那么此时不管隐藏层神经元的数目是多少,需要训练的参数就是这 10 × 10个权值参数(也就是卷积核的大小)。 -![image](img/ch5/5.27.2.png) +![image](/assets/ch5/5.27.2.png) 这里就体现了卷积神经网络的奇妙之处,使用少量的参数,却依然能有非常出色的性能。上述仅仅是提取图像一种特征的过程。如果要多提取出一些特征,可以增加多个卷积核,不同的卷积核能够得到图像不同尺度下的特征,称之为特征图(feature map)。 @@ -331,7 +331,7 @@ $$ 池化操作与多层次结构一起,实现了数据的降维,将低层次的局部特征组合成为较高层次的特征,从而对整个图片进行表示。如下图: -![image](img/ch5/5.27.3.png) +![image](/assets/ch5/5.27.3.png) ## 5.20 全连接、局部连接、全卷积与局部卷积 ​ 大多数神经网络中高层网络通常会采用全连接层(Global Connected Layer),通过多对多的连接方式对特征进行全局汇总,可以有效地提取全局信息。但是全连接的方式需要大量的参数,是神经网络中最占资源的部分之一,因此就需要由局部连接(Local Connected Layer),仅在局部区域范围内产生神经元连接,能够有效地减少参数量。根据卷积操作的作用范围可以分为全卷积(Global Convolution)和局部卷积(Local Convolution)。实际上这里所说的全卷积就是标准卷积,即在整个输入特征维度范围内采用相同的卷积核参数进行运算,全局共享参数的连接方式可以使神经元之间的连接参数大大减少;局部卷积又叫平铺卷积(Tiled Convolution)或非共享卷积(Unshared Convolution),是局部连接与全卷积的折衷。四者的比较如表XX所示。 @@ -339,16 +339,16 @@ $$ | 连接方式 | 示意图 | 说明 | | :------: | :---: | :--- | -| 全连接 | ![full-connected](img/ch5/full-connected.png) | 层间神经元完全连接,每个输出神经元可以获取到所有输入神经元的信息,有利于信息汇总,常置于网络末层;连接与连接之间独立参数,大量的连接大大增加模型的参数规模。 | -| 局部连接 | ![local-connected](img/ch5/local-connected.png) | 层间神经元只有局部范围内的连接,在这个范围内采用全连接的方式,超过这个范围的神经元则没有连接;连接与连接之间独立参数,相比于全连接减少了感受域外的连接,有效减少参数规模 | -| 全卷积 | ![convolution](img/ch5/conv.png) | 层间神经元只有局部范围内的连接,在这个范围内采用全连接的方式,连接所采用的参数在不同感受域之间共享,有利于提取特定模式的特征;相比于局部连接,共用感受域之间的参数可以进一步减少参数量。 | -| 局部卷积 | ![local-conv](img/ch5/local-conv.png) | 层间神经元只有局部范围内的连接,感受域内采用全连接的方式,而感受域之间间隔采用局部连接与全卷积的连接方式;相比与全卷积成倍引入额外参数,但有更强的灵活性和表达能力;相比于局部连接,可以有效控制参数量 | +| 全连接 | ![full-connected](/assets/ch5/full-connected.png) | 层间神经元完全连接,每个输出神经元可以获取到所有输入神经元的信息,有利于信息汇总,常置于网络末层;连接与连接之间独立参数,大量的连接大大增加模型的参数规模。 | +| 局部连接 | ![local-connected](/assets/ch5/local-connected.png) | 层间神经元只有局部范围内的连接,在这个范围内采用全连接的方式,超过这个范围的神经元则没有连接;连接与连接之间独立参数,相比于全连接减少了感受域外的连接,有效减少参数规模 | +| 全卷积 | ![convolution](/assets/ch5/conv.png) | 层间神经元只有局部范围内的连接,在这个范围内采用全连接的方式,连接所采用的参数在不同感受域之间共享,有利于提取特定模式的特征;相比于局部连接,共用感受域之间的参数可以进一步减少参数量。 | +| 局部卷积 | ![local-conv](/assets/ch5/local-conv.png) | 层间神经元只有局部范围内的连接,感受域内采用全连接的方式,而感受域之间间隔采用局部连接与全卷积的连接方式;相比与全卷积成倍引入额外参数,但有更强的灵活性和表达能力;相比于局部连接,可以有效控制参数量 | ## 5.21 局部卷积的应用 并不是所有的卷积都会进行权重共享,在某些特定任务中,会使用不权重共享的卷积。下面通过人脸这一任务来进行讲解。在读人脸方向的一些paper时,会发现很多都会在最后加入一个Local Connected Conv,也就是不进行权重共享的卷积层。总的来说,这一步的作用就是使用3D模型来将人脸对齐,从而使CNN发挥最大的效果。 -![image](img/ch5/img66.png) +![image](/assets/ch5/img66.png) 截取论文中的一部分图,经过3D对齐以后,形成的图像均是152×152,输入到上述的网络结构中。该结构的参数如下: diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/\347\254\254\345\205\255\347\253\240_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN).md" "b/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/\347\254\254\345\205\255\347\253\240_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN).md" index f4051f7b..43841475 100644 --- "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/\347\254\254\345\205\255\347\253\240_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN).md" +++ "b/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/\347\254\254\345\205\255\347\253\240_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN).md" @@ -14,9 +14,9 @@ ### 6.2.1 基本的单层网络结构 -​ 在进一步了解RNN之前,先给出最基本的单层网络结构,输入是`$x$`,经过变换`Wx+b`和激活函数`f`得到输出`y`: +​ 在进一步了解RNN之前,先给出最基本的单层网络结构,输入是`x`,经过变换`Wx+b`和激活函数`f`得到输出`y`: -![](img/ch6/6.1.jpg) +![](/assets/ch6/6.1.jpg) ### 6.2.2 图解经典RNN结构 @@ -30,31 +30,31 @@ 其单个序列如下图所示: - ![](img/ch6/6.2.jpg) + ![](/assets/ch6/6.2.jpg) 前面介绍了诸如此类的序列数据用原始的神经网络难以建模,基于此,RNN引入了隐状态$h$(hidden state),$h​$可对序列数据提取特征,接着再转换为输出。 为了便于理解,先计算$h_1​$: - ![](img/ch6/6.3.jpg) + ![](/assets/ch6/6.3.jpg) 注:图中的圆圈表示向量,箭头表示对向量做变换。 - RNN中,每个步骤使用的参数`$U,W,b$`​相同,`$h_2$`的计算方式和`$h_1​$`类似,其计算结果如下: + RNN中,每个步骤使用的参数`U,W,b`​相同,`h_2`的计算方式和`h_1​`类似,其计算结果如下: - ![](img/ch6/6.4.jpg) + ![](/assets/ch6/6.4.jpg) 计算$h_3$,$h_4​$也相似,可得: - ![](img/ch6/6.5.jpg) + ![](/assets/ch6/6.5.jpg) 接下来,计算RNN的输出$y_1$,采用$Softmax$作为激活函数,根据$y_n=f(Wx+b)$,得$y_1​$: - ![](img/ch6/6.6.jpg) + ![](/assets/ch6/6.6.jpg) 使用和$y_1​$相同的参数$V,c​$,得到$y_1,y_2,y_3,y_4​$的输出结构: - ![](img/ch6/6.7.jpg) + ![](/assets/ch6/6.7.jpg) 以上即为最经典的RNN结构,其输入为$x_1,x_2,x_3,x_4$,输出为$y_1,y_2,y_3,y_4$,当然实际中最大值为$y_n$,这里为了便于理解和展示,只计算4个输入和输出。从以上结构可看出,RNN结构的输入和输出等长。 @@ -64,17 +64,17 @@ ​ 方式一:可只在其中的某一个序列进行计算,比如序列第一个进行输入计算,其建模方式如下: -![](img/ch6/6.9.jpg) +![](/assets/ch6/6.9.jpg) ​ 方式二:把输入信息X作为每个阶段的输入,其建模方式如下: -![](img/ch6/6.10.jpg) +![](/assets/ch6/6.10.jpg) ### 6.2.4 sequence-to-vector结构 ​ 有时我们要处理的问题输入是一个序列,输出是一个单独的值,此时通常在最后的一个序列上进行输出变换,其建模如下所示: - ![](img/ch6/6.8.jpg) + ![](/assets/ch6/6.8.jpg) ### 6.2.5 Encoder-Decoder结构 @@ -84,23 +84,23 @@ ​ **步骤一**:将输入数据编码成一个上下文向量$c$,这部分称为Encoder,得到$c$有多种方式,最简单的方法就是把Encoder的最后一个隐状态赋值给$c$,还可以对最后的隐状态做一个变换得到$c$,也可以对所有的隐状态做变换。其示意如下所示: - ![](img/ch6/6.12.jpg) + ![](/assets/ch6/6.12.jpg) ​ **步骤二**:用另一个RNN网络(我们将其称为Decoder)对其进行编码,方法一是将步骤一中的$c​$作为初始状态输入到Decoder,示意图如下所示: - ![](img/ch6/6.13.jpg) + ![](/assets/ch6/6.13.jpg) 方法二是将$c$作为Decoder的每一步输入,示意图如下所示: - ![](img/ch6/6.14.jpg) + ![](/assets/ch6/6.14.jpg) ### 6.2.6 以上三种结构各有怎样的应用场景 | 网络结构 | 结构图示 | 应用场景举例 | | -------- | :---------------------: | ------------------------------------------------------------ | -| 1 vs N | ![](img/ch6/6.9.jpg) | 1、从图像生成文字,输入为图像的特征,输出为一段句子
2、根据图像生成语音或音乐,输入为图像特征,输出为一段语音或音乐 | -| N vs 1 | ![](img/ch6/6.8.jpg) | 1、输出一段文字,判断其所属类别
2、输入一个句子,判断其情感倾向
3、输入一段视频,判断其所属类别 | -| N vs M | ![](img/ch6/6.13.jpg) | 1、机器翻译,输入一种语言文本序列,输出另外一种语言的文本序列
2、文本摘要,输入文本序列,输出这段文本序列摘要
3、阅读理解,输入文章,输出问题答案
4、语音识别,输入语音序列信息,输出文字序列 | +| 1 vs N | ![](/assets/ch6/6.9.jpg) | 1、从图像生成文字,输入为图像的特征,输出为一段句子
2、根据图像生成语音或音乐,输入为图像特征,输出为一段语音或音乐 | +| N vs 1 | ![](/assets/ch6/6.8.jpg) | 1、输出一段文字,判断其所属类别
2、输入一个句子,判断其情感倾向
3、输入一段视频,判断其所属类别 | +| N vs M | ![](/assets/ch6/6.13.jpg) | 1、机器翻译,输入一种语言文本序列,输出另外一种语言的文本序列
2、文本摘要,输入文本序列,输出这段文本序列摘要
3、阅读理解,输入文章,输出问题答案
4、语音识别,输入语音序列信息,输出文字序列 | ### 6.2.7 图解RNN中的Attention机制 @@ -108,19 +108,19 @@ ​ 引入了Attention机制的Decoder中,有不同的$c$,每个$c​$会自动选择与当前输出最匹配的上下文信息,其示意图如下所示: -![](img/ch6/6.15.jpg) +![](/assets/ch6/6.15.jpg) ​ **举例**,比如输入序列是“我爱中国”,要将此输入翻译成英文: ​ 假如用$a_{ij}$衡量Encoder中第$j$阶段的$h_j$和解码时第$i$阶段的相关性,$a_{ij}$从模型中学习得到,和Decoder的第$i-1$阶段的隐状态、Encoder 第$j$个阶段的隐状态有关,比如$a_{3j}​$的计算示意如下所示: -![](img/ch6/6.19.jpg) +![](/assets/ch6/6.19.jpg) 最终Decoder中第$i$阶段的输入的上下文信息 $c_i$来自于所有$h_j$对$a_{ij}$的加权和。 其示意图如下图所示: -![](img/ch6/6.16.jpg) +![](/assets/ch6/6.16.jpg) ​ 在Encoder中,$h_1,h_2,h_3,h_4$分别代表“我”,“爱”,“中”,“国”所代表信息。翻译的过程中,$c_1$会选择和“我”最相关的上下午信息,如上图所示,会优先选择$a_{11}$,以此类推,$c_2$会优先选择相关性较大的$a_{22}$,$c_3$会优先选择相关性较大的$a_{33},a_{34}$,这就是attention机制。 @@ -132,9 +132,9 @@ 4. 在标准的RNN结构中,隐层的神经元之间也是带有权值的,且权值共享。 5. 理论上,RNNs能够对任何长度序列数据进行处理。但是在实践中,为了降低复杂度往往假设当前的状态只与之前某几个时刻状态相关,**下图便是一个典型的RNNs**: -![](img/ch6/figure_6.2_1.png) +![](/assets/ch6/figure_6.2_1.png) -![](img/ch6/figure_6.2_2.jpg) +![](/assets/ch6/figure_6.2_2.jpg) 输入单元(Input units):输入集$\bigr\{x_0,x_1,...,x_t,x_{t+1},...\bigr\}$, @@ -163,7 +163,7 @@ 2. RNNs可以记忆之前步骤的训练信息。 **定向循环结构如下图所示**: -![](img/ch6/figure_6.1_1.jpg) +![](/assets/ch6/figure_6.1_1.jpg) @@ -183,9 +183,9 @@ ## 6.8 标准RNN前向输出流程 -​ 以$x$表示输入,$h$是隐层单元,$o$是输出,$L$为损失函数,$y$为训练集标签。$t$表示$t$时刻的状态,$V,U,W$是权值,同一类型的连接权值相同。以下图为例进行说明标准RNN的前向传播算法: +​ 以 $x$ 表示输入,$h$是隐层单元,$o$是输出,$L$为损失函数,$y$为训练集标签。$t$表示$t$时刻的状态,$V,U,W$是权值,同一类型的连接权值相同。以下图为例进行说明标准RNN的前向传播算法: -​ ![](img/ch6/rnnbp.png) +​ ![](/assets/ch6/rnnbp.png) 对于$t$时刻: $$ @@ -242,11 +242,11 @@ $$ 首先来看tanh函数的函数及导数图如下所示: -![](img/ch6/tanh.jpg) +![](/assets/ch6/tanh.jpg) sigmoid函数的函数及导数图如下所示: -![](img/ch6/sigmoid.jpg) +![](/assets/ch6/sigmoid.jpg) 从上图观察可知,sigmoid函数的导数范围是(0,0.25],tanh函数的导数范围是(0,1],他们的导数最大都不大于1。 @@ -283,17 +283,17 @@ $$ ​ 所有 RNN 都具有一种重复神经网络模块的链式的形式。在标准的 RNN 中,这个重复的模块只有一个非常简单的结构,例如一个 tanh 层,如下图所示: -![](img/ch6/LSTM1.png) +![](/assets/ch6/LSTM1.png) ​ LSTM 同样是这样的结构,但是重复的模块拥有一个不同的结构。不同于单一神经网络层,这里是有四个,以一种非常特殊的方式进行交互。 -![](img/ch6/LSTM2.png) +![](/assets/ch6/LSTM2.png) 注:上图图标具体含义如下所示: -![](img/ch6/LSTM3.png) +![](/assets/ch6/LSTM3.png) ​ 上图中,每一条黑线传输着一整个向量,从一个节点的输出到其他节点的输入。粉色的圈代表 pointwise 的操作,诸如向量的和,而黄色的矩阵就是学习到的神经网络层。合在一起的线表示向量的连接,分开的线表示内容被复制,然后分发到不同的位置。 @@ -301,11 +301,11 @@ $$ ​ LSTM 的关键就是细胞状态,水平线在图上方贯穿运行。细胞状态类似于传送带。直接在整个链上运行,只有一些少量的线性交互。信息在上面流传保持不变会很容易。示意图如下所示: -![](img/ch6/LSTM4.png) +![](/assets/ch6/LSTM4.png) LSTM 有通过精心设计的称作为“门”的结构来去除或者增加信息到细胞状态的能力。门是一种让信息选择式通过的方法。他们包含一个 sigmoid 神经网络层和一个 pointwise 乘法操作。示意图如下: -![](img/ch6/LSTM5.png) +![](/assets/ch6/LSTM5.png) @@ -319,7 +319,7 @@ LSTM 拥有三个门,分别是忘记层门,输入层门和输出层门,来 ​ 操作步骤:该门会读取$h_{t-1}$和$x_t$,输出一个在 0 到 1 之间的数值给每个在细胞状态$C_{t-1}​$中的数字。1 表示“完全保留”,0 表示“完全舍弃”。示意图如下: -![](img/ch6/LSTM6.png) +![](/assets/ch6/LSTM6.png) **输入层门** @@ -333,11 +333,11 @@ LSTM 拥有三个门,分别是忘记层门,输入层门和输出层门,来 ​ 步骤二,tanh 层创建一个新的候选值向量$\tilde{C}_t$加入到状态中。其示意图如下: -![](img/ch6/LSTM7.png) +![](/assets/ch6/LSTM7.png) ​ 步骤三:将$c_{t-1}$更新为$c_{t}$。将旧状态与$f_t$相乘,丢弃掉我们确定需要丢弃的信息。接着加上$i_t * \tilde{C}_t$得到新的候选值,根据我们决定更新每个状态的程度进行变化。其示意图如下: -![](img/ch6/LSTM8.png) +![](/assets/ch6/LSTM8.png) **输出层门** 作用对象:隐层$h_t$ @@ -352,7 +352,7 @@ LSTM 拥有三个门,分别是忘记层门,输入层门和输出层门,来 其示意图如下所示: -![](img/ch6/LSTM9.png) +![](/assets/ch6/LSTM9.png) ### 6.11.4 LSTM流行的变体 @@ -360,19 +360,19 @@ LSTM 拥有三个门,分别是忘记层门,输入层门和输出层门,来 ​ 在正常的LSTM结构中,Gers F A 等人提出增加peephole 连接,可以门层接受细胞状态的输入。示意图如下所示: -![](img/ch6/LSTM10.png) +![](/assets/ch6/LSTM10.png) **对忘记门和输入门进行同时确定** ​ 不同于之前是分开确定什么忘记和需要添加什么新的信息,这里是一同做出决定。示意图如下所示: -![](img/ch6/LSTM11.png) +![](/assets/ch6/LSTM11.png) **Gated Recurrent Unit** ​ 由Kyunghyun Cho等人提出的Gated Recurrent Unit (GRU),其将忘记门和输入门合成了一个单一的更新门,同样还混合了细胞状态和隐藏状态,和其他一些改动。其示意图如下: -![](img/ch6/LSTM12.png) +![](/assets/ch6/LSTM12.png) 最终的模型比标准的 LSTM 模型要简单,也是非常流行的变体。 @@ -380,7 +380,7 @@ LSTM 拥有三个门,分别是忘记层门,输入层门和输出层门,来 LSTMs与GRUs的区别如图所示: -![](img/ch6/figure_6.6.6_2.png) +![](/assets/ch6/figure_6.6.6_2.png) 从上图可以看出,二者结构十分相似,**不同在于**: @@ -405,7 +405,7 @@ LSTMs与GRUs的区别如图所示: **(4)图像描述生成 (Generating Image Descriptions)** ​ 同卷积神经网络一样,RNNs已经在对无标图像描述自动生成中得到应用。CNNs与RNNs结合也被应用于图像描述自动生成。 -![](img/ch6/figure_6.4_1.png) +![](/assets/ch6/figure_6.4_1.png) ## 6.13 常见的RNNs扩展和改进模型 @@ -417,18 +417,18 @@ LSTMs与GRUs的区别如图所示: 2. 在每一步中,使用标准的前向反馈进行传播,然后使用学习算法进行学习。上下文每一个节点保存其连接隐藏层节点上一步输出,即保存上文,并作用于当前步对应的隐藏层节点状态,即隐藏层的输入由输入层的输出与上一步的自身状态所决定。因此SRNs能够解决标准多层感知机(MLP)无法解决的对序列数据进行预测的问题。 SRNs网络结构如下图所示: -![](img/ch6/figure_6.6.1_1.png) +![](/assets/ch6/figure_6.6.1_1.png) ### 6.13.2 Bidirectional RNNs ​ Bidirectional RNNs(双向网络)将两层RNNs叠加在一起,当前时刻输出(第t步的输出)不仅仅与之前序列有关,还与之后序列有关。例如:为了预测一个语句中的缺失词语,就需要该词汇的上下文信息。Bidirectional RNNs是一个相对较简单的RNNs,是由两个RNNs上下叠加在一起组成的。输出由前向RNNs和后向RNNs共同决定。如下图所示: -![](img/ch6/figure_6.6.2_1.png) +![](/assets/ch6/figure_6.6.2_1.png) ### 6.13.3 Deep RNNs ​ Deep RNNs与Bidirectional RNNs相似,其也是又多层RNNs叠加,因此每一步的输入有了多层网络。该网络具有更强大的表达与学习能力,但是复杂性也随之提高,同时需要更多的训练数据。Deep RNNs的结构如下图所示: -![](img/ch6/figure_6.6.3_1.png) +![](/assets/ch6/figure_6.6.3_1.png) ### 6.13.4 Echo State Networks(ESNs) **ESNs特点**: @@ -450,7 +450,7 @@ SRNs网络结构如下图所示: ​ ESNs的结构如下图所示: -![](img/ch6/figure_6.6.4_2.png) +![](/assets/ch6/figure_6.6.4_2.png) ### 6.13.4 Gated Recurrent Unit Recurrent Neural Networks GRUs是一般的RNNs的变型版本,其主要是从以下两个方面进行改进。 @@ -459,7 +459,7 @@ GRUs是一般的RNNs的变型版本,其主要是从以下两个方面进行改 2. 在产生误差error时,其可能是由之前某一个或者几个单词共同造成,所以应当对对应的单词weight进行更新。GRUs的结构如下图所示。GRUs首先根据当前输入单词向量word vector以及前一个隐藏层状态hidden state计算出update gate和reset gate。再根据reset gate、当前word vector以及前一个hidden state计算新的记忆单元内容(new memory content)。当reset gate为1的时候,new memory content忽略之前所有memory content,最终的memory是由之前的hidden state与new memory content一起决定。 -![](img/ch6/figure_6.6.5_1.png) +![](/assets/ch6/figure_6.6.5_1.png) @@ -474,11 +474,13 @@ GRUs是一般的RNNs的变型版本,其主要是从以下两个方面进行改 ### 6.13.7 Clockwork RNNs(CW-RNNs) ​ CW-RNNs是RNNs的改良版本,其使用时钟频率来驱动。它将隐藏层分为几个块(组,Group/Module),每一组按照自己规定的时钟频率对输入进行处理。为了降低RNNs的复杂度,CW-RNNs减少了参数数量,并且提高了网络性能,加速网络训练。CW-RNNs通过不同隐藏层模块在不同时钟频率下工作来解决长时依赖问题。将时钟时间进行离散化,不同的隐藏层组将在不同时刻进行工作。因此,所有的隐藏层组在每一步不会全部同时工作,这样便会加快网络的训练。并且,时钟周期小组的神经元不会连接到时钟周期大组的神经元,只允许周期大的神经元连接到周期小的(组与组之间的连接以及信息传递是有向的)。周期大的速度慢,周期小的速度快,因此是速度慢的神经元连速度快的神经元,反之则不成立。 -​ CW-RNNs与SRNs网络结构类似,也包括输入层(Input)、隐藏层(Hidden)、输出层(Output),它们之间存在前向连接,输入层到隐藏层连接,隐藏层到输出层连接。但是与SRN不同的是,隐藏层中的神经元会被划分为若干个组,设为$g​$,每一组中的神经元个数相同,设为$k​$,并为每一个组分配一个时钟周期$T_i\epsilon\{T_1,T_2,...,T_g\}​$,每一组中的所有神经元都是全连接,但是组$j​$到组$i​$的循环连接则需要满足$T_j​$大于$T_i​$。如下图所示,将这些组按照时钟周期递增从左到右进行排序,即$T_1fake_A->rec_B ​ 对于A域的所有图像,学习一个网络G_B,该网络可以生成B。对于B域的所有图像,也学习一个网络G_A,该网络可以生成G_B。 ​ 训练过程分成两步,首先对于A域的某张图像,送入G_B生成fake_B,然后对fake_B送入G_A,得到重构后的A图像rec_A。对于B域的某一张图像也是类似。重构后的图像rec_A/rec_B可以和原图A/B做均方误差,实现了有监督的训练。此处值得注意的是A->fake_B(B->fake_A)和fake_A->rec_B(fake_B->rec_A)的网络是一模一样的。下图是形象化的网络结构图: -![CycleGAN模型示意图](img/ch7/CycleGAN模型示意图.png) +![CycleGAN模型示意图](/assets/ch7/CycleGAN模型示意图.png) ​ cycleGAN的生成器采用U-Net,判别器采用LS-GAN。 **Loss设计** @@ -439,7 +439,7 @@ cycleGAN模型较好的解决了无监督图像转换问题,可是这种单一 ​ seqGAN在GAN的框架下,结合强化学习来做文本生成。 模型示意图如下: -![seqGAN模型](img/ch7/seqGAN模型.png) +![seqGAN模型](/assets/ch7/seqGAN模型.png) 在文本生成任务,seqGAN相比较于普通GAN区别在以下几点: - 生成器不取argmax。 @@ -452,7 +452,7 @@ cycleGAN模型较好的解决了无监督图像转换问题,可是这种单一 ​ GAN的良好生成特性近年来也开始被用于数据增广。以行人重识别为例,有许多GAN用于数据增广的工作[1-4]。行人重识别问题一个难点在于不同摄像头下拍摄的人物环境,角度差别非常大,导致存在较大的Domain gap。因此,可以考虑使用GAN来产生不同摄像头下的数据进行数据增广。以论文[1]为例,本篇paper提出了一个cycleGAN用于数据增广的方法。具体模型结构如下: -![cycleGAN数据增广](img/ch7/cycleGAN数据增广.png) +![cycleGAN数据增广](/assets/ch7/cycleGAN数据增广.png) ​ 对于每一对摄像头都训练一个cycleGAN,这样就可以实现将一个摄像头下的数据转换成另一个摄像头下的数据,但是内容(人物)保持不变。 在CVPR19中,[9]进一步提升了图像的生成质量,进行了“淘宝换衣”式的高质量图像生成(如下图),提供了更高质量的行人训练数据。 diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/\347\254\254\345\205\253\347\253\240_\347\233\256\346\240\207\346\243\200\346\265\213.md" "b/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/\347\254\254\345\205\253\347\253\240_\347\233\256\346\240\207\346\243\200\346\265\213.md" index 49897ece..8ab80600 100644 --- "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/\347\254\254\345\205\253\347\253\240_\347\233\256\346\240\207\346\243\200\346\265\213.md" +++ "b/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/\347\254\254\345\205\253\347\253\240_\347\233\256\346\240\207\346\243\200\346\265\213.md" @@ -6,9 +6,10 @@ ### 8.1.1 什么是目标检测? -​ 目标检测(Object Detection)的任务是找出图像中所有感兴趣的目标(物体),确定它们的类别和位置,是计算机视觉领域的核心问题之一。由于各类物体有不同的外观、形状和姿态,加上成像时光照、遮挡等因素的干扰,目标检测一直是计算机视觉领域最具有挑战性的问题。 +​ 目标检测(Object +Detection)的任务是找出图像中所有感兴趣的目标(物体),确定它们的类别和位置,是计算机视觉领域的核心问题之一。由于各类物体有不同的外观、形状和姿态,加上成像时光照、遮挡等因素的干扰,目标检测一直是计算机视觉领域最具有挑战性的问题。 -​ 计算机视觉中关于图像识别有四大类任务: +​ 计算机视觉中关于图像识别有四大类任务: **分类-Classification**:解决“是什么?”的问题,即给定一张图片或一段视频判断里面包含什么类别的目标。 @@ -18,7 +19,7 @@ **分割-Segmentation**:分为实例的分割(Instance-level)和场景分割(Scene-level),解决“每一个像素属于哪个目标物或场景”的问题。 -![图像识别四大类任务,图像来源于cs231n 2016课件Lecture 8](img/ch8/8.1.1.png) +![图像识别四大类任务,图像来源于cs231n 2016课件Lecture 8](/assets/ch8/8.1.1.png) ### 8.1.2 目标检测要解决的核心问题? @@ -36,42 +37,45 @@ **1.Two stage目标检测算法** -​ 先进行区域生成(region proposal,RP)(一个有可能包含待检物体的预选框),再通过卷积神经网络进行样本分类。 +​ 先进行区域生成(region proposal,RP)(一个有可能包含待检物体的预选框),再通过卷积神经网络进行样本分类。 -​ 任务:特征提取—>生成RP—>分类/定位回归。 +​ 任务:特征提取—>生成RP—>分类/定位回归。 -​ 常见的two stage目标检测算法有:R-CNN、SPP-Net、Fast R-CNN、Faster R-CNN和R-FCN等。 +​ 常见的two stage目标检测算法有:R-CNN、SPP-Net、Fast R-CNN、Faster R-CNN和R-FCN等。 **2.One stage目标检测算法** -​ 不用RP,直接在网络中提取特征来预测物体分类和位置。 +​ 不用RP,直接在网络中提取特征来预测物体分类和位置。 -​ 任务:特征提取—>分类/定位回归。 +​ 任务:特征提取—>分类/定位回归。 -​ 常见的one stage目标检测算法有:OverFeat、YOLOv1、YOLOv2、YOLOv3、SSD和RetinaNet等。 +​ 常见的one stage目标检测算法有:OverFeat、YOLOv1、YOLOv2、YOLOv3、SSD和RetinaNet等。 -![](img/ch8/8.1.2.png) +![](/assets/ch8/8.1.2.png) ### 8.1.4 目标检测有哪些应用? -​ 目标检测具有巨大的实用价值和应用前景。应用领域包括人脸检测、行人检测、车辆检测、飞机航拍或卫星图像中道路的检测、车载摄像机图像中的障碍物检测、医学影像在的病灶检测等。还有在安防领域中,可以实现比如安全帽、安全带等动态检测,移动侦测、区域入侵检测、物品看护等功能。 +​ +目标检测具有巨大的实用价值和应用前景。应用领域包括人脸检测、行人检测、车辆检测、飞机航拍或卫星图像中道路的检测、车载摄像机图像中的障碍物检测、医学影像在的病灶检测等。还有在安防领域中,可以实现比如安全帽、安全带等动态检测,移动侦测、区域入侵检测、物品看护等功能。 -## 8.2 Two Stage目标检测算法 +## 8.2 Two Stage目标检测算法 ### 8.2.1 R-CNN **R-CNN有哪些创新点?** -1. 使用CNN(ConvNet)对 region proposals 计算 feature vectors。从经验驱动特征(SIFT、HOG)到数据驱动特征(CNN feature map),提高特征对样本的表示能力。 +1. 使用CNN(ConvNet)对 region proposals 计算 feature vectors。从经验驱动特征(SIFT、HOG)到数据驱动特征(CNN feature + map),提高特征对样本的表示能力。 2. 采用大样本下(ILSVRC)有监督预训练和小样本(PASCAL)微调(fine-tuning)的方法解决小样本难以训练甚至过拟合等问题。 注:ILSVRC其实就是众所周知的ImageNet的挑战赛,数据量极大;PASCAL数据集(包含目标检测和图像分割等),相对较小。 **R-CNN 介绍** -​ R-CNN作为R-CNN系列的第一代算法,其实没有过多的使用“深度学习”思想,而是将“深度学习”和传统的“计算机视觉”的知识相结合。比如R-CNN pipeline中的第二步和第四步其实就属于传统的“计算机视觉”技术。使用selective search提取region proposals,使用SVM实现分类。 +​ R-CNN作为R-CNN系列的第一代算法,其实没有过多的使用“深度学习”思想,而是将“深度学习”和传统的“计算机视觉”的知识相结合。比如R-CNN +pipeline中的第二步和第四步其实就属于传统的“计算机视觉”技术。使用selective search提取region proposals,使用SVM实现分类。 -![](img/ch8/8.2.1-1.png) +![](/assets/ch8/8.2.1-1.png) 原论文中R-CNN pipeline只有4个步骤,光看上图无法深刻理解R-CNN处理机制,下面结合图示补充相应文字 @@ -79,22 +83,23 @@ 2. 重新训练全连接层。使用需要检测的目标重新训练(re-train)最后全连接层(connected layer)。 -3. 提取 proposals并计算CNN 特征。利用选择性搜索(Selective Search)算法提取所有proposals(大约2000幅images),调整(resize/warp)它们成固定大小,以满足 CNN输入要求(因为全连接层的限制),然后将feature map 保存到本地磁盘。 +3. 提取 proposals并计算CNN 特征。利用选择性搜索(Selective + Search)算法提取所有proposals(大约2000幅images),调整(resize/warp)它们成固定大小,以满足 CNN输入要求(因为全连接层的限制),然后将feature + map 保存到本地磁盘。 - ![](img/ch8/8.1.4.png) + ![](/assets/ch8/8.1.4.png) 4. 训练SVM。利用feature map 训练SVM来对目标和背景进行分类(每个类一个二进制SVM) 5. 边界框回归(Bounding boxes Regression)。训练将输出一些校正因子的线性回归分类器 -![](img/ch8/8.1.5.png) +![](/assets/ch8/8.1.5.png) **R-CNN 实验结果** R-CNN在VOC 2007测试集上mAP达到58.5%,打败当时所有的目标检测算法。 -![](img/ch8/8.1.6.png) - +![](/assets/ch8/8.1.6.png) ### 8.2.2 Fast R-CNN @@ -102,16 +107,20 @@ R-CNN在VOC 2007测试集上mAP达到58.5%,打败当时所有的目标检测 1. 只对整幅图像进行一次特征提取,避免R-CNN中的冗余特征提取 2. 用RoI pooling层替换最后一层的max pooling层,同时引入建议框数据,提取相应建议框特征 -3. Fast R-CNN网络末尾采用并行的不同的全连接层,可同时输出分类结果和窗口回归结果,实现了end-to-end的多任务训练【建议框提取除外】,也不需要额外的特征存储空间【R-CNN中的特征需要保持到本地,来供SVM和Bounding-box regression进行训练】 +3. Fast + R-CNN网络末尾采用并行的不同的全连接层,可同时输出分类结果和窗口回归结果,实现了end-to-end的多任务训练【建议框提取除外】,也不需要额外的特征存储空间【R-CNN中的特征需要保持到本地,来供SVM和Bounding-box + regression进行训练】 4. 采用SVD对Fast R-CNN网络末尾并行的全连接层进行分解,减少计算复杂度,加快检测速度。 **Fast R-CNN 介绍** -​ Fast R-CNN是基于R-CNN和SPPnets进行的改进。SPPnets,其创新点在于计算整幅图像的the shared feature map,然后根据object proposal在shared feature map上映射到对应的feature vector(就是不用重复计算feature map了)。当然,SPPnets也有缺点:和R-CNN一样,训练是多阶段(multiple-stage pipeline)的,速度还是不够"快",特征还要保存到本地磁盘中。 +​ Fast R-CNN是基于R-CNN和SPPnets进行的改进。SPPnets,其创新点在于计算整幅图像的the shared feature map,然后根据object +proposal在shared feature map上映射到对应的feature vector(就是不用重复计算feature +map了)。当然,SPPnets也有缺点:和R-CNN一样,训练是多阶段(multiple-stage pipeline)的,速度还是不够"快",特征还要保存到本地磁盘中。 将候选区域直接应用于特征图,并使用RoI池化将其转化为固定大小的特征图块。以下是Fast R-CNN的流程图 -![](img/ch8/8.2.2-1.png) +![](/assets/ch8/8.2.2-1.png) **RoI Pooling层详解** @@ -123,20 +132,26 @@ RoI Pooling 是Pooling层的一种,而且是针对RoI的Pooling,其特点是 RoI是Region of Interest的简写,一般是指图像上的区域框,但这里指的是由Selective Search提取的候选框。 -![](img/ch8/8.2.2-2.png) +![](/assets/ch8/8.2.2-2.png) 往往经过RPN后输出的不止一个矩形框,所以这里我们是对多个RoI进行Pooling。 **RoI Pooling的输入** -输入有两部分组成: +输入有两部分组成: -1. 特征图(feature map):指的是上面所示的特征图,在Fast RCNN中,它位于RoI Pooling之前,在Faster RCNN中,它是与RPN共享那个特征图,通常我们常常称之为“share_conv”; +1. 特征图(feature map):指的是上面所示的特征图,在Fast RCNN中,它位于RoI Pooling之前,在Faster + RCNN中,它是与RPN共享那个特征图,通常我们常常称之为“share_conv”; 2. RoIs,其表示所有RoI的N*5的矩阵。其中N表示RoI的数量,第一列表示图像index,其余四列表示其余的左上角和右下角坐标。 -在Fast RCNN中,指的是Selective Search的输出;在Faster RCNN中指的是RPN的输出,一堆矩形候选框,形状为1x5x1x1(4个坐标+索引index),其中值得注意的是:坐标的参考系不是针对feature map这张图的,而是针对原图的(神经网络最开始的输入)。其实关于ROI的坐标理解一直很混乱,到底是根据谁的坐标来。其实很好理解,我们已知原图的大小和由Selective Search算法提取的候选框坐标,那么根据"映射关系"可以得出特征图(featurwe map)的大小和候选框在feature map上的映射坐标。至于如何计算,其实就是比值问题,下面会介绍。所以这里把ROI理解为原图上各个候选框(region proposals),也是可以的。 +在Fast RCNN中,指的是Selective Search的输出;在Faster +RCNN中指的是RPN的输出,一堆矩形候选框,形状为1x5x1x1(4个坐标+索引index),其中值得注意的是:坐标的参考系不是针对feature +map这张图的,而是针对原图的(神经网络最开始的输入)。其实关于ROI的坐标理解一直很混乱,到底是根据谁的坐标来。其实很好理解,我们已知原图的大小和由Selective +Search算法提取的候选框坐标,那么根据"映射关系"可以得出特征图(featurwe map)的大小和候选框在feature +map上的映射坐标。至于如何计算,其实就是比值问题,下面会介绍。所以这里把ROI理解为原图上各个候选框(region proposals),也是可以的。 -注:说句题外话,由Selective Search算法提取的一系列可能含有object的bounding box,这些通常称为region proposals或者region of interest(ROI)。 +注:说句题外话,由Selective Search算法提取的一系列可能含有object的bounding box,这些通常称为region proposals或者region of +interest(ROI)。 **RoI的具体操作** @@ -148,50 +163,49 @@ RoI是Region of Interest的简写,一般是指图像上的区域框,但这 3. 对每个sections进行max pooling操作 -这样我们就可以从不同大小的方框得到固定大小的相应 的feature maps。值得一提的是,输出的feature maps的大小不取决于ROI和卷积feature maps大小。RoI Pooling 最大的好处就在于极大地提高了处理速度。 +这样我们就可以从不同大小的方框得到固定大小的相应 的feature maps。值得一提的是,输出的feature maps的大小不取决于ROI和卷积feature +maps大小。RoI Pooling 最大的好处就在于极大地提高了处理速度。 **RoI Pooling的输出** -输出是batch个vector,其中batch的值等于RoI的个数,vector的大小为channel * w * h;RoI Pooling的过程就是将一个个大小不同的box矩形框,都映射成大小固定(w * h)的矩形框。 +输出是batch个vector,其中batch的值等于RoI的个数,vector的大小为channel * w * h;RoI +Pooling的过程就是将一个个大小不同的box矩形框,都映射成大小固定(w * h)的矩形框。 **RoI Pooling示例** -![](img/ch8/8.1.11.gif) +![](/assets/ch8/8.1.11.gif) -### 8.2.3 Faster R-CNN +### 8.2.3 Faster R-CNN **Faster R-CNN有哪些创新点?** -Fast R-CNN依赖于外部候选区域方法,如选择性搜索。但这些算法在CPU上运行且速度很慢。在测试中,Fast R-CNN需要2.3秒来进行预测,其中2秒用于生成2000个ROI。Faster R-CNN采用与Fast R-CNN相同的设计,只是它用内部深层网络代替了候选区域方法。新的候选区域网络(RPN)在生成ROI时效率更高,并且以每幅图像10毫秒的速度运行。 -![](img/ch8/8.2.3-1.png) +Fast R-CNN依赖于外部候选区域方法,如选择性搜索。但这些算法在CPU上运行且速度很慢。在测试中,Fast +R-CNN需要2.3秒来进行预测,其中2秒用于生成2000个ROI。Faster R-CNN采用与Fast +R-CNN相同的设计,只是它用内部深层网络代替了候选区域方法。新的候选区域网络(RPN)在生成ROI时效率更高,并且以每幅图像10毫秒的速度运行。 +![](/assets/ch8/8.2.3-1.png)
图8.1.13 Faster R-CNN的流程图
-图8.1.13 Faster R-CNN的流程图 Faster R-CNN的流程图与Fast R-CNN相同,采用外部候选区域方法代替了内部深层网络。 -![](img/ch8/8.2.3-2.png) +![](/assets/ch8/8.2.3-2.png)
图8.1.14
-图8.1.14 **候选区域网络** -候选区域网络(RPN)将第一个卷积网络的输出特征图作为输入。它在特征图上滑动一个3×3的卷积核,以使用卷积网络(如下所示的ZF网络)构建与类别无关的候选区域。其他深度网络(如VGG或ResNet)可用于更全面的特征提取,但这需要以速度为代价。ZF网络最后会输出256个值,它们将馈送到两个独立的全连接层,以预测边界框和两个objectness分数,这两个objectness分数度量了边界框是否包含目标。我们其实可以使用回归器计算单个objectness分数,但为简洁起见,Faster R-CNN使用只有两个类别的分类器:即带有目标的类别和不带有目标的类别。 -![](img/ch8/8.2.3-3.png) +候选区域网络(RPN)将第一个卷积网络的输出特征图作为输入。它在特征图上滑动一个3×3的卷积核,以使用卷积网络(如下所示的ZF网络)构建与类别无关的候选区域。其他深度网络(如VGG或ResNet)可用于更全面的特征提取,但这需要以速度为代价。ZF网络最后会输出256个值,它们将馈送到两个独立的全连接层,以预测边界框和两个objectness分数,这两个objectness分数度量了边界框是否包含目标。我们其实可以使用回归器计算单个objectness分数,但为简洁起见,Faster +R-CNN使用只有两个类别的分类器:即带有目标的类别和不带有目标的类别。 +![](/assets/ch8/8.2.3-3.png)
图8.1.15
-图8.1.15 对于特征图中的每一个位置,RPN会做k次预测。因此,RPN将输出4×k个坐标和每个位置上2×k个得分。下图展示了8×8的特征图,且有一个3×3的卷积核执行运算,它最后输出8×8×3个ROI(其中k=3)。下图(右)展示了单个位置的3个候选区域。 -![](img/ch8/8.2.3-4.png) +![](/assets/ch8/8.2.3-4.png)
图8.1.16
-图8.1.16 -假设最好涵盖不同的形状和大小。因此,Faster R-CNN不会创建随机边界框。相反,它会预测一些与左上角名为锚点的参考框相关的偏移量(如x, y)。我们限制这些偏移量的值,因此我们的猜想仍然类似于锚点。 -![](img/ch8/8.1.17.png) +假设最好涵盖不同的形状和大小。因此,Faster R-CNN不会创建随机边界框。相反,它会预测一些与左上角名为锚点的参考框相关的偏移量(如x, +y)。我们限制这些偏移量的值,因此我们的猜想仍然类似于锚点。 +![](/assets/ch8/8.1.17.png)
图8.1.17
-图8.1.17 要对每个位置进行k个预测,我们需要以每个位置为中心的k个锚点。每个预测与特定锚点相关联,但不同位置共享相同形状的锚点。 -![](img/ch8/8.2.3-6.png) +![](/assets/ch8/8.2.3-6.png)
图8.1.18
-图8.1.18 这些锚点是精心挑选的,因此它们是多样的,且覆盖具有不同比例和宽高比的现实目标。这使得我们可以用更好的猜想来指导初始训练,并允许每个预测专门用于特定的形状。该策略使早期训练更加稳定和简便。 -![](img/ch8/8.2.3-7.png) +![](/assets/ch8/8.2.3-7.png)
图8.1.19
-图8.1.19 Faster R-CNN使用更多的锚点。它部署9个锚点框:3个不同宽高比的3个不同大小的锚点(Anchor)框。每一个位置使用9个锚点,每个位置会生成2×9个objectness分数和4×9个坐标。 ### 8.2.4 R-FCN @@ -203,7 +217,9 @@ R-FCN 仍属于two-stage 目标检测算法:RPN+R-FCN 1. Fully convolutional 2. 位置敏感得分图(position-sentive score maps) -> our region-based detector is **fully convolutional** with almost all computation shared on the entire image. To achieve this goal, we propose **position-sensitive score maps** to address a dilemma between translation-invariance in image classification and translation-variance in object detection. +> our region-based detector is **fully convolutional** with almost all computation shared on the entire image. To +> achieve this goal, we propose **position-sensitive score maps** to address a dilemma between translation-invariance in +> image classification and translation-variance in object detection. R-FCN backbone:ResNet @@ -211,34 +227,32 @@ ResNet-101+R-FCN:83.6% in PASCAL VOC 2007 test datasets 既提高了mAP,又加快了检测速度 - 假设我们只有一个特征图用来检测右眼。那么我们可以使用它定位人脸吗?应该可以。因为右眼应该在人脸图像的左上角,所以我们可以利用这一点定位整个人脸。如果我们还有其他用来检测左眼、鼻子或嘴巴的特征图,那么我们可以将检测结果结合起来,更好地定位人脸。现在我们回顾一下所有问题。在Faster R-CNN中,检测器使用了多个全连接层进行预测。如果有2000个ROI,那么成本非常高。R-FCN通过减少每个ROI所需的工作量实现加速。上面基于区域的特征图与ROI是独立的,可以在每个ROI之外单独计算。剩下的工作就比较简单了,因此R-FCN的速度比Faster R-CNN快。 -![](img/ch8/8.2.4-1.png) - - 图8.2.1 人脸检测 - 现在我们来看一下5×5的特征图M,内部包含一个蓝色方块。我们将方块平均分成3×3个区域。现在,我们在M中创建了一个新的特征图,来检测方块的左上角(TL)。这个新的特征图如下图(右)所示。只有黄色的网格单元[2,2]处于激活状态。在左侧创建一个新的特征图,用于检测目标的左上角。 -![](img/ch8/8.2.4-2.png) - - 图8.2.2 检测示例 - 我们将方块分成9个部分,由此创建了9个特征图,每个用来检测对应的目标区域。这些特征图叫做位置敏感得分图(position-sensitive score map),因为每个图检测目标的子区域(计算其得分)。 -![](img/ch8/8.2.4-3.png) - - 图8.2.3生成9个得分图 - 下图中红色虚线矩形是建议的ROI。我们将其分割成3×3个区域,并询问每个区域包含目标对应部分的概率是多少。例如,左上角ROI区域包含左眼的概率。我们将结果存储成3×3 vote数组,如下图(右)所示。例如,vote_array[0][0]包含左上角区域是否包含目标对应部分的得分。 -![](img/ch8/8.2.4-4.png) +假设我们只有一个特征图用来检测右眼。那么我们可以使用它定位人脸吗?应该可以。因为右眼应该在人脸图像的左上角,所以我们可以利用这一点定位整个人脸。如果我们还有其他用来检测左眼、鼻子或嘴巴的特征图,那么我们可以将检测结果结合起来,更好地定位人脸。现在我们回顾一下所有问题。在Faster +R-CNN中,检测器使用了多个全连接层进行预测。如果有2000个ROI,那么成本非常高。R-FCN通过减少每个ROI所需的工作量实现加速。上面基于区域的特征图与ROI是独立的,可以在每个ROI之外单独计算。剩下的工作就比较简单了,因此R-FCN的速度比Faster +R-CNN快。 + +![](/assets/ch8/8.2.4-1.png)
图8.2.1 人脸检测
+现在我们来看一下5×5的特征图M,内部包含一个蓝色方块。我们将方块平均分成3×3个区域。现在,我们在M中创建了一个新的特征图,来检测方块的左上角(TL)。这个新的特征图如下图(右)所示。只有黄色的网格单元[2,2] +处于激活状态。在左侧创建一个新的特征图,用于检测目标的左上角。 +![](/assets/ch8/8.2.4-2.png)
图8.2.2 检测示例
+我们将方块分成9个部分,由此创建了9个特征图,每个用来检测对应的目标区域。这些特征图叫做位置敏感得分图(position-sensitive +score map),因为每个图检测目标的子区域(计算其得分)。 +![](/assets/ch8/8.2.4-3.png)
图8.2.3生成9个得分图
+下图中红色虚线矩形是建议的ROI。我们将其分割成3×3个区域,并询问每个区域包含目标对应部分的概率是多少。例如,左上角ROI区域包含左眼的概率。我们将结果存储成3×3 +vote数组,如下图(右)所示。例如,vote_array[0][0]包含左上角区域是否包含目标对应部分的得分。 +![](/assets/ch8/8.2.4-4.png)
图8.2.4
+将ROI应用到特征图上,输出一个3x3数组。将得分图和ROI映射到vote数组的过程叫做位置敏感ROI池化(position-sensitive +ROI-pool)。该过程与前面讨论过的ROI池化非常接近。 +![](/assets/ch8/8.2.4-5.png)
图8.2.5
+将ROI的一部分叠加到对应的得分图上,计算V[i][j]。在计算出位置敏感ROI池化的所有值后,类别得分是其所有元素得分的平均值。 +![](/assets/ch8/8.2.6.png)
图8.2.6 ROI池化
+假如我们有C个类别要检测。我们将其扩展为C+1个类别,这样就为背景(非目标)增加了一个新的类别。每个类别有3×3个得分图,因此一共有( +C+1)×3×3个得分图。使用每个类别的得分图可以预测出该类别的类别得分。然后我们对这些得分应用 softmax +函数,计算出每个类别的概率。以下是数据流图,在本案例中,k=3。 +![](/assets/ch8/8.2.7.png)
图8.2.7
+ + - 图8.2.4 - 将ROI应用到特征图上,输出一个3x3数组。将得分图和ROI映射到vote数组的过程叫做位置敏感ROI池化(position-sensitive ROI-pool)。该过程与前面讨论过的ROI池化非常接近。 -![](img/ch8/8.2.4-5.png) - - 图8.2.5 - 将ROI的一部分叠加到对应的得分图上,计算V[i][j]。在计算出位置敏感ROI池化的所有值后,类别得分是其所有元素得分的平均值。 -![](img/ch8/8.2.6.png) - - 图8.2.6 ROI池化 - 假如我们有C个类别要检测。我们将其扩展为C+1个类别,这样就为背景(非目标)增加了一个新的类别。每个类别有3×3个得分图,因此一共有(C+1)×3×3个得分图。使用每个类别的得分图可以预测出该类别的类别得分。然后我们对这些得分应用 softmax 函数,计算出每个类别的概率。以下是数据流图,在本案例中,k=3。 -![](img/ch8/8.2.7.png) - - 图8.2.7 ### 8.2.5 FPN **FPN有哪些创新点?** @@ -246,9 +260,11 @@ ResNet-101+R-FCN:83.6% in PASCAL VOC 2007 test datasets 1. 多层特征 2. 特征融合 -解决目标检测中的多尺度问题,通过简单的网络连接改变,在基本不增加原有模型计算量的情况下,大幅度提升小物体(small object)检测的性能。 +解决目标检测中的多尺度问题,通过简单的网络连接改变,在基本不增加原有模型计算量的情况下,大幅度提升小物体(small +object)检测的性能。 -在物体检测里面,有限计算量情况下,网络的深度(对应到感受野)与 stride 通常是一对矛盾的东西,常用的网络结构对应的 stride 一般会比较大(如 32),而图像中的小物体甚至会小于 stride 的大小,造成的结果就是小物体的检测性能急剧下降。传统解决这个问题的思路包括: +在物体检测里面,有限计算量情况下,网络的深度(对应到感受野)与 stride 通常是一对矛盾的东西,常用的网络结构对应的 stride +一般会比较大(如 32),而图像中的小物体甚至会小于 stride 的大小,造成的结果就是小物体的检测性能急剧下降。传统解决这个问题的思路包括: 1. 图像金字塔(image pyramid),即多尺度训练和测试。但该方法计算量大,耗时较久。 2. 特征分层,即每层分别预测对应的scale分辨率的检测结果,如SSD算法。该方法强行让不同层学习同样的语义信息,但实际上不同深度对应于不同层次的语义特征,浅层网络分辨率高,学到更多是细节特征,深层网络分辨率低,学到更多是语义特征。 @@ -259,11 +275,14 @@ ResNet-101+R-FCN:83.6% in PASCAL VOC 2007 test datasets 2. 如何设计通用的特征表示来解决物体检测中的多个子问题?如 object proposal, box localization, instance segmentation. 3. 如何高效计算多尺度的特征表示? -FPN网络直接在Faster R-CNN单网络上做修改,每个分辨率的 feature map 引入后一分辨率缩放两倍的 feature map 做 element-wise 相加的操作。通过这样的连接,每一层预测所用的 feature map 都融合了不同分辨率、不同语义强度的特征,融合的不同分辨率的 feature map 分别做对应分辨率大小的物体检测。这样保证了每一层都有合适的分辨率以及强语义(rich semantic)特征。同时,由于此方法只是在原网络基础上加上了额外的跨层连接,在实际应用中几乎不增加额外的时间和计算量。作者接下来实验了将 FPN 应用在 Faster RCNN 上的性能,在 COCO 上达到了 state-of-the-art 的单模型精度。在RPN上,FPN增加了8.0个点的平均召回率(average recall,AR);在后面目标检测上,对于COCO数据集,FPN增加了2.3个点的平均精确率(average precision,AP),对于VOC数据集,FPN增加了3.8个点的AP。 - +FPN网络直接在Faster R-CNN单网络上做修改,每个分辨率的 feature map 引入后一分辨率缩放两倍的 feature map 做 element-wise +相加的操作。通过这样的连接,每一层预测所用的 feature map 都融合了不同分辨率、不同语义强度的特征,融合的不同分辨率的 feature +map 分别做对应分辨率大小的物体检测。这样保证了每一层都有合适的分辨率以及强语义(rich +semantic)特征。同时,由于此方法只是在原网络基础上加上了额外的跨层连接,在实际应用中几乎不增加额外的时间和计算量。作者接下来实验了将 +FPN 应用在 Faster RCNN 上的性能,在 COCO 上达到了 state-of-the-art 的单模型精度。在RPN上,FPN增加了8.0个点的平均召回率(average +recall,AR);在后面目标检测上,对于COCO数据集,FPN增加了2.3个点的平均精确率(average precision,AP),对于VOC数据集,FPN增加了3.8个点的AP。 - -![](img/ch8/FPN-01.png) +![](/assets/ch8/FPN-01.png) FPN算法主要由三个模块组成,分别是: @@ -271,37 +290,45 @@ FPN算法主要由三个模块组成,分别是: 2. Lareral connections(横向链接) 3. Top-down path(自顶向下线路) -![](img/ch8/FPN-02.png) +![](/assets/ch8/FPN-02.png) **Bottom-up pathway** -FPN是基于Faster R-CNN进行改进,其backbone是ResNet-101,FPN主要应用在Faster R-CNN中的RPN(用于bouding box proposal generation)和Fast R-CNN(用于object detection)两个模块中。 +FPN是基于Faster R-CNN进行改进,其backbone是ResNet-101,FPN主要应用在Faster R-CNN中的RPN(用于bouding box proposal +generation)和Fast R-CNN(用于object detection)两个模块中。 -其中 RPN 和 Fast RCNN 分别关注的是召回率(recall)和精确率(precision),在这里对比的指标分别为 Average Recall(AR) 和 Average Precision(AP)。 +其中 RPN 和 Fast RCNN 分别关注的是召回率(recall)和精确率(precision),在这里对比的指标分别为 Average Recall(AR) 和 Average +Precision(AP)。 注:Bottom-up可以理解为自底向上,Top-down可以理解为自顶向下。这里的下是指low-level,上是指high-level,分别对应于提取的低级(浅层)特征和高级语义(高层)特征。 -Bottom-up pathway 是卷积网络的前向传播过程。在前向传播过程中,feature map的大小可以在某些层发生改变。一些尺度(scale)因子为2,所以后一层feature map的大小是前一层feature map大小的二分之一,根据此关系进而构成了feature pyramid(hierarchy)。 +Bottom-up pathway 是卷积网络的前向传播过程。在前向传播过程中,feature map的大小可以在某些层发生改变。一些尺度(scale)因子为2,所以后一层feature +map的大小是前一层feature map大小的二分之一,根据此关系进而构成了feature pyramid(hierarchy)。 -然而还有很多层输出的feature map是一样的大小(即不进行缩放的卷积),作者将这些层归为同一 stage。对于feature pyramid,作者为每个stage定义一个pyramid level。 +然而还有很多层输出的feature map是一样的大小(即不进行缩放的卷积),作者将这些层归为同一 stage。对于feature +pyramid,作者为每个stage定义一个pyramid level。 作者将每个stage的最后一层的输出作为feature map,然后不同stage进行同一操作,便构成了feature pyramid。 -具体来说,对于ResNets-101,作者使用了每个stage的最后一个残差结构的特征激活输出。将这些残差模块输出表示为{C2, C3, C4, C5},对应于conv2,conv3,conv4和conv5的输出,并且注意它们相对于输入图像具有{4, 8, 16, 32}像素的步长。考虑到内存占用,没有将conv1包含在金字塔中。 +具体来说,对于ResNets-101,作者使用了每个stage的最后一个残差结构的特征激活输出。将这些残差模块输出表示为{C2, C3, C4, +C5},对应于conv2,conv3,conv4和conv5的输出,并且注意它们相对于输入图像具有{4, 8, 16, 32}像素的步长。考虑到内存占用,没有将conv1包含在金字塔中。 -![](img/ch8/FPN-03.png) +![](/assets/ch8/FPN-03.png) **Top-down pathway and lateral connections** -Top-town pathway是上采样(upsampling)过程。而later connection(横向连接)是将上采样的结果和bottom-up pathway生成的相同大小的feature map进行融合(merge)。 +Top-town pathway是上采样(upsampling)过程。而later connection(横向连接)是将上采样的结果和bottom-up pathway生成的相同大小的feature +map进行融合(merge)。 注:上采样尺度因子为2,因为为了和之前下采样卷积的尺度因子=2一样。上采样是放大,下采样是缩小。 -具体操作如下图所示,上采样(2x up)feature map与相同大小的bottom-up feature map进行逐像素相加融合(element-wise addition),其中bottom-up feature先要经过1x1卷积层,目的是为了减少通道维度(reduce channel dimensions)。 +具体操作如下图所示,上采样(2x up)feature map与相同大小的bottom-up feature map进行逐像素相加融合(element-wise +addition),其中bottom-up feature先要经过1x1卷积层,目的是为了减少通道维度(reduce channel dimensions)。 -注:减少通道维度是为了将bottom-up feature map的通道数量与top-down feature map的通道数量保持一致,又因为两者feature map大小一致,所以可以进行对应位置像素的叠加(element-wise addition)。 +注:减少通道维度是为了将bottom-up feature map的通道数量与top-down feature map的通道数量保持一致,又因为两者feature +map大小一致,所以可以进行对应位置像素的叠加(element-wise addition)。 -![](img/ch8/FPN-04.png) +![](/assets/ch8/FPN-04.png) ### 8.2.6 Mask R-CNN @@ -310,9 +337,10 @@ Top-town pathway是上采样(upsampling)过程。而later connection(横 1. Backbone:ResNeXt-101+FPN 2. RoI Align替换RoI Pooling -Mask R-CNN是一个实例分割(Instance segmentation)算法,主要是在目标检测的基础上再进行分割。Mask R-CNN算法主要是Faster R-CNN+FCN,更具体一点就是ResNeXt+RPN+RoI Align+Fast R-CNN+FCN。 +Mask R-CNN是一个实例分割(Instance segmentation)算法,主要是在目标检测的基础上再进行分割。Mask R-CNN算法主要是Faster +R-CNN+FCN,更具体一点就是ResNeXt+RPN+RoI Align+Fast R-CNN+FCN。 -![](img/ch8/Mask R-CNN-01.png) +![](/assets/ch8/Mask R-CNN-01.png) **Mask R-CNN算法步骤** @@ -325,24 +353,33 @@ Mask R-CNN是一个实例分割(Instance segmentation)算法,主要是在 **RoI Pooling和RoI Align有哪些不同?** -ROI Align 是在Mask-RCNN中提出的一种区域特征聚集方式,很好地解决了RoI Pooling操作中两次量化造成的区域不匹配(mis-alignment)的问题。实验显示,在检测测任务中将 RoI Pooling 替换为 RoI Align 可以提升检测模型的准确性。 +ROI Align 是在Mask-RCNN中提出的一种区域特征聚集方式,很好地解决了RoI Pooling操作中两次量化造成的区域不匹配(mis-alignment) +的问题。实验显示,在检测测任务中将 RoI Pooling 替换为 RoI Align 可以提升检测模型的准确性。 -在常见的两级检测框架(比如Fast-RCNN,Faster-RCNN,RFCN)中,RoI Pooling 的作用是根据预选框的位置坐标在特征图中将相应区域池化为固定尺寸的特征图,以便进行后续的分类和包围框回归操作。由于预选框的位置通常是由模型回归得到的,一般来讲是浮点数,而池化后的特征图要求尺寸固定。故RoI Pooling这一操作存在两次量化的过程。 +在常见的两级检测框架(比如Fast-RCNN,Faster-RCNN,RFCN)中,RoI Pooling +的作用是根据预选框的位置坐标在特征图中将相应区域池化为固定尺寸的特征图,以便进行后续的分类和包围框回归操作。由于预选框的位置通常是由模型回归得到的,一般来讲是浮点数,而池化后的特征图要求尺寸固定。故RoI +Pooling这一操作存在两次量化的过程。 - 将候选框边界量化为整数点坐标值。 - 将量化后的边界区域平均分割成 $k\times k$ 个单元(bin),对每一个单元的边界进行量化。 事实上,经过上述两次量化,此时的候选框已经和最开始回归出来的位置有一定的偏差,这个偏差会影响检测或者分割的准确度。在论文里,作者把它总结为“不匹配问题(misalignment)”。 -下面我们用直观的例子具体分析一下上述区域不匹配问题。如下图所示,这是一个Faster-RCNN检测框架。输入一张$800\times 800$的图片,图片上有一个$665\times 665$的包围框(框着一只狗)。图片经过主干网络提取特征后,特征图缩放步长(stride)为32。因此,图像和包围框的边长都是输入时的1/32。800正好可以被32整除变为25。但665除以32以后得到20.78,带有小数,于是RoI Pooling 直接将它量化成20。接下来需要把框内的特征池化$7\times 7$的大小,因此将上述包围框平均分割成$7\times 7$个矩形区域。显然,每个矩形区域的边长为2.86,又含有小数。于是ROI Pooling 再次把它量化到2。经过这两次量化,候选区域已经出现了较明显的偏差(如图中绿色部分所示)。更重要的是,该层特征图上0.1个像素的偏差,缩放到原图就是3.2个像素。那么0.8的偏差,在原图上就是接近30个像素点的差别,这一差别不容小觑。 +下面我们用直观的例子具体分析一下上述区域不匹配问题。如下图所示,这是一个Faster-RCNN检测框架。输入一张$800\times +800$的图片,图片上有一个$665\times +665$的包围框(框着一只狗)。图片经过主干网络提取特征后,特征图缩放步长(stride)为32。因此,图像和包围框的边长都是输入时的1/32。800正好可以被32整除变为25。但665除以32以后得到20.78,带有小数,于是RoI +Pooling 直接将它量化成20。接下来需要把框内的特征池化$7\times 7$的大小,因此将上述包围框平均分割成$7\times +7$个矩形区域。显然,每个矩形区域的边长为2.86,又含有小数。于是ROI Pooling +再次把它量化到2。经过这两次量化,候选区域已经出现了较明显的偏差(如图中绿色部分所示)。更重要的是,该层特征图上0.1个像素的偏差,缩放到原图就是3.2个像素。那么0.8的偏差,在原图上就是接近30个像素点的差别,这一差别不容小觑。 -![](img/ch8/Mask R-CNN-02.png) +![](/assets/ch8/Mask R-CNN-02.png) 为了解决RoI Pooling的上述缺点,作者提出了RoI Align这一改进的方法(如图2)。 -![](img/ch8/Mask R-CNN-03.png) +![](/assets/ch8/Mask R-CNN-03.png) -RoI Align的思路很简单:取消量化操作,使用双线性内插的方法获得坐标为浮点数的像素点上的图像数值,从而将整个特征聚集过程转化为一个连续的操作。值得注意的是,在具体的算法操作上,RoI Align并不是简单地补充出候选区域边界上的坐标点,然后将这些坐标点进行池化,而是重新设计了一套比较优雅的流程,如下图所示: +RoI Align的思路很简单:取消量化操作,使用双线性内插的方法获得坐标为浮点数的像素点上的图像数值,从而将整个特征聚集过程转化为一个连续的操作。值得注意的是,在具体的算法操作上,RoI +Align并不是简单地补充出候选区域边界上的坐标点,然后将这些坐标点进行池化,而是重新设计了一套比较优雅的流程,如下图所示: 1. 遍历每一个候选区域,保持浮点数边界不做量化。 @@ -350,39 +387,46 @@ RoI Align的思路很简单:取消量化操作,使用双线性内插的方 3. 在每个单元中计算固定四个坐标位置,用双线性内插的方法计算出这四个位置的值,然后进行最大池化操作。 -这里对上述步骤的第三点作一些说明:这个固定位置是指在每一个矩形单元(bin)中按照固定规则确定的位置。比如,如果采样点数是1,那么就是这个单元的中心点。如果采样点数是4,那么就是把这个单元平均分割成四个小方块以后它们分别的中心点。显然这些采样点的坐标通常是浮点数,所以需要使用插值的方法得到它的像素值。在相关实验中,作者发现将采样点设为4会获得最佳性能,甚至直接设为1在性能上也相差无几。事实上,RoI Align 在遍历取样点的数量上没有RoI Pooling那么多,但却可以获得更好的性能,这主要归功于解决了mis alignment的问题。值得一提的是,我在实验时发现,RoI Align在VOC 2007数据集上的提升效果并不如在COCO上明显。经过分析,造成这种区别的原因是COCO上小目标的数量更多,而小目标受mis alignment问题的影响更大(比如,同样是0.5个像素点的偏差,对于较大的目标而言显得微不足道,但是对于小目标,误差的影响就要高很多)。 +这里对上述步骤的第三点作一些说明:这个固定位置是指在每一个矩形单元(bin)中按照固定规则确定的位置。比如,如果采样点数是1,那么就是这个单元的中心点。如果采样点数是4,那么就是把这个单元平均分割成四个小方块以后它们分别的中心点。显然这些采样点的坐标通常是浮点数,所以需要使用插值的方法得到它的像素值。在相关实验中,作者发现将采样点设为4会获得最佳性能,甚至直接设为1在性能上也相差无几。事实上,RoI +Align 在遍历取样点的数量上没有RoI Pooling那么多,但却可以获得更好的性能,这主要归功于解决了mis +alignment的问题。值得一提的是,我在实验时发现,RoI Align在VOC +2007数据集上的提升效果并不如在COCO上明显。经过分析,造成这种区别的原因是COCO上小目标的数量更多,而小目标受mis +alignment问题的影响更大(比如,同样是0.5个像素点的偏差,对于较大的目标而言显得微不足道,但是对于小目标,误差的影响就要高很多)。 -![](img/ch8/Mask R-CNN-04.png) +![](/assets/ch8/Mask R-CNN-04.png) -### 8.2.7 DetNet(贡献者:北京理工大学--明奇) +### 8.2.7 DetNet(贡献者:北京理工大学--明奇) DetNet是发表在ECCV2018的论文,比较新,出发点是现有的检测任务backbone都是从分类任务衍生而来的,因此作者想针对检测专用的backbone做一些讨论和研究而设计了DetNet,思路比较新奇。 1. **Introduction** -  很多backbone的提出都是用于挑战ImageNet分类任务后被应用到检测上来,而鲜有单独针对检测任务设计的backbone。 +   很多backbone的提出都是用于挑战ImageNet分类任务后被应用到检测上来,而鲜有单独 + 针对检测任务设计的backbone。 -  **检测和分类有明显的区别**:(1)不仅需要分类,还需要精确的定位 (2)最近的检测器都是基于类似FPN结构,在分类网络基础上加额外多尺度特征进行检测,应对不同尺度变化的目标。这两点又是相互补充,共同协助网络完成分类到检测任务的转变。例如分类任务是检测的一环所以必不可少,但是传统分类采用的最高级特征定位细节不够,因此很多最近网络设法用类似FPN的结构去处理尺度变化的问题,就将分类较好地过渡到检测任务上了。 +  **检测和分类有明显的区别**:(1)不仅需要分类,还需要精确的定位 +(2)最近的检测器都是基于类似FPN结构,在分类网络基础上加额外多尺度特征进行检测,应对不同尺度变化的目标。这两点又是相互补充,共同协助网络完成分类到检测任务的转变。例如分类任务是检测的一环所以必不可少,但是传统分类采用的最高级特征定位细节不够,因此很多最近网络设法用类似FPN的结构去处理尺度变化的问题,就将分类较好地过渡到检测任务上了。 -2. **DetNet** +2. **DetNet** - 2.1 **Motivation** -   主要着眼点是**分辨率**,从大目标和小目标分别阐述保持分辨率的重要性。所以DetNet也是从分辨率的保持着手,解决多尺度物体的识别问题。 +2.1 **Motivation** +  主要着眼点是**分辨率**,从大目标和小目标分别阐述保持分辨率的重要性。所以DetNet也是从分辨率的保持着手,解决多尺度物体的识别问题。 * Weak visibility of large objects -  网络在较深层如P6(FPN)P7(RetinaNet)大目标的边界不明确使精确定位困难。 +   网络在较深层如P6(FPN)P7(RetinaNet)大目标的边界不明确使精确定位困难。 * Invisibility of small objects -  小目标就很惨了,降采样容易丢。这个就不赘述了,所以只要避开降采样就能防止目标丢失,但是这种方法又会导致抽象能力不够 +   小目标就很惨了,降采样容易丢。这个就不赘述了,所以只要避开降采样就能防止目标丢失,但是这种方法又会导致抽象能力不够 -​ 2.2 **DetNet Design** -  保持分辨率有两个麻烦的问题:(1)内存消耗大,计算大 (2)降采样减少导致高层的抽象特征不足以很好地进行分类任务。下面设计时会同时考虑时间和高层抽象信息两点。 +​ 2.2 **DetNet Design** +  保持分辨率有两个麻烦的问题:(1)内存消耗大,计算大 +(2)降采样减少导致高层的抽象特征不足以很好地进行分类任务。下面设计时会同时考虑时间和高层抽象信息两点。   先放出DetNet的多尺度各stage的尺寸如下图, 可以看到,相比前两种方式,DetNet在P4之后就不再进一步降采样了,进行分辨率的保持。 -![](img/ch8/DetNet-1.png) +![](/assets/ch8/DetNet-1.png)   实现细节如下图: -![](img/ch8/DetNet-2.png) +![](/assets/ch8/DetNet-2.png) * 采用的backbone是ResNet-50,改进设计了DetNet-59。 * 对bottlenecks进行了改进,传统的其实不止C,也包含两种,即将AB的膨胀卷积换成普通卷积。AB是新的基础模块。 @@ -390,126 +434,152 @@ DetNet是发表在ECCV2018的论文,比较新,出发点是现有的检测任 * DetNet也可以加FPN结构,方法类似。 - 3. **Experiments** -   检测和训练的细节配置就不看了。 +   检测和训练的细节配置就不看了。 - 3.1 **Main Results** +3.1 **Main Results** -![](img/ch8/DetNet-3.png) +![](/assets/ch8/DetNet-3.png) * 在FPN基础上明显有大物体涨点,同时由于高分辨率,小物体也有不错的提升。 * 膨胀卷积提供的大感受野使得分类也不逊色 -![](img/ch8/DetNet-4.png) + ![](/assets/ch8/DetNet-4.png) -​ 3.2 **Results analysis** -![](img/ch8/DetNet-5.png) +​ 3.2 **Results analysis** +![](/assets/ch8/DetNet-5.png) * 从AP50看出,高好1.7;从AP80看出,高了3.7。由此可以看出确实提高了检测性能。( -* 从定位性能来看,大物体的提升比小物体更多。作者认为是高分辨率解决了大物体边界模糊的问题。其实有一种解释:小目标没有大目标明显,因为膨胀卷积核降采样都会丢失小目标,只是膨胀卷积可能离散采样不至于像降采样直接给到后面没了,但是没有根本性的解决,所以小目标不大。 -![](img/ch8/DetNet-6.png) +* +从定位性能来看,大物体的提升比小物体更多。作者认为是高分辨率解决了大物体边界模糊的问题。其实有一种解释:小目标没有大目标明显,因为膨胀卷积核降采样都会丢失小目标,只是膨胀卷积可能离散采样不至于像降采样直接给到后面没了,但是没有根本性的解决,所以小目标不大。 +![](/assets/ch8/DetNet-6.png) * AR指标也有类似结论 * AR50体现了小目标的查全率更好,这也印证上面分析的:相对降采样,膨胀卷积丢失会好点。此下大目标效果虽然提升不大但是也很高了,作者表示DetNet擅长找到更精确的定位目标,在AR85的高指标就能看出。 * AR85看大目标丢失少,说明能够像 VGG一样对大目标效果优良。关于小目标的效果平平,作者认为没有必要太高,因为FPN结构对小目标已经利用地很充分了,这里即使不高也没事。 - - 3.3 **Discussion** -* 关于stage -  为了研究backbone对检测的影响,首先研究stage的作用。前4个还好说,和ResNet一样,但是P5 P6就不同,没有尺度的变化,和传统意义的stage不一样了,需要重新定义。这里DetNet也是类似ResNet的方法,虽然没有尺度变化,但是AB模块的位置还是保持了,B开启一个stage(~~听上去有点牵强~~)。如下图,认为新加的仍属于P5。 -![](img/ch8/DetNet-7.png) -  验证方法是做了实验,将P6开始的block换成上图所示的A模块对比效果如下图。 发现还是加了B效果更好。(但是这个stage和传统意义很不一样,所以很多性质不能相提并论,只是B模块的改变也不好判定什么) -![](img/ch8/DetNet-8.png) +* 关于stage +   为了研究backbone对检测的影响,首先研究stage的作用。前4个还好说,和ResNet一样,但是P5 + P6就不同,没有尺度的变化,和传统意义的stage不一样了,需要重新定义。这里DetNet也是类似ResNet的方法,虽然没有尺度变化,但是AB模块的位置还是保持了,B开启一个stage( + ~~听上去有点牵强~~)。如下图,认为新加的仍属于P5。 + ![](/assets/ch8/DetNet-7.png) +  验证方法是做了实验,将P6开始的block换成上图所示的A模块对比效果如下图。 +发现还是加了B效果更好。(但是这个stage和传统意义很不一样,所以很多性质不能相提并论,只是B模块的改变也不好判定什么) +![](/assets/ch8/DetNet-8.png) ### 8.2.8 CBNet -本部分介绍一篇在COCO数据集达到最高单模型性能——mAP 53.3的网络,论文于2019.9.3发布在ArXiv,全名是*CBNet: A Novel Composite Backbone Network Architecture for Object Detection* + +本部分介绍一篇在COCO数据集达到最高单模型性能——mAP 53.3的网络,论文于2019.9.3发布在ArXiv,全名是*CBNet: A Novel Composite +Backbone Network Architecture for Object Detection* 1. **Introduction** -  名义上是单模型,实际是多模型的特征融合,只是和真正的多模型策略略有不同。作者的起点是,设计新的模型往往需要在ImageNet上进行预训练,比较麻烦。因而提出的Composite Backbone Network (CBNet),采用经典网络的多重组合的方式构建网络,一方面可以提取到更有效的特征,另一方面也能够直接用现成的预训练参数(如ResNet,ResNeXt等)比较简单高效。 +  名义上是单模型,实际是多模型的特征融合,只是和真正的多模型策略略有不同。作者的起点是,设计新的模型往往需要在ImageNet上进行预训练,比较麻烦。因而提出的Composite +Backbone Network (CBNet),采用经典网络的多重组合的方式构建网络,一方面可以提取到更有效的特征,另一方面也能够直接用现成的预训练参数(如ResNet,ResNeXt等)比较简单高效。 2. **Proposed method** -![](img/ch8/CBNet-1.png) -2.1 **Architecture of CBNet** -![](img/ch8/CBNet-2.png) - -  如上图,模型中采用K个(K>1)相同的结构进行紧密联结。其中两个相同backbone的叫Dual-Backbone (DB),三个叫Triple- Backbone (TB);L代表backbone的stage数目,这里统一设置为L=5。其中,和前任工作不同的地方在于,这里将不同的stage信息进行复用回传,以便获取更好的特征(为什么work不好说)。 -2.2 **Other possible composite styles** -![](img/ch8/CBNet-3.png) +[//]: # (![](././img/ch8/CBNet-1.png)) +![占位图]() +2.1 **Architecture of CBNet** -  相关工作的其他类似结构,大同小异。要么是前面backbone的stage往后传播,要么是往前一个传播,每个都有一篇论文,应该都会给出不同的解释;第四个结构不太一样,是类似densnet的结构,但是密集连接+多backbone assemble的内存消耗不出意外会非常大。但是脱离这些体系来看,多backbone的结构类似多模型的assemble,和单模型有点不公平。 +[//]: # (![](./img/ch8/CBNet-2.png)) +![占位图]() +  如上图,模型中采用K个(K>1)相同的结构进行紧密联结。其中两个相同backbone的叫Dual-Backbone (DB),三个叫Triple- +Backbone (TB);L代表backbone的stage数目,这里统一设置为L=5。其中,和前任工作不同的地方在于,这里将不同的stage信息进行复用回传,以便获取更好的特征(为什么work不好说)。 +2.2 **Other possible composite styles** +[//]: # (![](./img/ch8/CBNet-3.png)) +![占位图]() +  相关工作的其他类似结构,大同小异。要么是前面backbone的stage往后传播,要么是往前一个传播,每个都有一篇论文,应该都会给出不同的解释;第四个结构不太一样,是类似densnet的结构,但是密集连接+多backbone +assemble的内存消耗不出意外会非常大。但是脱离这些体系来看,多backbone的结构类似多模型的assemble,和单模型有点不公平。 3. **Experiment** -* **result** -![](img/ch8/CBNet-4.png) +* **result** +[//]: # (![](./img/ch8/CBNet-4.png)) +![占位图]() COCO数据集上的结果。看来提升还是有的。但是也能看出,大趋势上,三阶级联效果不如两阶的提升大,也是这部分的特征提升空间有限的缘故,到底哪部分在work不好说。下图的研究就更说明这一点了,斜率逐渐减小。 +* **Comparisons of different composite styles** -* **Comparisons of different composite styles** -![](img/ch8/CBNet-5.png) - +[//]: # (![](./img/ch8/CBNet-5.png)) +![占位图]() 他的级联网络相比,作者的阐述点只落脚于特征的利用情况,但是这个东西本身就很玄乎,不好说到底怎么算利用得好。硬要说这种做法的解释性,大概就是将backbone方向的后面高级语义特征传播回前面进行加强,相当于横向的FPN传播。 +* **Number of backbones in CBNet** -* **Number of backbones in CBNet** -![](img/ch8/CBNet-6.png) - +[//]: # (![](./img/ch8/CBNet-6.png)) +![占位图]() 速度慢是必然的,FPN+ResNeXt为8fps,加上两个backboen后为5.5FPS;如果减去backbone的前两个stage,可以节省部分参数达到6.9FPS,而精度下降不大(整体速度太低,这个实验意义不大) -* **Sharing weights for CBNet** -![](img/ch8/CBNet-7.png) -* -从中可以看出其实权重是否share区别不大, 不到一个点的降幅,参数量减少。 +* **Sharing weights for CBNet** +[//]: # (![](./img/ch8/CBNet-7.png)) +![占位图]() -* **Effectiveness of basic feature enhancement by CBNet** -![](img/ch8/CBNet-8.png) +* -从中可以看出激活响应效果更好,确实是能够提取到更为有效的特征,对物体的响应更加敏感。 +从中可以看出其实权重是否share区别不大, 不到一个点的降幅,参数量减少。 + +* **Effectiveness of basic feature enhancement by CBNet** +[//]: # (![](./img/ch8/CBNet-8.png)) +![占位图]() +从中可以看出激活响应效果更好,确实是能够提取到更为有效的特征,对物体的响应更加敏感。 ## 8.3 One Stage目标检测算法 -我们将对单次目标检测器(包括SSD系列和YOLO系列等算法)进行综述。我们将分析FPN以理解多尺度特征图如何提高准确率,特别是小目标的检测,其在单次检测器中的检测效果通常很差。然后我们将分析Focal loss和RetinaNet,看看它们是如何解决训练过程中的类别不平衡问题的。 +我们将对单次目标检测器(包括SSD系列和YOLO系列等算法)进行综述。我们将分析FPN以理解多尺度特征图如何提高准确率,特别是小目标的检测,其在单次检测器中的检测效果通常很差。然后我们将分析Focal +loss和RetinaNet,看看它们是如何解决训练过程中的类别不平衡问题的。 -### 8.3.1 SSD +### 8.3.1 SSD **SSD有哪些创新点?** 1. 基于Faster R-CNN中的Anchor,提出了相似的先验框(Prior box) 2. 从不同比例的特征图(多尺度特征)中产生不同比例的预测,并明确地按长宽比分离预测。 -不同于前面的R-CNN系列,SSD属于one-stage方法。SSD使用 VGG16 网络作为特征提取器(和 Faster R-CNN 中使用的 CNN 一样),将后面的全连接层替换成卷积层,并在之后添加自定义卷积层,并在最后直接采用卷积进行检测。在多个特征图上设置不同缩放比例和不同宽高比的先验框以融合多尺度特征图进行检测,靠前的大尺度特征图可以捕捉到小物体的信息,而靠后的小尺度特征图能捕捉到大物体的信息,从而提高检测的准确性和定位的准确性。如下图是SSD的网络结构图。 +不同于前面的R-CNN系列,SSD属于one-stage方法。SSD使用 VGG16 网络作为特征提取器(和 Faster R-CNN 中使用的 CNN +一样),将后面的全连接层替换成卷积层,并在之后添加自定义卷积层,并在最后直接采用卷积进行检测。在多个特征图上设置不同缩放比例和不同宽高比的先验框以融合多尺度特征图进行检测,靠前的大尺度特征图可以捕捉到小物体的信息,而靠后的小尺度特征图能捕捉到大物体的信息,从而提高检测的准确性和定位的准确性。如下图是SSD的网络结构图。 -![](img/ch8/SSD-01.png) +![](/assets/ch8/SSD-01.png) **1. 怎样设置default boxes?** -SSD中default box的概念有点类似于Faster R-CNN中的anchor。不同于Faster R-CNN只在最后一个特征层取anchor, SSD在多个特征层上取default box,可以得到不同尺度的default box。在特征图的每个单元上取不同宽高比的default box,一般宽高比在{1,2,3,1/2,1/3}中选取,有时还会额外增加一个宽高比为1但具有特殊尺度的box。如下图所示,在8x8的feature map和4x4的feature map上的每个单元取4个不同的default box。原文对于300x300的输入,分别在conv4_3, conv7,conv8_2,conv9_2,conv10_2,conv11_2的特征图上的每个单元取4,6,6,6,4,4个default box. 由于以上特征图的大小分别是38x38,19x19,10x10,5x5,3x3,1x1,所以一共得到38x38x4+19x19x6+10x10x6+5x5x6+ +SSD中default box的概念有点类似于Faster R-CNN中的anchor。不同于Faster R-CNN只在最后一个特征层取anchor, SSD在多个特征层上取default +box,可以得到不同尺度的default box。在特征图的每个单元上取不同宽高比的default +box,一般宽高比在{1,2,3,1/2,1/3}中选取,有时还会额外增加一个宽高比为1但具有特殊尺度的box。如下图所示,在8x8的feature +map和4x4的feature map上的每个单元取4个不同的default box。原文对于300x300的输入,分别在conv4_3, +conv7,conv8_2,conv9_2,conv10_2,conv11_2的特征图上的每个单元取4,6,6,6,4,4个default box. +由于以上特征图的大小分别是38x38,19x19,10x10,5x5,3x3,1x1,所以一共得到38x38x4+19x19x6+10x10x6+5x5x6+ 3x3x4+1x1x4=8732个default box.对一张300x300的图片输入网络将会针对这8732个default box预测8732个边界框。 -![](img/ch8/SSD-02.png) +![](/assets/ch8/SSD-02.png) **2. 怎样对先验框进行匹配?** SSD在训练的时候只需要输入图像和图像中每个目标对应的ground truth. 先验框与ground truth 的匹配遵循两个原则: (1)对图片中的每个ground truth, 在先验框中找到与其IOU最大的先验框,则该先验框对应的预测边界框与ground truth 匹配。 -(2)对于(1)中每个剩下的没有与任何ground truth匹配到的先验框,找到与其IOU最大的ground truth,若其与该ground truth的IOU值大于某个阈值(一般设为0.5),则该先验框对应的预测边界框与该ground truth匹配。 +(2)对于(1)中每个剩下的没有与任何ground truth匹配到的先验框,找到与其IOU最大的ground truth,若其与该ground +truth的IOU值大于某个阈值(一般设为0.5),则该先验框对应的预测边界框与该ground truth匹配。 -按照这两个原则进行匹配,匹配到ground truth的先验框对应的预测边界框作为正样本,没有匹配到ground truth的先验框对应的预测边界框作为负样本。尽管一个ground truth可以与多个先验框匹配,但是ground truth的数量相对先验框还是很少,按照上面的原则进行匹配还是会造成负样本远多于正样本的情况。为了使正负样本尽量均衡(一般保证正负样本比例约为1:3),SSD采用hard negative mining, 即对负样本按照其预测背景类的置信度进行降序排列,选取置信度较小的top-k作为训练的负样本。 +按照这两个原则进行匹配,匹配到ground truth的先验框对应的预测边界框作为正样本,没有匹配到ground +truth的先验框对应的预测边界框作为负样本。尽管一个ground truth可以与多个先验框匹配,但是ground +truth的数量相对先验框还是很少,按照上面的原则进行匹配还是会造成负样本远多于正样本的情况。为了使正负样本尽量均衡(一般保证正负样本比例约为1:3),SSD采用hard +negative mining, 即对负样本按照其预测背景类的置信度进行降序排列,选取置信度较小的top-k作为训练的负样本。 **3. 怎样得到预测的检测结果?** -最后分别在所选的特征层上使用3x3卷积核预测不同default boxes所属的类别分数及其预测的边界框location。由于对于每个box需要预测该box属于每个类别的置信度(假设有c类,包括背景,例如20class的数据集合,c=21)和该box对应的预测边界框的location(包含4个值,即该box的中心坐标和宽高),则每个box需要预测c+4个值。所以对于某个所选的特征层,该层的卷积核个数为(c+4)x 该层的default box个数.最后将每个层得到的卷积结果进行拼接。对于得到的每个预测框,取其类别置信度的最大值,若该最大值大于置信度阈值,则最大值所对应的类别即为该预测框的类别,否则过滤掉此框。对于保留的预测框根据它对应的先验框进行解码得到其真实的位置参数(这里还需注意要防止预测框位置超出图片),然后根据所属类别置信度进行降序排列,取top-k个预测框,最后进行NMS,过滤掉重叠度较大的预测框,最后得到检测结果。 +最后分别在所选的特征层上使用3x3卷积核预测不同default +boxes所属的类别分数及其预测的边界框location。由于对于每个box需要预测该box属于每个类别的置信度(假设有c类,包括背景,例如20class的数据集合,c=21)和该box对应的预测边界框的location( +包含4个值,即该box的中心坐标和宽高),则每个box需要预测c+4个值。所以对于某个所选的特征层,该层的卷积核个数为(c+4)x 该层的default +box个数.最后将每个层得到的卷积结果进行拼接。对于得到的每个预测框,取其类别置信度的最大值,若该最大值大于置信度阈值,则最大值所对应的类别即为该预测框的类别,否则过滤掉此框。对于保留的预测框根据它对应的先验框进行解码得到其真实的位置参数(这里还需注意要防止预测框位置超出图片),然后根据所属类别置信度进行降序排列,取top-k个预测框,最后进行NMS,过滤掉重叠度较大的预测框,最后得到检测结果。 SSD优势是速度比较快,整个过程只需要一步,首先在图片不同位置按照不同尺度和宽高比进行密集抽样,然后利用CNN提取特征后直接进行分类与回归,所以速度比较快,但均匀密集采样会造成正负样本不均衡的情况使得训练比较困难,导致模型准确度有所降低。另外,SSD对小目标的检测没有大目标好,因为随着网络的加深,在高层特征图中小目标的信息丢失掉了,适当增大输入图片的尺寸可以提升小目标的检测效果。 @@ -522,23 +592,27 @@ SSD优势是速度比较快,整个过程只需要一步,首先在图片不 为了解决SSD算法检测小目标困难的问题,DSSD算法将SSD算法基础网络从VGG-16更改为ResNet-101,增强网络特征提取能力,其次参考FPN算法思路利用去Deconvolution结构将图像深层特征从高维空间传递出来,与浅层信息融合,联系不同层级之间的图像语义关系,设计预测模块结构,通过不同层级特征之间融合特征输出预测物体类别信息。 -DSSD算法中有两个特殊的结构:Prediction模块;Deconvolution模块。前者利用提升每个子任务的表现来提高准确性,并且防止梯度直接流入ResNet主网络。后者则增加了三个Batch Normalization层和三个3×3卷积层,其中卷积层起到了缓冲的作用,防止梯度对主网络影响太剧烈,保证网络的稳定性。 +DSSD算法中有两个特殊的结构:Prediction模块;Deconvolution模块。前者利用提升每个子任务的表现来提高准确性,并且防止梯度直接流入ResNet主网络。后者则增加了三个Batch +Normalization层和三个3×3卷积层,其中卷积层起到了缓冲的作用,防止梯度对主网络影响太剧烈,保证网络的稳定性。 SSD和DSSD的网络模型如下图所示: -![](img/ch8/DSSD-01.png) +![](/assets/ch8/DSSD-01.png) **Prediction Module** SSD直接从多个卷积层中单独引出预测函数,预测量多达7000多,梯度计算量也很大。MS-CNN方法指出,改进每个任务的子网可以提高准确性。根据这一思想,DSSD在每一个预测层后增加残差模块,并且对于多种方案进行了对比,如下图所示。结果表明,增加残差预测模块后,高分辨率图片的检测精度比原始SSD提升明显。 -![](img/ch8/DSSD-02.png) +![](/assets/ch8/DSSD-02.png) **Deconvolution模块** -为了整合浅层特征图和deconvolution层的信息,作者引入deconvolution模块,如下图所示。作者受到论文Learning to Refine Object Segments的启发,认为用于精细网络的deconvolution模块的分解结构达到的精度可以和复杂网络一样,并且更有效率。作者对其进行了一定的修改:其一,在每个卷积层后添加批归一化(batch normalization)层;其二,使用基于学习的deconvolution层而不是简单地双线性上采样;其三,作者测试了不同的结合方式,元素求和(element-wise sum)与元素点积(element-wise product)方式,实验证明元素点积计算能得到更好的精度。 +为了整合浅层特征图和deconvolution层的信息,作者引入deconvolution模块,如下图所示。作者受到论文Learning to Refine Object +Segments的启发,认为用于精细网络的deconvolution模块的分解结构达到的精度可以和复杂网络一样,并且更有效率。作者对其进行了一定的修改:其一,在每个卷积层后添加批归一化(batch +normalization)层;其二,使用基于学习的deconvolution层而不是简单地双线性上采样;其三,作者测试了不同的结合方式,元素求和(element-wise +sum)与元素点积(element-wise product)方式,实验证明元素点积计算能得到更好的精度。 -![](img/ch8/DSSD-03.png) +![](/assets/ch8/DSSD-03.png) ### 8.3.3 YOLOv1 @@ -549,42 +623,54 @@ SSD直接从多个卷积层中单独引出预测函数,预测量多达7000多 **YOLOv1介绍** -YOLO(You Only Look Once: Unified, Real-Time Object Detection)是one-stage detection的开山之作。之前的物体检测方法首先需要产生大量可能包含待检测物体的先验框, 然后用分类器判断每个先验框对应的边界框里是否包含待检测物体,以及物体所属类别的概率或者置信度,同时需要后处理修正边界框,最后基于一些准则过滤掉置信度不高和重叠度较高的边界框,进而得到检测结果。这种基于先产生候选区再检测的方法虽然有相对较高的检测准确率,但运行速度较慢。 +YOLO(You Only Look Once: Unified, Real-Time Object Detection)是one-stage detection的开山之作。之前的物体检测方法首先需要产生大量可能包含待检测物体的先验框, +然后用分类器判断每个先验框对应的边界框里是否包含待检测物体,以及物体所属类别的概率或者置信度,同时需要后处理修正边界框,最后基于一些准则过滤掉置信度不高和重叠度较高的边界框,进而得到检测结果。这种基于先产生候选区再检测的方法虽然有相对较高的检测准确率,但运行速度较慢。 -YOLO创造性的将物体检测任务直接当作回归问题(regression problem)来处理,将候选区和检测两个阶段合二为一。只需一眼就能知道每张图像中有哪些物体以及物体的位置。下图展示了各物体检测系统的流程图。 +YOLO创造性的将物体检测任务直接当作回归问题(regression +problem)来处理,将候选区和检测两个阶段合二为一。只需一眼就能知道每张图像中有哪些物体以及物体的位置。下图展示了各物体检测系统的流程图。 -![](img/ch8/YOLOv1-01.png) +![](/assets/ch8/YOLOv1-01.png) 事实上,YOLO也并没有真正的去掉候选区,而是直接将输入图片划分成7x7=49个网格,每个网格预测两个边界框,一共预测49x2=98个边界框。可以近似理解为在输入图片上粗略的选取98个候选区,这98个候选区覆盖了图片的整个区域,进而用回归预测这98个候选框对应的边界框。 **1. 网络结构是怎样的?** -YOLO网络借鉴了GoogLeNet分类网络结构,不同的是YOLO使用1x1卷积层和3x3卷积层替代inception module。如下图所示,整个检测网络包括24个卷积层和2个全连接层。其中,卷积层用来提取图像特征,全连接层用来预测图像位置和类别概率值。 +YOLO网络借鉴了GoogLeNet分类网络结构,不同的是YOLO使用1x1卷积层和3x3卷积层替代inception +module。如下图所示,整个检测网络包括24个卷积层和2个全连接层。其中,卷积层用来提取图像特征,全连接层用来预测图像位置和类别概率值。 -![](img/ch8/YOLOv1-02.png) +![](/assets/ch8/YOLOv1-02.png) **2. YOLO的输入、输出、损失函数分别是什么?** 前面说到YOLO将输入图像分成7x7的网格,最后输出是7x7xk的张量。YOLO网络最后接了两个全连接层,全连接层要求输入是固定大小的,所以YOLO要求输入图像有固定大小,论文中作者设计的输入尺寸是448x448。 -YOLO将输入图像分成7x7的网格,每个网格预测2个边界框。若某物体的ground truth的中心落在该网格,则该网格中与这个ground truth IOU最大的边界框负责预测该物体。对每个边界框会预测5个值,分别是边界框的中心x,y(相对于所属网格的边界),边界框的宽高w,h(相对于原始输入图像的宽高的比例),以及这些边界框的confidencescores(边界框与ground truth box的IOU值)。同时每个网格还需要预测c个类条件概率 (是一个c维向量,表示某个物体object在这个网格中,且该object分别属于各个类别的概率,这里的c类物体不包含背景)。论文中的c=20,则每个网格需要预测2x5+20=30个值,这些值被映射到一个30维的向量。 +YOLO将输入图像分成7x7的网格,每个网格预测2个边界框。若某物体的ground truth的中心落在该网格,则该网格中与这个ground truth +IOU最大的边界框负责预测该物体。对每个边界框会预测5个值,分别是边界框的中心x,y(相对于所属网格的边界),边界框的宽高w,h(相对于原始输入图像的宽高的比例),以及这些边界框的confidencescores(边界框与ground +truth box的IOU值)。同时每个网格还需要预测c个类条件概率 +(是一个c维向量,表示某个物体object在这个网格中,且该object分别属于各个类别的概率,这里的c类物体不包含背景)。论文中的c=20,则每个网格需要预测2x5+20=30个值,这些值被映射到一个30维的向量。 为了让边界框坐标损失、分类损失达到很好的平衡,损失函数设计如下图所示。 -![](img/ch8/YOLOv1-03.png) +![](/assets/ch8/YOLOv1-03.png) 如上图所示,损失函数分为坐标预测(蓝色框)、含有物体的边界框的confidence预测(红色框)、不含有物体的边界框的confidence预测(黄色框)、分类预测(紫色框)四个部分。 -由于不同大小的边界框对预测偏差的敏感度不同,小的边界框对预测偏差的敏感度更大。为了均衡不同尺寸边界框对预测偏差的敏感度的差异。作者巧妙的对边界框的w,h取均值再求L2 loss. YOLO中更重视坐标预测,赋予坐标损失更大的权重,记为 coord,在pascal voc训练中coodd=5 ,classification error部分的权重取1。 +由于不同大小的边界框对预测偏差的敏感度不同,小的边界框对预测偏差的敏感度更大。为了均衡不同尺寸边界框对预测偏差的敏感度的差异。作者巧妙的对边界框的w,h取均值再求L2 +loss. YOLO中更重视坐标预测,赋予坐标损失更大的权重,记为 coord,在pascal voc训练中coodd=5 ,classification error部分的权重取1。 -某边界框的置信度定义为:某边界框的confidence = 该边界框存在某类对象的概率pr(object)*该边界框与该对象的ground truth的IOU值 ,若该边界框存在某个对象pr(object)=1 ,否则pr(object)=0 。由于一幅图中大部分网格中是没有物体的,这些网格中的边界框的confidence置为0,相比于有物体的网格,这些不包含物体的网格更多,对梯度更新的贡献更大,会导致网络不稳定。为了平衡上述问题,YOLO损失函数中对没有物体的边界框的confidence error赋予较小的权重,记为 noobj,对有物体的边界框的confidence error赋予较大的权重。在pascal VOC训练中noobj=0.5 ,有物体的边界框的confidence error的权重设为1. +某边界框的置信度定义为:某边界框的confidence = 该边界框存在某类对象的概率pr(object)*该边界框与该对象的ground truth的IOU值 +,若该边界框存在某个对象pr(object)=1 ,否则pr(object)=0 +。由于一幅图中大部分网格中是没有物体的,这些网格中的边界框的confidence置为0,相比于有物体的网格,这些不包含物体的网格更多,对梯度更新的贡献更大,会导致网络不稳定。为了平衡上述问题,YOLO损失函数中对没有物体的边界框的confidence +error赋予较小的权重,记为 noobj,对有物体的边界框的confidence error赋予较大的权重。在pascal VOC训练中noobj=0.5 +,有物体的边界框的confidence error的权重设为1. **3. YOLO怎样预测?** YOLO最后采用非极大值抑制(NMS)算法从输出结果中提取最有可能的对象和其对应的边界框。 -输入一张图片到YOLO网络将输出一个7*7*30的张量表示图片中每个网格对应的可能的两个边界框以及每个边界框的置信度和包含的对象属于各个类别的概率。由此可以计算某对象i属于类别 同时在第j个边界框中的得分: +输入一张图片到YOLO网络将输出一个7*7*30的张量表示图片中每个网格对应的可能的两个边界框以及每个边界框的置信度和包含的对象属于各个类别的概率。由此可以计算某对象i属于类别 +同时在第j个边界框中的得分: -![](img/ch8/YOLOv1-04.png) +![](/assets/ch8/YOLOv1-04.png) 每个网格有20个类条件概率,2个边界框置信度,相当于每个网格有40个得分,7x7个网格有1960个得分,每类对象有1960/20=98个得分,即98个候选框。 @@ -604,11 +690,12 @@ YOLO最后采用非极大值抑制(NMS)算法从输出结果中提取最有 3.返回步骤2继续处理下一类对象。 -YOLO将识别与定位合二为一,结构简便,检测速度快,更快的Fast YOLO可以达到155FPS。相对于R-CNN系列, YOLO的整个流程中都能看到整张图像的信息,因此它在检测物体时能很好的利用上下文信息,从而不容易在背景上预测出错误的物体信息。同时YOLO可以学习到高度泛化的特征,能将一个域上学到的特征迁移到不同但相关的域上,如在自然图像上做训练的YOLO,在艺术图片上可以得到较好的测试结果。 +YOLO将识别与定位合二为一,结构简便,检测速度快,更快的Fast YOLO可以达到155FPS。相对于R-CNN系列, +YOLO的整个流程中都能看到整张图像的信息,因此它在检测物体时能很好的利用上下文信息,从而不容易在背景上预测出错误的物体信息。同时YOLO可以学习到高度泛化的特征,能将一个域上学到的特征迁移到不同但相关的域上,如在自然图像上做训练的YOLO,在艺术图片上可以得到较好的测试结果。 由于YOLO网格设置比较稀疏,且每个网格只预测2个边界框,其总体预测精度不高,略低于Fast RCNN。其对小物体的检测效果较差,尤其是对密集的小物体表现比较差。 -### 8.3.4 YOLOv2 +### 8.3.4 YOLOv2 **YOLOv2 有哪些创新点?** @@ -618,13 +705,14 @@ YOLOv1虽然检测速度快,但在定位方面不够准确,并且召回率 2. New Network:Darknet-19 3. 加入anchor -![](img/ch8/YOLOv2-01.png) +![](/assets/ch8/YOLOv2-01.png) **YOLOv2 介绍** **(1)Batch Normalization** -YOLOv2中在每个卷积层后加Batch Normalization(BN)层,去掉dropout. BN层可以起到一定的正则化效果,能提升模型收敛速度,防止模型过拟合。YOLOv2通过使用BN层使得mAP提高了2%。 +YOLOv2中在每个卷积层后加Batch Normalization(BN)层,去掉dropout. +BN层可以起到一定的正则化效果,能提升模型收敛速度,防止模型过拟合。YOLOv2通过使用BN层使得mAP提高了2%。 **(2)High Resolution Classifier** 目前的大部分检测模型都会使用主流分类网络(如vgg、resnet)在ImageNet上的预训练模型作为特征提取器, @@ -632,46 +720,62 @@ YOLOv2中在每个卷积层后加Batch Normalization(BN)层,去掉dropout. BN **(3)Convolutional With Anchor Boxes** -YOLOv1利用全连接层直接对边界框进行预测,导致丢失较多空间信息,定位不准。YOLOv2去掉了YOLOv1中的全连接层,使用Anchor Boxes预测边界框,同时为了得到更高分辨率的特征图,YOLOv2还去掉了一个池化层。由于图片中的物体都倾向于出现在图片的中心位置,若特征图恰好有一个中心位置,利用这个中心位置预测中心点落入该位置的物体,对这些物体的检测会更容易。所以总希望得到的特征图的宽高都为奇数。YOLOv2通过缩减网络,使用416x416的输入,模型下采样的总步长为32,最后得到13x13的特征图,然后对13x13的特征图的每个cell预测5个anchor boxes,对每个anchor box预测边界框的位置信息、置信度和一套分类概率值。使用anchor +YOLOv1利用全连接层直接对边界框进行预测,导致丢失较多空间信息,定位不准。YOLOv2去掉了YOLOv1中的全连接层,使用Anchor +Boxes预测边界框,同时为了得到更高分辨率的特征图,YOLOv2还去掉了一个池化层。由于图片中的物体都倾向于出现在图片的中心位置,若特征图恰好有一个中心位置,利用这个中心位置预测中心点落入该位置的物体,对这些物体的检测会更容易。所以总希望得到的特征图的宽高都为奇数。YOLOv2通过缩减网络,使用416x416的输入,模型下采样的总步长为32,最后得到13x13的特征图,然后对13x13的特征图的每个cell预测5个anchor +boxes,对每个anchor box预测边界框的位置信息、置信度和一套分类概率值。使用anchor boxes之后,YOLOv2可以预测13x13x5=845个边界框,模型的召回率由原来的81%提升到88%,mAP由原来的69.5%降低到69.2%.召回率提升了7%,准确率下降了0.3%。 **(4)Dimension Clusters** -在Faster R-CNN和SSD中,先验框都是手动设定的,带有一定的主观性。YOLOv2采用k-means聚类算法对训练集中的边界框做了聚类分析,选用boxes之间的IOU值作为聚类指标。综合考虑模型复杂度和召回率,最终选择5个聚类中心,得到5个先验框,发现其中中扁长的框较少,而瘦高的框更多,更符合行人特征。通过对比实验,发现用聚类分析得到的先验框比手动选择的先验框有更高的平均IOU值,这使得模型更容易训练学习。 +在Faster +R-CNN和SSD中,先验框都是手动设定的,带有一定的主观性。YOLOv2采用k-means聚类算法对训练集中的边界框做了聚类分析,选用boxes之间的IOU值作为聚类指标。综合考虑模型复杂度和召回率,最终选择5个聚类中心,得到5个先验框,发现其中中扁长的框较少,而瘦高的框更多,更符合行人特征。通过对比实验,发现用聚类分析得到的先验框比手动选择的先验框有更高的平均IOU值,这使得模型更容易训练学习。 **(5)New Network:Darknet-19** -YOLOv2采用Darknet-19,其网络结构如下图所示,包括19个卷积层和5个max pooling层,主要采用3x3卷积和1x1卷积,这里1x1卷积可以压缩特征图通道数以降低模型计算量和参数,每个卷积层后使用BN层以加快模型收敛同时防止过拟合。最终采用global avg pool 做预测。采用YOLOv2,模型的mAP值没有显著提升,但计算量减少了。 +YOLOv2采用Darknet-19,其网络结构如下图所示,包括19个卷积层和5个max +pooling层,主要采用3x3卷积和1x1卷积,这里1x1卷积可以压缩特征图通道数以降低模型计算量和参数,每个卷积层后使用BN层以加快模型收敛同时防止过拟合。最终采用global +avg pool 做预测。采用YOLOv2,模型的mAP值没有显著提升,但计算量减少了。 -![](img/ch8/YOLOv2-02.png) +![](/assets/ch8/YOLOv2-02.png) **(6)Direct location prediction** -Faster R-CNN使用anchor boxes预测边界框相对先验框的偏移量,由于没有对偏移量进行约束,每个位置预测的边界框可以落在图片任何位置,会导致模型不稳定,加长训练时间。YOLOv2沿用YOLOv1的方法,根据所在网格单元的位置来预测坐标,则Ground Truth的值介于0到1之间。网络中将得到的网络预测结果再输入sigmoid函数中,让输出结果介于0到1之间。设一个网格相对于图片左上角的偏移量是cx,cy。先验框的宽度和高度分别是pw和ph,则预测的边界框相对于特征图的中心坐标(bx,by)和宽高bw、bh的计算公式如下图所示。 +Faster R-CNN使用anchor +boxes预测边界框相对先验框的偏移量,由于没有对偏移量进行约束,每个位置预测的边界框可以落在图片任何位置,会导致模型不稳定,加长训练时间。YOLOv2沿用YOLOv1的方法,根据所在网格单元的位置来预测坐标,则Ground +Truth的值介于0到1之间。网络中将得到的网络预测结果再输入sigmoid函数中,让输出结果介于0到1之间。设一个网格相对于图片左上角的偏移量是cx,cy。先验框的宽度和高度分别是pw和ph,则预测的边界框相对于特征图的中心坐标( +bx,by)和宽高bw、bh的计算公式如下图所示。 -![](img/ch8/YOLOv2-03.png) +![](/assets/ch8/YOLOv2-03.png) YOLOv2结合Dimention Clusters, 通过对边界框的位置预测进行约束,使模型更容易稳定训练,这种方式使得模型的mAP值提升了约5%。 **(7)Fine-Grained Features** -YOLOv2借鉴SSD使用多尺度的特征图做检测,提出pass through层将高分辨率的特征图与低分辨率的特征图联系在一起,从而实现多尺度检测。YOLOv2提取Darknet-19最后一个max pool层的输入,得到26x26x512的特征图。经过1x1x64的卷积以降低特征图的维度,得到26x26x64的特征图,然后经过pass through层的处理变成13x13x256的特征图(抽取原特征图每个2x2的局部区域组成新的channel,即原特征图大小降低4倍,channel增加4倍),再与13x13x1024大小的特征图连接,变成13x13x1280的特征图,最后在这些特征图上做预测。使用Fine-Grained Features,YOLOv2的性能提升了1%. +YOLOv2借鉴SSD使用多尺度的特征图做检测,提出pass through层将高分辨率的特征图与低分辨率的特征图联系在一起,从而实现多尺度检测。YOLOv2提取Darknet-19最后一个max +pool层的输入,得到26x26x512的特征图。经过1x1x64的卷积以降低特征图的维度,得到26x26x64的特征图,然后经过pass +through层的处理变成13x13x256的特征图(抽取原特征图每个2x2的局部区域组成新的channel,即原特征图大小降低4倍,channel增加4倍),再与13x13x1024大小的特征图连接,变成13x13x1280的特征图,最后在这些特征图上做预测。使用Fine-Grained +Features,YOLOv2的性能提升了1%. **(8)Multi-Scale Training** -YOLOv2中使用的Darknet-19网络结构中只有卷积层和池化层,所以其对输入图片的大小没有限制。YOLOv2采用多尺度输入的方式训练,在训练过程中每隔10个batches,重新随机选择输入图片的尺寸,由于Darknet-19下采样总步长为32,输入图片的尺寸一般选择32的倍数{320,352,…,608}。采用Multi-Scale Training, 可以适应不同大小的图片输入,当采用低分辨率的图片输入时,mAP值略有下降,但速度更快,当采用高分辨率的图片输入时,能得到较高mAP值,但速度有所下降。 +YOLOv2中使用的Darknet-19网络结构中只有卷积层和池化层,所以其对输入图片的大小没有限制。YOLOv2采用多尺度输入的方式训练,在训练过程中每隔10个batches,重新随机选择输入图片的尺寸,由于Darknet-19下采样总步长为32,输入图片的尺寸一般选择32的倍数{320,352,…,608}。采用Multi-Scale +Training, 可以适应不同大小的图片输入,当采用低分辨率的图片输入时,mAP值略有下降,但速度更快,当采用高分辨率的图片输入时,能得到较高mAP值,但速度有所下降。 -YOLOv2借鉴了很多其它目标检测方法的一些技巧,如Faster R-CNN的anchor boxes, SSD中的多尺度检测。除此之外,YOLOv2在网络设计上做了很多tricks,使它能在保证速度的同时提高检测准确率,Multi-Scale Training更使得同一个模型适应不同大小的输入,从而可以在速度和精度上进行自由权衡。 +YOLOv2借鉴了很多其它目标检测方法的一些技巧,如Faster R-CNN的anchor boxes, +SSD中的多尺度检测。除此之外,YOLOv2在网络设计上做了很多tricks,使它能在保证速度的同时提高检测准确率,Multi-Scale +Training更使得同一个模型适应不同大小的输入,从而可以在速度和精度上进行自由权衡。 **YOLOv2的训练** YOLOv2的训练主要包括三个阶段。 第一阶段:先在ImageNet分类数据集上预训练Darknet-19,此时模型输入为$224\times 224$,共训练160个epochs。 -第二阶段:将网络的输入调整为$448\times 448$,继续在ImageNet数据集上finetune分类模型,训练10个epochs,此时分类模型的top-1准确度为76.5%,而top-5准确度为93.3%。 +第二阶段:将网络的输入调整为$448\times +448$,继续在ImageNet数据集上finetune分类模型,训练10个epochs,此时分类模型的top-1准确度为76.5%,而top-5准确度为93.3%。 第三个阶段:修改Darknet-19分类模型为检测模型,并在检测数据集上继续finetune网络。 -网络修改包括(网路结构可视化):移除最后一个卷积层、global avgpooling层以及softmax层,并且新增了三个$3\times 3 \times 2014$卷积层,同时增加了一个passthrough层,最后使用$1\times 1$卷积层输出预测结果。 +网络修改包括(网路结构可视化):移除最后一个卷积层、global avgpooling层以及softmax层,并且新增了三个$3\times 3 \times +2014$卷积层,同时增加了一个passthrough层,最后使用$1\times 1$卷积层输出预测结果。 -### 8.3.5 YOLO9000 +### 8.3.5 YOLO9000 github:http://pjreddie.com/yolo9000/ @@ -685,12 +789,13 @@ WordTree的生成方式如下: ①首先遍历ImageNet中的类别名词。 -②对每个名词,在WordNet(一种结构化概念及概念之间关系的语言数据库)上找到从它所在位置到根节点(设根节点为实体对象physical object)的最短路径,由于在WordNet中大多数同义词只有一个路径,所以先把将该路径上的词全都加到树中。 +②对每个名词,在WordNet(一种结构化概念及概念之间关系的语言数据库)上找到从它所在位置到根节点(设根节点为实体对象physical +object)的最短路径,由于在WordNet中大多数同义词只有一个路径,所以先把将该路径上的词全都加到树中。 ③迭代地检查剩下的名词,取它到根节点的最短路径,将该最短路径上的还没出现在层次树中的词加入到树中。 混合后的数据集形成一个有9418类的WordTree.生成的WordTree模型如下图所示。另外考虑到COCO数据集相对于ImageNet数据集数据量太少了,为了平衡两个数据集,作者进一步对COCO数据集过采样,使COCO数据集与ImageNet数据集的数据量比例接近1:4。 -![](img/ch8/YOLOv2-04.png) +![](/assets/ch8/YOLOv2-04.png) 对于物体的标签,采用one-hot编码的形式,数据集中的每个物体的类别标签被组织成1个长度为9418的向量,向量中除在WordTree中从该物体对应的名词到根节点的路径上出现的词对应的类别标号处为1,其余位置为0。 @@ -704,7 +809,7 @@ WordTree中每个节点的子节点都属于同一个子类,分层次的对每 YOLO9000使用WordTree混合目标检测数据集和分类数据集,并在其上进行联合训练,使之能实时检测出超过9000个类别的物体,其强大令人赞叹不已。YOLO9000尤其对动物的识别效果很好,但是对衣服或者设备等类别的识别效果不是很好,可能的原因是与目标检测数据集中的数据偏向有关。 -### 8.3.6 YOLOv3 +### 8.3.6 YOLOv3 YOLOv3总结了自己在YOLOv2的基础上做的一些尝试性改进,有的尝试取得了成功,而有的尝试并没有提升模型性能。其中有两个值得一提的亮点,一个是使用残差模型,进一步加深了网络结构;另一个是使用FPN架构实现多尺度检测。 @@ -716,21 +821,26 @@ YOLOv3总结了自己在YOLOv2的基础上做的一些尝试性改进,有的 **1. YOLOv3对网络结构做了哪些改进?** -YOLOv3在之前Darknet-19的基础上引入了残差块,并进一步加深了网络,改进后的网络有53个卷积层,取名为Darknet-53,网络结构如下图所示(以256*256的输入为例)。 +YOLOv3在之前Darknet-19的基础上引入了残差块,并进一步加深了网络,改进后的网络有53个卷积层,取名为Darknet-53,网络结构如下图所示(以256* +256的输入为例)。 -![](img/ch8/YOLOv3-01.png) +![](/assets/ch8/YOLOv3-01.png) 为了比较Darknet-53与其它网络结构的性能,作者在TitanX上,采用相同的实验设置,将256x256的图片分别输入以Darknet-19,ResNet-101,ResNet-152和Darknet-53为基础网络的分类模型中,实验得到的结果如下图所示。可以看到Darknet-53比ResNet-101的性能更好,而且速度是其1.5倍,Darknet-53与ResNet-152性能相似但速度几乎是其2倍。注意到,Darknet-53相比于其它网络结构实现了每秒最高的浮点计算量,说明其网络结构能更好的利用GPU。 -![](img/ch8/YOLOv3-02.png) +![](/assets/ch8/YOLOv3-02.png) **2.YOLOv3中怎样实现多尺度检测?** -YOLOv3借鉴了FPN的思想,从不同尺度提取特征。相比YOLOv2,YOLOv3提取最后3层特征图,不仅在每个特征图上分别独立做预测,同时通过将小特征图上采样到与大的特征图相同大小,然后与大的特征图拼接做进一步预测。用维度聚类的思想聚类出9种尺度的anchor box,将9种尺度的anchor box均匀的分配给3种尺度的特征图.如下图是在网络结构图的基础上加上多尺度特征提取部分的示意图(以在COCO数据集(80类)上256x256的输入为例): +YOLOv3借鉴了FPN的思想,从不同尺度提取特征。相比YOLOv2,YOLOv3提取最后3层特征图,不仅在每个特征图上分别独立做预测,同时通过将小特征图上采样到与大的特征图相同大小,然后与大的特征图拼接做进一步预测。用维度聚类的思想聚类出9种尺度的anchor +box,将9种尺度的anchor +box均匀的分配给3种尺度的特征图.如下图是在网络结构图的基础上加上多尺度特征提取部分的示意图(以在COCO数据集(80类) +上256x256的输入为例): -![](img/ch8/YOLOv3-03.png) +![](/assets/ch8/YOLOv3-03.png) -从YOLOv1到YOLOv2再到YOLO9000、YOLOv3, YOLO经历三代变革,在保持速度优势的同时,不断改进网络结构,同时汲取其它优秀的目标检测算法的各种trick,先后引入anchor box机制、引入FPN实现多尺度检测等。 +从YOLOv1到YOLOv2再到YOLO9000、YOLOv3, YOLO经历三代变革,在保持速度优势的同时,不断改进网络结构,同时汲取其它优秀的目标检测算法的各种trick,先后引入anchor +box机制、引入FPN实现多尺度检测等。 ### 8.3.7 RetinaNet @@ -739,17 +849,21 @@ YOLOv3借鉴了FPN的思想,从不同尺度提取特征。相比YOLOv2,YOLOv - Two-Stage检测器(如Faster R-CNN、FPN)效果好,但速度相对慢 - One-Stage检测器(如YOLO、SSD)速度快,但效果一般 -![](img/ch8/RetinaNet-01.png) +![](/assets/ch8/RetinaNet-01.png) 作者对one-stage检测器准确率不高的问题进行探究,发现主要问题在于正负类别不均衡(简单-难分类别不均衡)。 -> We discover that the extreme foreground-background class imbalance encountered during training of dense detectors is the central cause. +> We discover that the extreme foreground-background class imbalance encountered during training of dense detectors is +> the central cause. 作者建议通过重新设计标准的交叉熵损失(cross entropy loss)来解决这种类别不平衡(class inbalance)问题,即提出Focal Loss。 -> We propose to address this class imbalance by reshaping the standard cross entropy loss such that it down-weights the loss assigned to well-classified examples. Our novel Focal Loss focuses training on a sparse set of hard examples and prevents the vast number of easy negatives from overwhelming the detector during training. +> We propose to address this class imbalance by reshaping the standard cross entropy loss such that it down-weights the +> loss assigned to well-classified examples. Our novel Focal Loss focuses training on a sparse set of hard examples and +> prevents the vast number of easy negatives from overwhelming the detector during training. -结合Focal Loss的one-stage检测器称为RetinaNet,该检测器在COCO上mAP可以和特征金字塔网络(feature pyramid network,FPN)或者Mask R-CNN接近, +结合Focal Loss的one-stage检测器称为RetinaNet,该检测器在COCO上mAP可以和特征金字塔网络(feature pyramid network,FPN)或者Mask +R-CNN接近, **问:什么是类别不均衡(class imbalance)?** @@ -759,13 +873,16 @@ YOLOv3借鉴了FPN的思想,从不同尺度提取特征。相比YOLOv2,YOLOv 答:由于大多数都是简单易分的负样本(属于背景的样本),使得训练过程不能充分学习到属于那些有类别样本的信息;其次简单易分的负样本太多,可能掩盖了其他有类别样本的作用(这些简单易分的负样本仍产生一定幅度的loss,见下图蓝色曲线,数量多会对loss起主要贡献作用,因此就主导了梯度的更新方向,掩盖了重要的信息) -> This imbalance causes two problems: (1) training is inefficient as most locations are easy negatives that contribute no useful learning signal; (2) en masse, the easy negatives can overwhelm training and lead to degenerate models. +> This imbalance causes two problems: (1) training is inefficient as most locations are easy negatives that contribute +> no useful learning signal; (2) en masse, the easy negatives can overwhelm training and lead to degenerate models. -简单来说,因为bbox数量爆炸。 正是因为bbox中属于background的bbox太多了,所以如果分类器无脑地把所有bbox统一归类为background,accuracy也可以刷得很高。于是乎,分类器的训练就失败了。分类器训练失败,检测精度自然就低了。 +简单来说,因为bbox数量爆炸。 +正是因为bbox中属于background的bbox太多了,所以如果分类器无脑地把所有bbox统一归类为background,accuracy也可以刷得很高。于是乎,分类器的训练就失败了。分类器训练失败,检测精度自然就低了。 **问:为什么在two-stage检测器中,没有出现类别不均衡(class imbalamce)问题呢?** -答:因为通过RPN阶段可以减少候选目标区域,而在分类阶段,可以固定前景与背景比值(foreground-to-background ratio)为1:3,或者使用OHEM(online hard example mining)使得前景和背景的数量达到均衡。 +答:因为通过RPN阶段可以减少候选目标区域,而在分类阶段,可以固定前景与背景比值(foreground-to-background ratio)为1: +3,或者使用OHEM(online hard example mining)使得前景和背景的数量达到均衡。 **RetinaNet有哪些创新点?** @@ -781,13 +898,13 @@ $$ Focal Loss更加聚焦在困难样本(hard examples)上的训练。 -![](img/ch8/RetinaNet-02.png) +![](/assets/ch8/RetinaNet-02.png) 将Focal Loss与ResNet-101-FPN backbone结合提出RetinaNet(one-stage检测器),RetinaNet在COCO test-dev上达到39.1mAP,速度为5FPS。 RetinaNet检测器与当时最佳的其它检测器进行比较,无论是速度上还是准确率上都是最佳: -![](img/ch8/RetinaNet-03.png) +![](/assets/ch8/RetinaNet-03.png) **详解:** @@ -799,13 +916,13 @@ RetinaNet检测器与当时最佳的其它检测器进行比较,无论是速 首先是我们常使用的交叉熵损失函数: -![](img/ch8/RetinaNet-04.png) +![](/assets/ch8/RetinaNet-04.png) 上式中,y=+1或者y=-1。p∈[0,1]是y=+1的估计概率。作者定义pt为: -![](img/ch8/RetinaNet-05.png) +![](/assets/ch8/RetinaNet-05.png) -![](img/ch8/RetinaNet-06.png) +![](/assets/ch8/RetinaNet-06.png) 注:对交叉熵函数不了解的,可以参考[理解交叉熵作为损失函数在神经网络中的作用](https://blog.csdn.net/chaipp0607/article/details/73392175) @@ -813,11 +930,12 @@ RetinaNet检测器与当时最佳的其它检测器进行比较,无论是速 要对类别不均衡问题对loss的贡献进行一个控制,即加上一个控制权重即可,最初作者的想法即如下这样,对于属于少数类别的样本,增大α即可 -![](img/ch8/RetinaNet-07.png) +![](/assets/ch8/RetinaNet-07.png) 但这样有一个问题,它仅仅解决了正负样本之间的平衡问题,并没有区分易分/难分样本,按作者的话说: -> While α balances the importance of positive/negative examples, it does not differentiate between easy/hard examples. Instead, we propose to reshape the loss function to down-weight easy examples and thus focus training on hard negatives. +> While α balances the importance of positive/negative examples, it does not differentiate between easy/hard examples. +> Instead, we propose to reshape the loss function to down-weight easy examples and thus focus training on hard negatives. 问:为什么公式(3)只解决正负样本不均衡问题? @@ -829,9 +947,10 @@ RetinaNet检测器与当时最佳的其它检测器进行比较,无论是速 $$ (1-pt)^γ(1−pt)γ $$ -![](img/ch8/RetinaNet-08.png) +![](/assets/ch8/RetinaNet-08.png) -显然,样本越易分,pt就越大(pt—>1),modulating factor趋近于0,则贡献的loss就越小,同样地,样本越难分,其pt就越小,modulating factor接近于1,则贡献的loss不受影响。 +显然,样本越易分,pt就越大(pt—>1),modulating factor趋近于0,则贡献的loss就越小,同样地,样本越难分,其pt就越小,modulating +factor接近于1,则贡献的loss不受影响。 问:为什么pt越大,FL值越小? @@ -843,21 +962,24 @@ $$ 举原文中的一个例子,当pt=0.9时,带有modulating factor的focal loss是CE loss的100分之一,即进一步减小了正确分类的损失。 -> For instance, with γ = 2, an example classified with pt = 0.9 would have 100× lower loss compared with CE and with pt ≈ 0.968 it would have 1000× lower loss. This in turn increases the importance of correcting misclassified examples (whose loss is scaled down by at most 4× for pt ≤ .5 and γ = 2). +> For instance, with γ = 2, an example classified with pt = 0.9 would have 100× lower loss compared with CE and with +> pt ≈ 0.968 it would have 1000× lower loss. This in turn increases the importance of correcting misclassified examples ( +> whose loss is scaled down by at most 4× for pt ≤ .5 and γ = 2). 在实际中,作者采用如下公式,即综合了公式(3)和公式(4)的形式,这样机能调整正负样本的权重,又能控制难易分类样本的权重: -![](img/ch8/RetinaNet-09.png) +![](/assets/ch8/RetinaNet-09.png) 这里的两个参数 α和γ 来控制,在实验中a的选择范围也很广,一般而言当γ增加的时候,a需要减小一点,本文作者采用α=0.25,γ=2效果最好。 **RetinaNet Detector** -RetinaNet是由backbone网络和两个特殊任务的子网络(subnet)组成(属于one-stage检测器)。Backbone用来计算feature map;第一个子网络用来object classification,第二个子网络用来bounding box regression。 +RetinaNet是由backbone网络和两个特殊任务的子网络(subnet)组成(属于one-stage检测器)。Backbone用来计算feature +map;第一个子网络用来object classification,第二个子网络用来bounding box regression。 **Feature Pyramid Network Backbone** -![](img/ch8/RetinaNet-10.png) +![](/assets/ch8/RetinaNet-10.png) **Anchor** @@ -865,9 +987,9 @@ RetinaNet是由backbone网络和两个特殊任务的子网络(subnet)组成 **Box Regression Subnet** -![](img/ch8/RetinaNet-11.png) +![](/assets/ch8/RetinaNet-11.png) -![](img/ch8/RetinaNet-12.png) +![](/assets/ch8/RetinaNet-12.png) RetinaNet结构注意内容: @@ -880,11 +1002,15 @@ RetinaNet结构注意内容: **实验结果** -Table1是关于RetinaNet和Focal Loss的一些实验结果。(a)是在交叉熵的基础上加上参数a,a=0.5就表示传统的交叉熵,可以看出当a=0.75的时候效果最好,AP值提升了0.9。(b)是对比不同的参数γ和a的实验结果,可以看出随着γ的增加,AP提升比较明显。(d)通过和OHEM的对比可以看出最好的Focal Loss比最好的OHEM提高了3.2AP。这里OHEM1:3表示在通过OHEM得到的minibatch上强制positive和negative样本的比例为1:3,通过对比可以看出这种强制的操作并没有提升AP。(e)加入了运算时间的对比,可以和前面的Figure2结合起来看,速度方面也有优势!注意这里RetinaNet-101-800的AP是37.8,当把训练时间扩大1.5倍同时采用scale jitter,AP可以提高到39.1,这就是全文和table2中的最高的39.1AP的由来。 +Table1是关于RetinaNet和Focal +Loss的一些实验结果。(a)是在交叉熵的基础上加上参数a,a=0.5就表示传统的交叉熵,可以看出当a=0.75的时候效果最好,AP值提升了0.9。(b)是对比不同的参数γ和a的实验结果,可以看出随着γ的增加,AP提升比较明显。(d)通过和OHEM的对比可以看出最好的Focal +Loss比最好的OHEM提高了3.2AP。这里OHEM1:3表示在通过OHEM得到的minibatch上强制positive和negative样本的比例为1: +3,通过对比可以看出这种强制的操作并没有提升AP。(e)加入了运算时间的对比,可以和前面的Figure2结合起来看,速度方面也有优势!注意这里RetinaNet-101-800的AP是37.8,当把训练时间扩大1.5倍同时采用scale +jitter,AP可以提高到39.1,这就是全文和table2中的最高的39.1AP的由来。 -![](img/ch8/RetinaNet-13.png) +![](/assets/ch8/RetinaNet-13.png) -![](img/ch8/RetinaNet-14.png) +![](/assets/ch8/RetinaNet-14.png) ### 8.3.8 RFBNet @@ -892,26 +1018,31 @@ Table1是关于RetinaNet和Focal Loss的一些实验结果。(a)是在交叉 1. 提出RF block(RFB)模块 -RFBNet主要想利用一些技巧使得轻量级模型在速度和精度上达到很好的trade-off的检测器。灵感来自人类视觉的感受野结构Receptive Fields (RFs) ,提出了新奇的RF block(RFB)模块,来验证感受野尺寸和方向性的对提高有鉴别鲁棒特征的关系。RFBNet是以主干网络(backbone)为VGG16的SSD来构建的,主要是在Inception的基础上加入了dilated卷积层(dilated convolution),从而有效增大了感受野(receptive field)。整体上因为是基于SSD网络进行改进,所以检测速度还是比较快,同时精度也有一定的保证。 +RFBNet主要想利用一些技巧使得轻量级模型在速度和精度上达到很好的trade-off的检测器。灵感来自人类视觉的感受野结构Receptive +Fields (RFs) ,提出了新奇的RF +block(RFB)模块,来验证感受野尺寸和方向性的对提高有鉴别鲁棒特征的关系。RFBNet是以主干网络(backbone)为VGG16的SSD来构建的,主要是在Inception的基础上加入了dilated卷积层(dilated +convolution),从而有效增大了感受野(receptive field)。整体上因为是基于SSD网络进行改进,所以检测速度还是比较快,同时精度也有一定的保证。 **RFB介绍** RFB是一个类似Inception模块的多分支卷积模块,它的内部结构可分为两个组件:多分支卷积层和dilated卷积层。如下图: -![](img/ch8/RFBNet-01.png) +![](/assets/ch8/RFBNet-01.png) **1.多分支卷积层** -​ 根据RF的定义,用多种尺寸的卷积核来实现比固定尺寸更好。具体设计:1.瓶颈结构,1x1-s2卷积减少通道特征,然后加上一个nxn卷积。2.替换5x5卷积为两个3x3卷积去减少参数,然后是更深的非线性层。有些例子,使用1xn和nx1代替nxn卷积;shortcut直连设计来自于ResNet和Inception ResNet V2。3.为了输出,卷积经常有stride=2或者是减少通道,所以直连层用一个不带非线性激活的1x1卷积层。 +​ +根据RF的定义,用多种尺寸的卷积核来实现比固定尺寸更好。具体设计:1.瓶颈结构,1x1-s2卷积减少通道特征,然后加上一个nxn卷积。2.替换5x5卷积为两个3x3卷积去减少参数,然后是更深的非线性层。有些例子,使用1xn和nx1代替nxn卷积;shortcut直连设计来自于ResNet和Inception +ResNet V2。3.为了输出,卷积经常有stride=2或者是减少通道,所以直连层用一个不带非线性激活的1x1卷积层。 **2.Dilated 卷积层** -设计灵感来自Deeplab,在保持参数量和同样感受野的情况下,用来获取更高分辨率的特征。下图展示两种RFB结构:RFB和RFB-s。每个分支都是一个正常卷积后面加一个dilated卷积,主要是尺寸和dilated因子不同。(a)RFB。整体结构上借鉴了Inception的思想,主要不同点在于引入3个dilated卷积层(比如3x3conv,rate=1),这也是RFBNet增大感受野的主要方式之一;(b)RFB-s。RFB-s和RFB相比主要有两个改进,一方面用3x3卷积层代替5x5卷积层,另一方面用1x3和3x1卷积层代替3x3卷积层,主要目的应该是为了减少计算量,类似Inception后期版本对Inception结构的改进。 +设计灵感来自Deeplab,在保持参数量和同样感受野的情况下,用来获取更高分辨率的特征。下图展示两种RFB结构:RFB和RFB-s。每个分支都是一个正常卷积后面加一个dilated卷积,主要是尺寸和dilated因子不同。(a)RFB。整体结构上借鉴了Inception的思想,主要不同点在于引入3个dilated卷积层(比如3x3conv,rate=1),这也是RFBNet增大感受野的主要方式之一;(b)RFB-s。RFB-s和RFB相比主要有两个改进,一方面用3x3卷积层代替5x5卷积层,另一方面用1x3和3x1卷积层代替3x3卷积层,主要目的应该是为了减少计算量,类似Inception后期版本对Inception结构的改进。 -![](img/ch8/RFBNet-02.png) +![](/assets/ch8/RFBNet-02.png) -RFBNet300的整体结构如下图所示,基本上和SSD类似。RFBNet和SSD不同的是:1、主干网上用两个RFB结构替换原来新增的两层。2、conv4_3和conv7_fc在接预测层之前分别接RFB-s和RFB结构。 +RFBNet300的整体结构如下图所示,基本上和SSD类似。RFBNet和SSD不同的是:1、主干网上用两个RFB结构替换原来新增的两层。2、conv4_3和conv7_fc在接预测层之前分别接RFB-s和RFB结构。 -![](img/ch8/RFBNet-03.png) +![](/assets/ch8/RFBNet-03.png) ### 8.3.9 M2Det @@ -919,27 +1050,31 @@ RFBNet300的整体结构如下图所示,基本上和SSD类似。RFBNet和SSD 1. 提出了多层次特征金字塔网络(MLFPN)来构建更有效的特征金字塔,用于检测不同尺度的对象。 -M2Det的整体架构如下所示。M2Det使用backbone和多级特征金字塔网络(MLFPN)从输入图像中提取特征,然后类似于SSD,根据学习的特征生成密集的边界框和类别分数,最后是非最大抑制(NMS)操作以产生最终结果。 MLFPN由三个模块组成:特征融合模块(FFM),简化的U形模块(TUM)和按基于尺度的特征聚合模块(SFAM)。 FFMv1通过融合骨干网络的特征图,将语义信息丰富为基本特征。每个TUM生成一组多尺度特征,然后交替连接的TUM和FFMv2提取多级多尺度特征。此外,SFAM通过按比例缩放的特征连接操作和自适应注意机制将特征聚合到多级特征金字塔中。下面介绍有关M2Det中三个核心模块和网络配置的更多详细信息。 +M2Det的整体架构如下所示。M2Det使用backbone和多级特征金字塔网络(MLFPN)从输入图像中提取特征,然后类似于SSD,根据学习的特征生成密集的边界框和类别分数,最后是非最大抑制(NMS)操作以产生最终结果。 +MLFPN由三个模块组成:特征融合模块(FFM),简化的U形模块(TUM)和按基于尺度的特征聚合模块(SFAM)。 +FFMv1通过融合骨干网络的特征图,将语义信息丰富为基本特征。每个TUM生成一组多尺度特征,然后交替连接的TUM和FFMv2提取多级多尺度特征。此外,SFAM通过按比例缩放的特征连接操作和自适应注意机制将特征聚合到多级特征金字塔中。下面介绍有关M2Det中三个核心模块和网络配置的更多详细信息。 -![](img/ch8/M2Det-01.png) +![](/assets/ch8/M2Det-01.png) **FFMs** -FFM融合了M2Det中不同层次的特征,这对于构建最终的多级特征金字塔至关重要。它们使用1x1卷积层来压缩输入特征的通道,并使用连接操作来聚合这些特征图。特别是,由于FFMv1以backbone中不同比例的两个特征图作为输入,因此它采用一个上采样操作,在连接操作之前将深度特征重新缩放到相同的尺度。同时,FFMv2采用基本特征和前一个TUM的最大输出特征图 - 这两个具有相同的比例 - 作为输入,并产生下一个TUM的融合特征。 FFMv1和FFMv2的结构细节分别如下图(a)和(b)所示。 +FFM融合了M2Det中不同层次的特征,这对于构建最终的多级特征金字塔至关重要。它们使用1x1卷积层来压缩输入特征的通道,并使用连接操作来聚合这些特征图。特别是,由于FFMv1以backbone中不同比例的两个特征图作为输入,因此它采用一个上采样操作,在连接操作之前将深度特征重新缩放到相同的尺度。同时,FFMv2采用基本特征和前一个TUM的最大输出特征图 - +这两个具有相同的比例 - 作为输入,并产生下一个TUM的融合特征。 FFMv1和FFMv2的结构细节分别如下图(a)和(b)所示。 -![](img/ch8/M2Det-02.png) +![](/assets/ch8/M2Det-02.png) -**TUMs** +**TUMs** TUM不同于FPN和RetinaNet,TUM采用简化的U形结构,如上图(c)所示。编码器是一系列3x3,步长为2的卷积层.并且解码器将这些层的输出作为其参考特征集,而原始FPN选择ResNet主干网络中每个阶段的最后一层的输出。此外,在解码器分支的上采样层后添加1x1卷积层和按元素求和的操作,以增强学习能力并保持特征的平滑性。每个TUM的解码器中的所有输出形成当前级别的多尺度特征。整体而言,堆叠TUM的输出形成多层次多尺度特征,而前TUM主要提供浅层特征,中间TUM提供中等特征,后TUM提供深层特征。 **SFAM** -SFAM旨在将由TUM生成的多级多尺度特征聚合成多级特征金字塔,如下图所示。SFAM的第一阶段是沿着信道维度将等效尺度的特征连接在一起。聚合特征金字塔可以表示为$X = [X_1,X_2,...,X_i,...,X_L]$,其中 +SFAM旨在将由TUM生成的多级多尺度特征聚合成多级特征金字塔,如下图所示。SFAM的第一阶段是沿着信道维度将等效尺度的特征连接在一起。聚合特征金字塔可以表示为$X = [X_1,X_2,...,X_i,...,X_L] +$,其中 $$X_i = Concat(X_{1i}, X_{2i}, ...., X_{Li}) \in R^{W_i \times H_i \times C}$$ 指的是尺度第i个最大的特征。这里,聚合金字塔中的每个比例都包含来自多级深度的特征。但是,简单的连接操作不太适合。在第二阶段,引入了通道注意模块,以促使特征集中在最有益的通道。在SE区块之后,使用全局平均池化来在挤压步骤中生成通道统计z∈RC。 -![](img/ch8/M2Det-03.png) +![](/assets/ch8/M2Det-03.png) ## 8.4 人脸检测 @@ -959,7 +1094,10 @@ $$X_i = Concat(X_{1i}, X_{2i}, ...., X_{Li}) \in R^{W_i \times H_i \times C}$$ 由于本书着重关注深度学习,下面会着重介绍基于深度学习的人脸检测方法。 -2006年Hinton首次提出深度学习(Deep Learning)的概念,它是通过组合低层的特征形成更高层的抽象特征。随后研究者将深度学习应用在人脸检测领域,主要集中在基于卷积神经网络(CNN)的人脸检测研究,如基于级联卷积神经网络的人脸检测(cascade cnn)、 基于多任务卷积神经网络的人脸检测(MTCNN)、Facebox等,很大程度上提高了人脸检测的鲁棒性。当然通用目标检测算法像Faster-rcnn、yolo、ssd等也有用在人脸检测领域,也可以实现比较不错的结果,但是和专门人脸检测算法比还是有差别。下面部分主要介绍基于深度学习的的人脸检测算法,基于深度学习的通用目标检测算法将在第二大节介绍。 +2006年Hinton首次提出深度学习(Deep +Learning)的概念,它是通过组合低层的特征形成更高层的抽象特征。随后研究者将深度学习应用在人脸检测领域,主要集中在基于卷积神经网络(CNN)的人脸检测研究,如基于级联卷积神经网络的人脸检测(cascade +cnn)、 +基于多任务卷积神经网络的人脸检测(MTCNN)、Facebox等,很大程度上提高了人脸检测的鲁棒性。当然通用目标检测算法像Faster-rcnn、yolo、ssd等也有用在人脸检测领域,也可以实现比较不错的结果,但是和专门人脸检测算法比还是有差别。下面部分主要介绍基于深度学习的的人脸检测算法,基于深度学习的通用目标检测算法将在第二大节介绍。 ### 8.4.2 如何检测图片中不同大小的人脸? @@ -969,31 +1107,29 @@ $$X_i = Concat(X_{1i}, X_{2i}, ...., X_{Li}) \in R^{W_i \times H_i \times C}$$ (2)缩放滑动窗的大小(如图8.4.2所示)。 -![](img/ch8/8.4.1.png) +![](/assets/ch8/8.4.1.png)
图 8.1 图像金字塔
-图 8.1 图像金字塔 -​ ![](img/ch8/8.4.2.png) +​ ![](/assets/ch8/8.4.2.png)
图 8.2 缩放滑动窗口
- 图 8.2 缩放滑动窗口 -​ 基于深度学习的人脸检测算法中针对不同大小人脸主要也有两个策略,但和传统人脸检测算法有点区别,主要包括: +​ 基于深度学习的人脸检测算法中针对不同大小人脸主要也有两个策略,但和传统人脸检测算法有点区别,主要包括: (1)缩放图片大小。(不过也可以通过缩放滑动窗的方式,基于深度学习的滑动窗人脸检测方式效率会很慢存在多次重复卷积,所以要采用全卷积神经网络(FCN),用FCN将不能用滑动窗的方法。) (2)通过anchor box的方法(如图8.3所示,不要和图8.2混淆,这里是通过特征图预测原图的anchor box区域,具体在facebox中有描述)。 -![](img/ch8/8.4.3.png) +![](/assets/ch8/8.4.3.png)
图 8.3 anchor box
-图 8.3 anchor box ### 8.4.3 如何设定算法检测最小人脸尺寸? 主要是看滑动窗的最小窗口和anchorbox的最小窗口。 -(1)滑动窗的方法 +(1)滑动窗的方法 -假设通过12×12的滑动窗,不对原图做缩放的话,就可以检测原图中12×12的最小人脸。但是往往通常给定最小人脸a=40、或者a=80,以这么大的输入训练CNN进行人脸检测不太现实,速度会很慢,并且下一次需求最小人脸a=30*30又要去重新训练,通常还会是12×12的输入,为满足最小人脸框a,只需要在检测的时候对原图进行缩放即可:w=w×12/a。 +假设通过12×12的滑动窗,不对原图做缩放的话,就可以检测原图中12×12的最小人脸。但是往往通常给定最小人脸a=40、或者a=80,以这么大的输入训练CNN进行人脸检测不太现实,速度会很慢,并且下一次需求最小人脸a=30* +30又要去重新训练,通常还会是12×12的输入,为满足最小人脸框a,只需要在检测的时候对原图进行缩放即可:w=w×12/a。 (2)anchorbox的方法 @@ -1005,37 +1141,40 @@ $$X_i = Concat(X_{1i}, X_{2i}, ...., X_{Li}) \in R^{W_i \times H_i \times C}$$ 滑动窗的方式是基于分类器识别为人脸的框的位置确定最终的人脸, -![](img/ch8/8.4.4.png) +![](/assets/ch8/8.4.4.png)
图 8.4 滑动窗
-图 8.4 滑动窗 (2)FCN的方式: -​ FCN的方式通过特征图映射到原图的方式确定最终识别为人脸的位置,特征图映射到原图人脸框是要看特征图相比较于原图有多少次缩放(缩放主要查看卷积的步长和池化层),假设特征图上(2,3)的点,可粗略计算缩放比例为8倍,原图中的点应该是(16,24);如果训练的FCN为12*12的输入,对于原图框位置应该是(16,24,12,12),当然这只是估计位置,具体的再构建网络时要加入回归框的预测,主要是相对于原图框的一个平移与缩放。 +​ +FCN的方式通过特征图映射到原图的方式确定最终识别为人脸的位置,特征图映射到原图人脸框是要看特征图相比较于原图有多少次缩放(缩放主要查看卷积的步长和池化层),假设特征图上( +2,3)的点,可粗略计算缩放比例为8倍,原图中的点应该是(16,24);如果训练的FCN为12*12的输入,对于原图框位置应该是(16,24,12,12) +,当然这只是估计位置,具体的再构建网络时要加入回归框的预测,主要是相对于原图框的一个平移与缩放。 (3)通过anchor box的方式: -​ 通过特征图映射到图的窗口,通过特征图映射到原图到多个框的方式确定最终识别为人脸的位置。 +​ 通过特征图映射到图的窗口,通过特征图映射到原图到多个框的方式确定最终识别为人脸的位置。 ### 8.4.5 如何通过一个人脸的多个框确定最终人脸框位置? -![](img/ch8/8.4.5.png) +![](/assets/ch8/8.4.5.png)
图 8.5 通过NMS得到最终的人脸位置
-图 8.5 通过NMS得到最终的人脸位置 -NMS改进版本有很多,最原始的NMS就是判断两个框的交集,如果交集大于设定的阈值,将删除其中一个框,那么两个框应该怎么选择删除哪一个呢? 因为模型输出有概率值,一般会优选选择概率小的框删除。 +NMS改进版本有很多,最原始的NMS就是判断两个框的交集,如果交集大于设定的阈值,将删除其中一个框,那么两个框应该怎么选择删除哪一个呢? +因为模型输出有概率值,一般会优选选择概率小的框删除。 ### 8.4.6 基于级联卷积神经网络的人脸检测(Cascade CNN) 1. cascade cnn的框架结构是什么? - ![](img/ch8/8.4.6.png) + ![](/assets/ch8/8.4.6.png) 级联结构中有6个CNN,3个CNN用于人脸非人脸二分类,另外3个CNN用于人脸区域的边框校正。给定一幅图像,12-net密集扫描整幅图片,拒绝90%以上的窗口。剩余的窗口输入到12-calibration-net中调整大小和位置,以接近真实目标。接着输入到NMS中,消除高度重叠窗口。下面网络与上面类似。 -2. cascade cnn人脸校验模块原理是什么? +2. cascade cnn人脸校验模块原理是什么? -该网络用于窗口校正,使用三个偏移变量:Xn:水平平移量,Yn:垂直平移量,Sn:宽高比缩放。候选框口(x,y,w,h)中,(x,y)表示左上点坐标,(w,h)表示宽和高。 +该网络用于窗口校正,使用三个偏移变量:Xn:水平平移量,Yn:垂直平移量,Sn:宽高比缩放。候选框口(x,y,w,h)中,(x,y)表示左上点坐标,( +w,h)表示宽和高。 我们要将窗口的控制坐标调整为: $$ @@ -1056,7 +1195,7 @@ $$ 同时对偏移向量三个参数进行校正。 -![](img/ch8/8.4.8.png) +![](/assets/ch8/8.4.8.png) 3、训练样本应该如何准备? @@ -1074,15 +1213,17 @@ $$ ### 8.4.7 基于多任务卷积神经网络的人脸检测(MTCNN) -![](img/ch8/8.4.9.png) +![](/assets/ch8/8.4.9.png) -![](img/ch8/8.4.10.png) +![](/assets/ch8/8.4.10.png) -![](img/ch8/8.4.11.png) +![](/assets/ch8/8.4.11.png) -![](img/ch8/8.4.12.png) +![](/assets/ch8/8.4.12.png) -1.MTCNN模型有三个子网络。分别是P-Net,R-Net,O-Net.我想问一下,1.模型中的三个input size是指的是同一张图resize到不同尺度下喂给不同模型,还是同一张图,依次经过三个模型,然后是不同的输入尺寸?(这部分能给我讲一下吗)2.每个模型它都有对应三个结果(face classification;bounding box;facial landmark)这三个在网络上是如何对应的呢? +1.MTCNN模型有三个子网络。分别是P-Net,R-Net,O-Net.我想问一下,1.模型中的三个input +size是指的是同一张图resize到不同尺度下喂给不同模型,还是同一张图,依次经过三个模型,然后是不同的输入尺寸?(这部分能给我讲一下吗)2.每个模型它都有对应三个结果(face +classification;bounding box;facial landmark)这三个在网络上是如何对应的呢? 为了检测不同大小的人脸,开始需要构建图像金字塔,先经过pNet模型,输出人脸类别和边界框(边界框的预测为了对特征图映射到原图的框平移和缩放得到更准确的框),将识别为人脸的框映射到原图框位置可以获取patch,之后每一个patch通过resize的方式输入到rNet,识别为人脸的框并且预测更准确的人脸框,最后rNet识别为人脸的的每一个patch通过resize的方式输入到oNet,跟rNet类似,关键点是为了在训练集有限情况下使模型更鲁棒。 @@ -1092,7 +1233,7 @@ $$ ### 8.4.8 Facebox -![](img/ch8/8.4.13.png) +![](/assets/ch8/8.4.13.png) **(1)Rapidly Digested Convolutional Layers(RDCL)** @@ -1113,132 +1254,140 @@ $$ 为了anchor密度均衡,可以对密度不足的anchor以中心进行偏移加倍,如下图所示: -![](img/ch8/8.4.14.png) - - +![](/assets/ch8/8.4.14.png) ## 8.5 目标检测的技巧汇总 ### 8.5.1 Data Augmentation(贡献者:北京理工大学--明奇) + 介绍一篇发表在Big Data上的数据增强相关的文献综述。 -1. **Introduction** + +1. **Introduction** + * 数据增强与过拟合 -验证是否过拟合的方法:画出loss曲线,如果训练集loss持续减小但是验证集loss增大,就说明是过拟合了。 + 验证是否过拟合的方法:画出loss曲线,如果训练集loss持续减小但是验证集loss增大,就说明是过拟合了。 -![](img/ch8/8.5.1-1.png) +![](/assets/ch8/8.5.1-1.png) * 数据增强目的 -通过数据增强实现数据更复杂的表征,从而减小验证集和训练集以及最终测试集的差距,让网络更好地学习迁移数据集上的数据分布。这也说明网络不是真正地理解数据,而是记忆数据分布。 + 通过数据增强实现数据更复杂的表征,从而减小验证集和训练集以及最终测试集的差距,让网络更好地学习迁移数据集上的数据分布。这也说明网络不是真正地理解数据,而是记忆数据分布。 * 数据增强的方法 -(1)数据变换增强 -包括几何变换、色彩空间变换,随机擦除,对抗训练,神经风格迁移等 -(2)重采样增强 -主要侧重于新的实例合成。如图像混合(mixup),特征空间的增强,GAN生成图片。一张图看明白: + (1)数据变换增强 + 包括几何变换、色彩空间变换,随机擦除,对抗训练,神经风格迁移等 + (2)重采样增强 + 主要侧重于新的实例合成。如图像混合(mixup),特征空间的增强,GAN生成图片。一张图看明白: -![](img/ch8/8.5.1-2.png) +![](/assets/ch8/8.5.1-2.png) 2. **Image Data Augmentation techniques** -2.1 **Data Augmentations based on basic image manipulations** +2.1 **Data Augmentations based on basic image manipulations** * Geometric transformations -  如果数据集潜在的表征能够被观察和分离,那么简单的几何变换就能取得很好的效果。对于复杂的数据集如医学影像,数据小而且训练集和测试集的偏差大,几何变换等增强的合理运用就很关键。 +   如果数据集潜在的表征能够被观察和分离,那么简单的几何变换就能取得很好的效果。对于复杂的数据集如医学影像,数据小而且训练集和测试集的偏差大,几何变换等增强的合理运用就很关键。 - * Flipping -作者提到了要衡量普遍性的观点。但是这种变换对于数字数据集不具有安全性。 + * Flipping + 作者提到了要衡量普遍性的观点。但是这种变换对于数字数据集不具有安全性。 - * Color space -主要提及的识别RGB通道上的变换,将三通道图进行分离,以及直方图变换增强等。(颜色空间更多增强方式可以参考A Preliminary Study on Data Augmentation of Deep Learning for Image Classification) + * Color space + 主要提及的识别RGB通道上的变换,将三通道图进行分离,以及直方图变换增强等。(颜色空间更多增强方式可以参考A Preliminary + Study on Data Augmentation of Deep Learning for Image Classification) - * Cropping -通常在输入图片的尺寸不一时会进行按中心的裁剪操作。裁剪某种程度上和平移操作有相似性。根据裁剪幅度变化,该操作具有一定的不安全性。 + * Cropping + 通常在输入图片的尺寸不一时会进行按中心的裁剪操作。裁剪某种程度上和平移操作有相似性。根据裁剪幅度变化,该操作具有一定的不安全性。 - * Rotation -大幅度的旋转对数字集会有不安全性的考虑。 + * Rotation + 大幅度的旋转对数字集会有不安全性的考虑。 - * Translation -平移也需要合理设计。如车站人脸检测,只需要中心检测时,就可以加合适的平移增强。平移后空出部分填0或者255,或用高斯分布噪声。 + * Translation + 平移也需要合理设计。如车站人脸检测,只需要中心检测时,就可以加合适的平移增强。平移后空出部分填0或者255,或用高斯分布噪声。 - * Noise injection -在像素上叠加高斯分布的随机噪声。 + * Noise injection + 在像素上叠加高斯分布的随机噪声。 * Color space transformations -  由于实际图像中一定存在光线偏差,所以光线的增强十分有必要(但是IJCV的光流文章指出,3D建模的灯光增强实在是很难学习到,所以对于光线增强的效果不如几何也可能因为**光线的复杂度更高,数据样本远远不够**)。色彩变换十分多样,如像素限制、像素矩阵变换、像素值颠倒等;灰度图和彩图相比,计算时间成本大大较少,但是据实验效果会下降一些,很明显因为特征的维度被降维了;还有尝试将RGB映射到其他的色彩空间进行学习,YUV,CMY.HSV等。 -  除了计算大内存消耗和时间长等缺点,色彩变换也面临不安全性,比如识别人脸的关键信息是黄白黑,但是大量增强出红绿蓝,会丢信息。颜色变换的增强方法是从色彩空间角度拟合偏置,效果有限的可能性是多样的:1. 真实几何多样性比颜色更简单 2. 色彩的变化多样性更多,导致增强不够反而学不好,颜色空间的欠拟合 3. **变换不安全** +   由于实际图像中一定存在光线偏差,所以光线的增强十分有必要(但是IJCV的光流文章指出,3D建模的灯光增强实在是很难学习到,所以对于光线增强的效果不如几何也可能因为 + **光线的复杂度更高,数据样本远远不够** + )。色彩变换十分多样,如像素限制、像素矩阵变换、像素值颠倒等;灰度图和彩图相比,计算时间成本大大较少,但是据实验效果会下降一些,很明显因为特征的维度被降维了;还有尝试将RGB映射到其他的色彩空间进行学习,YUV,CMY.HSV等。 +   除了计算大内存消耗和时间长等缺点,色彩变换也面临不安全性,比如识别人脸的关键信息是黄白黑,但是大量增强出红绿蓝,会丢信息。颜色变换的增强方法是从色彩空间角度拟合偏置,效果有限的可能性是多样的:1. + 真实几何多样性比颜色更简单 2. 色彩的变化多样性更多,导致增强不够反而学不好,颜色空间的欠拟合 3. **变换不安全** * Experiment -![](img/ch8/8.5.1-3.png) + ![](/assets/ch8/8.5.1-3.png) -**随机裁剪**效果最好。 +**随机裁剪**效果最好。 +2.2 **Geometric versus photometric transformations** -2.2 **Geometric versus photometric transformations** * Kernel filter -滤波器核在图像处理用的比较广,这里提到用这种方法来增强。还提到了一种正则化增强方法PatchShuffle,在一个patch内随机交换像素值,使得对噪声的抵抗更强以及避免过拟合。 -文章指出关于应用滤波器增强的工作尚且不多,因为这种方法其实和CNN的机制是一样的,这么做也许还不如直接在原始CNN上加层加深网络。 + 滤波器核在图像处理用的比较广,这里提到用这种方法来增强。还提到了一种正则化增强方法PatchShuffle,在一个patch内随机交换像素值,使得对噪声的抵抗更强以及避免过拟合。 + 文章指出关于应用滤波器增强的工作尚且不多,因为这种方法其实和CNN的机制是一样的,这么做也许还不如直接在原始CNN上加层加深网络。 * Mixing images -~~就是那篇被ICLR拒稿的采样方法~~直接均值相加混合。 + ~~就是那篇被ICLR拒稿的采样方法~~直接均值相加混合。 -![](img/ch8/8.5.1-4.png) +![](/assets/ch8/8.5.1-4.png) -  还有非线性的mixup裁剪如下: +  还有非线性的mixup裁剪如下: -![](img/ch8/8.5.1-5.png) +![](/assets/ch8/8.5.1-5.png) -  以及随机裁剪的图像混合: +  以及随机裁剪的图像混合: -![](img/ch8/8.5.1-6.png) +![](/assets/ch8/8.5.1-6.png)   这些混合方式是十分反人类直觉的,因此可解释性不强。只能说是可能增强了对底层低级特征如线条边缘等的鲁棒性。其实有点没有抓住关键点。 * Random erasing -随机擦除就是类似cutout的思想,通过mask的遮挡使得网络能够提高遮挡情况的鲁棒性。需要手工设计的部分包括mask的大小以及生成方式。是一种比较有效的方法。这种方式也需要考量增强的安全性,比如MNIST数据集8cutout后可能出问题。 + 随机擦除就是类似cutout的思想,通过mask的遮挡使得网络能够提高遮挡情况的鲁棒性。需要手工设计的部分包括mask的大小以及生成方式。是一种比较有效的方法。这种方式也需要考量增强的安全性,比如MNIST数据集8cutout后可能出问题。 -![](img/ch8/8.5.1-7.png) +![](/assets/ch8/8.5.1-7.png) * A note on combining augmentations -组合的增强方式往往是连续变化的,导致数据集的容量会迅速扩大,这对于小数据集领域来说容易发生过拟合 ,所以需要设计合理的搜索算法设计恰当的训练数据集。 + 组合的增强方式往往是连续变化的,导致数据集的容量会迅速扩大,这对于小数据集领域来说容易发生过拟合 + ,所以需要设计合理的搜索算法设计恰当的训练数据集。 2.3 **Data Augmentations based on Deep Learning** -* Feature space augmentation -之前刚看的基于SMOTE类别不平衡的过采样法来进行特征空间的插值操作进行数据增强,就实验效果而言不算特别出众。 + +* Feature space augmentation + 之前刚看的基于SMOTE类别不平衡的过采样法来进行特征空间的插值操作进行数据增强,就实验效果而言不算特别出众。 * Adversarial training -对抗样本训练可以提高鲁棒性,但是实际应用中其实提高不一定明显,因为自然对抗样本的数目没有那么多。而NIPS的对抗攻击大赛很多从神经网络的学习策略下手,进行梯度攻击,更加偏向于人为的攻击了,对于普适的检测性能提高意义反而不大,更强调安全需求高的场合。 + 对抗样本训练可以提高鲁棒性,但是实际应用中其实提高不一定明显,因为自然对抗样本的数目没有那么多。而NIPS的对抗攻击大赛很多从神经网络的学习策略下手,进行梯度攻击,更加偏向于人为的攻击了,对于普适的检测性能提高意义反而不大,更强调安全需求高的场合。 * GAN‑based Data Augmentation - + * Neural Style Transfer 不觉得这个效果会普遍很好,应该来说是针对特定域会有效(如白天黑夜),实际效果应该有限。 -* Meta learning Data Augmentations - * Neural augmentation - * Smart Augmentation - 两个东西差不多,就是上次看到SmartAugment方法。随机采样类内图片进行通道叠加然后输出融合图像,学通过梯度下降使得输出图像的类内差距减小(没考虑类间关系,可能也不便处理)。 +* Meta learning Data Augmentations + * Neural augmentation + * Smart Augmentation + 两个东西差不多,就是上次看到SmartAugment方法。随机采样类内图片进行通道叠加然后输出融合图像,学通过梯度下降使得输出图像的类内差距减小(没考虑类间关系,可能也不便处理)。 -![](img/ch8/8.5.1-8.png) +![](/assets/ch8/8.5.1-8.png) * AutoAugment -谷歌最早做的自学习增强方法,走的NAS的思路RL+RNN搜索增强空间,还有后来最近发的检测增强也是大同小异,基本就是换汤不换药,问题在于**搜索空间太大**,复现搜索过于依赖硬件条件(~~普通实验室玩不起~~) + 谷歌最早做的自学习增强方法,走的NAS的思路RL+RNN搜索增强空间,还有后来最近发的检测增强也是大同小异,基本就是换汤不换药,问题在于 + **搜索空间太大**,复现搜索过于依赖硬件条件(~~普通实验室玩不起~~) 3. **Design considerations for image Data Augmentation** 3.1 **Test-time augmentation** -  许多都论文指出在检测阶段进行同等的数据增强能够获得较好的效果。归结可以认为是训练检测阶段的一致性。当然,这种手段时间成本太高,只在如医学影像等追求精度的关键领域可以使用。 +  许多都论文指出在检测阶段进行同等的数据增强能够获得较好的效果。归结可以认为是训练检测阶段的一致性。当然,这种手段时间成本太高,只在如医学影像等追求精度的关键领域可以使用。 3.2 **Curriculum learning**   Bengio团队早年在ICML提出的观点,确实合理,一开始就进行大量的增强容易导致网络不收敛。 从一个数据集学习到的数据增强也可以迁移到其他数据集。 - 3.3 **Resolution impact** 高清(1920×1080×3)或4K(3840×2160×3)等高分辨率图像需要更多的处理和内存来训练深度CNN。然而下一代模型更倾向于使用这样更高分辨率的图像。因为模型中常用的下采样会造成图像中信息的丢失,使图像识别更困难。 研究人员发现,高分辨率图像和低分辨率图像一起训练的模型集合,比单独的任何一个模型都要好。 -某个实验(这里就不注明引用了)在256×256图像和512×512图像上训练的模型分别获得7.96%和7.42%的top-5 error。汇总后,他们的top-5 error变低,为6.97%。 +某个实验(这里就不注明引用了)在256×256图像和512×512图像上训练的模型分别获得7.96%和7.42%的top-5 error。汇总后,他们的top-5 +error变低,为6.97%。 随着超分辨率网络的发展,将图像放大到更高的分辨率后训练模型,能够得到更好更健壮的图像分类器。 3.4 **Final dataset size** @@ -1248,8 +1397,6 @@ $$ 3.5 **Alleviating class imbalance with Data Augmentation**   这也是值得借鉴的一点。通过增强在一定程度上解决类别不平衡问题。但增强需要仔细设计,否则会面对已经学习较好的类别或者场景造成过拟合等问题。 - - ### 8.5.2 OHEM ### 8.5.3 NMS:Soft NMS/ Polygon NMS/ Inclined NMS/ ConvNMS/ Yes-Net NMS/ Softer NMS @@ -1265,99 +1412,102 @@ $$ ### 8.5.8 结合attention ### 8.5.9 训练tricks(贡献者:北京理工大学--明奇) + 介绍一篇2019.2.4亚马逊挂在ArXiv的目标检测训练tricks的文章(之前亚马逊发了篇分类的tricks在CVPR上) 1. **Introduction** -  上次亚马逊发了个分类的训练trick在CVPR上,这次是检测的,还没发表。就没什么多说的了,下面直接介绍。先看效果如下,其实摘要声称的5%是单阶段的yolov3的提升,说明:单阶段没有RoIPooling阶段很多性质确实不如两阶段,因此采用trick很有必要;相反,两阶段本身结构优于单阶段所以外加的trick提供的如不变性等网络自身能够学习和适应就不起作用了。 +  上次亚马逊发了个分类的训练trick在CVPR上,这次是检测的,还没发表。就没什么多说的了,下面直接介绍。先看效果如下,其实摘要声称的5%是单阶段的yolov3的提升,说明:单阶段没有RoIPooling阶段很多性质确实不如两阶段,因此采用trick很有必要;相反,两阶段本身结构优于单阶段所以外加的trick提供的如不变性等网络自身能够学习和适应就不起作用了。 -![](img/ch8/8.5.9-1.png) +![](/assets/ch8/8.5.9-1.png) -2. **Bag of Freebies** +2. **Bag of Freebies** -  提出了一种基于mixup的视觉联系图像混合方法,以及一些数据处理和训练策略。 +  提出了一种基于mixup的视觉联系图像混合方法,以及一些数据处理和训练策略。 2.1 **Visually Coherent Image Mixup for Object Detection** -  先介绍图像分类中的mixup方法,作用是提供了训练的正则化,应用到图像上如下图,将图像作简单的像素值输入mixup的凸函数中得到合成图;然后将one-hot编码类似处理得到新的label。 +  先介绍图像分类中的mixup方法,作用是提供了训练的正则化,应用到图像上如下图,将图像作简单的像素值输入mixup的凸函数中得到合成图;然后将one-hot编码类似处理得到新的label。 -![](img/ch8/8.5.9-2.png) +![](/assets/ch8/8.5.9-2.png) +  技术细节: -  技术细节: -* 相比于分类的resize,为了保证检测图像不畸变影响效果,作者选择直接叠加,取最大的宽高,空白进行灰度填充,不进行缩放。 -* 选择ab较大(如1.5,1.5)的Beta分布作为系数来混合图像,作者说是相干性视觉图像的更强;loss是两张图像物体的loss之和,loss计算权重分别是beta分布的系数 +* 相比于分类的resize,为了保证检测图像不畸变影响效果,作者选择直接叠加,取最大的宽高,空白进行灰度填充,不进行缩放。 +* 选择ab较大(如1.5,1.5)的Beta分布作为系数来混合图像,作者说是相干性视觉图像的更强;loss是两张图像物体的loss之和,loss计算权重分别是beta分布的系数 -![](img/ch8/8.5.9-3.png) +![](/assets/ch8/8.5.9-3.png) - - -2.2 **Classification Head Label Smoothing** +2.2 **Classification Head Label Smoothing**   标签平滑在检测的分类任务常有用到,最早是Inceptionv2中提出。   如果标签中有的是错的,或者不准,会导致网络过分信任标签而一起错下去。为了提高网络泛化能力,避免这种错误,在one-hot的label进行计算loss时,真实类别位置乘以一个系数(1-e),e很小如0.05,以0.95的概率送进去;非标注的类别原来为0,现在改为e=0.05送进去计算loss。网络的优化方向不变,但是相比0-1label会更加平滑。 (标签平滑这个讲的不错:https://juejin.im/post/5a29fd4051882534af25dc92) +![](/assets/ch8/8.5.9-4.png) -![](img/ch8/8.5.9-4.png) - - -  这里进一步改进了一下label smooth的公式而已,在原来基础上除了个类别数。 +  这里进一步改进了一下label smooth的公式而已,在原来基础上除了个类别数。 2.3 **Data Preprocessing**   就是数据增强,没什么其他的。至于分类也是几何变换和色彩变换。这么分区别其实是是否变换label。但是将真实世界就这么简单地分解过于粗糙了。好不容易谷歌的增强考虑到了如何学习一下检测任务的增强,但是也只是加了bbox_only的增强,就效果而言,一般;而且就实际来说,合理性和有效性有待商榷。 -  作者认为,两阶段网络的RPN生成就是对输入的任意裁剪,所以这个增强就够了;这老哥膨胀了,two-stage就不用裁剪的增强,虽然两阶段能提供一些不变性,但是用了一般来说都是更好的。 +  作者认为,两阶段网络的RPN生成就是对输入的任意裁剪,所以这个增强就够了;这老哥膨胀了,two-stage就不用裁剪的增强,虽然两阶段能提供一些不变性,但是用了一般来说都是更好的。 2.4 **Training Schedule Revamping** -训练策略上:余弦学习率调整+warmup +训练策略上:余弦学习率调整+warmup -2.5 **Synchronized Batch Normalization** -跨多卡同步正则化,土豪专区,穷人退避 +2.5 **Synchronized Batch Normalization** +跨多卡同步正则化,土豪专区,穷人退避 2.6 **Random shapes training for single-stage object detection networks** 多尺度训练,每经过一定的iteration更换一种尺度。举例是yolov3的尺度范围。 - - - - - - - ## 8.6 目标检测的常用数据集 ### 8.6.1 PASCAL VOC -​ VOC数据集是目标检测经常用的一个数据集,自2005年起每年举办一次比赛,最开始只有4类,到2007年扩充为20个类,共有两个常用的版本:2007和2012。学术界常用5k的train/val 2007和16k的train/val 2012作为训练集,test 2007作为测试集,用10k的train/val 2007+test 2007和16k的train/val 2012作为训练集,test2012作为测试集,分别汇报结果。 +​ VOC数据集是目标检测经常用的一个数据集,自2005年起每年举办一次比赛,最开始只有4类,到2007年扩充为20个类,共有两个常用的版本:2007和2012。学术界常用5k的train/val +2007和16k的train/val 2012作为训练集,test 2007作为测试集,用10k的train/val 2007+test 2007和16k的train/val +2012作为训练集,test2012作为测试集,分别汇报结果。 ### 8.6.2 MS COCO -​ COCO数据集是微软团队发布的一个可以用来图像recognition+segmentation+captioning 数据集,该数据集收集了大量包含常见物体的日常场景图片,并提供像素级的实例标注以更精确地评估检测和分割算法的效果,致力于推动场景理解的研究进展。依托这一数据集,每年举办一次比赛,现已涵盖检测、分割、关键点识别、注释等机器视觉的中心任务,是继ImageNet Chanllenge以来最有影响力的学术竞赛之一。 +​ COCO数据集是微软团队发布的一个可以用来图像recognition+segmentation+captioning +数据集,该数据集收集了大量包含常见物体的日常场景图片,并提供像素级的实例标注以更精确地评估检测和分割算法的效果,致力于推动场景理解的研究进展。依托这一数据集,每年举办一次比赛,现已涵盖检测、分割、关键点识别、注释等机器视觉的中心任务,是继ImageNet +Chanllenge以来最有影响力的学术竞赛之一。 -相比ImageNet,COCO更加偏好目标与其场景共同出现的图片,即non-iconic images。这样的图片能够反映视觉上的语义,更符合图像理解的任务要求。而相对的iconic images则更适合浅语义的图像分类等任务。 +相比ImageNet,COCO更加偏好目标与其场景共同出现的图片,即non-iconic images。这样的图片能够反映视觉上的语义,更符合图像理解的任务要求。而相对的iconic +images则更适合浅语义的图像分类等任务。 -​ COCO的检测任务共含有80个类,在2014年发布的数据规模分train/val/test分别为80k/40k/40k,学术界较为通用的划分是使用train和35k的val子集作为训练集(trainval35k),使用剩余的val作为测试集(minival),同时向官方的evaluation server提交结果(test-dev)。除此之外,COCO官方也保留一部分test数据作为比赛的评测集。 +​ +COCO的检测任务共含有80个类,在2014年发布的数据规模分train/val/test分别为80k/40k/40k,学术界较为通用的划分是使用train和35k的val子集作为训练集(trainval35k),使用剩余的val作为测试集(minival),同时向官方的evaluation +server提交结果(test-dev)。除此之外,COCO官方也保留一部分test数据作为比赛的评测集。 ### 8.6.3 Google Open Image -​ Open Image是谷歌团队发布的数据集。最新发布的Open Images V4包含190万图像、600个种类,1540万个bounding-box标注,是当前最大的带物体位置标注信息的数据集。这些边界框大部分都是由专业注释人员手动绘制的,确保了它们的准确性和一致性。另外,这些图像是非常多样化的,并且通常包含有多个对象的复杂场景(平均每个图像 8 个)。 +​ Open Image是谷歌团队发布的数据集。最新发布的Open Images +V4包含190万图像、600个种类,1540万个bounding-box标注,是当前最大的带物体位置标注信息的数据集。这些边界框大部分都是由专业注释人员手动绘制的,确保了它们的准确性和一致性。另外,这些图像是非常多样化的,并且通常包含有多个对象的复杂场景(平均每个图像 +8 个)。 ### 8.6.4 ImageNet -​ ImageNet是一个计算机视觉系统识别项目, 是目前世界上图像识别最大的数据库。ImageNet是美国斯坦福的计算机科学家,模拟人类的识别系统建立的。能够从图片识别物体。Imagenet数据集文档详细,有专门的团队维护,使用非常方便,在计算机视觉领域研究论文中应用非常广,几乎成为了目前深度学习图像领域算法性能检验的“标准”数据集。Imagenet数据集有1400多万幅图片,涵盖2万多个类别;其中有超过百万的图片有明确的类别标注和图像中物体位置的标注。 +​ ImageNet是一个计算机视觉系统识别项目, +是目前世界上图像识别最大的数据库。ImageNet是美国斯坦福的计算机科学家,模拟人类的识别系统建立的。能够从图片识别物体。Imagenet数据集文档详细,有专门的团队维护,使用非常方便,在计算机视觉领域研究论文中应用非常广,几乎成为了目前深度学习图像领域算法性能检验的“标准”数据集。Imagenet数据集有1400多万幅图片,涵盖2万多个类别;其中有超过百万的图片有明确的类别标注和图像中物体位置的标注。 ### 8.6.5 DOTA -​ DOTA是遥感航空图像检测的常用数据集,包含2806张航空图像,尺寸大约为4kx4k,包含15个类别共计188282个实例,其中14个主类,small vehicle 和 large vehicle都是vehicle的子类。其标注方式为四点确定的任意形状和方向的四边形。航空图像区别于传统数据集,有其自己的特点,如:尺度变化性更大;密集的小物体检测;检测目标的不确定性。数据划分为1/6验证集,1/3测试集,1/2训练集。目前发布了训练集和验证集,图像尺寸从800x800到4000x4000不等。 - +​ DOTA是遥感航空图像检测的常用数据集,包含2806张航空图像,尺寸大约为4kx4k,包含15个类别共计188282个实例,其中14个主类,small +vehicle 和 large +vehicle都是vehicle的子类。其标注方式为四点确定的任意形状和方向的四边形。航空图像区别于传统数据集,有其自己的特点,如:尺度变化性更大;密集的小物体检测;检测目标的不确定性。数据划分为1/6验证集,1/3测试集,1/2训练集。目前发布了训练集和验证集,图像尺寸从800x800到4000x4000不等。 ## 8.7 目标检测常用标注工具 ### 8.7.1 LabelImg -​ LabelImg 是一款开源的图像标注工具,标签可用于分类和目标检测,它是用 Python 编写的,并使用Qt作为其图形界面,简单好用。注释以 PASCAL VOC 格式保存为 XML 文件,这是 ImageNet 使用的格式。 此外,它还支持 COCO 数据集格式。 - +​ LabelImg 是一款开源的图像标注工具,标签可用于分类和目标检测,它是用 Python 编写的,并使用Qt作为其图形界面,简单好用。注释以 +PASCAL VOC 格式保存为 XML 文件,这是 ImageNet 使用的格式。 此外,它还支持 COCO 数据集格式。 ### 8.7.2 labelme -​ labelme 是一款开源的图像/视频标注工具,标签可用于目标检测、分割和分类。灵感是来自于 MIT 开源的一款标注工具 LabelMe。labelme 具有的特点是: + +​ labelme 是一款开源的图像/视频标注工具,标签可用于目标检测、分割和分类。灵感是来自于 MIT 开源的一款标注工具 +LabelMe。labelme 具有的特点是: - 支持图像的标注的组件有:矩形框,多边形,圆,线,点(rectangle, polygons, circle, lines, points) - 支持视频标注 @@ -1366,7 +1516,8 @@ $$ - 支出导出 COCO 格式用于 instance segmentation ### 8.7.3 Labelbox -​ Labelbox 是一家为机器学习应用程序创建、管理和维护数据集的服务提供商,其中包含一款部分免费的数据标签工具,包含图像分类和分割,文本,音频和视频注释的接口,其中图像视频标注具有的功能如下: + +​ Labelbox 是一家为机器学习应用程序创建、管理和维护数据集的服务提供商,其中包含一款部分免费的数据标签工具,包含图像分类和分割,文本,音频和视频注释的接口,其中图像视频标注具有的功能如下: - 可用于标注的组件有:矩形框,多边形,线,点,画笔,超像素等(bounding box, polygons, lines, points,brush, subpixels) - 标签可用于分类,分割,目标检测等 @@ -1376,7 +1527,7 @@ $$ ### 8.7.4 RectLabel -​ RectLabel 是一款在线免费图像标注工具,标签可用于目标检测、分割和分类。具有的功能或特点: +​ RectLabel 是一款在线免费图像标注工具,标签可用于目标检测、分割和分类。具有的功能或特点: - 可用的组件:矩形框,多边形,三次贝塞尔曲线,直线和点,画笔,超像素 - 可只标记整张图像而不绘制 @@ -1388,66 +1539,70 @@ $$ ### 8.7.5 CVAT -​ CVAT 是一款开源的基于网络的交互式视频/图像标注工具,是对加州视频标注工具(Video Annotation Tool) 项目的重新设计和实现。OpenCV团队正在使用该工具来标注不同属性的数百万个对象,许多 UI 和 UX 的决策都基于专业数据标注团队的反馈。具有的功能 +​ CVAT 是一款开源的基于网络的交互式视频/图像标注工具,是对加州视频标注工具(Video Annotation Tool) +项目的重新设计和实现。OpenCV团队正在使用该工具来标注不同属性的数百万个对象,许多 UI 和 UX 的决策都基于专业数据标注团队的反馈。具有的功能 - 关键帧之间的边界框插值 - 自动标注(使用TensorFlow OD API 和 Intel OpenVINO IR格式的深度学习模型) ### 8.7.6 VIA -​ VGG Image Annotator(VIA)是一款简单独立的手动注释软件,适用于图像,音频和视频。 VIA 在 Web 浏览器中运行,不需要任何安装或设置。 页面可在大多数现代Web浏览器中作为离线应用程序运行。 + +​ VGG Image Annotator(VIA)是一款简单独立的手动注释软件,适用于图像,音频和视频。 VIA 在 Web 浏览器中运行,不需要任何安装或设置。 +页面可在大多数现代Web浏览器中作为离线应用程序运行。 - 支持标注的区域组件有:矩形,圆形,椭圆形,多边形,点和折线 ### 8.7.6 其他标注工具 -​ liblabel,一个用 MATLAB 写的轻量级 语义/示例(semantic/instance) 标注工具。 +​ liblabel,一个用 MATLAB 写的轻量级 语义/示例(semantic/instance) 标注工具。 ImageTagger:一个开源的图像标注平台。 Anno-Mage:一个利用深度学习模型半自动图像标注工具,预训练模型是基于MS COCO数据集,用 RetinaNet 训练的。
​ 当然还有一些数据标注公司,可能包含更多标注功能,例如对三维目标检测的标注(3D Bounding box Labelling),激光雷达点云的标注(LIDAR 3D Point Cloud Labeling)等。 - - - - ## 8.8 目标检测工具和框架(贡献者:北京理工大学--明奇) -各种不同的算法虽然部分官方会有公布代码,或者github上有人复现,但是囿于安装环境不一,实现的框架(pytorch、C++、Caffee、tensorflow、MXNet等)不同,每次更换算法都需要重新安装环境,并且代码之间的迁移性差,十分不方便。所以为了方便将不同的算法统一在一个代码库中,不同的大厂都提出了自己的解决方案。如facebook的Detectron、商汤科技的mmdetection、SimpleDet等。其中Detectron最早,所以用户量最大,其次是国内近段时间崛起的mmdetection,下面介绍该目标检测工具箱。 +各种不同的算法虽然部分官方会有公布代码,或者github上有人复现,但是囿于安装环境不一,实现的框架(pytorch、C++、Caffee、tensorflow、MXNet等)不同,每次更换算法都需要重新安装环境,并且代码之间的迁移性差,十分不方便。所以为了方便将不同的算法统一在一个代码库中,不同的大厂都提出了自己的解决方案。如facebook的Detectron、商汤科技的mmdetection、SimpleDet等。其中Detectron最早,所以用户量最大,其次是国内近段时间崛起的mmdetection,下面介绍该目标检测工具箱。 1. **Introduction** -MMdetection的特点: + MMdetection的特点: + * 模块化设计:将不同网络的部分进行切割,模块之间具有很高的复用性和独立性(十分便利,可以任意组合) * 高效的内存使用 * SOTA -2. **Support Frameworks** +2. **Support Frameworks** + * 单阶段检测器 -SSD、RetinaNet、FCOS、FSAF + SSD、RetinaNet、FCOS、FSAF * 两阶段检测器 -Faster R-CNN、R-FCN、Mask R-CNN、Mask Scoring R-CNN、Grid R-CNN + Faster R-CNN、R-FCN、Mask R-CNN、Mask Scoring R-CNN、Grid R-CNN * 多阶段检测器 -Cascade R-CNN、Hybrid Task Cascade + Cascade R-CNN、Hybrid Task Cascade * 通用模块和方法 -soft-NMS、DCN、OHEN、Train from Scratch 、M2Det 、GN 、HRNet 、Libra R-CNN + soft-NMS、DCN、OHEN、Train from Scratch 、M2Det 、GN 、HRNet 、Libra R-CNN 3. **Architecture** 模型表征:划分为以下几个模块: Backbone(ResNet等)、Neck(FPN)、DenseHead(AnchorHead)、RoIExtractor、RoIHead(BBoxHead/MaskHead) 结构图如下: -![](img/ch8/mmdetection.png) + +[//]: # (![](./img/ch8/mmdetection.png)) +![占位图]() 4. **Notice** + * 1x代表12epoch的COCO训练,2x类似推导 * 由于batch-size一般比较小(1/2这样的量级),所以大多数地方默认冻结BN层。可以使用GN代替。 5. **参考链接** -mmdetection代码高度模块化,十分好用和便利,更详细的文档直接参见官方文档: -https://github.com/open-mmlab/mmdetection + mmdetection代码高度模块化,十分好用和便利,更详细的文档直接参见官方文档: + https://github.com/open-mmlab/mmdetection 注释版的mmdetection代码(更新至v1.0.0):https://github.com/ming71/mmdetection-annotated @@ -1455,7 +1610,6 @@ https://github.com/open-mmlab/mmdetection 安装记录(可能过时,以官方文档为准):https://ming71.github.io/mmdetection-memo.html 使用方法(截止更新日期,如果过时以官方为准):https://ming71.github.io/mmdetection-instruction.html - ## TODO - [ ] 目标检测基础知识:mAP、IoU和NMS等 @@ -1478,30 +1632,41 @@ http://blog.leanote.com/post/afanti.deng@gmail.com/b5f4f526490b https://blog.csdn.net/hw5226349/article/details/78987385 -[1] Girshick R, Donahue J, Darrell T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation[C]//Proceedings of the IEEE conference on computer vision and pattern recognition. 2014: 580-587. +[1] Girshick R, Donahue J, Darrell T, et al. Rich feature hierarchies for accurate object detection and semantic +segmentation[C]//Proceedings of the IEEE conference on computer vision and pattern recognition. 2014: 580-587. [2] Girshick R. Fast r-cnn[C]//Proceedings of the IEEE international conference on computer vision. 2015: 1440-1448. -[3] He K, Zhang X, Ren S, et al. Spatial pyramid pooling in deep convolutional networks for visual recognition[J]. IEEE transactions on pattern analysis and machine intelligence, 2015, 37(9): 1904-1916. +[3] He K, Zhang X, Ren S, et al. Spatial pyramid pooling in deep convolutional networks for visual recognition[J]. IEEE +transactions on pattern analysis and machine intelligence, 2015, 37(9): 1904-1916. -[4] Ren S, He K, Girshick R, et al. Faster r-cnn: Towards real-time object detection with region proposal networks[C]//Advances in neural information processing systems. 2015: 91-99. +[4] Ren S, He K, Girshick R, et al. Faster r-cnn: Towards real-time object detection with region proposal networks[C] +//Advances in neural information processing systems. 2015: 91-99. -[5] Lin T Y, Dollár P, Girshick R, et al. Feature pyramid networks for object detection[C]//Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2017: 2117-2125. +[5] Lin T Y, Dollár P, Girshick R, et al. Feature pyramid networks for object detection[C]//Proceedings of the IEEE +Conference on Computer Vision and Pattern Recognition. 2017: 2117-2125. -[6] He K, Gkioxari G, Dollár P, et al. Mask r-cnn[C]//Proceedings of the IEEE international conference on computer vision. 2017: 2961-2969. +[6] He K, Gkioxari G, Dollár P, et al. Mask r-cnn[C]//Proceedings of the IEEE international conference on computer +vision. 2017: 2961-2969. -[7] Liu W, Anguelov D, Erhan D, et al. Ssd: Single shot multibox detector[C]//European conference on computer vision. Springer, Cham, 2016: 21-37. +[7] Liu W, Anguelov D, Erhan D, et al. Ssd: Single shot multibox detector[C]//European conference on computer vision. +Springer, Cham, 2016: 21-37. [8] Fu C Y, Liu W, Ranga A, et al. Dssd: Deconvolutional single shot detector[J]. arXiv preprint arXiv:1701.06659, 2017. -[9] Redmon J, Divvala S, Girshick R, et al. You only look once: Unified, real-time object detection[C]//Proceedings of the IEEE conference on computer vision and pattern recognition. 2016: 779-788. +[9] Redmon J, Divvala S, Girshick R, et al. You only look once: Unified, real-time object detection[C]//Proceedings of +the IEEE conference on computer vision and pattern recognition. 2016: 779-788. -[10] Redmon J, Farhadi A. YOLO9000: better, faster, stronger[C]//Proceedings of the IEEE conference on computer vision and pattern recognition. 2017: 7263-7271. +[10] Redmon J, Farhadi A. YOLO9000: better, faster, stronger[C]//Proceedings of the IEEE conference on computer vision +and pattern recognition. 2017: 7263-7271. [11] Redmon J, Farhadi A. Yolov3: An incremental improvement[J]. arXiv preprint arXiv:1804.02767, 2018. -[12] Lin T Y, Goyal P, Girshick R, et al. Focal loss for dense object detection[C]//Proceedings of the IEEE international conference on computer vision. 2017: 2980-2988. +[12] Lin T Y, Goyal P, Girshick R, et al. Focal loss for dense object detection[C]//Proceedings of the IEEE +international conference on computer vision. 2017: 2980-2988. -[13] Liu S, Huang D. Receptive field block net for accurate and fast object detection[C]//Proceedings of the European Conference on Computer Vision (ECCV). 2018: 385-400. +[13] Liu S, Huang D. Receptive field block net for accurate and fast object detection[C]//Proceedings of the European +Conference on Computer Vision (ECCV). 2018: 385-400. -[14] Zhao Q, Sheng T, Wang Y, et al. M2Det: A Single-Shot Object Detector based on Multi-Level Feature Pyramid Network[J]. arXiv preprint arXiv:1811.04533, 2018. \ No newline at end of file +[14] Zhao Q, Sheng T, Wang Y, et al. M2Det: A Single-Shot Object Detector based on Multi-Level Feature Pyramid +Network[J]. arXiv preprint arXiv:1811.04533, 2018. \ No newline at end of file diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/\347\254\254\344\271\235\347\253\240_\345\233\276\345\203\217\345\210\206\345\211\262.md" "b/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/\347\254\254\344\271\235\347\253\240_\345\233\276\345\203\217\345\210\206\345\211\262.md" index 6f4f5a1a..2409a885 100644 --- "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/\347\254\254\344\271\235\347\253\240_\345\233\276\345\203\217\345\210\206\345\211\262.md" +++ "b/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/\347\254\254\344\271\235\347\253\240_\345\233\276\345\203\217\345\210\206\345\211\262.md" @@ -1,5 +1,3 @@ - - [TOC] # 第九章 图像分割 @@ -12,55 +10,63 @@ 为图像中的每个像素分配一个类别,如把画面中的所有物体都指出它们各自的类别。 -![](img/ch9/semantic-01.png) +![](/assets/ch9/semantic-01.png) **2.实例分割** 与语义分割不同,实例分割只对特定物体进行类别分配,这一点与目标检测有点相似,但目标检测输出的是边界框和类别,而实例分割输出的是掩膜(mask)和类别。 -![](img/ch9/Instance-01.png) +![](/assets/ch9/Instance-01.png) ## 9.2 传统的基于CNN的分割方法缺点? 传统的基于CNN的分割方法:为了对一个像素分类,使用该像素周围的一个图像块作为CNN的输入,用于训练与预测,这种方法主要有几个缺点: -1)存储开销大,例如,对每个像素使用15 * 15的图像块,然后不断滑动窗口,将图像块输入到CNN中进行类别判断,因此,需要的存储空间随滑动窗口的次数和大小急剧上升; +1)存储开销大,例如,对每个像素使用15 * +15的图像块,然后不断滑动窗口,将图像块输入到CNN中进行类别判断,因此,需要的存储空间随滑动窗口的次数和大小急剧上升; 2)效率低下,相邻像素块基本上是重复的,针对每个像素块逐个计算卷积,这种计算有很大程度上的重复; 3)像素块的大小限制了感受区域的大小,通常像素块的大小比整幅图像的大小小很多,只能提取一些局部特征,从而导致分类性能受到限制。 而全卷积网络(FCN)则是从抽象的特征中恢复出每个像素所属的类别。即从图像级别的分类进一步延伸到像素级别的分类。 - ## 9.3 FCN ### 9.3.1 FCN改变了什么? -​ 对于一般的分类CNN网络,如VGG和Resnet,都会在网络的最后加入一些全连接层,经过softmax后就可以获得类别概率信息。但是这个概率信息是1维的,即只能标识整个图片的类别,不能标识每个像素点的类别,所以这种全连接方法不适用于图像分割。 -​ 而FCN提出可以把后面几个全连接都换成卷积,这样就可以获得一张2维的feature map,后接softmax层获得每个像素点的分类信息,从而解决了分割问题,如图4。 +​ +对于一般的分类CNN网络,如VGG和Resnet,都会在网络的最后加入一些全连接层,经过softmax后就可以获得类别概率信息。但是这个概率信息是1维的,即只能标识整个图片的类别,不能标识每个像素点的类别,所以这种全连接方法不适用于图像分割。 +​ 而FCN提出可以把后面几个全连接都换成卷积,这样就可以获得一张2维的feature map,后接softmax层获得每个像素点的分类信息,从而解决了分割问题,如图4。 -![](img/ch9/figure_9.1.1_2.jpg) +![](/assets/ch9/figure_9.1.1_2.jpg) -
图 4
+图 4 -### 9.3.2 FCN网络结构? +### 9.3.2 FCN网络结构? -​ FCN对图像进行像素级的分类,从而解决了语义级别的图像分割(semantic segmentation)问题。与经典的CNN在卷积层之后使用全连接层得到固定长度的特征向量进行分类(全联接层+softmax输出)不同,FCN可以接受任意尺寸的输入图像,采用反卷积层对最后一个卷积层的feature map进行上采样, 使它恢复到输入图像相同的尺寸,从而可以对每个像素都产生了一个预测, 同时保留了原始输入图像中的空间信息, 最后在上采样的特征图上进行逐像素分类。 -​ 下图是语义分割所采用的全卷积网络(FCN)的结构示意图: +​ FCN对图像进行像素级的分类,从而解决了语义级别的图像分割(semantic +segmentation)问题。与经典的CNN在卷积层之后使用全连接层得到固定长度的特征向量进行分类(全联接层+softmax输出)不同,FCN可以接受任意尺寸的输入图像,采用反卷积层对最后一个卷积层的feature +map进行上采样, 使它恢复到输入图像相同的尺寸,从而可以对每个像素都产生了一个预测, 同时保留了原始输入图像中的空间信息, +最后在上采样的特征图上进行逐像素分类。 +​ 下图是语义分割所采用的全卷积网络(FCN)的结构示意图: -![](img/ch9/figure_9.1.2_1.jpg) +![](/assets/ch9/figure_9.1.2_1.jpg) ### 9.3.3 全卷积网络举例? -​ 通常CNN网络在卷积层之后会接上若干个全连接层, 将卷积层产生的特征图(feature map)映射成一个固定长度的特征向量。以AlexNet为代表的经典CNN结构适合于图像级的分类和回归任务,因为它们最后都得到整个输入图像的一个概率向量。 +​ 通常CNN网络在卷积层之后会接上若干个全连接层, 将卷积层产生的特征图(feature map) +映射成一个固定长度的特征向量。以AlexNet为代表的经典CNN结构适合于图像级的分类和回归任务,因为它们最后都得到整个输入图像的一个概率向量。 -![](img/ch9/figure_9.1.3_1.jpg) +![](/assets/ch9/figure_9.1.3_1.jpg)    如上图所示:    -(1)在CNN中, 猫的图片输入到AlexNet, 得到一个长为1000的输出向量, 表示输入图像属于每一类的概率, 其中在“tabby cat”这一类统计概率最高, 用来做分类任务。 +(1)在CNN中, 猫的图片输入到AlexNet, 得到一个长为1000的输出向量, 表示输入图像属于每一类的概率, 其中在“tabby cat”这一类统计概率最高, +用来做分类任务。    (2)FCN与CNN的区别在于把CNN最后的全连接层转换成卷积层,输出的是一张已经带有标签的图片, 而这个图片就可以做语义分割。    -(3)CNN的强大之处在于它的多层结构能自动学习特征,并且可以学习到多个层次的特征: 较浅的卷积层感知域较小,学习到一些局部区域的特征;较深的卷积层具有较大的感知域,能够学习到更加抽象一些的特征。高层的抽象特征对物体的大小、位置和方向等敏感性更低,从而有助于识别性能的提高, 所以我们常常可以将卷积层看作是特征提取器。 +(3)CNN的强大之处在于它的多层结构能自动学习特征,并且可以学习到多个层次的特征: +较浅的卷积层感知域较小,学习到一些局部区域的特征;较深的卷积层具有较大的感知域,能够学习到更加抽象一些的特征。高层的抽象特征对物体的大小、位置和方向等敏感性更低,从而有助于识别性能的提高, +所以我们常常可以将卷积层看作是特征提取器。 ### 9.2.4 全连接层和卷积层如何相互转化? @@ -71,11 +77,15 @@    (1)对于任一个卷积层,都存在一个能实现和它一样的前向传播函数的全连接层。权重矩阵是一个巨大的矩阵,除了某些特定块,其余部分都是零。而在其中大部分块中,元素都是相等的。    -(2)任何全连接层都可以被转化为卷积层。比如VGG16中第一个全连接层是25088 * 4096的数据尺寸,将它转化为512 * 7 * 7 * 4096的数据尺寸,即一个K=4096的全连接层,输入数据体的尺寸是7 * 7 * 512,这个全连接层可以被等效地看做一个F=7, P=0, S=1, K=4096 的卷积层。换句话说,就是将滤波器的尺寸设置为和输入数据体的尺寸一致7 * 7, 这样输出就变为1 * 1 * 4096, 本质上和全连接层的输出是一样的。 +(2)任何全连接层都可以被转化为卷积层。比如VGG16中第一个全连接层是25088 * 4096的数据尺寸,将它转化为512 * 7 * 7 * +4096的数据尺寸,即一个K=4096的全连接层,输入数据体的尺寸是7 * 7 * 512,这个全连接层可以被等效地看做一个F=7, P=0, S=1, +K=4096 的卷积层。换句话说,就是将滤波器的尺寸设置为和输入数据体的尺寸一致7 * 7, 这样输出就变为1 * 1 * 4096, +本质上和全连接层的输出是一样的。    **输出激活数据体深度是由卷积核的数目决定的(K=4096)。**    -在两种变换中,将全连接层转化为卷积层在实际运用中更加有用。假设一个卷积神经网络的输入是227x227x3的图像,一系列的卷积层和下采样层将图像数据变为尺寸为7x7x512的激活数据体, AlexNet的处理方式为使用了两个尺寸为4096的全连接层,最后一个有1000个神经元的全连接层用于计算分类评分。我们可以将这3个全连接层中的任意一个转化为卷积层: +在两种变换中,将全连接层转化为卷积层在实际运用中更加有用。假设一个卷积神经网络的输入是227x227x3的图像,一系列的卷积层和下采样层将图像数据变为尺寸为7x7x512的激活数据体, +AlexNet的处理方式为使用了两个尺寸为4096的全连接层,最后一个有1000个神经元的全连接层用于计算分类评分。我们可以将这3个全连接层中的任意一个转化为卷积层:    (1)第一个连接区域是[7x7x512]的全连接层,令其滤波器尺寸为F=7,K=4096,这样输出数据体就为[1x1x4096]。    @@ -86,49 +96,65 @@ ### 9.2.5 为什么传统CNN的输入图片是固定大小?    -对于CNN,一幅输入图片在经过卷积和pooling层时,这些层是不关心图片大小的。比如对于一个卷积层,outputsize = (inputsize - kernelsize) / stride + 1,它并不关心inputsize多大,对于一个inputsize大小的输入feature map,滑窗卷积,输出outputsize大小的feature map即可。pooling层同理。但是在进入全连接层时,feature map(假设大小为n×n)要拉成一条向量,而向量中每个元素(共n×n个)作为一个结点都要与下一个层的所有结点(假设4096个)全连接,这里的权值个数是4096×n×n,而我们知道神经网络结构一旦确定,它的权值个数都是固定的,所以这个n不能变化,n是conv5的outputsize,所以层层向回看,每个outputsize都要固定,那每个inputsize都要固定,因此输入图片大小要固定。 +对于CNN,一幅输入图片在经过卷积和pooling层时,这些层是不关心图片大小的。比如对于一个卷积层,outputsize = (inputsize - +kernelsize) / stride + 1,它并不关心inputsize多大,对于一个inputsize大小的输入feature map,滑窗卷积,输出outputsize大小的feature +map即可。pooling层同理。但是在进入全连接层时,feature +map(假设大小为n×n)要拉成一条向量,而向量中每个元素(共n×n个)作为一个结点都要与下一个层的所有结点(假设4096个)全连接,这里的权值个数是4096×n×n,而我们知道神经网络结构一旦确定,它的权值个数都是固定的,所以这个n不能变化,n是conv5的outputsize,所以层层向回看,每个outputsize都要固定,那每个inputsize都要固定,因此输入图片大小要固定。 ### 9.2.6 把全连接层的权重W重塑成卷积层的滤波器有什么好处?    -这样的转化可以在单个向前传播的过程中, 使得卷积网络在一张更大的输入图片上滑动,从而得到多个输出(可以理解为一个label map)。 +这样的转化可以在单个向前传播的过程中, 使得卷积网络在一张更大的输入图片上滑动,从而得到多个输出(可以理解为一个label +map)。    -比如: 我们想让224×224尺寸的浮窗,以步长为32在384×384的图片上滑动,把每个经停的位置都带入卷积网络,最后得到6×6个位置的类别得分, 那么通过将全连接层转化为卷积层之后的运算过程为: +比如: 我们想让224×224尺寸的浮窗,以步长为32在384×384的图片上滑动,把每个经停的位置都带入卷积网络,最后得到6×6个位置的类别得分, +那么通过将全连接层转化为卷积层之后的运算过程为:    -如果224×224的输入图片经过卷积层和下采样层之后得到了[7x7x512]的数组,那么,384×384的大图片直接经过同样的卷积层和下采样层之后会得到[12x12x512]的数组, 然后再经过上面由3个全连接层转化得到的3个卷积层,最终得到[6x6x1000]的输出((12 – 7)/1 + 1 = 6), 这个结果正是浮窗在原图经停的6×6个位置的得分。 +如果224×224的输入图片经过卷积层和下采样层之后得到了[7x7x512] +的数组,那么,384×384的大图片直接经过同样的卷积层和下采样层之后会得到[12x12x512]的数组, +然后再经过上面由3个全连接层转化得到的3个卷积层,最终得到[6x6x1000]的输出((12 – 7)/1 + 1 = 6), +这个结果正是浮窗在原图经停的6×6个位置的得分。    -一个确定的CNN网络结构之所以要固定输入图片大小,是因为全连接层权值数固定,而该权值数和feature map大小有关, 但是FCN在CNN的基础上把1000个结点的全连接层改为含有1000个1×1卷积核的卷积层,经过这一层,还是得到二维的feature map,同样我们也不关心这个feature map大小, 所以对于输入图片的size并没有限制。 +一个确定的CNN网络结构之所以要固定输入图片大小,是因为全连接层权值数固定,而该权值数和feature map大小有关, +但是FCN在CNN的基础上把1000个结点的全连接层改为含有1000个1×1卷积核的卷积层,经过这一层,还是得到二维的feature +map,同样我们也不关心这个feature map大小, 所以对于输入图片的size并没有限制。    如下图所示,FCN将传统CNN中的全连接层转化成卷积层,对应CNN网络FCN把最后三层全连接层转换成为三层卷积层: -![](img/ch9/figure_9.1.7_1.png) - -
一个分类网络
- -![](img/ch9/figure_9.1.7_2.png) +![](/assets/ch9/figure_9.1.7_1.png) -
变为全卷积网络
+一个分类网络 -![](img/ch9/figure_9.1.7_3.png) +![](/assets/ch9/figure_9.1.7_2.png) -
End-to-end, pixels-to pixels网络
+变为全卷积网络 -![](img/ch9/figure_9.1.7_4.jpg) +![](/assets/ch9/figure_9.1.7_3.png) +End-to-end, pixels-to pixels网络 +![](/assets/ch9/figure_9.1.7_4.jpg) -(1)全连接层转化为全卷积层 : 在传统的CNN结构中,前5层是卷积层,第6层和第7层分别是一个长度为4096的一维向量,第8层是长度为1000的一维向量,分别对应1000个不同类别的概率。FCN将这3层表示为卷积层,卷积核的大小 (通道数,宽,高) 分别为 (4096,1,1)、(4096,1,1)、(1000,1,1)。看上去数字上并没有什么差别,但是卷积跟全连接是不一样的概念和计算过程,使用的是之前CNN已经训练好的权值和偏置,但是不一样的在于权值和偏置是有自己的范围,属于自己的一个卷积核。 +(1)全连接层转化为全卷积层 : +在传统的CNN结构中,前5层是卷积层,第6层和第7层分别是一个长度为4096的一维向量,第8层是长度为1000的一维向量,分别对应1000个不同类别的概率。FCN将这3层表示为卷积层,卷积核的大小 ( +通道数,宽,高) 分别为 (4096,1,1)、(4096,1,1)、(1000,1,1) +。看上去数字上并没有什么差别,但是卷积跟全连接是不一样的概念和计算过程,使用的是之前CNN已经训练好的权值和偏置,但是不一样的在于权值和偏置是有自己的范围,属于自己的一个卷积核。    -(2)CNN中输入的图像大小是统一固定成227x227大小的图像,第一层pooling后为55x55,第二层pooling后图像大小为27x27,第五层pooling后的图像大小为13x13, 而FCN输入的图像是H * W大小,第一层pooling后变为原图大小的1/2,第二层变为原图大小的1/4,第五层变为原图大小的1/8,第八层变为原图大小的1/16。 +(2)CNN中输入的图像大小是统一固定成227x227大小的图像,第一层pooling后为55x55,第二层pooling后图像大小为27x27,第五层pooling后的图像大小为13x13, +而FCN输入的图像是H * +W大小,第一层pooling后变为原图大小的1/2,第二层变为原图大小的1/4,第五层变为原图大小的1/8,第八层变为原图大小的1/16。    -(3)经过多次卷积和pooling以后,得到的图像越来越小,分辨率越来越低。其中图像到H/32 * W/32的时候图片是最小的一层时,所产生图叫做heatmap热图,热图就是我们最重要的高维特征图,得到高维特征的heatmap之后就是最重要的一步也是最后的一步对原图像进行upsampling,把图像进行放大几次到原图像的大小。 +(3)经过多次卷积和pooling以后,得到的图像越来越小,分辨率越来越低。其中图像到H/32 * +W/32的时候图片是最小的一层时,所产生图叫做heatmap热图,热图就是我们最重要的高维特征图,得到高维特征的heatmap之后就是最重要的一步也是最后的一步对原图像进行upsampling,把图像进行放大几次到原图像的大小。    相较于使用被转化前的原始卷积神经网络对所有36个位置进行迭代计算优化模型,然后再对36个位置做预测,使用转化后的卷积神经网络进行一次前向传播计算要高效得多,因为36次计算都在共享计算资源。这一技巧在实践中经常使用,通常将一张图像尺寸变得更大,然后使用变换后的卷积神经网络来对空间上很多不同位置进行评价得到分类评分,然后在求这些分值的平均值。 ### 9.2.7 反卷积层理解    -Upsampling的操作可以看成是反卷积(deconvolutional),卷积运算的参数和CNN的参数一样是在训练FCN模型的过程中通过bp算法学习得到。反卷积层也是卷积层,不关心input大小,滑窗卷积后输出output。deconv并不是真正的deconvolution(卷积的逆变换),最近比较公认的叫法应该是transposed convolution,deconv的前向传播就是conv的反向传播。 +Upsampling的操作可以看成是反卷积(deconvolutional) +,卷积运算的参数和CNN的参数一样是在训练FCN模型的过程中通过bp算法学习得到。反卷积层也是卷积层,不关心input大小,滑窗卷积后输出output。deconv并不是真正的deconvolution(卷积的逆变换),最近比较公认的叫法应该是transposed +convolution,deconv的前向传播就是conv的反向传播。    反卷积参数: 利用卷积过程filter的转置(实际上就是水平和竖直方向上翻转filter)作为计算卷积前的特征图。    @@ -136,19 +162,20 @@ Upsampling的操作可以看成是反卷积(deconvolutional),卷积运算的    蓝色是反卷积层的input,绿色是反卷积层的outputFull padding, transposed Full padding, transposed。 -![](img/ch9/figure_9.1.8_1.png) +![](/assets/ch9/figure_9.1.8_1.png) -
上图中的反卷积,input是2×2, output是4×4。 Zero padding, non-unit strides, transposed。
+上图中的反卷积,input是2×2, output是4×4。 Zero padding, non-unit strides, transposed。 -![](img/ch9/figure_9.1.8_2.png) +![](/assets/ch9/figure_9.1.8_2.png) + +上图中的反卷积,input feature map是3×3, 转化后是5×5, output是5×5 -
上图中的反卷积,input feature map是3×3, 转化后是5×5, output是5×5
### 9.2.8 跳级(skip)结构    对CNN的结果做处理,得到了dense prediction,而作者在试验中发现,得到的分割结果比较粗糙,所以考虑加入更多前层的细节信息,也就是把倒数第几层的输出和最后的输出做一个fusion,实际上也就是加和: -![](img/ch9/figure_9.1.9_1.png) +![](/assets/ch9/figure_9.1.9_1.png)    实验表明,这样的分割结果更细致更准确。在逐层fusion的过程中,做到第三行再往下,结果又会变差,所以作者做到这里就停了。 @@ -175,39 +202,23 @@ Upsampling的操作可以看成是反卷积(deconvolutional),卷积运算的    *对于不同尺寸的输入图像,各层数据的尺寸(height,width)相应变化,深度(channel)不变。* -![](img/ch9/figure_9.1.10_1.png) - -   -(1)全卷积层部分进行特征提取, 提取卷积层(3个蓝色层)的输出来作为预测21个类别的特征。 +![](/assets/ch9/figure_9.1.10_1.png) -     -(2)图中虚线内是反卷积层的运算, 反卷积层(3个橙色层)可以把输入数据尺寸放大。和卷积层一样,升采样的具体参数经过训练确定。 - -     +  (1)全卷积层部分进行特征提取, 提取卷积层(3个蓝色层)的输出来作为预测21个类别的特征。
+  (2)图中虚线内是反卷积层的运算, 反卷积层(3个橙色层)可以把输入数据尺寸放大。和卷积层一样,升采样的具体参数经过训练确定。 1) 以经典的AlexNet分类网络为初始化。最后两级是全连接(红色),参数弃去不用。 - -![](img/ch9/figure_9.1.10_2.png) - -     + ![](/assets/ch9/figure_9.1.10_2.png) 2) 从特征小图()预测分割小图(),之后直接升采样为大图。 - -![](img/ch9/figure_9.1.10_3.png) - -
反卷积(橙色)的步长为32,这个网络称为FCN-32s
- -     + ![](/assets/ch9/figure_9.1.10_3.png) + 反卷积(橙色)的步长为32,这个网络称为FCN-32s 3) 升采样分为两次完成(橙色×2), 在第二次升采样前,把第4个pooling层(绿色)的预测结果(蓝色)融合进来。使用跳级结构提升精确性。 - -![](img/ch9/figure_9.1.10_4.png) - -
第二次反卷积步长为16,这个网络称为FCN-16s
- -     + ![](/assets/ch9/figure_9.1.10_4.png) + 第二次反卷积步长为16,这个网络称为FCN-16s 4) 升采样分为三次完成(橙色×3), 进一步融合了第3个pooling层的预测结果。 -![](img/ch9/figure_9.1.10_5.png) +![](/assets/ch9/figure_9.1.10_5.png) -
第三次反卷积步长为8,记为FCN-8s
+第三次反卷积步长为8,记为FCN-8s 其他参数:    minibatch:20张图片。 @@ -220,14 +231,15 @@ learning rate:0.001。    最后一层反卷积固定位bilinear插值不做学习。 -![](img/ch9/figure_9.1.10_6.png) +![](/assets/ch9/figure_9.1.10_6.png) ### 9.2.10 FCN缺点    (1)得到的结果还是不够精细。进行8倍上采样虽然比32倍的效果好了很多,但是上采样的结果还是比较模糊和平滑,对图像中的细节不敏感。    -(2)对各个像素进行分类,没有充分考虑像素与像素之间的关系。忽略了在通常的基于像素分类的分割方法中使用的空间规整(spatial regularization)步骤,缺乏空间一致性。 +(2)对各个像素进行分类,没有充分考虑像素与像素之间的关系。忽略了在通常的基于像素分类的分割方法中使用的空间规整(spatial +regularization)步骤,缺乏空间一致性。 ## 9.3 U-Net @@ -238,22 +250,27 @@ learning rate:0.001。    但是,这个方法也有两个很明显缺点。    -第一,它很慢,因为这个网络必须训练每个patch,并且因为patch间的重叠有很多的冗余(冗余会造成什么影响呢?卷积核里面的W,就是提取特征的权重,两个块如果重叠的部分太多,这个权重会被同一些特征训练两次,造成资源的浪费,减慢训练时间和效率,虽然说会有一些冗余,训练集大了,准确率不就高了吗?可是你这个是相同的图片啊,重叠的东西都是相同的,举个例子,我用一张相同的图片训练20次,按照这个意思也是增大了训练集啊,可是会出现什么结果呢,很显然,会导致过拟合,也就是对你这个图片识别很准,别的图片就不一定了)。 +第一,它很慢,因为这个网络必须训练每个patch,并且因为patch间的重叠有很多的冗余( +冗余会造成什么影响呢?卷积核里面的W,就是提取特征的权重,两个块如果重叠的部分太多,这个权重会被同一些特征训练两次,造成资源的浪费,减慢训练时间和效率,虽然说会有一些冗余,训练集大了,准确率不就高了吗?可是你这个是相同的图片啊,重叠的东西都是相同的,举个例子,我用一张相同的图片训练20次,按照这个意思也是增大了训练集啊,可是会出现什么结果呢,很显然,会导致过拟合,也就是对你这个图片识别很准,别的图片就不一定了)。    -第二,定位准确性和获取上下文信息不可兼得。大的patches需要更多的max-pooling层这样减小了定位准确性(为什么?因为你是对以这个像素为中心的点进行分类,如果patch太大,最后经过全连接层的前一层大小肯定是不变的,如果你patch大就需要更多的pooling达到这个大小,而pooling层越多,丢失信息的信息也越多;小的patches只能看到很小的局部信息,包含的背景信息不够。 +第二,定位准确性和获取上下文信息不可兼得。大的patches需要更多的max-pooling层这样减小了定位准确性( +为什么?因为你是对以这个像素为中心的点进行分类,如果patch太大,最后经过全连接层的前一层大小肯定是不变的,如果你patch大就需要更多的pooling达到这个大小,而pooling层越多,丢失信息的信息也越多;小的patches只能看到很小的局部信息,包含的背景信息不够。    这篇论文建立了一个更好全卷积方法。我们定义和扩展了这个方法它使用更少的训练图片但产生更精确的分割。 -![](img/ch9/figure_9.2_1.png) +![](/assets/ch9/figure_9.2_1.png)    -(1) 使用全卷积神经网络。(全卷积神经网络就是卷积取代了全连接层,全连接层必须固定图像大小而卷积不用,所以这个策略使得,你可以输入任意尺寸的图片,而且输出也是图片,所以这是一个端到端的网络。) +(1) 使用全卷积神经网络。( +全卷积神经网络就是卷积取代了全连接层,全连接层必须固定图像大小而卷积不用,所以这个策略使得,你可以输入任意尺寸的图片,而且输出也是图片,所以这是一个端到端的网络。)    -(2) 左边的网络是收缩路径:使用卷积和maxpooling。 +(2) 左边的网络是收缩路径:使用卷积和maxpooling。    -(3) 右边的网络是扩张路径:使用上采样产生的特征图与左侧收缩路径对应层产生的特征图进行concatenate操作。(pooling层会丢失图像信息和降低图像分辨率且是不可逆的操作,对图像分割任务有一些影响,对图像分类任务的影响不大,为什么要做上采样?因为上采样可以补足一些图片的信息,但是信息补充的肯定不完全,所以还需要与左边的分辨率比较高的图片相连接起来(直接复制过来再裁剪到与上采样图片一样大小),这就相当于在高分辨率和更抽象特征当中做一个折衷,因为随着卷积次数增多,提取的特征也更加有效,更加抽象,上采样的图片是经历多次卷积后的图片,肯定是比较高效和抽象的图片,然后把它与左边不怎么抽象但更高分辨率的特征图片进行连接)。 +(3) 右边的网络是扩张路径: +使用上采样产生的特征图与左侧收缩路径对应层产生的特征图进行concatenate操作。(pooling层会丢失图像信息和降低图像分辨率且是不可逆的操作,对图像分割任务有一些影响,对图像分类任务的影响不大,为什么要做上采样?因为上采样可以补足一些图片的信息,但是信息补充的肯定不完全,所以还需要与左边的分辨率比较高的图片相连接起来(直接复制过来再裁剪到与上采样图片一样大小),这就相当于在高分辨率和更抽象特征当中做一个折衷,因为随着卷积次数增多,提取的特征也更加有效,更加抽象,上采样的图片是经历多次卷积后的图片,肯定是比较高效和抽象的图片,然后把它与左边不怎么抽象但更高分辨率的特征图片进行连接)。    -(4) 最后再经过两次反卷积操作,生成特征图,再用两个1X1的卷积做分类得到最后的两张heatmap,例如第一张表示的是第一类的得分,第二张表示第二类的得分heatmap,然后作为softmax函数的输入,算出概率比较大的softmax类,选择它作为输入给交叉熵进行反向传播训练。 +(4) +最后再经过两次反卷积操作,生成特征图,再用两个1X1的卷积做分类得到最后的两张heatmap,例如第一张表示的是第一类的得分,第二张表示第二类的得分heatmap,然后作为softmax函数的输入,算出概率比较大的softmax类,选择它作为输入给交叉熵进行反向传播训练。 下面是U-Net模型的代码实现:(贡献者:黄钦建-华南理工大学) @@ -328,6 +345,7 @@ def get_unet(): ``` ## 9.4 SegNet +    可训练的图像分割引擎,包含一个encoder网络,一个对应的decoder网络,衔接像素级分类层,解码网络与VGG16的13层卷积层相同。解码网络是将低分辨率的编码特征图映射到全分辨率的特征图。解码网络使用最大池化层的池化索引进行非线性上采样,上采样过程就不需要学习。上采样得到的稀疏图与可训练的滤波器卷积得到致密的特征图。    @@ -341,7 +359,7 @@ def get_unet():    SegNet网络的结构如下图所示: -![](img/ch9/figure_9.3_1.jpg) +![](/assets/ch9/figure_9.3_1.jpg)    SegNet网络结构如图1所示,Input为输入图片,Output为输出分割的图像,不同颜色代表不同的分类。语义分割的重要性就在于不仅告诉你图片中某个东西是什么,而且告知你他在图片的位置。我们可以看到是一个对称网络,由中间绿色pooling层与红色upsampling层作为分割,左边是卷积提取高维特征,并通过pooling使图片变小,SegNet作者称为Encoder,右边是反卷积(在这里反卷积与卷积没有区别)与upsampling,通过反卷积使得图像分类后特征得以重现,upsampling使图像变大,SegNet作者称为Decoder,最后通过Softmax,输出不同分类的最大值。这就是大致的SegNet过程,下面对这个过程里面使用到的方法进行介绍。 @@ -350,17 +368,23 @@ SegNet网络结构如图1所示,Input为输入图片,Output为输出分割    SegNet解码技术如下图所示: -![](img/ch9/figure_9.3_2.jpg) +![](/assets/ch9/figure_9.3_2.jpg)    -解码网络使用保存的最大池化索引上采样,得到稀疏的特征图,将特征图与可训练的解码滤波器族卷积得到致密的特征图。之后进行BN。高维的特征图输入soft-max层,对每个像素进行分类,得到每个像素属于K类的概率。 图3中右边是FCN的解码技术,FCN对编码的特征图进行降维,降维后输入到解码网络,解码网络中,上采样使用反卷积实现,上采样的特征图与降维的编码图进行element-wise add得到最终的解码特征图。FCN解码模型需要存储编码特征图,在嵌入式设备中内存紧张。 +解码网络使用保存的最大池化索引上采样,得到稀疏的特征图,将特征图与可训练的解码滤波器族卷积得到致密的特征图。之后进行BN。高维的特征图输入soft-max层,对每个像素进行分类,得到每个像素属于K类的概率。 +图3中右边是FCN的解码技术,FCN对编码的特征图进行降维,降维后输入到解码网络,解码网络中,上采样使用反卷积实现,上采样的特征图与降维的编码图进行element-wise +add得到最终的解码特征图。FCN解码模型需要存储编码特征图,在嵌入式设备中内存紧张。    -SegNet的Encoder过程中,卷积的作用是提取特征,SegNet使用的卷积为same卷积(详见卷积神经网络CNN(1)),即卷积后不改变图片大小;在Decoder过程中,同样使用same卷积,不过卷积的作用是为upsampling变大的图像丰富信息,使得在Pooling过程丢失的信息可以通过学习在Decoder得到。SegNet中的卷积与传统CNN的卷积并没有区别。 +SegNet的Encoder过程中,卷积的作用是提取特征,SegNet使用的卷积为same卷积(详见卷积神经网络CNN(1)) +,即卷积后不改变图片大小;在Decoder过程中,同样使用same卷积,不过卷积的作用是为upsampling变大的图像丰富信息,使得在Pooling过程丢失的信息可以通过学习在Decoder得到。SegNet中的卷积与传统CNN的卷积并没有区别。 ## 9.5 空洞卷积(Dilated Convolutions)    -在图像分割领域,图像输入到CNN(典型的网络比如FCN[3])中,FCN先像传统的CNN那样对图像做卷积再pooling,降低图像尺寸的同时增大感受野,但是由于图像分割预测是pixel-wise的输出,所以要将pooling后较小的图像尺寸upsampling到原始的图像尺寸进行预测(upsampling一般采用deconv反卷积操作,deconv可参见知乎答案如何理解深度学习中的deconvolution networks?),之前的pooling操作使得每个pixel预测都能看到较大感受野信息。因此图像分割FCN中有两个关键,一个是pooling减小图像尺寸增大感受野,另一个是upsampling扩大图像尺寸。在先减小再增大尺寸的过程中,肯定有一些信息损失掉了,那么能不能设计一种新的操作,不通过pooling也能有较大的感受野看到更多的信息呢?答案就是dilated conv。 +在图像分割领域,图像输入到CNN(典型的网络比如FCN[3] +)中,FCN先像传统的CNN那样对图像做卷积再pooling,降低图像尺寸的同时增大感受野,但是由于图像分割预测是pixel-wise的输出,所以要将pooling后较小的图像尺寸upsampling到原始的图像尺寸进行预测(upsampling一般采用deconv反卷积操作,deconv可参见知乎答案如何理解深度学习中的deconvolution +networks?),之前的pooling操作使得每个pixel预测都能看到较大感受野信息。因此图像分割FCN中有两个关键,一个是pooling减小图像尺寸增大感受野,另一个是upsampling扩大图像尺寸。在先减小再增大尺寸的过程中,肯定有一些信息损失掉了,那么能不能设计一种新的操作,不通过pooling也能有较大的感受野看到更多的信息呢?答案就是dilated +conv。    以前的CNN主要问题总结:    @@ -372,18 +396,25 @@ SegNet的Encoder过程中,卷积的作用是提取特征,SegNet使用的卷    举例如下: -![](img/ch9/figure_9.3_3.png) +![](/assets/ch9/figure_9.3_3.png) -
Dilated Convolution with a 3 x 3 kernel and dilation rate 2
+Dilated Convolution with a 3 x 3 kernel and dilation rate 2    下面看一下dilated conv原始论文[4]中的示意图 -![](img/ch9/figure_9.3_4.jpg) +![](/assets/ch9/figure_9.3_4.jpg)    -(a) 图对应3x3的1-dilated conv,和普通的卷积操作一样,(b)图对应3x3的2-dilated conv,实际的卷积kernel size还是3x3,但是空洞为1,也就是对于一个7x7的图像patch,只有9个红色的点和3x3的kernel发生卷积操作,其余的点略过。也可以理解为kernel的size为7x7,但是只有图中的9个点的权重不为0,其余都为0。 可以看到虽然kernel size只有3x3,但是这个卷积的感受野已经增大到了7x7(如果考虑到这个2-dilated conv的前一层是一个1-dilated conv的话,那么每个红点就是1-dilated的卷积输出,所以感受野为3x3,所以1-dilated和2-dilated合起来就能达到7x7的conv),(c)图是4-dilated conv操作,同理跟在两个1-dilated和2-dilated conv的后面,能达到15x15的感受野。对比传统的conv操作,3层3x3的卷积加起来,stride为1的话,只能达到(kernel-1) * layer+1=7的感受野,也就是和层数layer成线性关系,而dilated conv的感受野是指数级的增长。 +(a) 图对应3x3的1-dilated conv,和普通的卷积操作一样,(b)图对应3x3的2-dilated conv,实际的卷积kernel +size还是3x3,但是空洞为1,也就是对于一个7x7的图像patch,只有9个红色的点和3x3的kernel发生卷积操作,其余的点略过。也可以理解为kernel的size为7x7,但是只有图中的9个点的权重不为0,其余都为0。 +可以看到虽然kernel size只有3x3,但是这个卷积的感受野已经增大到了7x7(如果考虑到这个2-dilated conv的前一层是一个1-dilated +conv的话,那么每个红点就是1-dilated的卷积输出,所以感受野为3x3,所以1-dilated和2-dilated合起来就能达到7x7的conv),(c) +图是4-dilated conv操作,同理跟在两个1-dilated和2-dilated +conv的后面,能达到15x15的感受野。对比传统的conv操作,3层3x3的卷积加起来,stride为1的话,只能达到(kernel-1) * +layer+1=7的感受野,也就是和层数layer成线性关系,而dilated conv的感受野是指数级的增长。    -dilated的好处是不做pooling损失信息的情况下,加大了感受野,让每个卷积输出都包含较大范围的信息。在图像需要全局信息或者语音文本需要较长的sequence信息依赖的问题中,都能很好的应用dilated conv,比如图像分割、语音合成WaveNet、机器翻译ByteNet中。 +dilated的好处是不做pooling损失信息的情况下,加大了感受野,让每个卷积输出都包含较大范围的信息。在图像需要全局信息或者语音文本需要较长的sequence信息依赖的问题中,都能很好的应用dilated +conv,比如图像分割、语音合成WaveNet、机器翻译ByteNet中。 ## 9.6 RefineNet @@ -392,26 +423,33 @@ dilated的好处是不做pooling损失信息的情况下,加大了感受野,    RefineNet block的作用就是把不同resolution level的feature map进行融合。网络结构如下: -![](img/ch9/figure_9.4_1.png) +![](/assets/ch9/figure_9.4_1.png)    -最左边一栏就是FCN的encoder部分(文中是用的ResNet),先把pretrained ResNet按feature map的分辨率分成四个ResNet blocks,然后向右把四个blocks分别作为4个path通过RefineNet block进行融合refine,最后得到一个refined feature map(接softmax再双线性插值输出)。 -注意除了RefineNet-4,所有的RefineNet block都是二输入的,用于融合不同level做refine,而单输入的RefineNet-4可以看作是先对ResNet的一个task adaptation。 +最左边一栏就是FCN的encoder部分(文中是用的ResNet),先把pretrained ResNet按feature map的分辨率分成四个ResNet +blocks,然后向右把四个blocks分别作为4个path通过RefineNet block进行融合refine,最后得到一个refined feature map( +接softmax再双线性插值输出)。 +注意除了RefineNet-4,所有的RefineNet block都是二输入的,用于融合不同level做refine,而单输入的RefineNet-4可以看作是先对ResNet的一个task +adaptation。    **RefineNet Block**    -接下来仔细看一下RefineNet block,可以看到主要组成部分是Residual convolution unit, Multi-resolution fusion, Chained residual pooling, Output convolutions. 切记这个block作用是融合多个level的feature map输出单个level的feature map,但具体的实现应该是和输入个数、shape无关的。 +接下来仔细看一下RefineNet block,可以看到主要组成部分是Residual convolution unit, Multi-resolution fusion, Chained +residual pooling, Output convolutions. 切记这个block作用是融合多个level的feature map输出单个level的feature +map,但具体的实现应该是和输入个数、shape无关的。 -![](img/ch9/figure_9.4_2.png) +![](/assets/ch9/figure_9.4_2.png)    -Residual convolution unit就是普通的去除了BN的residual unit; +Residual convolution unit就是普通的去除了BN的residual unit;    -Multi-resolution fusion是先对多输入的feature map都用一个卷积层进行adaptation(都化到最小的feature map的shape),再上采样再做element-wise的相加。注意如果是像RefineNet-4那样的单输入block这一部分就直接pass了; +Multi-resolution fusion是先对多输入的feature map都用一个卷积层进行adaptation(都化到最小的feature map的shape) +,再上采样再做element-wise的相加。注意如果是像RefineNet-4那样的单输入block这一部分就直接pass了;    -Chained residual pooling中的ReLU对接下来池化的有效性很重要,还可以使模型对学习率的变化没这么敏感。这个链式结构能从很大范围区域上获取背景context。另外,这个结构中大量使用了identity mapping这样的连接,无论长距离或者短距离的,这样的结构允许梯度从一个block直接向其他任一block传播。 +Chained residual pooling中的ReLU对接下来池化的有效性很重要,还可以使模型对学习率的变化没这么敏感。这个链式结构能从很大范围区域上获取背景context。另外,这个结构中大量使用了identity +mapping这样的连接,无论长距离或者短距离的,这样的结构允许梯度从一个block直接向其他任一block传播。    Output convolutions就是输出前再加一个RCU。 @@ -419,42 +457,44 @@ Output convolutions就是输出前再加一个RCU。 ## 9.7 PSPNet    -场景解析对于无限制的开放词汇和不同场景来说是具有挑战性的.本文使用文中的pyramid pooling module实现基于不同区域的上下文集成,提出了PSPNet,实现利用上下文信息的能力进行场景解析。 +场景解析对于无限制的开放词汇和不同场景来说是具有挑战性的.本文使用文中的pyramid pooling +module实现基于不同区域的上下文集成,提出了PSPNet,实现利用上下文信息的能力进行场景解析。    作者认为,FCN存在的主要问题是没有采取合适的策略来用全局的信息,本文的做法就是借鉴SPPNet来设计了PSPNet解决这个问题。    很多State-of-the-art的场景解析框架都是基于FCN的.基于CNN的方法能够增强动态物体的理解,但是在无限制词汇和不同场景中仍然面临挑战.举个例子,如下图. -![](img/ch9/figure_9.6_1.png) +![](/assets/ch9/figure_9.6_1.png)    -FCN认为右侧框中是汽车,但是实际上是船,如果参考上下文的先验知识,就会发现左边是一个船屋,进而推断是框中是船.FCN存在的主要问题就是不能利用好全局的场景线索。 +FCN认为右侧框中是汽车,但是实际上是船,如果参考上下文的先验知识,就会发现左边是一个船屋,进而推断是框中是船.FCN存在的主要问题就是不能利用好全局的场景线索。    -对于尤其复杂的场景理解,之前都是采用空间金字塔池化来做的,和之前方法不同(为什么不同,需要参考一下经典的金字塔算法),本文提出了pyramid scene parsing network(PSPNet)。 +对于尤其复杂的场景理解,之前都是采用空间金字塔池化来做的,和之前方法不同(为什么不同,需要参考一下经典的金字塔算法),本文提出了pyramid +scene parsing network(PSPNet)。    本文的主要贡献如下:    -(1) 提出了PSPNet在基于FCN的框架中集成困难的上下文特征 +(1) 提出了PSPNet在基于FCN的框架中集成困难的上下文特征    -(2) 通过基于深度监督误差开发了针对ResNet的高效优化策略 +(2) 通过基于深度监督误差开发了针对ResNet的高效优化策略    -(3) 构建了一个用于state-of-the-art的场景解析和语义分割的实践系统(具体是什么?) +(3) 构建了一个用于state-of-the-art的场景解析和语义分割的实践系统(具体是什么?)    通过观察FCN的结果,发现了如下问题:    -(1) 关系不匹配(Mismatched Relationship) +(1) 关系不匹配(Mismatched Relationship)    -(2) 易混淆的类别(Confusion Categories) +(2) 易混淆的类别(Confusion Categories)    -(3) 不显眼的类别(Inconspicuous Classes) +(3) 不显眼的类别(Inconspicuous Classes)    总结以上结果发现,以上问题部分或者全部与上下文关系和全局信息有关系,因此本文提出了PSPNet.框架如下: -![](img/ch9/figure_9.6_2.png) +![](/assets/ch9/figure_9.6_2.png)    并且加入额外的深度监督 Loss -![](img/ch9/figure_9.6_3.png) +![](/assets/ch9/figure_9.6_3.png) ## 9.8 DeepLab系列 @@ -463,32 +503,41 @@ FCN认为右侧框中是汽车,但是实际上是船,如果参考上下文    DeepLab 是结合了深度卷积神经网络(DCNNs)和概率图模型(DenseCRFs)的方法。    -在实验中发现 DCNNs 做语义分割时精准度不够的问题,根本原因是 DCNNs 的高级特征的平移不变性,即高层次特征映射,根源于重复的池化和下采样。 +在实验中发现 DCNNs 做语义分割时精准度不够的问题,根本原因是 DCNNs +的高级特征的平移不变性,即高层次特征映射,根源于重复的池化和下采样。    针对信号下采样或池化降低分辨率,DeepLab 是采用的 atrous(带孔)算法扩展感受野,获取更多的上下文信息。    -分类器获取以对象中心的决策是需要空间变换的不变性,这天然地限制了 DCNN 的定位精度,DeepLab 采用完全连接的条件随机场(CRF)提高模型捕获细节的能力。 +分类器获取以对象中心的决策是需要空间变换的不变性,这天然地限制了 DCNN 的定位精度,DeepLab +采用完全连接的条件随机场(CRF)提高模型捕获细节的能力。    -除空洞卷积和 CRFs 之外,论文使用的 tricks 还有 Multi-Scale features。其实就是 U-Net 和 FPN 的思想,在输入图像和前四个最大池化层的输出上附加了两层的 MLP,第一层是 128 个 3×3 卷积,第二层是 128 个 1×1 卷积。最终输出的特征与主干网的最后一层特征图融合,特征图增加 5×128=640 个通道。 +除空洞卷积和 CRFs 之外,论文使用的 tricks 还有 Multi-Scale features。其实就是 U-Net 和 FPN 的思想,在输入图像和前四个最大池化层的输出上附加了两层的 +MLP,第一层是 128 个 3×3 卷积,第二层是 128 个 1×1 卷积。最终输出的特征与主干网的最后一层特征图融合,特征图增加 5×128=640 +个通道。    实验表示多尺度有助于提升预测结果,但是效果不如 CRF 明显。    -论文模型基于 VGG16,在 Titan GPU 上运行速度达到了 8FPS,全连接 CRF 平均推断需要 0.5s ,在 PASCAL VOC-2012 达到 71.6% IOU accuracy。 +论文模型基于 VGG16,在 Titan GPU 上运行速度达到了 8FPS,全连接 CRF 平均推断需要 0.5s ,在 PASCAL VOC-2012 达到 71.6% IOU +accuracy。 ### 9.8.2 DeepLabv2    -DeepLabv2 是相对于 DeepLabv1 基础上的优化。DeepLabv1 在三个方向努力解决,但是问题依然存在:特征分辨率的降低、物体存在多尺度,DCNN 的平移不变性。 +DeepLabv2 是相对于 DeepLabv1 基础上的优化。DeepLabv1 在三个方向努力解决,但是问题依然存在:特征分辨率的降低、物体存在多尺度,DCNN +的平移不变性。    -因 DCNN 连续池化和下采样造成分辨率降低,DeepLabv2 在最后几个最大池化层中去除下采样,取而代之的是使用空洞卷积,以更高的采样密度计算特征映射。 +因 DCNN 连续池化和下采样造成分辨率降低,DeepLabv2 +在最后几个最大池化层中去除下采样,取而代之的是使用空洞卷积,以更高的采样密度计算特征映射。    物体存在多尺度的问题,DeepLabv1 中是用多个 MLP 结合多尺度特征解决,虽然可以提供系统的性能,但是增加特征计算量和存储空间。    -论文受到 Spatial Pyramid Pooling (SPP) 的启发,提出了一个类似的结构,在给定的输入上以不同采样率的空洞卷积并行采样,相当于以多个比例捕捉图像的上下文,称为 ASPP (atrous spatial pyramid pooling) 模块。 +论文受到 Spatial Pyramid Pooling (SPP) 的启发,提出了一个类似的结构,在给定的输入上以不同采样率的空洞卷积并行采样,相当于以多个比例捕捉图像的上下文,称为 +ASPP (atrous spatial pyramid pooling) 模块。    DCNN 的分类不变形影响空间精度。DeepLabv2 是采样全连接的 CRF 在增强模型捕捉细节的能力。    -论文模型基于 ResNet,在 NVidia Titan X GPU 上运行速度达到了 8FPS,全连接 CRF 平均推断需要 0.5s ,在耗时方面和 DeepLabv1 无差异,但在 PASCAL VOC-2012 达到 79.7 mIOU。 +论文模型基于 ResNet,在 NVidia Titan X GPU 上运行速度达到了 8FPS,全连接 CRF 平均推断需要 0.5s ,在耗时方面和 DeepLabv1 +无差异,但在 PASCAL VOC-2012 达到 79.7 mIOU。 ### 9.8.3 DeepLabv3 @@ -497,7 +546,7 @@ DCNN 的分类不变形影响空间精度。DeepLabv2 是采样全连接的 CRF    DeepLabv3 论文比较了多种捕获多尺度信息的方式: -![](img/ch9/figure_9.6_4.png) +![](/assets/ch9/figure_9.6_4.png)    1.Image Pyramid:将输入图片放缩成不同比例,分别应用在 DCNN 上,将预测结果融合得到最终输出。 @@ -508,9 +557,11 @@ DeepLabv3 论文比较了多种捕获多尺度信息的方式:    4.Spatial Pyramid Pooling:空间金字塔池化具有不同采样率和多种视野的卷积核,能够以多尺度捕捉对象。    -DeepLabv1-v2 都是使用带孔卷积提取密集特征来进行语义分割。但是为了解决分割对象的多尺度问题,DeepLabv3 设计采用多比例的带孔卷积级联或并行来捕获多尺度背景。 +DeepLabv1-v2 都是使用带孔卷积提取密集特征来进行语义分割。但是为了解决分割对象的多尺度问题,DeepLabv3 +设计采用多比例的带孔卷积级联或并行来捕获多尺度背景。    -此外,DeepLabv3 将修改之前提出的带孔空间金字塔池化模块,该模块用于探索多尺度卷积特征,将全局背景基于图像层次进行编码获得特征,取得 state-of-art 性能,在 PASCAL VOC-2012 达到 86.9 mIOU。 +此外,DeepLabv3 将修改之前提出的带孔空间金字塔池化模块,该模块用于探索多尺度卷积特征,将全局背景基于图像层次进行编码获得特征,取得 +state-of-art 性能,在 PASCAL VOC-2012 达到 86.9 mIOU。 ### 9.8.4 DeepLabv3+ @@ -523,11 +574,13 @@ DeepLabv1-v2 都是使用带孔卷积提取密集特征来进行语义分割。    deeplab V3新设计的aspp结构解决了问题1,deeplab v3+主要目的在于解决问题2。    -问题2 可以使用空洞卷积替代更多的pooling层来获取分辨率更高的feature。但是feature分辨率更高会极大增加运算量。以deeplab v3使用的resnet101为例,stride=16将造成后面9层feature变大,后面9层的计算量变为原来的2*2=4倍大。stride=8则更为恐怖,后面78层的计算量都会变大很多。 +问题2 可以使用空洞卷积替代更多的pooling层来获取分辨率更高的feature。但是feature分辨率更高会极大增加运算量。以deeplab +v3使用的resnet101为例,stride=16将造成后面9层feature变大,后面9层的计算量变为原来的2* +2=4倍大。stride=8则更为恐怖,后面78层的计算量都会变大很多。    解决方案:1、编解码器结构;2 Modified Aligned Xception -![](img/ch9/figure_9.6_5.png) +![](/assets/ch9/figure_9.6_5.png)    在deeplabv3基础上加入解码器。A是aspp结构,其中8x的上采样可以看做是一个解码器。B是编解码结构,它集合了高层和底层的特征。C就是本文采取的结构。 @@ -536,20 +589,25 @@ deeplab V3新设计的aspp结构解决了问题1,deeplab v3+主要目的在于    (1)Encoder-Decoder with Atrous Convolution -![](img/ch9/figure_9.6_6.png) +![](/assets/ch9/figure_9.6_6.png)    编码器采用deeplabv3。    -解码器部分:先从低层级选一个feature,将低层级的feature用1 * 1的卷积进行通道压缩(原本为256通道,或者512通道),目的在于减少低层级的比重。作者认为编码器得到的feature具有更丰富的信息,所以编码器的feature应该有更高的比重。 这样做有利于训练。 +解码器部分:先从低层级选一个feature,将低层级的feature用1 * +1的卷积进行通道压缩(原本为256通道,或者512通道),目的在于减少低层级的比重。作者认为编码器得到的feature具有更丰富的信息,所以编码器的feature应该有更高的比重。 +这样做有利于训练。    -再将编码器的输出上采样,使其分辨率与低层级feature一致。举个例子,如果采用resnet conv2 输出的feature,则这里要* 4上采样。将两种feature连接后,再进行一次3 * 3的卷积(细化作用),然后再次上采样就得到了像素级的预测。后面的实验结果表明这种结构在 stride=16 时既有很高的精度速度又很快。stride=8相对来说只获得了一点点精度的提升,但增加了很多的计算量。 +再将编码器的输出上采样,使其分辨率与低层级feature一致。举个例子,如果采用resnet conv2 输出的feature,则这里要* +4上采样。将两种feature连接后,再进行一次3 * 3的卷积(细化作用),然后再次上采样就得到了像素级的预测。后面的实验结果表明这种结构在 +stride=16 时既有很高的精度速度又很快。stride=8相对来说只获得了一点点精度的提升,但增加了很多的计算量。    (2)Modified Aligned Xception    -Xception主要采用了deepwish seperable convolution来替换原来的卷积层。简单的说就是这种结构能在更少参数更少计算量的情况下学到同样的信息。这边则是考虑将原来的resnet-101骨架网换成xception。 +Xception主要采用了deepwish seperable +convolution来替换原来的卷积层。简单的说就是这种结构能在更少参数更少计算量的情况下学到同样的信息。这边则是考虑将原来的resnet-101骨架网换成xception。 -![](img/ch9/figure_9.6_7.png) +![](/assets/ch9/figure_9.6_7.png)    **红色部分为修改** @@ -561,8 +619,10 @@ Xception主要采用了deepwish seperable convolution来替换原来的卷积层 额外的RELU层和归一化操作添加在每个 3 × 3 depthwise convolution之后(原来只在1 * 1卷积之后) ## 9.9 Mask-R-CNN + ### 9.9.1 Mask-RCNN 的网络结构示意图 -![](img/ch9/figure_9.8_1.png) + +![](/assets/ch9/figure_9.8_1.png)    其中黑色部分为原来的Faster-RCNN,红色部分为在Faster网络上的修改: @@ -586,9 +646,10 @@ Xception主要采用了deepwish seperable convolution来替换原来的卷积层    来看下后面两种RCNN方法与Mask结合的示意图: -![](img/ch9/figure_9.8_2.png) +![](/assets/ch9/figure_9.8_2.png)    -图中灰色部分是原来的RCNN结合ResNet or FPN的网络,下面黑色部分为新添加的并联Mask层,这个图本身与上面的图也没有什么区别,旨在说明作者所提出的Mask RCNN方法的泛化适应能力:可以和多种RCNN框架结合,表现都不错。 +图中灰色部分是原来的RCNN结合ResNet or FPN的网络,下面黑色部分为新添加的并联Mask层,这个图本身与上面的图也没有什么区别,旨在说明作者所提出的Mask +RCNN方法的泛化适应能力:可以和多种RCNN框架结合,表现都不错。 ### 9.9.3 Mask-RCNN 技术要点 @@ -599,7 +660,8 @@ Xception主要采用了deepwish seperable convolution来替换原来的卷积层    **2.技术要点2 - ROIAlign**    -采用ROIAlign替代RoiPooling(改进池化操作)。引入了一个插值过程,先通过双线性插值到14*14,再pooling到7*7,很大程度上解决了仅通过Pooling直接采样带来的Misalignment对齐问题。 +采用ROIAlign替代RoiPooling(改进池化操作)。引入了一个插值过程,先通过双线性插值到14*14,再pooling到7* +7,很大程度上解决了仅通过Pooling直接采样带来的Misalignment对齐问题。    PS: 虽然 Misalignment 在分类问题上影响并不大,但在 Pixel 级别的 Mask 上会存在较大误差。    @@ -616,23 +678,24 @@ $Lmask(Cls_k) = Sigmoid (Cls_k)$,平均二值交叉熵 (average binary cross    Why K个mask?通过对每个 Class 对应一个Mask可以有效避免类间竞争(其他Class不贡献Loss)。 -![](img/ch9/figure_9.8_3.png) +![](/assets/ch9/figure_9.8_3.png)    通过结果对比来看(Table2 b),也就是作者所说的 Decouple 解耦,要比多分类的Softmax效果好很多。    另外,作者给出了很多实验分割效果,就不都列了,只贴一张和FCIS的对比图(FCIS出现了Overlap的问题) -![](img/ch9/figure_9.8_4.png) +![](/assets/ch9/figure_9.8_4.png) ## 9.10 CNN在基于弱监督学习的图像分割中的应用    -答案来源:[CNN在基于弱监督学习的图像分割中的应用](https://zhuanlan.zhihu.com/p/23811946) +答案来源:[CNN在基于弱监督学习的图像分割中的应用](https://zhuanlan.zhihu.com/p/23811946)    最近基于深度学习的图像分割技术一般依赖于卷积神经网络CNN的训练,训练过程中需要非常大量的标记图像,即一般要求训练图像中都要有精确的分割结果。    -对于图像分割而言,要得到大量的完整标记过的图像非常困难,比如在ImageNet数据集上,有1400万张图有类别标记,有50万张图给出了bounding box,但是只有4460张图像有像素级别的分割结果。对训练图像中的每个像素做标记非常耗时,特别是对医学图像而言,完成对一个三维的CT或者MRI图像中各组织的标记过程需要数小时。 +对于图像分割而言,要得到大量的完整标记过的图像非常困难,比如在ImageNet数据集上,有1400万张图有类别标记,有50万张图给出了bounding +box,但是只有4460张图像有像素级别的分割结果。对训练图像中的每个像素做标记非常耗时,特别是对医学图像而言,完成对一个三维的CT或者MRI图像中各组织的标记过程需要数小时。    如果学习算法能通过对一些初略标记过的数据集的学习就能完成好的分割结果,那么对训练数据的标记过程就很简单,这可以大大降低花在训练数据标记上的时间。这些初略标记可以是:    @@ -649,11 +712,12 @@ Why K个mask?通过对每个 Class 对应一个Mask可以有效避免类间竞    香港中文大学的Di Lin提出了一个基于Scribble标记的弱监督学习方法。Scribble是一个很方便使用的标记方法,因此被用得比较广泛。如下图,只需要画五条线就能完成对一副图像的标记工作。 -![](img/ch9/figure_9.9_1.png) +![](/assets/ch9/figure_9.9_1.png)    -ScribbleSup分为两步,第一步将像素的类别信息从scribbles传播到其他未标记的像素,自动完成所有的训练图像的标记工作; 第二步使用这些标记图像训练CNN。在第一步中,该方法先生成super-pxels, 然后基于graph cut的方法对所有的super-pixel进行标记。 +ScribbleSup分为两步,第一步将像素的类别信息从scribbles传播到其他未标记的像素,自动完成所有的训练图像的标记工作; +第二步使用这些标记图像训练CNN。在第一步中,该方法先生成super-pxels, 然后基于graph cut的方法对所有的super-pixel进行标记。 -![](img/ch9/figure_9.9_2.png) +![](/assets/ch9/figure_9.9_2.png)    Graph Cut的能量函数为: @@ -663,25 +727,28 @@ $$ $$    -在这个graph中,每个super-pixel是graph中的一个节点,相接壤的super-pixel之间有一条连接的边。这个能量函数中的一元项包括两种情况,一个是来自于scribble的,一个是来自CNN对该super-pixel预测的概率。整个最优化过程实际上是求graph cut能量函数和CNN参数联合最优值的过程: +在这个graph中,每个super-pixel是graph中的一个节点,相接壤的super-pixel之间有一条连接的边。这个能量函数中的一元项包括两种情况,一个是来自于scribble的,一个是来自CNN对该super-pixel预测的概率。整个最优化过程实际上是求graph +cut能量函数和CNN参数联合最优值的过程: $$ -\sum_{i}\psi _i^{scr}\left(y_i|X,S\right)+\sum _i-logP\left(y_i| X,\theta\right)+\sum_{i,j}\psi _{ij}\left(y_i,y_j|X\right) +\sum_{i}\psi _i^{scr}\left(y_i|X,S\right)+\sum _i-logP\left(y_i| X,\theta\right)+\sum_{i,j}\psi _{ij}\left( +y_i,y_j|X\right) $$    上式的最优化是通过交替求 $Y$ 和 $\theta$ 的最优值来实现的。文章中发现通过三次迭代就能得到比较好的结果。 -![](img/ch9/figure_9.9_3.png) +![](/assets/ch9/figure_9.9_3.png) ### 9.10.2 图像级别标记    论文地址:[Constrained Convolutional Neural Networks for Weakly Supervised Segmentation (ICCV 2015)](https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/Pathak_Constrained_Convolutional_Neural_ICCV_2015_paper.pdf)    -UC Berkeley的Deepak Pathak使用了一个具有图像级别标记的训练数据来做弱监督学习。训练数据中只给出图像中包含某种物体,但是没有其位置信息和所包含的像素信息。该文章的方法将image tags转化为对CNN输出的label分布的限制条件,因此称为 Constrained convolutional neural network (CCNN). +UC Berkeley的Deepak Pathak使用了一个具有图像级别标记的训练数据来做弱监督学习。训练数据中只给出图像中包含某种物体,但是没有其位置信息和所包含的像素信息。该文章的方法将image +tags转化为对CNN输出的label分布的限制条件,因此称为 Constrained convolutional neural network (CCNN). -![](img/ch9/figure_9.9_4.png) +![](/assets/ch9/figure_9.9_4.png)    该方法把训练过程看作是有线性限制条件的最优化过程: @@ -692,47 +759,57 @@ subject\to\qquad A\overrightarrow{P} \geqslant \overrightarrow{b},\sum_{X}^{ }P( $$    -其中的线性限制条件来自于训练数据上的标记,例如一幅图像中前景类别像素个数期望值的上界或者下界(物体大小)、某个类别的像素个数在某图像中为0,或者至少为1等。该目标函数可以转化为为一个loss function,然后通过SGD进行训练。 +其中的线性限制条件来自于训练数据上的标记,例如一幅图像中前景类别像素个数期望值的上界或者下界(物体大小)、某个类别的像素个数在某图像中为0,或者至少为1等。该目标函数可以转化为为一个loss +function,然后通过SGD进行训练。 -![](img/ch9/figure_9.9_5.png) +![](/assets/ch9/figure_9.9_5.png)    -实验中发现单纯使用Image tags作为限制条件得到的分割结果还比较差,在PASCAL VOC 2012 test数据集上得到的mIoU为35.6%,加上物体大小的限制条件后能达到45.1%,如果再使用bounding box做限制,可以达到54%。FCN-8s可以达到62.2%,可见弱监督学习要取得好的结果还是比较难。 +实验中发现单纯使用Image tags作为限制条件得到的分割结果还比较差,在PASCAL VOC 2012 +test数据集上得到的mIoU为35.6%,加上物体大小的限制条件后能达到45.1%,如果再使用bounding +box做限制,可以达到54%。FCN-8s可以达到62.2%,可见弱监督学习要取得好的结果还是比较难。 ### 9.10.3 DeepLab+bounding box+image-level labels**    论文地址:[Weakly-and Semi-Supervised Learning of a DCNN for Semantic Image Segmentation](https://arxiv.org/pdf/1502.02734.pdf)    -Google的George Papandreou 和UCLA的Liang-Chieh Chen等在DeepLab的基础上进一步研究了使用bounding box和image-level labels作为标记的训练数据。使用了期望值最大化算法(EM)来估计未标记的像素的类别和CNN的参数。 +Google的George Papandreou 和UCLA的Liang-Chieh Chen等在DeepLab的基础上进一步研究了使用bounding box和image-level +labels作为标记的训练数据。使用了期望值最大化算法(EM)来估计未标记的像素的类别和CNN的参数。 -![](img/ch9/figure_9.9_6.png) +![](/assets/ch9/figure_9.9_6.png)    对于image-level标记的数据,我们可以观测到图像的像素值和图像级别的标记 ,但是不知道每个像素的标号,因此把$y$当做隐变量。使用如下的概率图模式: $$ -P\left ( x,y,z;\theta \right ) = P\left ( x \right )\left (\prod_{m=1}^{M} P\left ( y_m|x;\theta \right )\right )P\left ( z|y \right ) +P\left ( x,y,z;\theta \right ) = P\left ( x \right )\left (\prod_{m=1}^{M} P\left ( y_m|x;\theta \right )\right ) +P\left ( z|y \right ) $$    这篇论文是通过EM算法来学习模型的参数$\theta$,具体推导过程可参考原论文。 -![](img/ch9/figure_9.9_7.png) +![](/assets/ch9/figure_9.9_7.png)    -对于给出bounding box标记的训练图像,该方法先使用CRF对该训练图像做自动分割,然后在分割的基础上做全监督学习。通过实验发现,单纯使用图像级别的标记得到的分割效果较差,但是使用bounding box的训练数据可以得到较好的结果,在VOC2012 test数据集上得到mIoU 62.2%。另外如果使用少量的全标记图像和大量的弱标记图像进行结合,可以得到与全监督学习(70.3%)接近的分割结果(69.0%)。 +对于给出bounding box标记的训练图像,该方法先使用CRF对该训练图像做自动分割,然后在分割的基础上做全监督学习。通过实验发现,单纯使用图像级别的标记得到的分割效果较差,但是使用bounding +box的训练数据可以得到较好的结果,在VOC2012 test数据集上得到mIoU +62.2%。另外如果使用少量的全标记图像和大量的弱标记图像进行结合,可以得到与全监督学习(70.3%)接近的分割结果(69.0%)。 ### 9.10.4 统一的框架    -论文地址:[Learning to Segment Under Various Forms of Weak Supervision (CVPR 2015)](https://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Xu_Learning_to_Segment_2015_CVPR_paper.pdf) +论文地址:[Learning to Segment Under Various Forms of Weak Supervision (CVPR 2015)](https://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Xu_Learning_to_Segment_2015_CVPR_paper.pdf)    -Wisconsin-Madison大学的Jia Xu提出了一个统一的框架来处理各种不同类型的弱标记:图像级别的标记、bounding box和部分像素标记如scribbles。该方法把所有的训练图像分成共计$n$个super-pixel,对每个super-pixel提取一个$d$维特征向量。因为不知道每个super-pixel所属的类别,相当于无监督学习,因此该方法对所有的super-pixel做聚类,使用的是最大间隔聚类方法(max-margin clustering, MMC),该过程的最优化目标函数是: +Wisconsin-Madison大学的Jia Xu提出了一个统一的框架来处理各种不同类型的弱标记:图像级别的标记、bounding +box和部分像素标记如scribbles。该方法把所有的训练图像分成共计$n$个super-pixel,对每个super-pixel提取一个$d$维特征向量。因为不知道每个super-pixel所属的类别,相当于无监督学习,因此该方法对所有的super-pixel做聚类,使用的是最大间隔聚类方法( +max-margin clustering, MMC),该过程的最优化目标函数是: $$ -\underset{W,H}{min} \qquad \frac{1}{2}tr\left ( W^TW \right ) + \lambda\sum_{p=1}^{n}\sum_{c=1}^{C}\xi \left ( w_c;x_p;h_p^c \right) +\underset{W,H}{min} \qquad \frac{1}{2}tr\left ( W^TW \right ) + \lambda\sum_{p=1}^{n}\sum_{c=1}^{C}\xi \left ( +w_c;x_p;h_p^c \right) $$    在这个目标函数的基础上,根据不同的弱标记方式,可以给出不同的限制条件,因此该方法就是在相应的限制条件下求最大间隔聚类。 -![](img/ch9/figure_9.9_8.png) +![](/assets/ch9/figure_9.9_8.png)    该方法在Siftflow数据集上得到了比较好的结果,比state-of-the-art的结果提高了10%以上。 @@ -740,175 +817,197 @@ $$    小结:在弱标记的数据集上训练图像分割算法可以减少对大量全标记数据的依赖,在大多数应用中会更加贴合实际情况。弱标记可以是图像级别的标记、边框和部分像素的标记等。训练的方法一般看做是限制条件下的最优化方法。另外EM算法可以用于CNN参数和像素类别的联合求优。 - ### 9.10.5 弱监督分割最新进展(贡献者:明奇-北京理工大学) + * **bbox监督** + 1. Learning to Segment via Cut-and-Paste(ECCV 2018) 利用GAN对抗学习的思想,在cut-paste思想指导下利用bbox弱监督进行实例分割。 -![](img/ch9/9.10.5-1.png) + +[//]: # (![](img/ch9/9.10.5-1.png) ) +![占位图]() 采用对抗学习的思想,网络主体分为两大部分:mask生成器和合成图像判别器。具体过程为:(1)在图像上截取gt,经过特征提取后预测一个bbox内gt的mask;(2)在原图上随机cut一个背景图像,将bbox内按照生成的mask提取出物体分割结果,然后paste到原图裁剪的背景上去;(3)合成的图像经过判别器进行真假判断。 通过生成器生成更好mask来使得判别器更难判别,在对抗学习中提升两者的性能,逐渐获得更好的结果 . 2. Simple Does It: Weakly Supervised Instance and Semantic Segmentation(CVPR2017) -本文做的是bbox弱监督语义/实例分割任务,能达到全监督分割效果(DeepLabv1)的95%。主要工作为:讨论了使用弱监督语义标签进行迭代训练的方法,以及其限制和不足之处;证明了通过类似GrabCut的算法能通过bbox生成分割训练标签方法的可行性,可以避免像上面的迭代方法重新调整网络训练策略;在VOC数据集上逼近监督学习的分割任务效果。 -作者的启发是:将bbox level的mask送入网络训练后得到分割mask的比输入的bbox mask要好(这是很好的insight)。因此启发的操作是:将bbox level标注作为初始mask输入优化,每次得到的标注作为gt进行下一轮的迭代,从而不断获得更好的效果。效果图如下: -![](img/ch9/9.10.5-3.png) -在此基础上,再加上优化的GrabCut+算法,以及部分区域的筛选,以及BSDS500的边界预测信息整合到一起,能够达到很好的弱监督迭代分割效果。 - - - + 本文做的是bbox弱监督语义/实例分割任务,能达到全监督分割效果(DeepLabv1) + 的95%。主要工作为:讨论了使用弱监督语义标签进行迭代训练的方法,以及其限制和不足之处;证明了通过类似GrabCut的算法能通过bbox生成分割训练标签方法的可行性,可以避免像上面的迭代方法重新调整网络训练策略;在VOC数据集上逼近监督学习的分割任务效果。 + 作者的启发是:将bbox level的mask送入网络训练后得到分割mask的比输入的bbox mask要好(这是很好的insight)。因此启发的操作是:将bbox + level标注作为初始mask输入优化,每次得到的标注作为gt进行下一轮的迭代,从而不断获得更好的效果。效果图如下: +[//]: # (![](img/ch9/9.10.5-3.png)) +在此基础上,再加上优化的GrabCut+算法,以及部分区域的筛选,以及BSDS500的边界预测信息整合到一起,能够达到很好的弱监督迭代分割效果。 * **分类监督** + 1. Weakly Supervised Learning of Instance Segmentation with Inter-pixel Relations(CVPR2019) -使用分类标注作为弱监督信息,在CAM提取到特征的基础上,进一步设计IRNet学习额外的特征约束,从而到达更好的弱监督实例分割效果。为了解决CAM应用到实例分割的上述局限,设计IRNet。其组成为两部分:(1)不分类别的实例响应图 (2)pairwise semantic affinitie。其中通过不分类别的实例响应图和CAM结合,约束后得到instance-wise CAMS;另一个分支预先预测物体的边界然后得到pairwise semantic affinitie(关于这个的论文参考Related Work的对应部分,有相应的方法,暂时不深究)进行融合和处理得到最终的分割。整体流程如下: -![](img/ch9/9.10.5-2.png) + 使用分类标注作为弱监督信息,在CAM提取到特征的基础上,进一步设计IRNet学习额外的特征约束,从而到达更好的弱监督实例分割效果。为了解决CAM应用到实例分割的上述局限,设计IRNet。其组成为两部分:(1)不分类别的实例响应图 + (2)pairwise semantic affinitie。其中通过不分类别的实例响应图和CAM结合,约束后得到instance-wise + CAMS;另一个分支预先预测物体的边界然后得到pairwise semantic affinitie(关于这个的论文参考Related + Work的对应部分,有相应的方法,暂时不深究)进行融合和处理得到最终的分割。整体流程如下: + +[//]: # (![](img/ch9/9.10.5-2.png) ) 2. Weakly Supervised Instance Segmentation using Class Peak Response(CVPR2018) -本文使用图像级的类别标注监督信息,通过探索类别响应峰值使分类网络能够很好地提取实例分割mask。本工作是使用图像级标注进行弱监督实例分割的首个工作。 -在分类监督信息之下,CNN网络会产生一个类别响应图,每个位置是类别置信度分数。其局部极大值往往具有实例很强视觉语义线索。首先将类别峰值响应图的信息进行整合,然后反向传播将其映射到物体实例信息量较大的区域如边界。上述从类别极值响应图产生的映射图称为Peak Response Maps (PRMs),该图提供了实例物体的详细表征,可以很好地用作分割监督信息。 -具体流程如图: -![](img/ch9/9.10.5-4.png) + 本文使用图像级的类别标注监督信息,通过探索类别响应峰值使分类网络能够很好地提取实例分割mask。本工作是使用图像级标注进行弱监督实例分割的首个工作。 + 在分类监督信息之下,CNN网络会产生一个类别响应图,每个位置是类别置信度分数。其局部极大值往往具有实例很强视觉语义线索。首先将类别峰值响应图的信息进行整合,然后反向传播将其映射到物体实例信息量较大的区域如边界。上述从类别极值响应图产生的映射图称为Peak + Response Maps (PRMs),该图提供了实例物体的详细表征,可以很好地用作分割监督信息。 + 具体流程如图: + +[//]: # (![](img/ch9/9.10.5-4.png) ) 首先将图片经过正常的分类网络训练,其中在类别预测响应图上提取出局部响应极值点,进行增强卷积后预测出PRM。然后结合多种信息进行推断生成mask。 3. Weakly Supervised Semantic Segmentation Using Superpixel Pooling Network(AAAI 2017) -本文介绍通过类别标注的标签实现弱监督语义分割的方法。该方法在语义分割mask生成和使用生成mask学习分割生成网络之间反复交替。要实现这种交替迭代学习,关键点就是如何利用类别标注得到较准确的初始分割。为了解决这一问题,提出了Superpixel Pooling Network (SPN),将输入图像的超像素分割结果作为低阶结构的表征,辅助语义分割的推断。 -![](img/ch9/9.10.5-5.png) + 本文介绍通过类别标注的标签实现弱监督语义分割的方法。该方法在语义分割mask生成和使用生成mask学习分割生成网络之间反复交替。要实现这种交替迭代学习,关键点就是如何利用类别标注得到较准确的初始分割。为了解决这一问题,提出了Superpixel + Pooling Network (SPN),将输入图像的超像素分割结果作为低阶结构的表征,辅助语义分割的推断。 + +[//]: # (![](img/ch9/9.10.5-5.png) ) 首先是SPN生成初始mask,然后用另一个网络DecoupledNet来学习每个像素的mask标注。其中,该分割网络将语义分割任务解耦为分类和分割两个子任务,并且能够从类别标注中学习形状先验知识用于辅助分割。 - + ## 9.11 DenseNet(贡献者:黄钦建-华南理工大学)    这篇论文是CVPR2017年的最佳论文。    -卷积神经网络结构的设计主要朝着两个方向发展,一个是更宽的网络(代表:GoogleNet、VGG),一个是更深的网络(代表:ResNet)。但是随着层数的加深会出现一个问题——梯度消失,这将会导致网络停止训练。到目前为止解决这个问题的思路基本都是在前后层之间加一个identity connections(short path)。 +卷积神经网络结构的设计主要朝着两个方向发展,一个是更宽的网络(代表:GoogleNet、VGG),一个是更深的网络(代表:ResNet)。但是随着层数的加深会出现一个问题——梯度消失,这将会导致网络停止训练。到目前为止解决这个问题的思路基本都是在前后层之间加一个identity +connections(short path)。 -![](img/ch9/9-10-3.png) +![](/assets/ch9/9-10-3.png)    由上图中可知Resnet是做值的相加(也就是add操作),通道数是不变的。而DenseNet是做通道的合并(也就是Concatenation操作),就像Inception那样。从这两个公式就可以看出这两个网络的本质不同。此外DensetNet的前面一层输出也是后面所有层的输入,这也不同于ResNet残差网络。 - -![](img/ch9/9-10-1.png) +![](/assets/ch9/9-10-1.png)    DenseNet的Block结构如上图所示。    -1*1卷积核的目的:减少输入的特征图数量,这样既能降维减少计算量,又能融合各个通道的特征。我们将使用BottleNeck Layers的DenseNet表示为DenseNet-B。(在论文的实验里,将1×1×n小卷积里的n设置为4k,k为每个H产生的特征图数量) +1*1卷积核的目的:减少输入的特征图数量,这样既能降维减少计算量,又能融合各个通道的特征。我们将使用BottleNeck +Layers的DenseNet表示为DenseNet-B。(在论文的实验里,将1×1×n小卷积里的n设置为4k,k为每个H产生的特征图数量) -![](img/ch9/9-10-2.png) +![](/assets/ch9/9-10-2.png)    -上图是DenseNet网络的整体网络结构示意图。其中1*1卷积核的目的是进一步压缩参数,并且在Transition Layer层有个参数Reduction(范围是0到1),表示将这些输出缩小到原来的多少倍,默认是0.5,这样传给下一个Dense Block的时候channel数量就会减少一半。当Reduction的值小于1的时候,我们就把带有这种层的网络称为DenseNet-C。 +上图是DenseNet网络的整体网络结构示意图。其中1*1卷积核的目的是进一步压缩参数,并且在Transition +Layer层有个参数Reduction(范围是0到1),表示将这些输出缩小到原来的多少倍,默认是0.5,这样传给下一个Dense +Block的时候channel数量就会减少一半。当Reduction的值小于1的时候,我们就把带有这种层的网络称为DenseNet-C。    DenseNet网络的优点包括: + - 减轻了梯度消失 - 加强了feature的传递 -- 更有效地利用了feature  -- 一定程度上较少了参数数量 +- 更有效地利用了feature- 一定程度上较少了参数数量 - 一定程度上减轻了过拟合 ## 9.12 图像分割的常用数据集 ### 9.12.1 PASCAL VOC -VOC 数据集分为20类,包括背景为21类,分别如下: -- Person: person -- Animal: bird, cat, cow, dog, horse, sheep -- Vehicle: aeroplane, bicycle, boat, bus, car, motorbike, train +VOC 数据集分为20类,包括背景为21类,分别如下: + +- Person: person +- Animal: bird, cat, cow, dog, horse, sheep +- Vehicle: aeroplane, bicycle, boat, bus, car, motorbike, train - Indoor: bottle, chair, dining table, potted plant, sofa, tv/monitor VOC 数据集中用于分割比赛的图片实例如下,包含原图以及图像分类分割和图像物体分割两种图(PNG格式)。图像分类分割是在20种物体中,ground-turth图片上每个物体的轮廓填充都有一个特定的颜色,一共20种颜色。 -![](img/ch9/VOC-01.png) +![](/assets/ch9/VOC-01.png) ### 9.12.2 MS COCO -MS COCO 是最大图像分割数据集,提供的类别有 80 类,有超过 33 万张图片,其中 20 万张有标注,整个数据集中个体的数目超过 150 万个。MS COCO是目前难度最大,挑战最高的图像分割数据集。 +MS COCO 是最大图像分割数据集,提供的类别有 80 类,有超过 33 万张图片,其中 20 万张有标注,整个数据集中个体的数目超过 150 +万个。MS COCO是目前难度最大,挑战最高的图像分割数据集。 -![](img/ch9/COCO-01.png) +![](/assets/ch9/COCO-01.png) ### 9.12.3 Cityscapes -Cityscapes 是驾驶领域进行效果和性能测试的图像分割数据集,它包含了5000张精细标注的图像和20000张粗略标注的图像,这些图像包含50个城市的不同场景、不同背景、不同街景,以及30类涵盖地面、建筑、交通标志、自然、天空、人和车辆等的物体标注。Cityscapes评测集有两项任务:像素级(Pixel-level)图像场景分割(以下简称语义分割)与实例级(Instance-level)图像场景分割(以下简称实例分割)。 +Cityscapes +是驾驶领域进行效果和性能测试的图像分割数据集,它包含了5000张精细标注的图像和20000张粗略标注的图像,这些图像包含50个城市的不同场景、不同背景、不同街景,以及30类涵盖地面、建筑、交通标志、自然、天空、人和车辆等的物体标注。Cityscapes评测集有两项任务:像素级(Pixel-level)图像场景分割(以下简称语义分割)与实例级(Instance-level)图像场景分割(以下简称实例分割)。 -![](img/ch9/Cityscapes-01.png) +![](/assets/ch9/Cityscapes-01.png) ## 9.13 全景分割(贡献者:北京理工大学--明奇) + 全景分割的开山之作:何恺明的*Panoptic Segmentation* 1. **Introduction** -  语义分割通过带孔全卷积网络,根据不同的stuff进行划分;实例分割则是在目标检测的基础上基于检测框进行物体的分割。缺少一种框架可以将两者进行融合实现既能分割背景又能分割实例,而这在自动驾驶和AR技术中大有作为。由此提出的全景分割任务能将两者进行结合。 +  语义分割通过带孔全卷积网络,根据不同的stuff进行划分;实例分割则是在目标检测的基础上基于检测框进行物体的分割。缺少一种框架可以将两者进行融合实现既能分割背景又能分割实例,而这在自动驾驶和AR技术中大有作为。由此提出的全景分割任务能将两者进行结合。 +  全景分割的思路很直观:为图像的每个像素分配语义label和类内实例id,前者用于区分语义信息,后者用于分割实例(因此stuff不具有实例id)。提出全景分割时,只是启发式地将语意分割和实例分割两种任务的输出进行后处理的融合(如NMS),并以此建立PS任务的baseline。为了评价全景分割的质量,提出panoptic +quality (PQ) 标准,将背景和物体的评价纳入一个完整的框架下。示意图如下: +![](/assets/ch9/9.13-1.png) -  全景分割的思路很直观:为图像的每个像素分配语义label和类内实例id,前者用于区分语义信息,后者用于分割实例(因此stuff不具有实例id)。提出全景分割时,只是启发式地将语意分割和实例分割两种任务的输出进行后处理的融合(如NMS),并以此建立PS任务的baseline。为了评价全景分割的质量,提出panoptic quality (PQ) 标准,将背景和物体的评价纳入一个完整的框架下。示意图如下: -![](img/ch9/9.13-1.png) +2. **Panoptic Segmentation** -2. **Panoptic Segmentation** * **Task format** -全景分割的标注方法: -像素级的标注,标出类别label和类内实例id。如果某像素的这两个信息都能匹配,则可以将该像素匹配到某个类别和实例中去;类外的像素可以分配空标签,即并不是所有的像素都要有语义类别。 + 全景分割的标注方法: + 像素级的标注,标出类别label和类内实例id。如果某像素的这两个信息都能匹配,则可以将该像素匹配到某个类别和实例中去;类外的像素可以分配空标签,即并不是所有的像素都要有语义类别。 * **Stuff and thing labels** -对于stuff和thing(背景填充和物体实例)的标签,交集是空集,并集是所有可能的label空间。这两者是互相独立不相关的(很好理解,像素属于那个类和它属于哪个物体不具有相关性)。 + 对于stuff和thing(背景填充和物体实例)的标签,交集是空集,并集是所有可能的label空间。这两者是互相独立不相关的(很好理解,像素属于那个类和它属于哪个物体不具有相关性)。 * **Relationship** -都是像素级的label,需要为每个像素分配对应的标签。但是实例分割基于region的,允许重叠的segmentation,而全景分割和语义分割一样是像素级的label,不允许重叠标签的出现。 + 都是像素级的label,需要为每个像素分配对应的标签。但是实例分割基于region的,允许重叠的segmentation,而全景分割和语义分割一样是像素级的label,不允许重叠标签的出现。 * **Confidence scores** -这一点上更像语义分割而不是实例分割,对于PS不需要置信分数评价分割质量。提到这个,作者认为语义分割和全景分割可以直接利用人工标注的label进行对比从而评价当前mask的质量;而实例分割在选择mask时评价的是分类置信度,这个并没有人工标注进行参考,因此难以把握。 + 这一点上更像语义分割而不是实例分割,对于PS不需要置信分数评价分割质量。提到这个,作者认为语义分割和全景分割可以直接利用人工标注的label进行对比从而评价当前mask的质量;而实例分割在选择mask时评价的是分类置信度,这个并没有人工标注进行参考,因此难以把握。 3. **Panoptic Segmentation Metric** -  用于衡量全景分割效果的指标应具有:完备性;可解释性;简洁性。由是提出了PQ指标,可分为两步:分割匹配、在匹配上进行计算PQ。 +   用于衡量全景分割效果的指标应具有:完备性;可解释性;简洁性。由是提出了PQ指标,可分为两步:分割匹配、在匹配上进行计算PQ。 3.1 **Segment Matching** -  定义match:预测的segmentation和gt的iou大于0.5,说明两者can match。再结合全景分割的不可重叠性,不难得到:最多只有一个预测的segmentation可以match gt。 +  定义match:预测的segmentation和gt的iou大于0.5,说明两者can +match。再结合全景分割的不可重叠性,不难得到:最多只有一个预测的segmentation可以match gt。 3.2 **PQ Computation** -  PQ的计算类似mAP,也是类内求取,然后求类间的平均值,以便不敏感类别不平衡。对于每一类,可以根据gt与预测的segmentation分为三类(下图描述): -![](img/ch9/9.13-2.png) +  PQ的计算类似mAP,也是类内求取,然后求类间的平均值,以便不敏感类别不平衡。对于每一类,可以根据gt与预测的segmentation分为三类(下图描述): +![](/assets/ch9/9.13-2.png) TP: 预测为正,实际为正,描述match较好的 FP: 预测为正,实际为负,描述match错的 FN: 预测为负,实际为正,描述没match出来的gt   通过上述三类可以计算得到PQ值公式: -![](img/ch9/9.13-3.png) +![](/assets/ch9/9.13-3.png) 式中出去FP与FN后,剩下的式子描述的是match的segmentation的平均IoU,加上FP与FN是为了惩罚match失败的分割实例。 有意思的是,对上述式子进行简单的恒等变化: -![](img/ch9/9.13-4.png) +![](/assets/ch9/9.13-4.png) 第一项评价的是match分割的质量,第二项类似于F1得分。因此可以PQ分解为: $$PQ=SQ*RQ$$ * **Void labels** -gt中可能出现两种像素标注为空的情况:超出类别的像素和模糊不清的像素(难以分类)。在评估结果时,这些空的标签不予以评估。具体而言: -(1)在matching部分,预测出为void的像素会被移出prediction并不参与IoU计算; -(2)matching后,unmatched prediction按照一般情况会计算FP FN,但是对于空标签情况,如果该prediction含有的void像素块超过一定匹配阈值就会被移除,并不算作FP计算得分。 + gt中可能出现两种像素标注为空的情况:超出类别的像素和模糊不清的像素(难以分类)。在评估结果时,这些空的标签不予以评估。具体而言: + (1)在matching部分,预测出为void的像素会被移出prediction并不参与IoU计算; + (2)matching后,unmatched prediction按照一般情况会计算FP FN,但是对于空标签情况,如果该prediction含有的void像素块超过一定匹配阈值就会被移除,并不算作FP计算得分。 * **Group labels** -有时区分相同语义类别的实例个体标注比较困难,因此有提出组标签的标注方法。但对于PQ计算而言: -(1)matching部分不使用组标签,而是严格区分实例 -(2)matching后,对于包含一部分相同类别像素点的unmatched predicted segments,这一部分将被去除并不视作false positives + 有时区分相同语义类别的实例个体标注比较困难,因此有提出组标签的标注方法。但对于PQ计算而言: + (1)matching部分不使用组标签,而是严格区分实例 + (2)matching后,对于包含一部分相同类别像素点的unmatched predicted segments,这一部分将被去除并不视作false positives 3.3 **Comparison to Existing Metrics** + * **Semantic segmentation metrics** -衡量语义分割的标准有像素级精度,平均精度,IoU。但是其只专注于像素级的划分,不能反映物体实例级别的分割性能。 + 衡量语义分割的标准有像素级精度,平均精度,IoU。但是其只专注于像素级的划分,不能反映物体实例级别的分割性能。 * **Instance segmentation metrics** -度量为AP,主要是引入了置信度分数confidence score对检测目标进行打分。(两者不是完全的隔绝,实例分割也有用IoU监督的,而confidence score是否能够反映mask的真实质量也有存疑过,这个标准也不是固定的) + 度量为AP,主要是引入了置信度分数confidence score对检测目标进行打分。(两者不是完全的隔绝,实例分割也有用IoU监督的,而confidence + score是否能够反映mask的真实质量也有存疑过,这个标准也不是固定的) * **Panoptic quality** -PQ的度量可以分解成SQ和RQ,SQ反映了语义分割的像素级IoU性能,RQ专注于检测识别的效果,因此将两者统一到一个框架下。 + PQ的度量可以分解成SQ和RQ,SQ反映了语义分割的像素级IoU性能,RQ专注于检测识别的效果,因此将两者统一到一个框架下。 分割效果: -![](img/ch9/9.13-5.png) +![](/assets/ch9/9.13-5.png)

diff --git "a/ch10_\345\274\272\345\214\226\345\255\246\344\271\240/\347\254\254\345\215\201\347\253\240_\345\274\272\345\214\226\345\255\246\344\271\240.md" "b/ch10_\345\274\272\345\214\226\345\255\246\344\271\240/\347\254\254\345\215\201\347\253\240_\345\274\272\345\214\226\345\255\246\344\271\240.md" index ee5c110b..78fbbeb8 100644 --- "a/ch10_\345\274\272\345\214\226\345\255\246\344\271\240/\347\254\254\345\215\201\347\253\240_\345\274\272\345\214\226\345\255\246\344\271\240.md" +++ "b/ch10_\345\274\272\345\214\226\345\255\246\344\271\240/\347\254\254\345\215\201\347\253\240_\345\274\272\345\214\226\345\255\246\344\271\240.md" @@ -19,7 +19,7 @@ https://morvanzhou.github.io/tutorials/machine-learning/reinforcement-learning/ 小孩想要走路,但在这之前,他需要先站起来,站起来之后还要保持平衡,接下来还要先迈出一条腿,是左腿还是右腿,迈出一步后还要迈出下一步。 小孩就是 agent,他试图通过采取行动(即行走)来操纵环境(行走的表面),并且从一个状态转变到另一个状态(即他走的每一步),当他完成任务的子任务(即走了几步)时,孩子得到奖励(给巧克力吃),并且当他不能走路时,就不会给巧克力。 -![](img/ch10/10-1.png) +![](/assets/ch10/10-1.png) 上图中agent代表自身,如果是自动驾驶,agent就是车;如果你玩游戏它就是你当前控制的游戏角色,如马里奥,马里奥往前走时环境就一直在发生变化,有小怪物或者障碍物出现,它需要通过跳跃来进行躲避,就是要做action(如向前走和跳起的动作);无人驾驶的action就是车左转、右转或刹车等等,它无时无刻都在与环境产生交互,action会反馈给环境,进而改变环境,如果自动驾驶的车行驶目标是100米,它向前开了10米,那环境就发生了变化,所以每次产生action都会导致环境改变,环境的改变会反馈给自身(agent),就是这样的一个循环;反馈又两种方式:1、做的好(reward)即正反馈,2、做得不好(punishment惩罚)即负反馈。Agent可能做得好,也可能做的不好,环境始终都会给它反馈,agent会尽量去做对自身有利的决策,通过反反复复这样的一个循环,agent会越来越做的好,就像孩子在成长过程中会逐渐明辨是非,这就是强化学习。 @@ -28,7 +28,7 @@ https://morvanzhou.github.io/tutorials/machine-learning/reinforcement-learning/ 例如一家日本公司 Fanuc,工厂机器人在拿起一个物体时,会捕捉这个过程的视频,记住它每次操作的行动,操作成功还是失败了,积累经验,下一次可以更快更准地采取行动。 -![](img/ch10/10-2.png) +![](/assets/ch10/10-2.png) (2)Inventory Management @@ -64,7 +64,7 @@ https://morvanzhou.github.io/tutorials/machine-learning/reinforcement-learning/ 在机器学习中,我们比较熟知的是监督式学习,非监督学习,此外还有一个大类就是强化学习: 当前的机器学习算法可以分为3种:有监督的学习(Supervised Learning)、无监督的学习(Unsupervised Learning)和强化学习(Reinforcement Learning),结构图如下所示: - ![](img/ch10/10-3.png) + ![](/assets/ch10/10-3.png) ### 10.3.1 强化学习和监督式学习的区别: @@ -102,7 +102,7 @@ exploitation 会尝试过去经验中最有效的行为。 ## 10.4 强化学习主要有哪些算法? 强化学习不需要监督信号,可以在模型未知的环境中平衡探索和利用, 其主要算法有蒙特卡罗强化学习, 时间差分(temporal difference: TD)学习, 策略梯度等。典型的深度强化学习算法特点及性能比较如下图所示: -![](img/ch10/10-4.png) +![](/assets/ch10/10-4.png) 除了上述深度强化学习算法,还有深度迁移强化学习、分层深度强化学习、深度记忆强化学习以及多智能体强化学习等算法。 ## 10.5 深度迁移强化学习算法 diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/\347\254\254\345\215\201\344\270\200\347\253\240_\350\277\201\347\247\273\345\255\246\344\271\240.md" "b/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/\347\254\254\345\215\201\344\270\200\347\253\240_\350\277\201\347\247\273\345\255\246\344\271\240.md" index 92b1e729..add2ec6e 100644 --- "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/\347\254\254\345\215\201\344\270\200\347\253\240_\350\277\201\347\247\273\345\255\246\344\271\240.md" +++ "b/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/\347\254\254\345\215\201\344\270\200\347\253\240_\350\277\201\347\247\273\345\255\246\344\271\240.md" @@ -44,9 +44,9 @@ - **基于模型的迁移 (Parameter based TL)**:利用源域和目标域的参数共享模型 - **基于关系的迁移 (Relation based TL)**:利用源域中的逻辑网络关系进行迁移 -![1542972502781](img/ch11/1542972502781.png) +![1542972502781](/assets/ch11/1542972502781.png) -![1542974131814](img/ch11/1542974131814.png) +![1542974131814](/assets/ch11/1542974131814.png) ### 11.1.5 迁移学习与传统机器学习有什么区别? @@ -56,7 +56,7 @@ | 数据标签 | 不需要足够的数据标注 | 足够的数据标注 | | 建模 | 可以重用之前的模型 | 每个任务分别建模 | -![1542973960796](img/ch11/1542973960796.png) +![1542973960796](/assets/ch11/1542973960796.png) ### 11.1.6 迁移学习的核心及度量准则? **迁移学习的总体思路可以概括为**:开发算法来最大限度地利用有标注的领域的知识,来辅助目标领域的知识获取和学习。 @@ -76,9 +76,11 @@ 3. 迁移学习与协方差漂移:**协方差漂移**:数据的条件概率分布发生变化。 -Reference: +Reference: -1. [王晋东,迁移学习简明手册](https://github.com/jindongwang/transferlearning-tutorial) +[//]: # ((https://github.com/jindongwang/transferlearning-tutorial)) + +1. 王晋东,迁移学习简明手册 2. Ben-David, S., Blitzer, J., Crammer, K., Kulesza, A., Pereira, F., & Vaughan, J. W. (2010). A theory of learning from different domains. Machine learning, 79(1-2), 151-175. 3. Tan, B., Song, Y., Zhong, E. and Yang, Q., 2015, August. Transitive transfer learning. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (pp. 1155-1164). ACM. @@ -108,9 +110,11 @@ Reference: > 2. 除直接看infer的结果的Accurancy以外,如何衡量迁移学习学习效果? > 3. 对抗网络是如何进行迁移的? -Reference: +Reference: + +[//]: # ([王晋东,迁移学习简明手册](https://github.com/jindongwang/transferlearning-tutorial)) -1. [王晋东,迁移学习简明手册](https://github.com/jindongwang/transferlearning-tutorial) +1. 王晋东,迁移学习简明手册 2. Ben-David, S., Blitzer, J., Crammer, K., Kulesza, A., Pereira, F., & Vaughan, J. W. (2010). A theory of learning from different domains. Machine learning, 79(1-2), 151-175. 3. Tan, B., Song, Y., Zhong, E. and Yang, Q., 2015, August. Transitive transfer learning. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (pp. 1155-1164). ACM. @@ -124,9 +128,9 @@ Reference: ​ 基于样本的迁移学习方法 (Instance based Transfer Learning) 根据一定的权重生成规则,对数据样本进行重用,来进行迁移学习。图[14](#bookmark90)形象地表示了基于样本迁移方法的思想源域中存在不同种类的动物,如狗、鸟、猫等,目标域只有狗这一种类别。在迁移时,为了最大限度地和目标域相似,我们可以人为地提高源域中属于狗这个类别的样本权重。 -![](media/631e5aab4e0680c374793804817bfbb6.jpg) +![](/assets/ch11/631e5aab4e0680c374793804817bfbb6.jpg) -
图 14: 基于样本的迁移学习方法示意图 +图 14: 基于样本的迁移学习方法示意图 ​ 在迁移学习中,对于源域D~s~和目标域D~t~,通常假定产生它们的概率分布是不同且未知的(P(X~s~) =P(X~t~))。另外,由于实例的维度和数量通常都非常大,因此,直接对 P(X~s~) 和P(X~t~) 进行估计是不可行的。因而,大量的研究工作 [[Khan and Heisterkamp,2016](#bookmark267), [Zadrozny, 2004](#bookmark319), [Cortes et al.,2008](#bookmark242), [Dai et al., 2007](#bookmark243), [Tan et al.,2015](#bookmark302), [Tan et al., 2017](#bookmark303)] 着眼于对源域和目标域的分布比值进行估计(P(**X**t)/P(**X**s))。所估计得到的比值即为样本的权重。这些方法通常都假设P(**x**s) \<并且源域和目标域的条件概率分布相同(P(y\|x~s~)=*P*(y\|x~t~))。特别地,上海交通大学Dai等人[[Dai et al.,2007](#bookmark243)]提出了 TrAdaboost方法,将AdaBoost的思想应用于迁移学习中,提高有利于目标分类任务的实例权重、降低不利于目标分类任务的实例权重,并基于PAC理论推导了模型的泛化误差上界。TrAdaBoost方法是此方面的经典研究之一。文献 [[Huang et al., 2007](#bookmark264)]提出核均值匹配方法 (Kernel Mean atching, KMM)对于概率分布进行估计,目标是使得加权后的源域和目标域的概率分布尽可能相近。在最新的研究成果中,香港科技大学的Tan等人扩展了实例迁移学习方法的应用场景,提出 了传递迁移学习方法(Transitive Transfer Learning, TTL) [[Tan etal., 2015](#bookmark302)] 和远域迁移学习 (Distant Domain Transfer Learning,DDTL) [[Tan et al., 2017](#bookmark303)],利用联合矩阵分解和深度神经网络,将迁移学习应用于多个不相似的领域之间的知识共享,取得了良好的效果。 @@ -136,9 +140,9 @@ Reference: ​ 基于特征的迁移方法 (Feature based Transfer Learning) 是指将通过特征变换的方式互相迁移 [[Liu et al., 2011](#bookmark272), [Zheng et al.,2008](#bookmark327), [Hu and Yang, 2011](#bookmark263)],来减少源域和目标域之间的差距;或者将源域和目标域的数据特征变换到统一特征空间中 [[Pan et al.,2011](#bookmark288), [Long et al., 2014b](#bookmark278), [Duan et al.,2012](#bookmark248)],然后利用传统的机器学习方法进行分类识别。根据特征的同构和异构性,又可以分为同构和异构迁移学习。图[15](#bookmark93)很形象地表示了两种基于特 征的迁移学习方法。 -![](media/fa08900e89bfd53cc28345d21bc6aca0.jpg) +![](/assets/ch11/fa08900e89bfd53cc28345d21bc6aca0.jpg) -
图 15: 基于特征的迁移学习方法示意图 +图 15: 基于特征的迁移学习方法示意图 ​ 基于特征的迁移学习方法是迁移学习领域中最热门的研究方法,这类方法通常假设源域和目标域间有一些交叉的特征。香港科技大学的 Pan 等人 [[Pan et al.,2011](#bookmark288)] 提出的迁移 成分分析方法 (Transfer Component Analysis, TCA)是其中较为典型的一个方法。该方法的 核心内容是以最大均值差异 (Maximum MeanDiscrepancy, MMD) [[Borgwardt et al., 2006](#bookmark236)]作为度量准则,将不同数据领域中的分布差异最小化。加州大学伯克利分校的 Blitzer 等人 [[Blitzer et al., 2006](#bookmark235)] 提出了一种基于结构对应的学习方法(Structural Corresponding Learning,SCL),该算法可以通过映射将一个空间中独有的一些特征变换到其他所有空间中的轴特征上,然后在该特征上使用机器学习的算法进行分类预测。清华大学龙明盛等人[[Long et al.,2014b](#bookmark278)]提出在最小化分布距离的同时,加入实例选择的迁移联合匹配(Tran-fer Joint Matching, TJM) 方法,将实例和特征迁移学习方法进行了有机的结合。澳大利亚卧龙岗大学的 Jing Zhang 等人 [[Zhang et al., 2017a](#bookmark321)]提出对于源域和目标域各自训练不同 的变换矩阵,从而达到迁移学习的目标。 @@ -146,9 +150,9 @@ Reference: ​ 基于模型的迁移方法 (Parameter/Model based Transfer Learning) 是指从源域和目标域中找到他们之间共享的参数信息,以实现迁移的方法。这种迁移方式要求的假设条件是: 源域中的数据与目标域中的数据可以共享一些模型的参数。其中的代表性工作主要有[[Zhao et al., 2010](#bookmark324), [Zhao et al., 2011](#bookmark325), [Panet al., 2008b](#bookmark287), [Pan et al., 2008a](#bookmark286)]。图[16](#bookmark96)形象地 表示了基于模型的迁移学习方法的基本思想。 -![](media/602723a1d3ce0f3abe7c591a8e4bb6ec.jpg) +![](/assets/ch11/602723a1d3ce0f3abe7c591a8e4bb6ec.jpg) -
图 16: 基于模型的迁移学习方法示意图 +图 16: 基于模型的迁移学习方法示意图 ​ 其中,中科院计算所的Zhao等人[[Zhao et al., 2011](#bookmark325)]提出了TransEMDT方法。该方法首先针对已有标记的数据,利用决策树构建鲁棒性的行为识别模型,然后针对无标定数据,利用K-Means聚类方法寻找最优化的标定参数。西安邮电大学的Deng等人[[Deng et al.,2014](#bookmark245)] 也用超限学习机做了类似的工作。香港科技大学的Pan等人[[Pan etal., 2008a](#bookmark286)]利用HMM,针对Wifi室内定位在不同设备、不同时间和不同空间下动态变化的特点,进行不同分布下的室内定位研究。另一部分研究人员对支持向量机 SVM 进行了改进研究 [[Nater et al.,2011](#bookmark285), [Li et al., 2012](#bookmark269)]。这些方法假定 SVM中的权重向量 **w** 可以分成两个部分: **w** = **wo**+**v**, 其中 **w**0代表源域和目标域的共享部分, **v** 代表了对于不同领域的特定处理。在最新的研究成果中,香港科技大学的 Wei 等人 [[Wei et al., 2016b](#bookmark313)]将社交信息加入迁移学习方法的 正则项中,对方法进行了改进。清华大学龙明盛等人[[Long et al., 2015a](#bookmark275), [Long et al., 2016](#bookmark276), [Long etal., 2017](#bookmark280)]改进了深度网络结构,通过在网络中加入概率分布适配层,进一步提高了深度迁移学习网络对于大数据的泛化能力。 @@ -160,13 +164,13 @@ Reference: ​ 我们将重点讨论基于特征和基于模型的迁移学习方法,这也是目前绝大多数研究工作的热点。 -![](media/aa10d36f758430dd4ff72d2bf6a76a6c.jpg) +![](/assets/ch11/aa10d36f758430dd4ff72d2bf6a76a6c.jpg) -
图 17: 基于关系的迁移学习方法示意图 +图 17: 基于关系的迁移学习方法示意图 -![1542812440636](media/1542812440636.png) +![1542812440636](/assets/ch11/1542812440636.png) -
图 18: 基于马尔科夫逻辑网的关系迁移 +图 18: 基于马尔科夫逻辑网的关系迁移 @@ -177,9 +181,9 @@ Reference: ​ 图 [19](#bookmark84)形象地表示了几种数据分布的情况。简单来说,数据的边缘分布不同,就是数据整体不相似。数据的条件分布不同,就是数据整体相似,但是具体到每个类里,都不太相似。 -![1542812748062](media/1542812748062.png) +![1542812748062](/assets/ch11/1542812748062.png) -
图 19: 不同数据分布的目标域数据 +图 19: 不同数据分布的目标域数据 ​ 根据数据分布的性质,这类方法又可以分为边缘分布自适应、条件分布自适应、以及联合分布自适应。下面我们分别介绍每类方法的基本原理和代表性研究工作。介绍每类研究工作时,我们首先给出基本思路,然后介绍该类方法的核心,最后结合最近的相关工作介绍该类方法的扩展。 @@ -203,9 +207,9 @@ Reference: ​ STL 方法的基本思路如图所示。首先利用大多数投票的思想,对无标定的位置行为生成伪标;然后在再生核希尔伯特空间中,利用类内相关性进行自适应地空间降维,使得不同情境中的行为数据之间的相关性增大;最后,通过二次标定,实现对未知标定数据的精准标定。 -![1542817481582](media/1542817481582.png) +![1542817481582](/assets/ch11/1542817481582.png) -
图 21: STL 方法的示意图 +图 21: STL 方法的示意图 ### 11.3.4 联合分布自适应 ​ 联合分布自适应方法 (Joint Distribution Adaptation) 的目标是减小源域和目标域的联合概率分布的距离,从而完成迁移学习。从形式上来说,联合分布自适应方法是用*P*(**x**s) 和P(**x**t)之间的距离、以及P(ys\|**x**s)和P(yt\|**x**t)之间的距离来近似两个领域之间的差异。即: @@ -222,28 +226,28 @@ Reference: 1. 精度比较: BDA \>JDA \>TCA \>条件分布自适应。 2. 将不同的概率分布自适应方法用于神经网络,是一个发展趋势。图[23](#bookmark119)展示的结果表明将概率分布适配加入深度网络中,往往会取得比非深度方法更好的结果。 -![1542823019007](media/1542823019007.png) +![1542823019007](/assets/ch11/1542823019007.png) -
图 22: BDA 方法的效果第二类方法:特征选择 +图 22: BDA 方法的效果第二类方法:特征选择 ### 11.3.6 特征选择 ​ 特征选择法的基本假设是:源域和目标域中均含有一部分公共的特征,在这部分公共的特征,源领域和目标领域的数据分布是一致的。因此,此类方法的目标就是,通过机器学习方法,选择出这部分共享的特征,即可依据这些特征构建模型。 ​ 图 [24](#bookmark122)形象地表示了特征选择法的主要思路。 -![1542823210556](media/1542823210556.png) +![1542823210556](/assets/ch11/1542823210556.png) -
图 23: 不同分布自适应方法的精度比较 +图 23: 不同分布自适应方法的精度比较 -![](media/a3db84158d9b6454adff88dbe4fa5d28.jpg) +![](/assets/ch11/a3db84158d9b6454adff88dbe4fa5d28.jpg) -
图 24: 特征选择法示意图 +图 24: 特征选择法示意图 ​ 这这个领域比较经典的一个方法是发表在 2006 年的 ECML-PKDD 会议上,作者提出了一个叫做 SCL 的方法 (Structural Correspondence Learning) [[Blitzer et al.,2006](#bookmark235)]。这个方法的目标就是我们说的,找到两个领域公共的那些特征。作者将这些公共的特征叫做Pivot feature。找出来这些Pivot feature,就完成了迁移学习的任务。 -![](media/4abacd82901988c3e0a98bdb07b2abc6.jpg) +![](/assets/ch11/4abacd82901988c3e0a98bdb07b2abc6.jpg) -
图 25: 特征选择法中的 Pivot feature 示意图 +图 25: 特征选择法中的 Pivot feature 示意图 ​ 图 [25](#bookmark124)形象地展示了 Pivot feature 的含义。 Pivot feature指的是在文本分类中,在不同领域中出现频次较高的那些词。总结起来: @@ -255,15 +259,15 @@ Reference: ​ 统计特征对齐方法主要将数据的统计特征进行变换对齐。对齐后的数据,可以利用传统机器学习方法构建分类器进行学习。SA方法(Subspace Alignment,子空间对齐)[[Fernando et al.,2013](#bookmark249)]是其中的代表性成果。SA方法直接寻求一个线性变换**M**,将不同的数据实现变换对齐。SA方法的优化目标如下: -![1542823438846](media/1542823438846.png) +![1542823438846](/assets/ch11/1542823438846.png) 则变换 **M** 的值为: -![1542823455820](media/1542823455820.png) +![1542823455820](/assets/ch11/1542823455820.png) 可以直接获得上述优化问题的闭式解: -![1542823474720](media/1542823474720.png) +![1542823474720](/assets/ch11/1542823474720.png) ​ SA 方法实现简单,计算过程高效,是子空间学习的代表性方法。 @@ -275,37 +279,36 @@ Reference: ​ 流形空间中的距离度量:两点之间什么最短?在二维上是直线(线段),可在三维呢?地球上的两个点的最短距离可不是直线,它是把地球展开成二维平面后画的那条直线。那条线在三维的地球上就是一条曲线。这条曲线就表示了两个点之间的最短距离,我们叫它测地线。更通俗一点, 两点之间,测地线最短。在流形学习中,我们遇到测量距离的时候更多的时候用的就是这个测地线。在我们要介绍的 GFK 方法中,也是利用了这个测地线距离。比如在下面的图中,从 A 到 C 最短的距离在就是展开后的线段,但是在三维球体上看它却是一条曲线。 -![](media/fcbe02803e45f6455a4602b645b472c5.jpg) +![](/assets/ch11/fcbe02803e45f6455a4602b645b472c5.jpg) -
图 28: 三维空间中两点之间的距离示意图 +图 28: 三维空间中两点之间的距离示意图 ​ 由于在流形空间中的特征通常都有着很好的几何性质,可以避免特征扭曲,因此我们首先将原始空间下的特征变换到流形空间中。在众多已知的流形中, Grassmann 流形G(d) 可以通过将原始的 d 维子空间 (特征向量)看作它基础的元素,从而可以帮助学习分类 器。在 Grassmann流形中,特征变换和分布适配通常都有着有效的数值形式,因此在迁移学习问题中可以被很高效地表示和求解 [[Hamm and Lee,2008](#bookmark260)]。因此,利用 Grassmann流形空间中来进行迁移学习是可行的。现存有很多方法可以将原始特征变换到流形空间 中[[Gopalan et al., 2011](#bookmark257), [Baktashmotlagh et al.,2014](#bookmark230)]。 -​ 在众多的基于流形变换的迁移学习方法中,GFK(Geodesic Flow Kernel)方法[[Gong et -al., 2012](#bookmark255)]是最为代表性的一个。GFK是在2011年发表在ICCV上的SGF方法[[Gopalan et al., -2011](#bookmark257)]发展起来的。我们首先介绍SGF方法。 +​ 在众多的基于流形变换的迁移学习方法中,GFK(Geodesic Flow Kernel)方法[[Gong etal., 2012](#bookmark255)]是最为代表性的一个。GFK是在2011年发表在ICCV上的SGF方法[[Gopalan et al.,2011](#bookmark257)]发展起来的。我们首先介绍SGF方法。 -​ SGF 方法从增量学习中得到启发:人类从一个点想到达另一个点,需要从这个点一步一步走到那一个点。那么,如果我们把源域和目标域都分别看成是高维空间中的两个点,由源域变换到目标域的过程不就完成了迁移学习吗?也就是说, 路是一步一步走出来的。 +​ SGF 方法从增量学习中得到启发:人类从一个点想到达另一个点,需要从这个点一步一步走到那一个点。那么,如果我们把源域和目标域都分别看成是高维空间中的两个点,由源域变换到目标域的过程不就完成了迁移学习吗?也就是说, 路是一步一步走出来的。 ​ 于是 SGF 就做了这个事情。它是怎么做的呢?把源域和目标域分别看成高维空间 (即Grassmann流形)中的两个点,在这两个点的测地线距离上取d个中间点,然后依次连接起来。这样,源域和目标域就构成了一条测地线的路径。我们只需要找到合适的每一步的变换,就能从源域变换到目标域了。图 [29](#bookmark133)是 SGF 方法的示意图。 -![](media/103de3658cbb97ad4c24bafe28f9d957.jpg) +![](/assets/ch11/103de3658cbb97ad4c24bafe28f9d957.jpg) -
图 29: SGF 流形迁移学习方法示意图 +图 29: SGF 流形迁移学习方法示意图 ​ SGF 方法的主要贡献在于:提出了这种变换的计算及实现了相应的算法。但是它有很明显的缺点:到底需要找几个中间点? SGF也没能给出答案,就是说这个参数d是没法估计的,没有一个好的方法。这个问题在 GFK 中被回答了。 ​ GFK方法首先解决SGF的问题:如何确定中间点的个数d。它通过提出一种核学习的方法,利用路径上的无穷个点的积分,把这个问题解决了。这是第一个贡献。然后,它又解决了第二个问题:当有多个源域的时候,我们如何决定使用哪个源域跟目标域进行迁移? GFK通过提出Rank of Domain度量,度量出跟目标域最近的源域,来解决这个问题。图 [30](#bookmark134)是 GFK 方法的示意图。 -![](media/e654d14df0b44ee4e8a0e505c654044b.jpg) +![](/assets/ch11/e654d14df0b44ee4e8a0e505c654044b.jpg) -
图 30: GFK 流形迁移学习方法示意图 +图 30: GFK 流形迁移学习方法示意图 -​ 用Ss和St分别表示源域和目标域经过主成分分析(PCA)之后的子空间,则G可以视为所有的d维子空间的集合。每一个d维的原始子空间都可以被看作G上的一个点。因此,在两点之间的测地线{\$(t) :0 \< t \<1}可以在两个子空间之间构成一条路径。如果我 们令Ss = \$(0),St =\$(1),则寻找一条从\$(0)到\$(1)的测地线就等同于将原始的特征变换到一个无穷维度的空间中,最终减小域之间的漂移现象。这种方法可以被看作是一种从\$(0)到\$(1)的増量式“行走”方法。 +​ 用Ss和St分别表示源域和目标域经过主成分分析(PCA)之后的子空间,则G可以视为所有的d维子空间的集合。每一个d维的原始子空间都可以被看作G上的一个点。因此,在两点之间的测地线{\$(t) :0 \< t \<1}可以在两个子空间之间构成一条路径。 +如果我 们令 $Ss = (0)$,$St = (1)$,则寻找一条从 $(0)$到 $(1)$的测地线就等同于将原始的特征变换到一个无穷维度的空间中,最终减小域之间的漂移现象。这种方法可以被看作是一种从 $(0)$到 $(1)$的増量式“行走”方法。 ​ 特别地,流形空间中的特征可以被表示为**z** =\$(t)T**x**。变换后的特征**Z**i和**Z**j的内积定义了一个半正定 (positive semidefinite) 的测地线流式核 -![1542823895008](media/1542823895008.png) +![1542823895008](/assets/ch11/1542823895008.png) ​ GFK 方法详细的计算过程可以参考原始的文章,我们在这里不再赘述。 @@ -327,9 +330,9 @@ al., 2012](#bookmark255)]是最为代表性的一个。GFK是在2011年发表在 ​ 图[36](#bookmark148)展示了一个简单的finetune过程。从图中我们可以看到,我们采用的预训练好的网络非常复杂,如果直接拿来从头开始训练,则时间成本会非常高昂。我们可以将此网络进行改造,固定前面若干层的参数,只针对我们的任务,微调后面若干层。这样,网络训练速度会极大地加快,而且对提高我们任务的表现也具有很大的促进作用。 -![](media/b1630ca5d004d4b430672c8b8ce7fb90.jpg) +![](/assets/ch11/b1630ca5d004d4b430672c8b8ce7fb90.jpg) -
图 36: 一个简单的 finetune 示意图 +图 36: 一个简单的 finetune 示意图 **Finetune 的优势** ​ Finetune 的优势是显然的,包括: @@ -350,9 +353,9 @@ al., 2012](#bookmark255)]是最为代表性的一个。GFK是在2011年发表在 ​ 随着 AlexNet [[Krizhevsky et al., 2012](#bookmark268)] 在 2012 年的 ImageNet大赛上获得冠军,深度学习开始在机器学习的研究和应用领域大放异彩。尽管取得了很好的结果,但是神经网络本身就像一个黑箱子,看得见,摸不着,解释性不好。由于神经网络具有良好的层次结构很自然地就有人开始关注,能否通过这些层次结构来很好地解释网络?于是,有了我们熟知的例子:假设一个网络要识别一只猫,那么一开始它只能检测到一些边边角角的东西,和猫根本没有关系;然后可能会检测到一些线条和圆形;慢慢地,可以检测到有猫的区域;接着是猫腿、猫脸等等。图 [32](#bookmark137)是一个简单的示例。 -![1542824195602](media/1542824195602.png) +![1542824195602](/assets/ch11/1542824195602.png) -
图 32: 深度神经网络进行特征提取到分类的简单示例 +图 32: 深度神经网络进行特征提取到分类的简单示例 ​ 这表达了一个什么事实呢?概括来说就是:前面几层都学习到的是通用的特征(general feature);随着网络层次的加深,后面的网络更偏重于学习任务特定的特征(specific feature)。 这非常好理解,我们也都很好接受。那么问题来了:如何得知哪些层能够学习到 general feature,哪些层能够学习到specific feature。更进一步:如果应用于迁移学习,如何决定该迁移哪些层、固定哪些层? @@ -377,9 +380,9 @@ al., 2012](#bookmark255)]是最为代表性的一个。GFK是在2011年发表在 ​ 这个图说明了什么呢?我们先看蓝色的BnB和BnB+(就是BnB加上finetune)。对 BnB而言,原训练好的 B 模型的前 3 层直接拿来就可以用而不会对模型精度有什么损失到了第4 和第5 层,精度略有下降,不过还是可以接受。然而到了第6 第第7层,精度居然奇迹般地回升了!这是为什么?原因如下:对于一开始精度下降的第4 第 5 层来说,确 -![1542824318155](media/1542824318155.png) +![1542824318155](/assets/ch11/1542824318155.png) -
图 33: 深度网络迁移实验结果 1 +图 33: 深度网络迁移实验结果 1 实是到了这一步,feature变得越来越specific,所以下降了。那对于第6第7层为什么精度又不变了?那是因为,整个网络就8层,我们固定了第6第7层,这个网络还能学什么呢?所以很自然地,精度和原来的 B 网络几乎一致! @@ -417,7 +420,7 @@ al., 2012](#bookmark255)]是最为代表性的一个。GFK是在2011年发表在 ​ 深度网络中最重要的是网络损失的定义。绝大多数深度迁移学习方法都采用了以下的损失定义方式: -![1542824918145](media/1542824918145.png) +![1542824918145](/assets/ch11/1542824918145.png) ​ 其中,I表示网络的最终损失,lc(Ds,**y**s)表示网络在有标注的数据(大部分是源域)上的常规分类损失(这与普通的深度网络完全一致),Ia(Ds,Dt)表示网络的自适应损失。最后一部分是传统的深度网络所不具有的、迁移学习所独有的。此部分的表达与我们先前讨论过的源域和目标域的分布差异,在道理上是相同的。式中的A是权衡两部分的权重参数。 @@ -436,17 +439,17 @@ al., 2012](#bookmark255)]是最为代表性的一个。GFK是在2011年发表在 ​ 通常用 Gf 来表示特征提取器,用 Gd 来表示判别器。正是基于这样的领域对抗的思想,深度对抗网络可以被很好地运用于迁移学习问题中。与深度网络自适应迁移方法类似,深度对抗网络的损失也由两部分构成:网络训练的损失lc*和领域判别损失Id: -![1542826334834](media/1542826334834.png) +![1542826334834](/assets/ch11/1542826334834.png) **DANN** Yaroslav Ganin 等人 [[Ganin et al., 2016](#bookmark251)]首先在神经网络的训练中加入了对抗机制,作者将他们的网络称之为DANN(Domain-Adversarial Neural Network)。在此研宄中,网络的学习目标是:生成的特征尽可能帮助区分两个领域的特征,同时使得判别器无法对两个领域的差异进行判别。该方法的领域对抗损失函数表示为: -![1542826461988](media/1542826461988.png) +![1542826461988](/assets/ch11/1542826461988.png) Id = max 其中的 Ld 表示为 -![1542826475517](media/1542826475517.png) +![1542826475517](/assets/ch11/1542826475517.png) diff --git "a/ch12_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203/\347\254\254\345\215\201\344\272\214\347\253\240_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203.md" "b/ch12_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203/\347\254\254\345\215\201\344\272\214\347\253\240_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203.md" index 1faa74d2..f945b5d6 100644 --- "a/ch12_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203/\347\254\254\345\215\201\344\272\214\347\253\240_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203.md" +++ "b/ch12_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203/\347\254\254\345\215\201\344\272\214\347\253\240_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203.md" @@ -82,7 +82,7 @@ sess.close() ###   整个系统从底层到上层可分为七层: -![](img\ch12\1.bmp) +![](/assets/ch12/1.bmp)   设备层:硬件计算资源,支持CPU、GPU @@ -387,15 +387,11 @@ def VGG16(x): ## 12.3.2 Caffe的特点是什么? -(1)、模块化:Caffe从一开始就设计得尽可能模块化,允许对新数据格式、网络层和损失函数进行扩展。 - -(2)、表示和实现分离:Caffe的模型(model)定义是用Protocol Buffer语言写进配置文件的。以任意有向无环图的形式,Caffe支持网络架构。Caffe会根据网络的需要来正确占用内存。通过一个函数调用,实现CPU和GPU之间的切换。 - -(3)、测试覆盖:在Caffe中,每一个单一的模块都对应一个测试。 - -(4)、python和Matlab接口:同时提供Python和Matlab接口。 - -(5)、预训练参考模型:针对视觉项目,Caffe提供了一些参考模型,这些模型仅应用在学术和非商业领域,它们的license不是BSD。 +1. 模块化:Caffe从一开始就设计得尽可能模块化,允许对新数据格式、网络层和损失函数进行扩展。 +2. 表示和实现分离:Caffe的模型(model)定义是用Protocol Buffer语言写进配置文件的。以任意有向无环图的形式,Caffe支持网络架构。Caffe会根据网络的需要来正确占用内存。通过一个函数调用,实现CPU和GPU之间的切换。 +3. 测试覆盖:在Caffe中,每一个单一的模块都对应一个测试。 +4. python和Matlab接口:同时提供Python和Matlab接口。 +5. 预训练参考模型:针对视觉项目,Caffe提供了一些参考模型,这些模型仅应用在学术和非商业领域,它们的license不是BSD。 ## 12.3.3 Caffe的设计思想是怎样的? @@ -447,30 +443,31 @@ BlobProto、Datum、FillerParameter、NetParameter、SolverParameter、SolverSta ### 1. Caffe Python接口 -  Caffe提供 Python 接口,即Pycaffe,具体实现在caffe、python文件夹内。在Python代码中import caffe,可以load models(导入模型)、forward and backward (前向、反向迭代)、handle IO(数据输入输出)、visualize networks(绘制net)和instrument model solving(自定义优化方法)。所有的模型数据、计算参数都是暴露在外、可供读写的。 -  (1)caffe.Net 是主要接口,负责导入数据、校验数据、计算模型。 -  (2)caffe.Classsifier 用于图像分类。 -  (3)caffe.Detector 用于图像检测。 -  (4)caffe.SGDSolver 是露在外的 solver 的接口。 -  (5)caffe.io 处理输入输出,数据预处理。 -  (6)caffe.draw 可视化 net 的结构。 -  (7)caffe blobs 以 numpy ndarrys 的形式表示,方便而且高效。 +Caffe提供 Python 接口,即Pycaffe,具体实现在caffe、python文件夹内。在Python代码中import caffe,可以load models(导入模型)、forward and backward (前向、反向迭代)、handle IO(数据输入输出)、visualize networks(绘制net)和instrument model solving(自定义优化方法)。 +所有的模型数据、计算参数都是暴露在外、可供读写的。 + 1. caffe.Net 是主要接口,负责导入数据、校验数据、计算模型。 + 2. caffe.Classsifier 用于图像分类。 + 3. caffe.Detector 用于图像检测。 + 4. caffe.SGDSolver 是露在外的 solver 的接口。 + 5. caffe.io 处理输入输出,数据预处理。 + 6. caffe.draw 可视化 net 的结构。 + 7. caffe blobs 以 numpy ndarrys 的形式表示,方便而且高效。 ### 2. Caffe MATLAB接口 -  MATLAB接口(Matcaffe)在 caffe/matlab 目录的 caffe 软件包。在 matcaffe 的基础上,可将Caffe整合到MATLAB代码中。 -  MATLAB接口包括: -  (1)MATLAB 中创建多个网络结构。 -  (2)网络的前向传播(Forward)与反向传播(Backward)计算。 -  (3)网络中的任意一层以及参数的存取。 -  (4)网络参数保存至文件或从文件夹加载。 -  (5)blob 和 network 形状调整。 -  (6)网络参数编辑和调整。 -  (7)创建多个 solvers 进行训练。 -  (8)从solver 快照(Snapshots)恢复并继续训练。 -  (9)访问训练网络(Train nets)和测试网络(Test nets)。 -  (10)迭代后网络交由 MATLAB 控制。 -  (11)MATLAB代码融合梯度算法。 +MATLAB接口(Matcaffe)在 caffe/matlab 目录的 caffe 软件包。在 matcaffe 的基础上,可将Caffe整合到MATLAB代码中。 +MATLAB接口包括: +1. MATLAB 中创建多个网络结构。 +2. 网络的前向传播(Forward)与反向传播(Backward)计算。 +3. 网络中的任意一层以及参数的存取。 +4. 网络参数保存至文件或从文件夹加载。 +5. blob 和 network 形状调整。 +6. 网络参数编辑和调整。 +7. 创建多个 solvers 进行训练。 +8. 从solver 快照(Snapshots)恢复并继续训练。 +9. 访问训练网络(Train nets)和测试网络(Test nets)。 +10. 迭代后网络交由 MATLAB 控制。 +11. MATLAB代码融合梯度算法。 ### 3. Caffe 命令行接口 @@ -478,10 +475,10 @@ BlobProto、Datum、FillerParameter、NetParameter、SolverParameter、SolverSta #### 1. caffe train -  caffe train 命令用于模型学习,具体包括: -  (1)caffe train 带 solver.prototxt 参数完成配置。 -  (2)caffe train 带 snapshot mode_iter_1000.solverstate 参数加载 solver snapshot。 -  (3)caffe train 带 weights 参数 model.caffemodel 完成 Fine-tuning 模型初始化。 +caffe train 命令用于模型学习,具体包括: +1. caffe train 带 solver.prototxt 参数完成配置。 +2. caffe train 带 snapshot mode_iter_1000.solverstate 参数加载 solver snapshot。 +3. caffe train 带 weights 参数 model.caffemodel 完成 Fine-tuning 模型初始化。 #### 2. caffe test @@ -499,10 +496,10 @@ BlobProto、Datum、FillerParameter、NetParameter、SolverParameter、SolverSta ### 10.4.1新手原则。 刚入门的新手不建议直接上来就开始搭建网络模型。比较建议的学习顺序如下: -- 1.了解神经网络工作原理,熟悉基本概念及术语。 -- 2.阅读经典网络模型论文+实现源码(深度学习框架视自己情况而定)。 -- 3.找数据集动手跑一个网络,可以尝试更改已有的网络模型结构。 -- 4.根据自己的项目需要设计网络。 +1. 了解神经网络工作原理,熟悉基本概念及术语。 +2. 阅读经典网络模型论文+实现源码(深度学习框架视自己情况而定)。 +3. 找数据集动手跑一个网络,可以尝试更改已有的网络模型结构。 +4. 根据自己的项目需要设计网络。 ### 10.4.2深度优先原则。 @@ -511,8 +508,8 @@ BlobProto、Datum、FillerParameter、NetParameter、SolverParameter、SolverSta ### 10.4.3卷积核size一般为奇数。 卷积核为奇数有以下好处: -- 1 保证锚点刚好在中间,方便以 central pixel为标准进行滑动卷积,避免了位置信息发生偏移 。 -- 2 保证在填充(Padding)时,在图像之间添加额外的零层,图像的两边仍然对称。 +1. 保证锚点刚好在中间,方便以 central pixel为标准进行滑动卷积,避免了位置信息发生偏移 。 +2. 保证在填充(Padding)时,在图像之间添加额外的零层,图像的两边仍然对称。 ### 10.4.4卷积核不是越大越好。 @@ -535,25 +532,25 @@ AlexNet中用到了一些非常大的卷积核,比如11×11、5×5卷积核, 论文:[ImageNet Classification with Deep Convolutional Neural Networks](https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf) 代码实现:[tensorflow](https://github.com/tensorflow/tensorflow/blob/361a82d73a50a800510674b3aaa20e4845e56434/tensorflow/contrib/slim/python/slim/nets/alexnet.py) 主要特点: ->> - 1.第一次使用非线性激活函数ReLU。 ->> - 2.增加防加过拟合方法:Droupout层,提升了模型鲁棒性。 ->> - 3.首次使用数据增强。 ->> - 4.首次使用GPU加速运算。 +>> 1. 第一次使用非线性激活函数ReLU。 +>> 2. 增加防加过拟合方法:Droupout层,提升了模型鲁棒性。 +>> 3. 首次使用数据增强。 +>> 4. 首次使用GPU加速运算。 >- 2 VGGNet 论文:[Very Deep Convolutional Networks for Large-Scale Image Recognition](https://arxiv.org/abs/1409.1556) 代码实现:[tensorflow](https://github.com/tensorflow/tensorflow/blob/361a82d73a50a800510674b3aaa20e4845e56434/tensorflow/contrib/slim/python/slim/nets/vgg.py) 主要特点: ->> - 1.网络结构更深。 ->> - 2.普遍使用小卷积核。 +>> 1. 网络结构更深。 +>> 2. 普遍使用小卷积核。 >- 3 GoogLeNet 论文:[Going Deeper with Convolutions](https://arxiv.org/abs/1409.4842) 代码实现:[tensorflow](https://github.com/tensorflow/tensorflow/blob/361a82d73a50a800510674b3aaa20e4845e56434/tensorflow/contrib/slim/python/slim/nets/inception_v1.py) -主要特点: ->> - 1.增强卷积模块功能。 ->>主要的创新在于他的Inception,这是一种网中网(Network In Network)的结构,即原来的结点也是一个网络。Inception一直在不断发展,目前已经V2、V3、V4。其中1*1卷积主要用来降维,用了Inception之后整个网络结构的宽度和深度都可扩大,能够带来2-3倍的性能提升。 ->> - 2.连续小卷积代替大卷积,保证感受野不变的同时,减少了参数数目。 +>- 主要特点: +>> 1. 增强卷积模块功能。 +>> 主要的创新在于他的Inception,这是一种网中网(Network In Network)的结构,即原来的结点也是一个网络。Inception一直在不断发展,目前已经V2、V3、V4。其中1*1卷积主要用来降维,用了Inception之后整个网络结构的宽度和深度都可扩大,能够带来2-3倍的性能提升。 +>> 2. 连续小卷积代替大卷积,保证感受野不变的同时,减少了参数数目。 >- 4 ResNet 论文:[Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) 代码实现:[tensorflow](https://github.com/tensorflow/tensorflow/blob/361a82d73a50a800510674b3aaa20e4845e56434/tensorflow/contrib/slim/python/slim/nets/inception_v1.py) @@ -566,10 +563,10 @@ AlexNet中用到了一些非常大的卷积核,比如11×11、5×5卷积核, >> 提出了feature recalibration,通过引入 attention 重新加权,可以得到抑制无效特征,提升有效特征的权重,并很容易地和现有网络结合,提升现有网络性能,而计算量不会增加太多。 **CV领域网络结构演进历程:** -![CV领域网络结构演进历程](img/ch12/网络结构演进.png) +![CV领域网络结构演进历程](/assets/ch12/网络结构演进.png) **ILSVRC挑战赛历年冠军:** -![ILSVRC挑战赛历年冠军](img/ch12/历年冠军.png) +![ILSVRC挑战赛历年冠军](/assets/ch12/历年冠军.png) 此后,ILSVRC挑战赛的名次一直是衡量一个研究机构或企业技术水平的重要标尺。 diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/\347\254\254\345\215\201\344\270\211\347\253\240_\344\274\230\345\214\226\347\256\227\346\263\225.md" "b/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/\347\254\254\345\215\201\344\270\211\347\253\240_\344\274\230\345\214\226\347\256\227\346\263\225.md" index f4f003a2..2231abef 100644 --- "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/\347\254\254\345\215\201\344\270\211\347\253\240_\344\274\230\345\214\226\347\256\227\346\263\225.md" +++ "b/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/\347\254\254\345\215\201\344\270\211\347\253\240_\344\274\230\345\214\226\347\256\227\346\263\225.md" @@ -2,7 +2,7 @@ -# 第一十三章 优化算法 +# 第十三章 优化算法 ## 13.1 如何解决训练样本少的问题 @@ -17,6 +17,7 @@ 深度学习并不能胜任目前所有的数据环境,以下列举两种情况: (1)深度学习能取得目前的成果,很大一部分原因依赖于海量的数据集以及高性能密集计算硬件。因此,当数据集过小时,需要考虑与传统机器学习相比,是否在性能和硬件资源效率更具有优势。 + (2)深度学习目前在视觉,自然语言处理等领域都有取得不错的成果。这些领域最大的特点就是具有局部相关性。例如图像中,人的耳朵位于两侧,鼻子位于两眼之间,文本中单词组成句子。这些都是具有局部相关性的,一旦被打乱则会破坏语义或者有不同的语义。所以当数据不具备这种相关性的时候,深度学习就很难取得效果。 ## 13.3 有没有可能找到比已知算法更好的算法? @@ -81,10 +82,10 @@ $$ **(1)stochastic GD** /**Mini-Batch GD** ​ 在GD算法中,每次的梯度都是从所有样本中累计获取的,这种情况最容易导致梯度方向过于稳定一致,且更新次数过少,容易陷入局部最优。而stochastic GD是GD的另一种极端更新方式,其每次都只使用一个样本进行参数更新,这样更新次数大大增加也就不容易陷入局部最优。但引出的一个问题的在于其更新方向过多,导致不易于进一步优化。Mini-Batch GD便是两种极端的折中,即每次更新使用一小批样本进行参数更新。Mini-Batch GD是目前最常用的优化算法,严格意义上Mini-Batch GD也叫做stochastic GD,所以很多深度学习框架上都叫做SGD。 -**(2)动量 ** +**(2)动量** ​ 动量也是GD中常用的方式之一,SGD的更新方式虽然有效,但每次只依赖于当前批样本的梯度方向,这样的梯度方向依然很可能很随机。动量就是用来减少随机,增加稳定性。其思想是模仿物理学的动量方式,每次更新前加入部分上一次的梯度量,这样整个梯度方向就不容易过于随机。一些常见情况时,如上次梯度过大,导致进入局部最小点时,下一次更新能很容易借助上次的大梯度跳出局部最小点。 -**(3)自适应学习率 ** +**(3)自适应学习率** ​ 无论是GD还是动量重点优化角度是梯度方向。而学习率则是用来直接控制梯度更新幅度的超参数。自适应学习率的优化方法有很多,例如Adagrad和RMSprop。两种自适应学习率的方式稍有差异,但主要思想都是基于历史的累计梯度去计算一个当前较优的学习率。 @@ -256,9 +257,9 @@ Loss = \lVert g(x)-f(x) \rVert^2_2. $$ 假设损失函数的数据空间是下图这样的,我们最优的权值就是为了寻找下图中的最小值点, 对于这种数学寻找最小值问题,采用梯度下降的方法再适合不过了。 -![](img/ch13/figure_13_15_1.png) +![](/assets/ch13/figure_13_15_1.png) -
图 13.8.1
+图 13.8.1 ### 13.8.2 梯度消失/爆炸产生的原因? @@ -272,9 +273,9 @@ $$ (2)激活函数 如果激活函数选择不合适,比如使用 sigmoid,梯度消失就会很明显了,原因看下图,左图是sigmoid的函数图,右边是其导数的图像,如果使用sigmoid作为损失函数,其梯度是不可能超过0.25的,这样经过链式求导之后,很容易发生梯度消失。 -![](img/ch13/figure_13_15_2.png) +![](/assets/ch13/figure_13_15_2.png) -
图 13.8.2 sigmod函数与其导数
+图 13.8.2 sigmod函数与其导数 ### 13.8.3 梯度消失、爆炸的解决方案 diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/\347\254\254\345\215\201\345\233\233\347\253\240_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264.md" "b/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/\347\254\254\345\215\201\345\233\233\347\253\240_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264.md" index 72465aae..cd27a4a5 100644 --- "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/\347\254\254\345\215\201\345\233\233\347\253\240_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264.md" +++ "b/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/\347\254\254\345\215\201\345\233\233\347\253\240_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264.md" @@ -15,7 +15,7 @@ ​ 超参数调整可以说是深度学习中理论和实际联系最重要的一个环节。目前,深度学习仍存在很多不可解释的部分,如何设计优化出好的网络可以为深度学习理论的探索提供重要的支持。超参数调整一般分为手动调整和自动优化超参数两种。读者可先浏览思维导图,本章节不会过多阐述所有超参数的详细原理,如果需要了解这部分,您可以翻阅前面的基础章节或者查阅相关文献资料。当然,下面会讲到的一些超参数优化的建议是根据笔者们的实践以及部分文献资料得到认知建议,并不是非常严格且一定有效的,很多研究者可能会很不同意某些的观点或有着不同的直觉,这都是可保留讨论的,因为这很依赖于数据本身情况。 -![](img\ch14\思维导图.png) +![](/assets/ch14/思维导图.png) ​ @@ -108,7 +108,7 @@ natural_exp_decay(learning_rate, global_step, decay_steps, decay_rate, 指数衰减是最常用的衰减方式,这种方式简单直接,在训练初期衰减较大利于收敛,在后期衰减较小利于精调。以上两种均为指数衰减,区别在于后者使用以自然指数下降。 -![./](img\ch14\指数衰减.jpeg) +![./](/assets/ch14/指数衰减.jpeg) 2、**piecewise_constant** @@ -138,11 +138,11 @@ $$ 有别于上述两种,多项式衰减则是在每一步迭代上都会调整学习率。主要看Power参数,若Power为1,则是下图中的红色直线;若power小于1,则是开1/power次方,为蓝色线;绿色线为指数,power大于1。 -![](img\ch14\多项式衰减.jpeg) +![](/assets/ch14/多项式衰减.jpeg) 此外,需要注意的是参数cycle,cycle对应的是一种周期循环调整的方式。这种cycle策略主要目的在后期防止在一个局部极小值震荡,若跳出该区域或许能得到更有的结果。这里说明cycle的方式不止可以在多项式中应用,可配合类似的周期函数进行衰减,如下图。 -![](img\ch14\cycle衰减.jpeg) +![](/assets/ch14/cycle衰减.jpeg) 4、**inverse_time_decay** @@ -151,7 +151,7 @@ inverse_time_decay(learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None) ``` -逆时衰减,这种方式和指数型类似。如图,![](img\ch14\逆时衰减.jpeg) +逆时衰减,这种方式和指数型类似。如图,![](/assets/ch14/逆时衰减.jpeg) 5、**cosine_decay** @@ -162,7 +162,7 @@ cosine_decay(learning_rate, global_step, decay_steps, alpha=0.0, 余弦衰减,即按余弦函数的方式衰减学习率,如图 -![](img\ch14\余弦衰减.jpeg) +![](/assets/ch14/余弦衰减.jpeg) 6、**cosine_decay_restarts** @@ -173,7 +173,7 @@ cosine_decay_restarts(learning_rate, global_step, first_decay_steps, 余弦衰减,即余弦版本的cycle策略,作用与多项式衰减中的cycle相同。区别在于余弦重启衰减会重新回到初始学习率,拉长周期,而多项式版本则会逐周期衰减。 -![](img\ch14\余弦cycle衰减.jpeg) +![](/assets/ch14/余弦cycle衰减.jpeg) 7、**linear_cosine_decay** @@ -185,13 +185,13 @@ linear_cosine_decay(learning_rate, global_step, decay_steps, 线性余弦衰减,主要应用于增强学习领域。 -![](img\ch14\线性余弦衰减.jpeg) +![](/assets/ch14/线性余弦衰减.jpeg) 8、**noisy_linear_cosine_decay** 噪声线性余弦衰减,即在线性余弦衰减中加入随机噪声,增大寻优的随机性。 -![](img\ch14\噪声线性余弦衰减.jpeg) +![](/assets/ch14/噪声线性余弦衰减.jpeg) ### 14.3.4 极端批样本数量下,如何训练网络? @@ -315,7 +315,7 @@ GAN常用训练技巧 ​ 随机搜索,是一种用来替代网格搜索的搜索方式。随机搜索有别于网格搜索的一点在于,我们不需要设定一个离散的超参数集合,而是对每个超参数定义一个分布函数来生成随机超参数。随机搜索相比于网格搜索在一些不敏感超参上拥有明显优势。例如网格搜索对于批样本数量(batch size),在[16,32,64]这些范围内进行逐项调试,这样的调试显然收益更低下。当然随机搜索也可以进行细粒度范围内的重复的搜索优化。 -![](img\ch14\14.14.png) +![](/assets/ch14/14.14.png) ​ 基于模型的超参优化: @@ -345,13 +345,13 @@ NASNet是最早由google brain 通过网络架构搜索策略搜索并成功训 NASNet的核心思想是利用强化学习对搜索空间内的结构进行反馈探索。架构搜索图如下,定义了一个以RNN为核心的搜索控制器。在搜索空间以概率p对模型进行搜索采样。得到网络模型A后,对该模型进行训练,待模型收敛得到设定的准确率R后,将梯度传递给控制器RNN进行梯度更新。 -![](img\ch14\NAS搜索策略.png) +![](/assets/ch14/NAS搜索策略.png) ​ 架构搜索策略流程 RNN控制器会对卷积层的滤波器的尺寸、数量以及滑动间隔进行预测。每次预测的结果都会作为下一级的输入,档层数达到设定的阈值时,会停止预测。而这个阈值也会随着训练的进行而增加。这里的控制器之预测了卷积,并没有对例如inception系列的分支结构或者ResNet的跳级结构等进行搜索。所以,控制器需要进一步扩展到预测这些跳级结构上,这样搜索空间相应的也会增大。为了预测这些结构,RNN控制器内每一层都增加了一个预测跳级结构的神经元,文中称为锚点,稍有不同的是该锚点的预测会由前面所有层的锚点状态决定。 -![](img\ch14\RNN控制器.png) +![](/assets/ch14/RNN控制器.png) ​ RNN控制器 @@ -359,7 +359,7 @@ NASNet大体沿用了上述生成网络结构的机器,并在此基础上做 1、先验行地加入inception系列和ResNet的堆叠模块的思想。其定义了两种卷积模块,Normal Cell和Reduction Cell,前者不进行降采样,而后者是个降采样的模块。而由这两种模块组成的结构可以很方便的通过不同数量的模块堆叠将其从小数据集搜索到的架构迁移到大数据集上,大大提高了搜索效率。 -![](img\ch14\NASNet的RNN控制器.png) +![](/assets/ch14/NASNet的RNN控制器.png) ​ NASNet的RNN控制器 diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/\347\254\254\345\215\201\344\272\224\347\253\240_\345\274\202\346\236\204\350\277\220\347\256\227\343\200\201GPU\345\217\212\346\241\206\346\236\266\351\200\211\345\236\213.md" "b/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/\347\254\254\345\215\201\344\272\224\347\253\240_\345\274\202\346\236\204\350\277\220\347\256\227\343\200\201GPU\345\217\212\346\241\206\346\236\266\351\200\211\345\236\213.md" index 1d3cdaa9..3c5f9f3d 100644 --- "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/\347\254\254\345\215\201\344\272\224\347\253\240_\345\274\202\346\236\204\350\277\220\347\256\227\343\200\201GPU\345\217\212\346\241\206\346\236\266\351\200\211\345\236\213.md" +++ "b/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/\347\254\254\345\215\201\344\272\224\347\253\240_\345\274\202\346\236\204\350\277\220\347\256\227\343\200\201GPU\345\217\212\346\241\206\346\236\266\351\200\211\345\236\213.md" @@ -22,24 +22,24 @@ GPU,图形显示芯片作为不同于CPU的设计逻辑和应用场景,有 首先,下图简单地展示了几个GPU不同于CPU的特性: * 计算核心: 图中的CPU,i7-5960,Intel的第五代Broadwell架构,其中包括了8个CPU核心(支持16线程),也就是理论上可以有16个不同的运算同时进行。除了8个核心计算单元,大部分的芯片面积是被3级缓存,内存和控制电路占据了。同样的,来自Nvidia的GTX980GPU,在差不多的芯片面积上,大部分是计算单元,16个SM,也就是流处理单元,每个流处理单元中包含着128个CUDA计算核心,所以总共来说,有2048个GPU运算单元,相应地这颗GPU理论上可以在一个时钟周期内可以进行2048次单精度运算。 -![CPU和GPU的简单架构对比图](img/ch15/cpu_gpu.png) +![CPU和GPU的简单架构对比图](/assets/ch15/cpu_gpu.png) * 计算核心频率:时钟频率,代表每一秒中内能进行同步脉冲次数,也是从一个侧面反映一个计算元件的工作速度。下图中对比了个别早期产品,比如Intel的x5650和几款Nvidia的GPU。可以看出核心频率而言,CPU要远高于GPU。对于CPU而言,在不考虑能源消耗和制程工艺限制的情况下,追求更高的主频。但,在GPU的设计中,采用了多核心设计,即使是提高一些频率,其实对于总体性能影像不会特别大。当然,其中还有能耗方面的考虑,避免发热过高,也进行了权衡。还有一个可能的原因是,在一个流处理器中的每个核心(CUDA核心)的运行共享非常有限的缓存和寄存器,由于共享内存也是有性能极限的,所以即使每个GPU核心频率提高,如果被缓存等拖累也是无法展现出高性能的。 -![CPU简单信息](img/ch15/cpu_specs.png) +![CPU简单信息](/assets/ch15/cpu_specs.png) -![GPU的简单信息对比](img/ch15/gpu_specs.png) +![GPU的简单信息对比](/assets/ch15/gpu_specs.png) * 内存架构:GPU的多层内存架构包括全局内存(也就是通常意义上大部分比较关注的内存,在若干到16GB之间,截至到当前最新),2级缓存,和芯片上的存储(包括寄存器,和1级缓存共用的共享内存,只读/纹理缓存和常量缓存)。通常来说,最高速的共享内存/缓存和寄存器都是非常有限的,比如在Tesla的K20中,只有48K的缓存可以作为共享内存或者1级缓存使用,所以在很多用GPU加速算法实现的过程中,有效地利用这些高速缓存是使得性能提升的非常重要的方面。 -![GPU的简单信息对比](img/ch15/gpu_memory_arch.png) +![GPU的简单信息对比](/assets/ch15/gpu_memory_arch.png) -![GPU的内存架构容量信息](img/ch15/gpu_memory.png) +![GPU的内存架构容量信息](/assets/ch15/gpu_memory.png) ### 15.3.2 CUDA 核心是什么? 上面提到在一个GPU芯片里,会很几千个CUDA核心,被分布在多个流处理单元(SM)中,比如上面提到早期的GTX980中的16个SM中各包含了128个CUDA核心。如下图所示,作为GPU架构中的最小单元,其实它的设计和CPU有着非常类似的结构,其中包括了一个浮点运算单元和整型运算单元,和控制单元。同一个流处理器中,所有的CUDA核心将同步执行同一个指令,但是作用于不同的数据点上。 -![CUDA简单介绍](img/ch15/cudacore.jpg) +![CUDA简单介绍](/assets/ch15/cudacore.jpg) 一般来说,更加多的CUDA核心意味着有更多的并行执行单元,所以也就可以片面地认为是有更加高的性能。但是,其实这个也是取决于很多方面,最重要的是算法在并行实现的时候有没有高效地调度和内存的使用优化。在现在我们使用的大部分GPU加速的深度学习框架里,包括Tensorflow,PyTorch等都是依赖于底层的GPU的矩阵加速代码的实现。为此Nvidia公司也是制定和实现了统一的接口,比如cuDNN,方便上层框架更好的利用GPU的性能。 @@ -53,7 +53,7 @@ GPU整体的架构而言,某种意义上是同时支持以上两种并行模 基于深度学习中大部分的操作的天然并行性(大量的矩阵操作),GPU在当下还是一种非常适合的计算平台。一个非常典型的例子就是常见的矩阵相乘(如下图),要计算Z = X×Y,通过并行计算,X和Y中的行向量和列向量的逐元素相乘就可以同时进行,只要得到结果后再进行累加,而且累加的过程中也是可以进行并行化,使得效率有非常大的提高。Nvidia也是制定和开发了一套底层类库,CUBlas方便开发者。我们熟悉的几大框架(e.g. Tensorflow, PyTorch等)也是遵循和使用了这些并行类库,所以才使得训练和部署性能有了非常多的提高。 -![CUDA 矩阵乘法示例](img/ch15/mat_mul_gpu.png) +![CUDA 矩阵乘法示例](/assets/ch15/mat_mul_gpu.png) ### 15.3.4 深度学习中的GPU应用 深度学习在最近几年内出现的井喷现象背后也是GPU的存在和发展作为坚实的推动力量。 @@ -85,7 +85,7 @@ GPU的性能主要由以下三个参数构成: 下图描绘了GTX 900和1000系列里各个型号的32位浮点计算能力和价格的对比。其中价格为Wikipedia的建议价格。 -![浮点计算能力和价格的对比。](img/ch15/gtx.png) +![浮点计算能力和价格的对比。](/assets/ch15/gtx.png) 我们可以从图中读出两点信息: @@ -148,9 +148,9 @@ Nvidia一般每一两年发布一次新版本的GPU,例如2017年发布的是G cuda8.0https://developer.nvidia.com/cuda-80-ga2-download-archive cuda9.0https://developer.nvidia.com/cuda-90-download-archive 进入网址之后选择对应的系统版本即可,如下图所示: - ![cuda8.0](img/ch15/cuda8.0.png) + ![cuda8.0](/assets/ch15/cuda8.0.png) - ![cuda9.0](img/ch15/cuda9.0.png) + ![cuda9.0](/assets/ch15/cuda9.0.png) 2. 命令行中进入到cuda所在的位置,授予运行权限: cuda8.0: sudo chmod +x cuda_8.0.61_375.26_linux.run diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/\347\254\254\345\215\201\344\270\203\347\253\240_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262.md" "b/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/\347\254\254\345\215\201\344\270\203\347\253\240_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262.md" index cbf1c485..124013ad 100644 --- "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/\347\254\254\345\215\201\344\270\203\347\253\240_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262.md" +++ "b/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/\347\254\254\345\215\201\344\270\203\347\253\240_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262.md" @@ -14,21 +14,31 @@ (1)随着AI技术的飞速发展,越来越多的公司希望在自己的移动端产品中注入AI能力。 -(2)对于在线学习和增量学习等实时应用而言,如何减少含有大量层级及结点的大型神经网络所需要的内存和计算量显得极为重要。 +(2)对于在线学习和增量学习等实时应用而言,如何减少含有大量层级及结点的大型神经网络所需要的内存和计算量显得极为重要。 (3)模型的参数在一定程度上能够表达其复杂性,相关研究表明,并不是所有的参数都在模型中发挥作用,部分参数作用有限、表达冗余,甚至会降低模型的性能。 (4)复杂的模型固然具有更好的性能,但是高额的存储空间、计算资源消耗是使其难以有效的应用在各硬件平台上的重要原因。 (5)智能设备的流行提供了内存、CPU、能耗和宽带等资源,使得深度学习模型部署在智能移动设备上变得可行。 -(6)高效的深度学习方法可以有效的帮助嵌入式设备、分布式系统完成复杂工作,在移动端部署深度学习有很重要的意义。 +(6)高效的深度学习方法可以有效的帮助嵌入式设备、分布式系统完成复杂工作,在移动端部署深度学习有很重要的意义。 ## 17.3 模型压缩的必要性及可行性 -| 必要性 | 首先是资源受限,其次在许多网络结构中,如VGG-16网络,参数数量1亿3千多万,占用500MB空间,需要进行309亿次浮点运算才能完成一次图像识别任务。 | -| -------- | ------------------------------------------------------------ | -| 可行性 | 模型的参数在一定程度上能够表达其复杂性,相关研究表明,并不是所有的参数都在模型中发挥作用,部分参数作用有限、表达冗余,甚至会降低模型的性能。论文提出,很多的深度神经网络仅仅使用很少一部分(5%)权值就足以预测剩余的权值。该论文还提出这些剩下的权值甚至可以直接不用被学习。也就是说,仅仅训练一小部分原来的权值参数就有可能达到和原来网络相近甚至超过原来网络的性能(可以看作一种正则化)。 | -| 最终目的 | 最大程度的减小模型复杂度,减少模型存储需要的空间,也致力于加速模型的训练和推测 | +[//]: # () +[//]: # (| 必要性 | |) + +[//]: # (| -------- | ------------------------------------------------------------ |) + +[//]: # (| 可行性 | |) + +[//]: # (| 最终目的 | 最大程度的减小模型复杂度,减少模型存储需要的空间,也致力于加速模型的训练和推测 |) + + +| 必要性 | 首先是资源受限,其次在许多网络结构中,如VGG-16网络,参数数量1亿3千多万,占用500MB空间,需要进行309亿次浮点运算才能完成一次图像识别任务。 | +| ------------- | ------------- | +| 可行性 | 模型的参数在一定程度上能够表达其复杂性,相关研究表明,并不是所有的参数都在模型中发挥作用,部分参数作用有限、表达冗余,甚至会降低模型的性能。论文`Predicting parameters in deep learning`提出,很多的深度神经网络仅仅使用很少一部分(5%)权值就足以预测剩余的权值。该论文还提出这些剩下的权值甚至可以直接不用被学习。也就是说,仅仅训练一小部分原来的权值参数就有可能达到和原来网络相近甚至超过原来网络的性能(可以看作一种正则化)。 | +| 最终目的 | 最大程度的减小模型复杂度,减少模型存储需要的空间,也致力于加速模型的训练和推测 | ## 17.4 目前有哪些深度学习模型压缩方法? @@ -56,7 +66,7 @@ 如果按剪枝粒度分,从粗到细,可分为中间隐含层剪枝、通道剪枝、卷积核剪枝、核内剪枝、单个权重剪枝。下面按照剪枝粒度的分类从粗(左)到细(右)。 -![](img/ch17/剪枝粒度分类.png) +![](/assets/ch17/剪枝粒度分类.png) (a)层间剪枝 (b)特征图剪枝 (c)k*k核剪枝 (d)核内剪枝 @@ -79,15 +89,15 @@ ### 17.4.4 网络蒸馏 -​ 网络精馏是指利用大量未标记的迁移数据(transfer data),让小模型去拟合大模型,从而让小模型学到与大模型相似的函数映射.网络精馏可以看成在同一个域上迁移学习[34]的一种特例,目的是获得一个比原模型更为精简的网络,整体的框架图如图 4所示. +​ 网络精馏是指利用大量未标记的迁移数据(transfer data),让小模型去拟合大模型,从而让小模型学到与大模型相似的函数映射.网络精馏可以看成在同一个域上迁移学习[34]的一种特例,目的是获得一个比原模型更为精简的网络,整体的框架图如图 4所示. -![](img/ch17/网络蒸馏.png) +![](/assets/ch17/网络蒸馏.png) ### 17.4.5 前端压缩 (1)知识蒸馏 -​ 一个复杂模型可由多个简单模型或者强约束条件训练得到。复杂模型特点是性能好,但其参数量大,计算效率低。小模型特点是计算效率高,但是其性能较差。知识蒸馏是让复杂模型学习到的知识迁移到小模型当中,使其保持其快速的计算速度前提下,同时拥有复杂模型的性能,达到模型压缩的目的。 +​ 一个复杂模型可由多个简单模型或者强约束条件训练得到。复杂模型特点是性能好,但其参数量大,计算效率低。小模型特点是计算效率高,但是其性能较差。知识蒸馏是让复杂模型学习到的知识迁移到小模型当中,使其保持其快速的计算速度前提下,同时拥有复杂模型的性能,达到模型压缩的目的。 (2)紧凑的模型结构设计 ​ 紧凑的模型结构设计主要是对神经网络卷积的方式进行改进,比如使用两个3x3的卷积替换一个5x5的卷积、使用深度可分离卷积等等方式降低计算参数量。 目前很多网络基于模块化设计思想,在深度和宽度两个维度上都很大,导致参数冗余。因此有很多关于模型设计的研究,如SqueezeNet、MobileNet等,使用更加细致、高效的模型设计,能够很大程度的减少模型尺寸,并且也具有不错的性能。 (3)滤波器层面的剪枝 @@ -97,14 +107,14 @@ ### 17.4.6 后端压缩 (1)低秩近似 -​ 在卷积神经网络中,卷积运算都是以矩阵相乘的方式进行。对于复杂网络,权重矩阵往往非常大,非常消耗存储和计算资源。低秩近似就是用若干个低秩矩阵组合重构大的权重矩阵,以此降低存储和计算资源消耗。 +​ 在卷积神经网络中,卷积运算都是以矩阵相乘的方式进行。对于复杂网络,权重矩阵往往非常大,非常消耗存储和计算资源。低秩近似就是用若干个低秩矩阵组合重构大的权重矩阵,以此降低存储和计算资源消耗。 | 事项 | 特点 | | :--- | :----------------------------------------------------------- | | 优点 | 可以降低存储和计算消耗;
一般可以压缩2-3倍;精度几乎没有损失; | | 缺点 | 模型越复杂,权重矩阵越大,利用低秩近似重构参数矩阵不能保证模型的性能 ;
超参数的数量随着网络层数的增加呈线性变化趋势,例如中间层的特征通道数等等。
随着模型复杂度的提升,搜索空间急剧增大。 | -(2)未加限制的剪枝 +(2)未加限制的剪枝 ​ 完成训练后,不加限制地剪去那些冗余参数。 @@ -113,9 +123,9 @@ | 优点 | 保持模型性能不损失的情况下,减少参数量9-11倍;
剔除不重要的权重,可以加快计算速度,同时也可以提高模型的泛化能力; | | 缺点 | 极度依赖专门的运行库和特殊的运行平台,不具有通用性;
压缩率过大时,破坏性能; | -(3)参数量化 +(3)参数量化 -​ 神经网络的参数类型一般是32位浮点型,使用较小的精度代替32位所表示的精度。或者是将多个权重映射到同一数值,权重共享。**量化其实是一种权值共享的策略**。量化后的权值张量是一个高度稀疏的有很多共享权值的矩阵,对非零参数,我们还可以进行定点压缩,以获得更高的压缩率。 +​ 神经网络的参数类型一般是32位浮点型,使用较小的精度代替32位所表示的精度。或者是将多个权重映射到同一数值,权重共享。**量化其实是一种权值共享的策略**。量化后的权值张量是一个高度稀疏的有很多共享权值的矩阵,对非零参数,我们还可以进行定点压缩,以获得更高的压缩率。 | 事项 | 特点 | | ---- | ------------------------------------------------------------ | @@ -130,7 +140,7 @@ INT8量化:TensorFlow-lite [20], TensorRT [21]; (4)二值网络 -​ 相对量化更为极致,对于32bit浮点型数用1bit二进制数-1或者1表示,可大大减小模型尺寸。 +​ 相对量化更为极致,对于32bit浮点型数用1bit二进制数-1或者1表示,可大大减小模型尺寸。 | 事项 | 特点 | | ---- | ------------------------------------------------------------ | @@ -151,7 +161,7 @@ INT8量化:TensorFlow-lite [20], TensorRT [21]; 在2013年,Denil等人[57]从理论上利用低秩分解的技术并分析了深度神经网络存在大量的冗余信 息,开创了基于低秩分解的深度网络模型压缩与加速的新思路.如图7所示,展示了主流的张量分解后卷积 计 算. -![](img\ch17\低秩分解模型压缩加速.jpg) +![](/assets/ch17\低秩分解模型压缩加速.jpg) (出自《深度神经网络压缩与加速综述》) @@ -177,12 +187,12 @@ INT8量化:TensorFlow-lite [20], TensorRT [21]; ### 17.4.9 网络压缩未来研究方向有哪些? -网络剪枝、网络精馏和网络分解都能在一定程度上实现网络压缩的目的.回归到深度网络压缩的本质目的上,即提取网络中的有用信息,以下是一些值得研究和探寻的方向. -(1) 权重参数对结果的影响度量.深度网络的最终结果是由全部的权重参数共同作用形成的,目前,关于单个卷积核/卷积核权重的重要性的度量仍然是比较简单的方式,尽管文献[14]中给出了更为细节的分析,但是由于计算难度大,并不实用.因此,如何通过更有效的方式来近似度量单个参数对模型的影响,具有重要意义. -(2) 学生网络结构的构造.学生网络的结构构造目前仍然是由人工指定的,然而,不同的学生网络结构的训练难度不同,最终能够达到的效果也有差异.因此,如何根据教师网络结构设计合理的网络结构在精简模型的条件下获取较高的模型性能,是未来的一个研究重点. -(3) 参数重建的硬件架构支持.通过分解网络可以无损地获取压缩模型,在一些对性能要求高的场景中是非常重要的.然而,参数的重建步骤会拖累预测阶段的时间开销,如何通过硬件的支持加速这一重建过程,将是未来的一个研究方向. -(4) 任务或使用场景层面的压缩.大型网络通常是在量级较大的数据集上训练完成的,比如,在 ImageNet上训练的模型具备对 1 000 类物体的分类,但在一些具体场景的应用中,可能仅需要一个能识别其中几类的小型模型.因此,如何从一个全功能的网络压缩得到部分功能的子网络,能够适应很多实际应用场景的需求. -(5) 网络压缩效用的评价.目前,对各类深度网络压缩算法的评价是比较零碎的,侧重于和被压缩的大型网络在参数量和运行时间上的比较.未来的研究可以从提出更加泛化的压缩评价标准出发,一方面平衡运行速度和模型大小在不同应用场景下的影响;另一方面,可以从模型本身的结构性出发,对压缩后的模型进行评价. +网络剪枝、网络精馏和网络分解都能在一定程度上实现网络压缩的目的.回归到深度网络压缩的本质目的上,即提取网络中的有用信息,以下是一些值得研究和探寻的方向. +(1) 权重参数对结果的影响度量.深度网络的最终结果是由全部的权重参数共同作用形成的,目前,关于单个卷积核/卷积核权重的重要性的度量仍然是比较简单的方式,尽管文献[14]中给出了更为细节的分析,但是由于计算难度大,并不实用.因此,如何通过更有效的方式来近似度量单个参数对模型的影响,具有重要意义. +(2) 学生网络结构的构造.学生网络的结构构造目前仍然是由人工指定的,然而,不同的学生网络结构的训练难度不同,最终能够达到的效果也有差异.因此,如何根据教师网络结构设计合理的网络结构在精简模型的条件下获取较高的模型性能,是未来的一个研究重点. +(3) 参数重建的硬件架构支持.通过分解网络可以无损地获取压缩模型,在一些对性能要求高的场景中是非常重要的.然而,参数的重建步骤会拖累预测阶段的时间开销,如何通过硬件的支持加速这一重建过程,将是未来的一个研究方向. +(4) 任务或使用场景层面的压缩.大型网络通常是在量级较大的数据集上训练完成的,比如,在 ImageNet上训练的模型具备对 1 000 类物体的分类,但在一些具体场景的应用中,可能仅需要一个能识别其中几类的小型模型.因此,如何从一个全功能的网络压缩得到部分功能的子网络,能够适应很多实际应用场景的需求. +(5) 网络压缩效用的评价.目前,对各类深度网络压缩算法的评价是比较零碎的,侧重于和被压缩的大型网络在参数量和运行时间上的比较.未来的研究可以从提出更加泛化的压缩评价标准出发,一方面平衡运行速度和模型大小在不同应用场景下的影响;另一方面,可以从模型本身的结构性出发,对压缩后的模型进行评价. (出自《深度网络模型压缩综述》) @@ -195,9 +205,9 @@ https://blog.csdn.net/nature553863/article/details/81083955 模型优化加速能够提升网络的计算效率,具体包括: (1)Op-level的快速算法:FFT Conv2d (7x7, 9x9), Winograd Conv2d (3x3, 5x5) 等; (2)Layer-level的快速算法:Sparse-block net [1] 等; -(3)优化工具与库:TensorRT (Nvidia), Tensor Comprehension (Facebook) 和 Distiller (Intel) 等; +(3)优化工具与库:TensorRT (Nvidia), Tensor Comprehension (Facebook) 和 Distiller (Intel) 等; -原文:https://blog.csdn.net/nature553863/article/details/81083955 +原文:https://blog.csdn.net/nature553863/article/details/81083955 ### 17.5.2 TensorRT加速原理 @@ -215,11 +225,11 @@ https://blog.csdn.net/xh_hit/article/details/79769599 (3) 对于网络结构的水平组合,水平组合是指将输入为相同张量和执行相同操作的层融合一起,例如图2向图3的转化。 -![](img/ch17/tensorRT1.png) +![](/assets/ch17/tensorRT1.png) -![](img/ch17/tensorRT2.png) +![](/assets/ch17/tensorRT2.png) -![](img/ch17/tensorRT3.png) +![](/assets/ch17/tensorRT3.png) ​ 以上3步即是TensorRT对于所部署的深度学习网络的优化和重构,根据其优化和重构策略,第一和第二步适用于所有的网络架构,但是第三步则对于含有Inception结构的神经网络加速效果最为明显。 @@ -251,15 +261,15 @@ https://blog.csdn.net/xh_hit/article/details/79769599 | Resnet101 | int8 | TRT4.0.1 | 9 | 0.7574 | ## 17.6 影响神经网络速度的4个因素(再稍微详细一点) -1. FLOPs(FLOPs就是网络执行了多少multiply-adds操作); +1. FLOPs(FLOPs就是网络执行了多少multiply-adds操作); + +2. MAC(内存访问成本); -2. MAC(内存访问成本); +3. 并行度(如果网络并行度高,速度明显提升); -3. 并行度(如果网络并行度高,速度明显提升); +4. 计算平台(GPU,ARM) -4. 计算平台(GPU,ARM) - ## 17.7 压缩和加速方法如何选择? @@ -274,23 +284,23 @@ https://blog.csdn.net/xh_hit/article/details/79769599 ## 17.8 改变网络结构设计为什么会实现模型压缩、加速? ### 17.8.1 Group convolution -​ Group convolution最早出现在AlexNet中,是为了解决单卡显存不够,将网络部署到多卡上进行训练而提出。Group convolution可以减少单个卷积1/g的参数量。如何计算的呢? +​ Group convolution最早出现在AlexNet中,是为了解决单卡显存不够,将网络部署到多卡上进行训练而提出。Group convolution可以减少单个卷积1/g的参数量。如何计算的呢? ​ 假设 - 输入特征的的维度为$H*W*C_1$; - 卷积核的维度为$H_1*W_1*C_1$,共$C_2$个; -- 输出特征的维度为$H_1*W_1*C_2$ 。 +- 输出特征的维度为$H_1*W_1*C_2$ 。 传统卷积计算方式如下: -![image](img/ch17/1.png) +![image](/assets/ch17/1.png) 传统卷积运算量为: $$ A = H*W * h1 * w1 * c1 * c2 $$ Group convolution是将输入特征的维度c1分成g份,每个group对应的channel数为c1/g,特征维度H \* W \* c1/g;,每个group对应的卷积核的维度也相应发生改变为h1 \* w1 \* c1/9,共c2/g个;每个group相互独立运算,最后将结果叠加在一起。 Group convolution计算方式如下: -![image](img/ch17/2.png) +![image](/assets/ch17/2.png) Group convolution运算量为: $$ B = H * W * h1 * w1 * c1/g * c2/g * g @@ -307,19 +317,19 @@ depthwise conv(DW)有效减少参数数量并提升运算速度。但是由于 pointwise conv(PW)实现通道特征信息交流,解决DW卷积导致“信息流通不畅”的问题。 假设输入特征的的维度为H \* W \* c1;卷积核的维度为h1 \* w1 \* c1,共c2个;输出特征的维度为 H1 \* W1 \* c2。 传统卷积计算方式如下: -![image](img/ch17/3.png) +![image](/assets/ch17/3.png) 传统卷积运算量为: $$ A = H * W * h1 * w1 * c1 * c2 $$ DW卷积的计算方式如下: -![image](img/ch17/4.png) -DW卷积运算量为: +![image](/assets/ch17/4.png) +DW卷积运算量为: $$ B_DW = H * W * h1 * w1 * 1 * c1 $$ PW卷积的计算方式如下: -![image](img/ch17/5.png) +![image](/assets/ch17/5.png) $$ B_PW = H_m * W_m * 1 * 1 * c_1 * c_2 @@ -330,7 +340,7 @@ B = B_DW + B_PW $$ Depthwise separable convolution相对于传统卷积的运算量: $$ -\dfrac{B}{A} = \dfrac{ H * W * h_1 * w_1 * 1 * c_1 + H_m * W_m * 1 * 1 * c_1 * c_2}{H * W * h1 * w1 * c_1 * c_2} +\dfrac{B}{A} = \dfrac{ H * W * h_1 * w_1 * 1 * c_1 + H_m * W_m * 1 * 1 * c_1 * c_2}{H * W * h1 * w1 * c_1 * c_2} = \dfrac{1}{c_2} + \dfrac{1}{h_1 * w_1} $$ @@ -376,141 +386,141 @@ $$ **模型中分支数量越少,模型速度越快** 此结论主要是由实验结果所得。 以下为网络分支数和各分支包含的卷积数目对神经网络速度的影响。 -![image](img/ch17/6.png) +![image](/assets/ch17/6.png) 实验中使用的基本网络结构,分别将它们重复10次,然后进行实验。实验结果如下: -![image](img/ch17/7.png) +![image](/assets/ch17/7.png) 由实验结果可知,随着网络分支数量的增加,神经网络的速度在降低。网络碎片化程度对GPU的影响效果明显,对CPU不明显,但是网络速度同样在降低。 ### 17.8.7 减少元素级操作 **元素级操作所带来的时间消耗也不能忽视** ReLU ,Tensor 相加,Bias相加的操作,分离卷积(depthwise convolution)都定义为元素级操作。 FLOPs大多数是对于卷积计算而言的,因为元素级操作的FLOPs相对要低很多。但是过的元素级操作也会带来时间成本。ShuffleNet作者对ShuffleNet v1和MobileNet v2的几种层操作的时间消耗做了分析,发现元素级操作对于网络速度的影响也很大。 -![image](img/ch17/8.png) +![image](/assets/ch17/8.png) ## 17.9 常用的轻量级网络有哪些? ### 17.9.1 SequeezeNet -SqueenzeNet出自F. N. Iandola, S.Han等人发表的论文《SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and < 0.5MB model size》,作者在保证精度不损失的同时,将原始AlexNet压缩至原来的510倍。 +SqueenzeNet出自F. N. Iandola, S.Han等人发表的论文《SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and < 0.5MB model size》,作者在保证精度不损失的同时,将原始AlexNet压缩至原来的510倍。 #### 1.1 设计思想 在网络结构设计方面主要采取以下三种方式: * 用1\*1卷积核替换3\*3卷积 - * 理论上一个1\*1卷积核的参数是一个3\*3卷积核的1/9,可以将模型尺寸压缩9倍。 + * 理论上一个1\*1卷积核的参数是一个3\*3卷积核的1/9,可以将模型尺寸压缩9倍。 * 减小3\*3卷积的输入通道数 - * 根据上述公式,减少输入通道数不仅可以减少卷积的运算量,而且输入通道数与输出通道数相同时还可以减少MAC。 + * 根据上述公式,减少输入通道数不仅可以减少卷积的运算量,而且输入通道数与输出通道数相同时还可以减少MAC。 * 延迟降采样 - * 分辨率越大的输入能够提供更多特征的信息,有利于网络的训练判断,延迟降采样可以提高网络精度。 + * 分辨率越大的输入能够提供更多特征的信息,有利于网络的训练判断,延迟降采样可以提高网络精度。 #### 1.2 网络架构 SqueezeNet提出一种多分支结构——fire model,其中是由Squeeze层和expand层构成。Squeeze层是由s1个1\*1卷积组成,主要是通过1\*1的卷积降低expand层的输入维度;expand层利用e1个1\*1和e3个3\*3卷积构成多分支结构提取输入特征,以此提高网络的精度(其中e1=e3=4*s1)。 -![image](img/ch17/9.png) +![image](/assets/ch17/9.png) SqueezeNet整体网络结构如下图所示: -![image](img/ch17/10.png) +![image](/assets/ch17/10.png) #### 1.3实验结果 不同压缩方法在ImageNet上的对比实验结果 -![image](img/ch17/11.png) +![image](/assets/ch17/11.png) 由实验结果可知,SqueezeNet不仅保证了精度,而且将原始AlexNet从240M压缩至4.8M,压缩50倍,说明此轻量级网络设计是可行。 ### 17.9.2 MobileNet MobileNet 是Google团队于CVPR-2017的论文《MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications》中针对手机等嵌入式设备提出的一种轻量级的深层神经网络,该网络结构在VGG的基础上使用DW+PW的组合,在保证不损失太大精度的同时,降低模型参数量。 #### 2.1 设计思想 * 采用深度可分离卷积代替传统卷积 - * 采用DW卷积在减少参数数量的同时提升运算速度。但是由于每个feature map只被一个卷积核卷积,因此经过DW输出的feature map不能只包含输入特征图的全部信息,而且特征之间的信息不能进行交流,导致“信息流通不畅”。 - * 采用PW卷积实现通道特征信息交流,解决DW卷积导致“信息流通不畅”的问题。 + * 采用DW卷积在减少参数数量的同时提升运算速度。但是由于每个feature map只被一个卷积核卷积,因此经过DW输出的feature map不能只包含输入特征图的全部信息,而且特征之间的信息不能进行交流,导致“信息流通不畅”。 + * 采用PW卷积实现通道特征信息交流,解决DW卷积导致“信息流通不畅”的问题。 * 使用stride=2的卷积替换pooling - * 直接在卷积时利用stride=2完成了下采样,从而节省了需要再去用pooling再去进行一次下采样的时间,可以提升运算速度。同时,因为pooling之前需要一个stride=1的 conv,而与stride=2 conv的计算量想比要高近4倍(**个人理解**)。 + * 直接在卷积时利用stride=2完成了下采样,从而节省了需要再去用pooling再去进行一次下采样的时间,可以提升运算速度。同时,因为pooling之前需要一个stride=1的 conv,而与stride=2 conv的计算量想比要高近4倍(**个人理解**)。 #### 2.2 网络架构 * DW conv和PW conv -MobileNet的网络架构主要是由DW conv和PW conv组成,相比于传统卷积可以降低$\dfrac{1}{N} + \dfrac{1}{Dk}​$倍的计算量。 -标准卷积与DW conv和PW conv如图所示: -![image](img/ch17/12.png) -深度可分离卷积与传统卷积运算量对比: -![image](img/ch17/13.png) -网络结构: -![image](img/ch17/14.png) + MobileNet的网络架构主要是由DW conv和PW conv组成,相比于传统卷积可以降低$\dfrac{1}{N} + \dfrac{1}{Dk}​$倍的计算量。 + 标准卷积与DW conv和PW conv如图所示: + ![image](/assets/ch17/12.png) + 深度可分离卷积与传统卷积运算量对比: + ![image](/assets/ch17/13.png) + 网络结构: + ![image](/assets/ch17/14.png) * MobileNets的架构 -![image](img/ch17/15.png) + ![image](/assets/ch17/15.png) #### 2.3 实验结果 -![image](img/ch17/16.png) +![image](/assets/ch17/16.png) 由上表可知,使用相同的结构,深度可分离卷积虽然准确率降低1%,但是参数量减少了6/7。 ### 17.9.3 MobileNet-v2 MobileNet-V2是2018年1月公开在arXiv上论文《Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation》,是对MobileNet-V1的改进,同样是一个轻量化卷积神经网络。 #### 3.1 设计思想 * 采用Inverted residuals - * 为了保证网络可以提取更多的特征,在residual block中第一个1\*1 Conv和3*3 DW Conv之前进行通道扩充 + * 为了保证网络可以提取更多的特征,在residual block中第一个1\*1 Conv和3*3 DW Conv之前进行通道扩充 * Linear bottlenecks - * 为了避免Relu对特征的破坏,在residual block的Eltwise sum之前的那个 1\*1 Conv 不再采用Relu + * 为了避免Relu对特征的破坏,在residual block的Eltwise sum之前的那个 1\*1 Conv 不再采用Relu * stride=2的conv不使用shot-cot,stride=1的conv使用shot-cut #### 3.2 网络架构 * Inverted residuals -ResNet中Residuals block先经过1\*1的Conv layer,把feature map的通道数降下来,再经过3\*3 Conv layer,最后经过一个1\*1 的Conv layer,将feature map 通道数再“扩张”回去。即采用先压缩,后扩张的方式。而 inverted residuals采用先扩张,后压缩的方式。 -MobileNet采用DW conv提取特征,由于DW conv本身提取的特征数就少,再经过传统residuals block进行“压缩”,此时提取的特征数会更少,因此inverted residuals对其进行“扩张”,保证网络可以提取更多的特征。 -![image](img/ch17/17.png) + ResNet中Residuals block先经过1\*1的Conv layer,把feature map的通道数降下来,再经过3\*3 Conv layer,最后经过一个1\*1 的Conv layer,将feature map 通道数再“扩张”回去。即采用先压缩,后扩张的方式。而 inverted residuals采用先扩张,后压缩的方式。 + MobileNet采用DW conv提取特征,由于DW conv本身提取的特征数就少,再经过传统residuals block进行“压缩”,此时提取的特征数会更少,因此inverted residuals对其进行“扩张”,保证网络可以提取更多的特征。 + ![image](/assets/ch17/17.png) * Linear bottlenecks -ReLu激活函数会破坏特征。ReLu对于负的输入,输出全为0,而本来DW conv特征通道已经被“压缩”,再经过ReLu的话,又会损失一部分特征。采用Linear,目的是防止Relu破坏特征。 -![image](img/ch17/18.png) + ReLu激活函数会破坏特征。ReLu对于负的输入,输出全为0,而本来DW conv特征通道已经被“压缩”,再经过ReLu的话,又会损失一部分特征。采用Linear,目的是防止Relu破坏特征。 + ![image](/assets/ch17/18.png) * shortcut -stride=2的conv不使用shot-cot,stride=1的conv使用shot-cut -![image](img/ch17/19.png) + stride=2的conv不使用shot-cot,stride=1的conv使用shot-cut + ![image](/assets/ch17/19.png) * 网络架构 -![image](img/ch17/20.png) + ![image](/assets/ch17/20.png) ### 17.9.4 Xception Xception是Google提出的,arXiv 的V1 于2016年10月公开《Xception: Deep Learning with Depthwise Separable Convolutions 》,Xception是对Inception v3的另一种改进,主要是采用depthwise separable convolution来替换原来Inception v3中的卷积操作。 #### 4.1设计思想 * 采用depthwise separable convolution来替换原来Inception v3中的卷积操作 - 与原版的Depth-wise convolution有两个不同之处: - * 第一个:原版Depth-wise convolution,先逐通道卷积,再1*1卷积; 而Xception是反过来,先1\*1卷积,再逐通道卷积; - * 第二个:原版Depth-wise convolution的两个卷积之间是不带激活函数的,而Xception在经过1\*1卷积之后会带上一个Relu的非线性激活函数; + 与原版的Depth-wise convolution有两个不同之处: + * 第一个:原版Depth-wise convolution,先逐通道卷积,再1*1卷积; 而Xception是反过来,先1\*1卷积,再逐通道卷积; + * 第二个:原版Depth-wise convolution的两个卷积之间是不带激活函数的,而Xception在经过1\*1卷积之后会带上一个Relu的非线性激活函数; #### 4.2网络架构 feature map在空间和通道上具有一定的相关性,通过Inception模块和非线性激活函数实现通道之间的解耦。增多3\*3的卷积的分支的数量,使它与1\*1的卷积的输出通道数相等,此时每个3\*3的卷积只作用与一个通道的特征图上,作者称之为“极致的Inception(Extream Inception)”模块,这就是Xception的基本模块。 -![image](img/ch17/21.png) +![image](/assets/ch17/21.png) ### 17.9.5 ShuffleNet-v1 ShuffleNet 是Face++团队提出的,晚于MobileNet两个月在arXiv上公开《ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices 》用于移动端前向部署的网络架构。ShuffleNet基于MobileNet的group思想,将卷积操作限制到特定的输入通道。而与之不同的是,ShuffleNet将输入的group进行打散,从而保证每个卷积核的感受野能够分散到不同group的输入中,增加了模型的学习能力。 #### 5.1 设计思想 * 采用group conv减少大量参数 - * roup conv与DW conv存在相同的“信息流通不畅”问题 + * roup conv与DW conv存在相同的“信息流通不畅”问题 * 采用channel shuffle解决上述问题 - * MobileNet中采用PW conv解决上述问题,SheffleNet中采用channel shuffle + * MobileNet中采用PW conv解决上述问题,SheffleNet中采用channel shuffle * 采用concat替换add操作 - * avg pooling和DW conv(s=2)会减小feature map的分辨率,采用concat增加通道数从而弥补分辨率减小而带来信息的损失 + * avg pooling和DW conv(s=2)会减小feature map的分辨率,采用concat增加通道数从而弥补分辨率减小而带来信息的损失 #### 5.2 网络架构 MobileNet中1\*1卷积的操作占据了约95%的计算量,所以作者将1\*1也更改为group卷积,使得相比MobileNet的计算量大大减少。 -![image](img/ch17/22.png) +![image](/assets/ch17/22.png) group卷积与DW存在同样使“通道信息交流不畅”的问题,MobileNet中采用PW conv解决上述问题,SheffleNet中采用channel shuffle。 ShuffleNet的shuffle操作如图所示 -![image](img/ch17/24.png) +![image](/assets/ch17/24.png) avg pooling和DW conv(s=2)会减小feature map的分辨率,采用concat增加通道数从而弥补分辨率减小而带来信息的损失;实验表明:多多使用通道(提升通道的使用率),有助于提高小模型的准确率。 -![image](img/ch17/23.png) +![image](/assets/ch17/23.png) 网络结构: -![image](img/ch17/25.png) +![image](/assets/ch17/25.png) ### 17.9.6 ShuffleNet-v2 huffleNet-v2 是Face++团队提出的《ShuffleNet V2: Practical Guidelines for Ecient CNN Architecture Design》,旨在设计一个轻量级但是保证精度、速度的深度网络。 #### 6.1 设计思想 * 文中提出影响神经网络速度的4个因素: - * a. FLOPs(FLOPs就是网络执行了多少multiply-adds操作) - * b. MAC(内存访问成本) - * c. 并行度(如果网络并行度高,速度明显提升) - * d. 计算平台(GPU,ARM) + * a. FLOPs(FLOPs就是网络执行了多少multiply-adds操作) + * b. MAC(内存访问成本) + * c. 并行度(如果网络并行度高,速度明显提升) + * d. 计算平台(GPU,ARM) * ShuffleNet-v2 提出了4点网络结构设计策略: - * G1.输入输出的channel相同时,MAC最小 - * G2.过度的组卷积会增加MAC - * G3.网络碎片化会降低并行度 - * G4.元素级运算不可忽视 + * G1.输入输出的channel相同时,MAC最小 + * G2.过度的组卷积会增加MAC + * G3.网络碎片化会降低并行度 + * G4.元素级运算不可忽视 #### 6.2 网络结构 depthwise convolution 和 瓶颈结构增加了 MAC,用了太多的 group,跨层连接中的 element-wise Add 操作也是可以优化的点。所以在 shuffleNet V2 中增加了几种新特性。 所谓的 channel split 其实就是将通道数一分为2,化成两分支来代替原先的分组卷积结构(G2),并且每个分支中的卷积层都是保持输入输出通道数相同(G1),其中一个分支不采取任何操作减少基本单元数(G3),最后使用了 concat 代替原来的 elementy-wise add,并且后面不加 ReLU 直接(G4),再加入channle shuffle 来增加通道之间的信息交流。 对于下采样层,在这一层中对通道数进行翻倍。 在网络结构的最后,即平均值池化层前加入一层 1x1 的卷积层来进一步的混合特征。 -![image](img/ch17/26.png) +![image](/assets/ch17/26.png) 网络结构 -![image](img/ch17/27.png) +![image](/assets/ch17/27.png) #### 6.4 ShuffleNet-v2具有高精度的原因 * 由于高效,可以增加更多的channel,增加网络容量 @@ -519,7 +529,7 @@ depthwise convolution 和 瓶颈结构增加了 MAC,用了太多的 group, ## 17.10 现有移动端开源框架及其特点 -### 17.10.1 NCNN +### 17.10.1 NCNN 1、开源时间:2017年7月    @@ -531,20 +541,20 @@ depthwise convolution 和 瓶颈结构增加了 MAC,用了太多的 group, - 1)NCNN考虑了手机端的硬件和系统差异以及调用方式,架构设计以手机端运行为主要原则。 - 2)无第三方依赖,跨平台,手机端 CPU 的速度快于目前所有已知的开源框架(以开源时间为参照对象)。 -- 3)基于 ncnn,开发者能够将深度学习算法轻松移植到手机端高效执行,开发出人工智能 APP。 +- 3)基于 ncnn,开发者能够将深度学习算法轻松移植到手机端高效执行,开发出人工智能 APP。 -5、功能: +5、功能: - 1、NCNN支持卷积神经网络、多分支多输入的复杂网络结构,如vgg、googlenet、resnet、squeezenet 等。 -- 2、NCNN无需依赖任何第三方库。 -- 3、NCNN全部使用C/C++实现,以及跨平台的cmake编译系统,可轻松移植到其他系统和设备上。 -- 4、汇编级优化,计算速度极快。使用ARM NEON指令集实现卷积层,全连接层,池化层等大部分 CNN 关键层。 -- 5、精细的数据结构设计,没有采用需消耗大量内存的通常框架——im2col + 矩阵乘法,使得内存占用极低。 -- 6、支持多核并行计算,优化CPU调度。 -- 7、整体库体积小于500K,可精简到小于300K。 -- 8、可扩展的模型设计,支持8bit 量化和半精度浮点存储。 -- 9、支持直接内存引用加载网络模型。 -- 10、可注册自定义层实现并扩展。 +- 2、NCNN无需依赖任何第三方库。 +- 3、NCNN全部使用C/C++实现,以及跨平台的cmake编译系统,可轻松移植到其他系统和设备上。 +- 4、汇编级优化,计算速度极快。使用ARM NEON指令集实现卷积层,全连接层,池化层等大部分 CNN 关键层。 +- 5、精细的数据结构设计,没有采用需消耗大量内存的通常框架——im2col + 矩阵乘法,使得内存占用极低。 +- 6、支持多核并行计算,优化CPU调度。 +- 7、整体库体积小于500K,可精简到小于300K。 +- 8、可扩展的模型设计,支持8bit 量化和半精度浮点存储。 +- 9、支持直接内存引用加载网络模型。 +- 10、可注册自定义层实现并扩展。 6、NCNN在Android端部署示例 @@ -608,7 +618,7 @@ ANDROID_PLATFORM 指定最低系统版本,"android-14" 就是 android-4.0 QNNPACK 的输入矩阵来自低精度、移动专用的计算机视觉模型。其它库在计算A和B矩阵相乘时,重新打包 A 和 B 矩阵以更好地利用缓存层次结构,希望在大量计算中分摊打包开销,QNNPACK 删除所有计算非必需的内存转换,针对 A和B矩阵相乘适用于一级缓存的情况进行了优化。 -![](img/ch17/QNNPACK1.jpeg) +![](/assets/ch17/QNNPACK1.jpeg) ​ 1)优化了L1缓存计算,不需要输出中间结果,直接输出最终结果,节省内存带宽和缓存占用。 @@ -617,27 +627,27 @@ QNNPACK 的输入矩阵来自低精度、移动专用的计算机视觉模型。 - 常规实现:在量化矩阵-矩阵乘法中,8位整数的乘积通常会被累加至 32 位的中间结果中,随后重新量化以产生 8 位的输出。遇到大矩阵尺寸时,比如有时K太大,A和B的面板无法直接转入缓存,此时,需利用缓存层次结构,借助GEMM将A和B的面板沿着K维分割成固定大小的子面板,以便于每个子面板都能适应L1缓存,随后为每个子面板调用微内核。这一缓存优化需要 PDOT 为内核输出 32 位中间结果,最终将它们相加并重新量化为 8 位整数。 - 优化实现:由于 ONNPACK 对于面板 A 和 B 总是适应 L1 缓存的移动神经网络进行了优化,因此它在调用微内核时处理整个 A 和 B 的面板。而由于无需在微内核之外积累 32 位的中间结果,QNNPACK 会将 32 位的中间结果整合进微内核中并写出 8 位值,这节省了内存带宽和缓存占用。 -![](img/ch17/QNNPACK2.jpeg) +![](/assets/ch17/QNNPACK2.jpeg) ​ 2)取消了矩阵 A 的重新打包。 - 常规实现: - 矩阵 B 包含静态权重,可以一次性转换成任何内存布局,但矩阵 A 包含卷积输入,每次推理运行都会改变。因此,重新打包矩阵 A 在每次运行时都会产生开销。尽管存在开销,传统的 GEMM实现还是出于以下两个原因对矩阵 A 进行重新打包: + 矩阵 B 包含静态权重,可以一次性转换成任何内存布局,但矩阵 A 包含卷积输入,每次推理运行都会改变。因此,重新打包矩阵 A 在每次运行时都会产生开销。尽管存在开销,传统的 GEMM实现还是出于以下两个原因对矩阵 A 进行重新打包: - a 缓存关联性及微内核效率受限。如果不重新打包,微内核将不得不读取被潜在的大跨距隔开的几行A。如果这个跨距恰好是 2 的许多次幂的倍数,面板中不同行 A 的元素可能会落入同一缓存集中。如果冲突的行数超过了缓存关联性,它们就会相互驱逐,性能也会大幅下降。 - - b 打包对微内核效率的影响与当前所有移动处理器支持的 SIMD 向量指令的使用密切相关。这些指令加载、存储或者计算小型的固定大小元素向量,而不是单个标量(scalar)。在矩阵相乘中,充分利用向量指令达到高性能很重要。在传统的 GEMM 实现中,微内核把 MR 元素重新打包到向量暂存器里的 MR 线路中。 + a 缓存关联性及微内核效率受限。如果不重新打包,微内核将不得不读取被潜在的大跨距隔开的几行A。如果这个跨距恰好是 2 的许多次幂的倍数,面板中不同行 A 的元素可能会落入同一缓存集中。如果冲突的行数超过了缓存关联性,它们就会相互驱逐,性能也会大幅下降。 + + b 打包对微内核效率的影响与当前所有移动处理器支持的 SIMD 向量指令的使用密切相关。这些指令加载、存储或者计算小型的固定大小元素向量,而不是单个标量(scalar)。在矩阵相乘中,充分利用向量指令达到高性能很重要。在传统的 GEMM 实现中,微内核把 MR 元素重新打包到向量暂存器里的 MR 线路中。 - 优化实现: - a 当面板适配一级缓存时,不会存在缓存关联性及微内核效率受限的问题。 + a 当面板适配一级缓存时,不会存在缓存关联性及微内核效率受限的问题。 - b 在 QNNPACK 实现中,MR 元素在存储中不是连续的,微内核需要把它们加载到不同的向量暂存器中。越来越大的暂存器压力迫使 QNNPACK 使用较小的 MRxNR 拼贴,但实际上这种差异很小,而且可以通过消除打包开销来补偿。例如,在 32 位 ARM 架构上,QNNPACK 使用 4×8 微内核,其中 57% 的向量指令是乘-加;另一方面,gemmlowp 库使用效率稍高的 4×12 微内核,其中 60% 的向量指令是乘-加。微内核加载 A 的多个行,乘以 B 的满列,结果相加,然后完成再量化并记下量化和。A 和 B 的元素被量化为 8 位整数,但乘积结果相加到 32 位。大部分 ARM 和 ARM64 处理器没有直接完成这一运算的指令,所以它必须分解为多个支持运算。QNNPACK 提供微内核的两个版本,其不同之处在于用于乘以 8 位值并将它们累加到 32 位的指令序列。 + b 在 QNNPACK 实现中,MR 元素在存储中不是连续的,微内核需要把它们加载到不同的向量暂存器中。越来越大的暂存器压力迫使 QNNPACK 使用较小的 MRxNR 拼贴,但实际上这种差异很小,而且可以通过消除打包开销来补偿。例如,在 32 位 ARM 架构上,QNNPACK 使用 4×8 微内核,其中 57% 的向量指令是乘-加;另一方面,gemmlowp 库使用效率稍高的 4×12 微内核,其中 60% 的向量指令是乘-加。微内核加载 A 的多个行,乘以 B 的满列,结果相加,然后完成再量化并记下量化和。A 和 B 的元素被量化为 8 位整数,但乘积结果相加到 32 位。大部分 ARM 和 ARM64 处理器没有直接完成这一运算的指令,所以它必须分解为多个支持运算。QNNPACK 提供微内核的两个版本,其不同之处在于用于乘以 8 位值并将它们累加到 32 位的指令序列。 2)**从矩阵相乘到卷积** -![](img/ch17/QNNPACK3.jpeg) +![](/assets/ch17/QNNPACK3.jpeg) ​ 传统实现: @@ -655,7 +665,7 @@ QNNPACK 的输入矩阵来自低精度、移动专用的计算机视觉模型。 3)**深度卷积** -![](img/ch17/QNNPACK4.jpeg) +![](/assets/ch17/QNNPACK4.jpeg) 分组卷积(grouped convolution)将输入和输出通道分割成多组,然后对每个组进行分别处理。在有限条件下,当组数等于通道数时,该卷积就是深度卷积,常用于当前的神经网络架构中。深度卷积对每个通道分别执行空间滤波,展示了与正常卷积非常不同的计算模式。因此,通常要向深度卷积提供单独实现,QNNPACK 包括一个高度优化版本 3×3 深度卷积。 @@ -667,23 +677,23 @@ QNNPACK 实现高性能的关键因素在于完美利用通用暂存器(GPR 7、性能优势: -​ 测试结果显示出 QNNPACK 在端到端基准上的性能优势。在量化当前最优 MobileNetV2 架构上,基于QNNPACK 的 Caffe2 算子的速度大约是 TensorFlow Lite 速度的 2 倍,在多种手机上都是如此。除了 QNNPACK 之外,Facebook 还开源了 Caffe2 quantized MobileNet v2 模型,其 top-1 准确率比相应的 TensorFlow 模型高出 1.3%。 +​ 测试结果显示出 QNNPACK 在端到端基准上的性能优势。在量化当前最优 MobileNetV2 架构上,基于QNNPACK 的 Caffe2 算子的速度大约是 TensorFlow Lite 速度的 2 倍,在多种手机上都是如此。除了 QNNPACK 之外,Facebook 还开源了 Caffe2 quantized MobileNet v2 模型,其 top-1 准确率比相应的 TensorFlow 模型高出 1.3%。 **MobileNetV1** MobileNetV1 架构在使用深度卷积(depthwise convolution)使模型更适合移动设备方面具备开创性。MobileNetV1 包括几乎整个 1×1 卷积和 3×3 卷积。Facebook 研究者将量化 MobileNetV1 模型从 TensorFlow Lite 转换而来,并在 TensorFlow Lite 和 QNNPACK 的 32-bit ARM 设备上对 MobileNetV1 进行基准测试。二者运行时均使用 4 线程,研究者观察到 QNNPACK 的运行速度几何平均值是 TensorFlow Lite 的 1.8 倍。 -![](img/ch17/mv1.jpg) +![](/assets/ch17/mv1.jpg) **MobileNetV2** 作为移动视觉任务的当前最优架构之一,MobileNetV2 引入了瓶颈构造块和瓶颈之间的捷径连接。研究者在 MobileNetV2 分类模型的量化版上对比基于 QNNPACK 的 Caffe2 算子和 TensorFlow Lite 实现。使用的量化 Caffe2 MobileNetV2 模型已开源,量化 TensorFlow Lite 模型来自官方库:https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/g3doc/models.md。下表展示了二者在常用测试集上的 top1 准确率: -![](img/ch17/mv2.jpg) +![](/assets/ch17/mv2.jpg) ​ Facebook 研究者利用这些模型建立了 Facebook AI 性能评估平台(https://github.com/facebook/FAI-PEP)的基准,该基准基于 32-bit ARM 环境的大量手机设备。对于 TensorFlow Lite 线程设置,研究者尝试了一到四个线程,并报告了最快速的结果。结果显示 TensorFlow Lite 使用四线程的性能最优,因此后续研究中使用四线程来对比 TensorFlow Lite 和 QNNPACK。下表展示了结果,以及在典型智能手机和高端机上,基于 QNNPACK 的算子速度比 TensorFlow Lite 快得多。 -![](img/ch17/mv3.jpg) +![](/assets/ch17/mv3.jpg) Facebook开源高性能内核库QNNPACK https://baijiahao.baidu.com/s?id=1615725346726413945&wfr=spider&for=pc @@ -783,7 +793,7 @@ https://blog.csdn.net/zchang81/article/details/74280019 5、框架结构 -![](img/ch17/MDL1.png) +![](/assets/ch17/MDL1.png) MDL 框架主要包括:**模型转换模块(MDL Converter)、模型加载模块(Loader)、网络管理模块(Net)、矩阵运算模块(Gemmers)及供 Android 端调用的 JNI 接口层(JNI Interfaces)。** @@ -824,7 +834,7 @@ MDL 框架主要包括:**模型转换模块(MDL Converter)、模型加载 **功能特点** -- 高性能支持ARM CPU +- 高性能支持ARM CPU - 支持Mali GPU @@ -843,14 +853,14 @@ MDL 框架主要包括:**模型转换模块(MDL Converter)、模型加载 2、开源用户:小米     -3、GitHub地址:https://github.com/XiaoMi/mace +3、GitHub地址:https://github.com/XiaoMi/mace 4、简介:Mobile AI Compute Engine (MACE) 是一个专为移动端异构计算设备优化的深度学习前向预测框架。 MACE覆盖了常见的移动端计算设备(CPU,GPU和DSP),并且提供了完整的工具链和文档,用户借助MACE能够很方便地在移动端部署深度学习模型。MACE已经在小米内部广泛使用并且被充分验证具有业界领先的性能和稳定性。 5、MACE的基本框架: -![](img/ch17/mace-arch.png) +![](/assets/ch17/mace-arch.png) **MACE Model** @@ -868,7 +878,7 @@ CPU/GPU/DSP Runtime对应于各个计算设备的算子实现。 6、MACE使用的基本流程 -![](img/ch17/mace-work-flow-zh.png) +![](/assets/ch17/mace-work-flow-zh.png) **1. 配置模型部署文件(.yml)** @@ -925,7 +935,7 @@ MACE提供了命令行benchmark工具,可以细粒度的查看模型中所涉 MACE 支持 TensorFlow 和 Caffe 模型,提供转换工具,可以将训练好的模型转换成专有的模型数据文件,同时还可以选择将模型转换成C++代码,支持生成动态库或者静态库,提高模型保密性。 -![](img/ch17/maca_com.jpg) +![](/assets/ch17/maca_com.jpg) @@ -966,7 +976,7 @@ TensorFlow Lite可以与Android 8.1中发布的神经网络API完美配合,即 5、架构: -![](img/ch17/tflite_artc.JPEG) +![](/assets/ch17/tflite_artc.JPEG) 其组件包括: @@ -982,10 +992,10 @@ Android Studio 3.0, SDK Version API26, NDK Version 14 步骤: 1. 将此项目导入到Android Studio: - https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/java/demo + https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/java/demo 2. 下载移动端的模型(model)和标签数据(lables): - https://storage.googleapis.com/download.tensorflow.org/models/tflite/mobilenet_v1_224_android_quant_2017_11_08.zip + https://storage.googleapis.com/download.tensorflow.org/models/tflite/mobilenet_v1_224_android_quant_2017_11_08.zip 3. 下载完成解压mobilenet_v1_224_android_quant_2017_11_08.zip文件得到一个xxx.tflite和labes.txt文件,分别是模型和标签文件,并且把这两个文件复制到assets文件夹下。 @@ -1018,7 +1028,7 @@ Android Studio 3.0, SDK Version API26, NDK Version 14 PocketFlow 框架主要由两部分组件构成,分别是模型压缩/加速算法组件和超参数优化组件,具体结构如下图所示。 -![](img/ch17/framework_design.png) +![](/assets/ch17/framework_design.png) ​ 开发者将未压缩的原始模型作为 PocketFlow 框架的输入,同时指定期望的性能指标,例如模型的压缩和/或加速倍数;在每一轮迭代过程中,超参数优化组件选取一组超参数取值组合,之后模型压缩/加速算法组件基于该超参数取值组合,对原始模型进行压缩,得到一个压缩后的候选模型;基于对候选模型进行性能评估的结果,超参数优化组件调整自身的模型参数,并选取一组新的超参数取值组合,以开始下一轮迭代过程;当迭代终止时,PocketFlow 选取最优的超参数取值组合以及对应的候选模型,作为最终输出,返回给开发者用作移动端的模型部署。 @@ -1034,11 +1044,11 @@ PocketFlow 框架主要由两部分组件构成,分别是模型压缩/加速 - d)网络蒸馏(network distillation)组件:对于上述各种模型压缩组件,通过将未压缩的原始模型的输出作为额外的监督信息,指导压缩后模型的训练,在压缩/加速倍数不变的前提下均可以获得0.5%-2.0%不等的精度提升。 -- e) 多GPU训练(multi-GPU training)组件:深度学习模型训练过程对计算资源要求较高,单个GPU难以在短时间内完成模型训练,因此团队提供了对于多机多卡分布式训练的全面支持,以加快使用者的开发流程。无论是基于 ImageNet 数据的Resnet-50图像分类模型还是基于 WMT14 数据的 Transformer 机器翻译模型,均可以在一个小时内训练完毕。[1] +- e) 多GPU训练(multi-GPU training)组件:深度学习模型训练过程对计算资源要求较高,单个GPU难以在短时间内完成模型训练,因此团队提供了对于多机多卡分布式训练的全面支持,以加快使用者的开发流程。无论是基于 ImageNet 数据的Resnet-50图像分类模型还是基于 WMT14 数据的 Transformer 机器翻译模型,均可以在一个小时内训练完毕。[1] - f) 超参数优化(hyper-parameter optimization)组件:多数开发者对模型压缩算法往往不甚了解,但超参数取值对最终结果往往有着巨大的影响,因此团队引入了超参数优化组件,采用了包括强化学习等算法以及 AI Lab 自研的 AutoML 自动超参数优化框架来根据具体性能需求,确定最优超参数取值组合。例如,对于通道剪枝算法,超参数优化组件可以自动地根据原始模型中各层的冗余程度,对各层采用不同的剪枝比例,在保证满足模型整体压缩倍数的前提下,实现压缩后模型识别精度的最大化。 - ![](img/ch17/packflow1.jpg) + ![](/assets/ch17/packflow1.jpg) 7、PocketFlow 性能 @@ -1046,19 +1056,19 @@ PocketFlow 框架主要由两部分组件构成,分别是模型压缩/加速 ​ 在 CIFAR-10 数据集上,PocketFlow 以 ResNet-56 作为基准模型进行通道剪枝,并加入了超参数优化和网络蒸馏等训练策略,实现了 2.5 倍加速下分类精度损失 0.4%,3.3 倍加速下精度损失 0.7%,且显著优于未压缩的 ResNet-44 模型; 在 ImageNet 数据集上,PocketFlow 可以对原本已经十分精简的 MobileNet 模型继续进行权重稀疏化,以更小的模型尺寸取得相似的分类精度;与 Inception-V1、ResNet-18 等模型相比,模型大小仅为后者的约 20~40%,但分类精度基本一致(甚至更高)。 -![](img/ch17/packflow2.jpg) +![](/assets/ch17/packflow2.jpg) -![](img/ch17/packflow3.jpg) +![](/assets/ch17/packflow3.jpg) -相比于费时费力的人工调参,PocketFlow 框架中的 AutoML 自动超参数优化组件仅需 10 -余次迭代就能达到与人工调参类似的性能,在经过 100 次迭代后搜索得到的超参数组合可以降低约 0.6% -的精度损失;通过使用超参数优化组件自动地确定网络中各层权重的量化比特数,PocketFlow 在对用于 ImageNet 图像分类任务的 -ResNet-18 模型进行压缩时,取得了一致性的性能提升;当平均量化比特数为 4 比特时,超参数优化组件的引入可以将分类精度从 63.6% +相比于费时费力的人工调参,PocketFlow 框架中的 AutoML 自动超参数优化组件仅需 10 +余次迭代就能达到与人工调参类似的性能,在经过 100 次迭代后搜索得到的超参数组合可以降低约 0.6% +的精度损失;通过使用超参数优化组件自动地确定网络中各层权重的量化比特数,PocketFlow 在对用于 ImageNet 图像分类任务的 +ResNet-18 模型进行压缩时,取得了一致性的性能提升;当平均量化比特数为 4 比特时,超参数优化组件的引入可以将分类精度从 63.6% 提升至 68.1%(原始模型的分类精度为 70.3%)。 -![](img/ch17/packflow4.jpg) +![](/assets/ch17/packflow4.jpg) -![](img/ch17/packflow5.jpg) +![](/assets/ch17/packflow5.jpg) **参考文献** @@ -1102,10 +1112,10 @@ https://blog.csdn.net/zchang81/article/details/74280019 ## 17.11 移动端开源框架部署 ### 17.8.1 以NCNN为例 -部署步骤 +部署步骤 ### 17.8.2 以QNNPACK为例 -部署步骤 +部署步骤 ### 17.8.4 在Android手机上使用MACE实现图像分类 diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-3-2.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-3-2.png" deleted file mode 100644 index 56982267..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-3-2.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/\347\254\254\345\215\201\345\205\253\347\253\240_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227.md" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/\347\254\254\345\215\201\345\205\253\347\253\240_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227.md" index bbea60df..beafdb94 100644 --- "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/\347\254\254\345\215\201\345\205\253\347\253\240_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227.md" +++ "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/\347\254\254\345\215\201\345\205\253\347\253\240_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227.md" @@ -48,7 +48,7 @@   Deeplearning4j在已建立的各个库及其在系统整体中的所处位置 -![Deeplearning4j](img/18-2-2.png) +![Deeplearning4j](/assets/ch18/18-2-2.png)   Github地址:https://github.com/deeplearning4j/deeplearning4j @@ -60,11 +60,11 @@   Mahout算法库: -![Mahout](img/18-2-3-1.png) +![Mahout](/assets/ch18/18-2-3-1.png)   Mahout应用场景: -![Mahout](img/18-2-3-2.png) +![Mahout](/assets/ch18/18-2-3-2.png)   Github地址:https://github.com/apache/mahout @@ -82,13 +82,13 @@ - 算法库:包含广义线性模型、推荐系统、聚类、决策树和评估的算法 - 实用程序:包括测试数据的生成、外部数据的读入等功能 -![架构图](img/18-2-4-1.png) -
架构图
+![架构图](/assets/ch18/18-2-4-1.png) +架构图   MLlib目前支持4种常见的机器学习问题: 分类、回归、聚类和协同过滤,MLlib在Spark整个生态系统中的位置如图下图所示。 -![生态系统位置](img/18-2-4-2.png) -
生态系统位置
+![生态系统位置](/assets/ch18/18-2-4-2.png) +生态系统位置 ### 18.2.5 Ray @@ -117,11 +117,11 @@ Ray框架优点   架构设计一方面减少了跨节点的RPC开销,另一方面也能规避中心节点的瓶颈问题。当然缺点也不是没有,由于缺乏全局的任务视图,无法进行全局规划,因此任务的拓扑逻辑结构也就未必是最优的了。 -![架构图](img/18-2-5-1.png) -
架构图
+![架构图](/assets/ch18/18-2-5-1.png) +架构图 -![任务调度图](img/18-2-5-2.png) -
任务调度图
+![任务调度图](/assets/ch18/18-2-5-2.png) +任务调度图   Ray架构现状: - API层以上 的部分还比较薄弱,Core模块核心逻辑估需要时间打磨。 @@ -141,13 +141,13 @@ Ray框架优点 - 能集成Spark的批处理和交互查询。 - 为实现复杂的算法提供和批处理类似的简单接口。 -![Spark Streaming架构图](img/18-2-6-1.png) -
Spark Streaming架构图
+![Spark Streaming架构图](/assets/ch18/18-2-6-1.png) +Spark Streaming架构图   Spark Streaming把实时输入数据流以时间片Δt (如1秒)为单位切分成块。Spark Streaming会把每块数据作为一个RDD,并使用RDD操作处理每一小块数据。每个块都会生成一个Spark Job处理,最终结果也返回多块。 -![Spark Streaming基本原理图](img/18-2-6-2.png) -
Spark Streaming基本原理图
+![Spark Streaming基本原理图](/assets/ch18/18-2-6-2.png) +Spark Streaming基本原理图   正如Spark Streaming最初的目标一样,它通过丰富的API和基于内存的高速计算引擎让用户可以结合流式处理,批处理和交互查询等应用。因此Spark Streaming适合一些需要历史数据和实时数据结合分析的应用场合。当然,对于实时性要求不是特别高的应用也能完全胜任。另外通过RDD的数据重用机制可以得到更高效的容错处理。 @@ -227,8 +227,8 @@ server1:4,server2:4,server3:4,server4:4 python train.py   Petastorm是一个由 Uber ATG 开发的开源数据访问库。这个库可以直接基于数 TB Parquet 格式的数据集进行单机或分布式训练和深度学习模型评估。Petastorm 支持基于 Python 的机器学习框架,如 Tensorflow、Pytorch 和 PySpark,也可以直接用在 Python 代码中。 -![深度学习集群](img/18-2-9-1.png) -
深度学习集群
+![深度学习集群](/assets/ch18/18-2-9-1.png) +深度学习集群   即使是在现代硬件上训练深度模型也很耗时,而且在很多情况下,很有必要在多台机器上分配训练负载。典型的深度学习集群需要执行以下几个步骤: - 一台或多台机器读取集中式或本地数据集。 @@ -239,17 +239,17 @@ server1:4,server2:4,server3:4,server4:4 python train.py 有了 Petastorm,消费数据就像在 HDFS 或文件系统中创建和迭代读取对象一样简单。Petastorm 使用 PyArrow 来读取 Parquet 文件。   将多个数据源组合到单个表格结构中,从而生成数据集。可以多次使用相同的数据集进行模型训练和评估。 -![深度学习集群](img/18-2-9-2.png) -
深度学习集群
+![深度学习集群](/assets/ch18/18-2-9-2.png) +深度学习集群   为分布式训练进行分片 在分布式训练环境中,每个进程通常负责训练数据的一个子集。一个进程的数据子集与其他进程的数据子集正交。Petastorm 支持将数据集的读时分片转换为正交的样本集。 -![Petastorm 将数据集的非重叠子集提供给参与分布式训练的不同机器](img/18-2-9-3.png) -
Petastorm 将数据集的非重叠子集提供给参与分布式训练的不同机器
+![Petastorm 将数据集的非重叠子集提供给参与分布式训练的不同机器](/assets/ch18/18-2-9-3.png) +Petastorm 将数据集的非重叠子集提供给参与分布式训练的不同机器   本地缓存 Petastorm 支持在本地存储中缓存数据。当网络连接速度较慢或带宽很昂贵时,这会派上用场。 -![本地缓存](img/18-2-9-4.png) +![本地缓存](/assets/ch18/18-2-9-4.png) Github地址:https://github.com/uber/petastorm @@ -260,11 +260,11 @@ Github地址:https://github.com/uber/petastorm   满足的应用场景: 为了利用TensorFlow在现有的Spark和Hadoop集群上进行深度学习。而不需要为深度学习设置单独的集群。 -![架构图](img/18-2-10-1.png) -
架构图
+![架构图](/assets/ch18/18-2-10-1.png) +架构图 -![运行流程图](img/18-2-10-2.png) -
运行流程图
+![运行流程图](/assets/ch18/18-2-10-2.png) +运行流程图   优点: - 轻松迁移所有现有的TensorFlow程序,<10行代码更改; @@ -290,7 +290,7 @@ Github地址:https://github.com/uber/petastorm ### 18.4.2 实时流计算过程 -![](img/18-4-1.png) +![](/assets/ch18/18-4-1.png)   我们以热卖产品的统计为例,看下传统的计算手段: - 将用户行为、log等信息清洗后保存在数据库中. @@ -405,7 +405,7 @@ public static boolean isTick(Tuple tuple) { 有了上面的基础设施,我们还需要一些手段来完成“工程化”,将设想变为现实。 这里,我们看看Michael G. Noll的滑动窗口设计。 -![](img/18-4-2.png) +![](/assets/ch18/18-4-2.png) Topology @@ -427,7 +427,7 @@ Topology 上面的topology设计如下: -![](img/18-4-3.png) +![](/assets/ch18/18-4-3.png) 将聚合计算与时间结合起来 前文,我们叙述了tick事件,回调中会触发bolt的execute方法,那可以这么做: @@ -470,7 +470,7 @@ RollingCountBolt: 上面的代码可能有点抽象,看下这个图就明白了,tick一到,窗口就滚动: -![](img/18-4-4.png) +![](/assets/ch18/18-4-4.png) ``` IntermediateRankingsBolt & TotalRankingsBolt: @@ -526,7 +526,7 @@ TotalRankingsBolt的聚合排序方法:   结语   下图可能就是我们想要的结果,我们完成了t0 - t1时刻之间的热点话题统计. -![](img/18-4-5.png) +![](/assets/ch18/18-4-5.png) ## 18.5 如何进行离线计算? @@ -580,11 +580,11 @@ TotalRankingsBolt的聚合排序方法:   F-Measure是Precision和Recall加权调和平均: -![F-Measure](img/18-9-2-1.png) +![F-Measure](/assets/ch18/18-9-2-1.png)   当参数α=1时,就是最常见的F1,也即 -![F-Measure](img/18-9-2-2.png) +![F-Measure](/assets/ch18/18-9-2-2.png)   可知F1综合了P和R的结果,当F1较高时则能说明试验方法比较有效。 @@ -592,7 +592,7 @@ TotalRankingsBolt的聚合排序方法:   E值表示查准率P和查全率R的加权平均值,当其中一个为0时,E值为1,其计算公式: -![E值](img/18-9-3-1.png) +![E值](/assets/ch18/18-9-3-1.png)   b越大,表示查准率的权重越大。 diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-10-2.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-10-2.png" deleted file mode 100644 index d5f27493..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-10-2.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-2.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-2.png" deleted file mode 100644 index c96f96d1..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-2.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-4-2.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-4-2.png" deleted file mode 100644 index b5344fd5..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-4-2.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-5-1.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-5-1.png" deleted file mode 100644 index fba6a2cb..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-5-1.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-5-2.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-5-2.png" deleted file mode 100644 index d09a0598..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-5-2.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-6-1.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-6-1.png" deleted file mode 100644 index ff572fed..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-6-1.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-6-2.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-6-2.png" deleted file mode 100644 index 459d8f58..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-6-2.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-1.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-1.png" deleted file mode 100644 index 894619ea..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-1.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-2.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-2.png" deleted file mode 100644 index 5fb2c8fe..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-2.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-3.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-3.png" deleted file mode 100644 index 7d6b87a2..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-3.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-4.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-4.png" deleted file mode 100644 index 1823c37b..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-9-4.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-1.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-1.png" deleted file mode 100644 index c9b2b301..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-1.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-2.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-2.png" deleted file mode 100644 index d83ca44e..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-2.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-3.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-3.png" deleted file mode 100644 index 8cd85879..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-3.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-4.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-4.png" deleted file mode 100644 index 20b25262..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-4.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-9-2-1.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-9-2-1.png" deleted file mode 100644 index 71b6fb7b..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-9-2-1.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-9-2-2.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-9-2-2.png" deleted file mode 100644 index 457fb048..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-9-2-2.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-9-3-1.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-9-3-1.png" deleted file mode 100644 index 2c75bcef..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-9-3-1.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-10-1.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-10-1.png" deleted file mode 100644 index 53c0fb5c..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-10-1.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-3-1.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-3-1.png" deleted file mode 100644 index 683b767c..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-3-1.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-4-1.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-4-1.png" deleted file mode 100644 index 5db66668..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-4-1.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-4-5.png" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-4-5.png" deleted file mode 100644 index a43fd0c3..00000000 Binary files "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-4-5.png" and /dev/null differ diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/\347\254\254\345\215\201\345\205\253\347\253\240_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257.md" "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/\347\254\254\345\215\201\345\205\253\347\253\240_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257.md" index 4dfefbc3..89be34ca 100644 --- "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/\347\254\254\345\215\201\345\205\253\347\253\240_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257.md" +++ "b/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/\347\254\254\345\215\201\345\205\253\347\253\240_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257.md" @@ -23,7 +23,7 @@ ### 18.2.1 PaddlePaddle -  PaddlePaddle【1】是百度开源的一个深度学习平台。PaddlePaddle为深度学习研究人员提供了丰富的API,可以轻松地完成神经网络配置,模型训练等任务。 +  PaddlePaddle【1】是百度开源的一个深度学习平台。PaddlePaddle为深度学习研究人员提供了丰富的API,可以轻松地完成神经网络配置,模型训练等任务。 官方文档中简易介绍了如何使用框架在 - 线性回归 @@ -49,7 +49,7 @@   Deeplearning4j在已建立的各个库及其在系统整体中的所处位置 -![Deeplearning4j](img/18-2-2.png) +![Deeplearning4j](/assets/ch18/18-2-2.png)   Github地址:https://github.com/deeplearning4j/deeplearning4j @@ -61,15 +61,15 @@   Mahout算法库: -![Mahout](img/18-2-3-1.png) +![Mahout](/assets/ch18/18-2-3-1.png)   Mahout应用场景: -![Mahout](img/18-2-3-2.png) +![Mahout](/assets/ch18/18-2-3-2.png)   Github地址:https://github.com/apache/mahout -### 18.2.4 Spark MLllib +### 18.2.4 Spark MLllib MLlib(Machine Learnig lib) 【4】是Spark对常用的机器学习算法的实现库,同时包括相关的测试和数据生成器。 @@ -77,7 +77,7 @@ MLlib是MLBase一部分,其中MLBase分为四部分:MLlib、MLI、ML Optimiz - ML Optimizer会选择它认为最适合的已经在内部实现好了的机器学习算法和相关参数,来处理用户输入的数据,并返回模型或别的帮助分析的结果; - MLI 是一个进行特征抽取和高级ML编程抽象的算法实现的API或平台; -- MLlib是Spark实现一些常见的机器学习算法和实用程序,包括分类、回归、聚类、协同过滤、降维以及底层优化,该算法可以进行可扩充; +- MLlib是Spark实现一些常见的机器学习算法和实用程序,包括分类、回归、聚类、协同过滤、降维以及底层优化,该算法可以进行可扩充; - MLRuntime 基于Spark计算框架,将Spark的分布式计算应用到机器学习领域。 MLlib主要包含三个部分: @@ -86,13 +86,13 @@ MLlib主要包含三个部分: - 算法库:包含广义线性模型、推荐系统、聚类、决策树和评估的算法 - 实用程序:包括测试数据的生成、外部数据的读入等功能 -![架构图](img/18-2-4-1.png) -
架构图
+![架构图](/assets/ch18/18-2-4-1.png) +架构图   MLlib目前支持4种常见的机器学习问题: 分类、回归、聚类和协同过滤,MLlib在Spark整个生态系统中的位置如图下图所示。 -![生态系统位置](img/18-2-4-2.png) -
生态系统位置
+![生态系统位置](/assets/ch18/18-2-4-2.png) +生态系统位置 ### 18.2.5 Ray @@ -122,11 +122,11 @@ Ray框架优点:   架构设计一方面减少了跨节点的RPC开销,另一方面也能规避中心节点的瓶颈问题。当然缺点也不是没有,由于缺乏全局的任务视图,无法进行全局规划,因此任务的拓扑逻辑结构也就未必是最优的了。 -![架构图](img/18-2-5-1.png) -
架构图
+![架构图](/assets/ch18/18-2-5-1.png) +架构图 -![任务调度图](img/18-2-5-2.png) -
任务调度图
+![任务调度图](/assets/ch18/18-2-5-2.png) +任务调度图   Ray架构现状: @@ -148,11 +148,11 @@ Ray框架优点: - 能集成Spark的批处理和交互查询。 - 为实现复杂的算法提供和批处理类似的简单接口。 -![Spark Streaming架构图](img/18-2-6-1.png) +![Spark Streaming架构图](/assets/ch18/18-2-6-1.png)   Spark Streaming把实时输入数据流以时间片Δt (如1秒)为单位切分成块。Spark Streaming会把每块数据作为一个RDD,并使用RDD操作处理每一小块数据。每个块都会生成一个Spark Job处理,最终结果也返回多块。 -![Spark Streaming基本原理图](img/18-2-6-2.png) +![Spark Streaming基本原理图](/assets/ch18/18-2-6-2.png)   正如Spark Streaming最初的目标一样,它通过丰富的API和基于内存的高速计算引擎让用户可以结合流式处理,批处理和交互查询等应用。因此Spark Streaming适合一些需要历史数据和实时数据结合分析的应用场合。当然,对于实时性要求不是特别高的应用也能完全胜任。另外通过RDD的数据重用机制可以得到更高效的容错处理。 @@ -223,7 +223,7 @@ server1:4,server2:4,server3:4,server4:4 python train.py   BigDL缺点: -- 对机器要求高 jdk7上运行性能差 在CentOS 6和7上,要将最大用户进程增加到更大的值(例如514585); 否则,可能会看到错误,如“无法创建新的本机线程”。 +- 对机器要求高 jdk7上运行性能差 在CentOS 6和7上,要将最大用户进程增加到更大的值(例如514585); 否则,可能会看到错误,如“无法创建新的本机线程”。 - 训练和验证的数据会加载到内存,挤占内存   BigDL满足的应用场景: @@ -236,7 +236,7 @@ server1:4,server2:4,server3:4,server4:4 python train.py   Petastorm是一个由 Uber ATG 开发的开源数据访问库。这个库可以直接基于数 TB Parquet 格式的数据集进行单机或分布式训练和深度学习模型评估。Petastorm 支持基于 Python 的机器学习框架,如 Tensorflow、Pytorch 和 PySpark,也可以直接用在 Python 代码中。 -![深度学习集群](img/18-2-9-1.png) +![深度学习集群](/assets/ch18/18-2-9-1.png)   即使是在现代硬件上训练深度模型也很耗时,而且在很多情况下,很有必要在多台机器上分配训练负载。典型的深度学习集群需要执行以下几个步骤: @@ -249,16 +249,16 @@ server1:4,server2:4,server3:4,server4:4 python train.py   将多个数据源组合到单个表格结构中,从而生成数据集。可以多次使用相同的数据集进行模型训练和评估。 -![深度学习集群](img/18-2-9-2.png) +![深度学习集群](/assets/ch18/18-2-9-2.png)   为分布式训练进行分片 在分布式训练环境中,每个进程通常负责训练数据的一个子集。一个进程的数据子集与其他进程的数据子集正交。Petastorm 支持将数据集的读时分片转换为正交的样本集。 -![Petastorm 将数据集的非重叠子集提供给参与分布式训练的不同机器](img/18-2-9-3.png) - Petastorm 将数据集的非重叠子集提供给参与分布式训练的不同机器 +![Petastorm 将数据集的非重叠子集提供给参与分布式训练的不同机器](/assets/ch18/18-2-9-3.png) +Petastorm 将数据集的非重叠子集提供给参与分布式训练的不同机器   本地缓存 Petastorm 支持在本地存储中缓存数据。当网络连接速度较慢或带宽很昂贵时,这会派上用场。 -![本地缓存](img/18-2-9-4.png) +![本地缓存](/assets/ch18/18-2-9-4.png) Github地址:https://github.com/uber/petastorm @@ -269,19 +269,19 @@ Github地址:https://github.com/uber/petastorm   满足的应用场景: 为了利用TensorFlow在现有的Spark和Hadoop集群上进行深度学习。而不需要为深度学习设置单独的集群。 -![架构图](img/18-2-10-1.png) +![架构图](/assets/ch18/18-2-10-1.png) -![运行流程图](img/18-2-10-2.png) +![运行流程图](/assets/ch18/18-2-10-2.png)   优点: -- 轻松迁移所有现有的TensorFlow程序,<10行代码更改; -- 支持所有TensorFlow功能:同步/异步训练,模型/数据并行,推理和TensorBoard; -- 服务器到服务器的直接通信在可用时实现更快的学习; -- 允许数据集在HDFS和由Spark推动的其他来源或由TensorFlow拖动; -- 轻松集成您现有的数据处理流水线和机器学习算法(例如,MLlib,CaffeOnSpark); +- 轻松迁移所有现有的TensorFlow程序,<10行代码更改; +- 支持所有TensorFlow功能:同步/异步训练,模型/数据并行,推理和TensorBoard; +- 服务器到服务器的直接通信在可用时实现更快的学习; +- 允许数据集在HDFS和由Spark推动的其他来源或由TensorFlow拖动; +- 轻松集成您现有的数据处理流水线和机器学习算法(例如,MLlib,CaffeOnSpark); - 轻松部署在云或内部部署:CPU和GPU,以太网和Infiniband。 -- TensorFlowOnSpark是基于google的TensorFlow的实现,而TensorFlow有着一套完善的教程,内容丰富。 +- TensorFlowOnSpark是基于google的TensorFlow的实现,而TensorFlow有着一套完善的教程,内容丰富。   劣势: @@ -297,7 +297,7 @@ Github地址:https://github.com/uber/petastorm ### 18.3.2 实时流计算过程 -![](img/18-4-1.png) +![](/assets/ch18/18-4-1.png)   我们以热卖产品的统计为例,看下传统的计算手段: @@ -310,13 +310,13 @@ Github地址:https://github.com/uber/petastorm   这是一个假想的场景,但假设你具有处理类似场景的经验,应该会体会到这样一些问题和难处: - 水平扩展问题(scale-out) -显然,如果是一个具有一定规模的电子商务网站,数据量都是很大的。而交易信息因为涉及事务,所以很难直接舍弃关系型数据库的事务能力,迁移到具有更好的scale-out能力的NoSQL数据库中。 + 显然,如果是一个具有一定规模的电子商务网站,数据量都是很大的。而交易信息因为涉及事务,所以很难直接舍弃关系型数据库的事务能力,迁移到具有更好的scale-out能力的NoSQL数据库中。   那么,一般都会做sharding。历史数据还好说,我们可以按日期来归档,并可以通过批处理式的离线计算,将结果缓存起来。 但是,这里的要求是20分钟内,这很难。 - 性能问题 -这个问题,和scale-out是一致的,假设我们做了sharding,因为表分散在各个节点中,所以我们需要多次入库,并在业务层做聚合计算。 + 这个问题,和scale-out是一致的,假设我们做了sharding,因为表分散在各个节点中,所以我们需要多次入库,并在业务层做聚合计算。   问题是,20分钟的时间要求,我们需要入库多少次呢?10分钟呢?5分钟呢?实时呢? @@ -417,7 +417,7 @@ public static boolean isTick(Tuple tuple) { 有了上面的基础设施,我们还需要一些手段来完成“工程化”,将设想变为现实。 这里,我们看看Michael G. Noll的滑动窗口设计。 -![](img/18-4-2.png) +![](/assets/ch18/18-4-2.png) Topology @@ -439,7 +439,7 @@ Topology 上面的topology设计如下: -![](img/18-4-3.png) +![](/assets/ch18/18-4-3.png) 将聚合计算与时间结合起来 前文,我们叙述了tick事件,回调中会触发bolt的execute方法,那可以这么做: @@ -482,7 +482,7 @@ RollingCountBolt: 上面的代码可能有点抽象,看下这个图就明白了,tick一到,窗口就滚动: -![](img/18-4-4.png) +![](/assets/ch18/18-4-4.png) ``` IntermediateRankingsBolt & TotalRankingsBolt: @@ -537,9 +537,9 @@ TotalRankingsBolt的聚合排序方法:   结语 -  下图可能就是我们想要的结果,我们完成了t0 - t1时刻之间的热点话题统计. +  下图可能就是我们想要的结果,我们完成了t0 - t1时刻之间的热点话题统计. -![](img/18-4-5.png) +![](/assets/ch18/18-4-5.png) ## 18.4 如何进行离线计算? @@ -644,54 +644,54 @@ TotalRankingsBolt的聚合排序方法: > - 对于本次分析无利用的数据 通常采用逻辑删除 建立标记位 通过01或者true false表示数据是否有效 > - 对于最后一个字段不固定的情况 可以采用动态拼接的方式 > - 静态资源过滤 -> - js css img (静态数据) 只关心真正请求页面的(index.html) + > - js css img (静态数据) 只关心真正请求页面的(index.html) > - data(动态数据) > - 在mr中,如果涉及小且频繁使用的数据,如何优化? -> - 每次都从数据库查询 效率极低 + > - 每次都从数据库查询 效率极低 > - 可以通过数据结构保存在内存中 方便查询 一般在setup方法中进行初始化操作 > - 关于mr程序输出文件名 -> - part-r-00000 表示是reducetask的输出 + > - part-r-00000 表示是reducetask的输出 > - part-m-00000 表示是maptask的输出 ### 18.4.3 数据建模 > - 维度建模 -> -> 专门适用于OLAP的设计模式存在着两种类型的表:事实表 维度表 -> -> - 事实表:主题的客观度量 能够以记录主题为准 信息多不精准 + > + > 专门适用于OLAP的设计模式存在着两种类型的表:事实表 维度表 + > + > - 事实表:主题的客观度量 能够以记录主题为准 信息多不精准 > - 维度表:看问题分析问题的角度 信息精但是不全 可跟事实表关系 > > - 维度建模三种常见模型 -> -> - 星型模型 一个事实表带多个维度表 维度之间没关系 数仓发展建立初期(一个主题) + > + > - 星型模型 一个事实表带多个维度表 维度之间没关系 数仓发展建立初期(一个主题) > - 雪花模型 一个事实表带多个维度表 维度之间可以继续关系维度 不利于维护 少用 > - 星座模型 多个事实表带多个维度 有些维度可以共用 数仓发展后期(多个主题) -> -> 不管什么模型,在数仓中,一切有利于数据分析即可为,不用考虑数据冗余性和其他设计规范。 + > + > 不管什么模型,在数仓中,一切有利于数据分析即可为,不用考虑数据冗余性和其他设计规范。 > > - 模块设计–维度建模 -> -> 在本项目中,因为分析主题只有一个(网站流量日志),所有采用星型模型 -> 事实表---->对应清洗完之后的数据 -> 维度表----->来自于提前通过工具生成 维度表范围要横跨事实表分析维度 -> 点击流模型属于业务模型数据 既不是事实表 也不是维度表 是为了后续计算某些业务指标方便而由业务指定 + > + > 在本项目中,因为分析主题只有一个(网站流量日志),所有采用星型模型 + > 事实表---->对应清洗完之后的数据 + > 维度表----->来自于提前通过工具生成 维度表范围要横跨事实表分析维度 + > 点击流模型属于业务模型数据 既不是事实表 也不是维度表 是为了后续计算某些业务指标方便而由业务指定 > > - 宽表:为了分析,把原来表中某些字段属性提取出来,构成新的字段 也称之为明细表 -> -> 窄表:没有扩宽的表 原始表 -> 宽表数据来自于窄表 insert(宽)+select (窄) -> 总结:hive中,有几种方式可以创建出带有数据的表? -> -> - create+load data 创建表加载数据(内部表) + > + > 窄表:没有扩宽的表 原始表 + > 宽表数据来自于窄表 insert(宽)+select (窄) + > 总结:hive中,有几种方式可以创建出带有数据的表? + > + > - create+load data 创建表加载数据(内部表) > > - create +external +location 创建外部表指定数据路径 > > - create+insert+select 表的数据来自于后面查询语句返回的结果 > > - create+select 创建的表结构和数据来自于后面的查询语句 -> -> ``` + > + > ``` > # -- hive内置解析url的函数 > > parse_url_tuple(url,host path,query,queryvalue) @@ -705,8 +705,8 @@ TotalRankingsBolt的聚合排序方法: > ``` > > - group by 语法限制 -> -> ``` + > + > ``` > select count(*) as pvs from ods_weblog_detail t where datestr='20130918' group by t.hour > > select t.hour,count(*) as pvs from ods_weblog_detail t where datestr='20130918' group by t.hour @@ -961,7 +961,7 @@ TotalRankingsBolt的聚合排序方法: > > - mysql----->hdfs 导入的文件分隔符为逗号 > - mysql----->hive -> - 需要先复制表结构到hive 再向表中导入数据 + > - 需要先复制表结构到hive 再向表中导入数据 > - 导入的文件分隔符为 ‘\001’ > - sqoop中增量导入的判断是通过上次导入到某个列的某个值来标识 的,这个值由用户自己维护,一般企业中选择不重复且自增长的主键最多,自增长的时间也可以。 > @@ -1024,10 +1024,10 @@ TotalRankingsBolt的聚合排序方法: > **导出** > > - hdfs导出到mysql -> -> - 要先在mysql中手动创建对应的表结构 -> -> ``` + > + > - 要先在mysql中手动创建对应的表结构 + > + > ``` > # hdfs文件导出到mysql > > bin/sqoop export \ @@ -1095,8 +1095,8 @@ TotalRankingsBolt的聚合排序方法: 等功能。 -
【架构设计图】
-![架构设计图](img/18-5-1-1.jpg) +【架构设计图】 +![架构设计图](/assets/ch18/18-5-1-1.jpg) ### 18.5.2 如何设计人机交互系统的问答引擎算法架构? @@ -1105,7 +1105,7 @@ TotalRankingsBolt的聚合排序方法: 本章节介绍的问答引擎架构由预处理模块、检索模块、知识图谱、排序模块、用户画像组成。 -![架构图](img/18-5-2-2.jpg) +![架构图](/assets/ch18/18-5-2-2.jpg) 检索模块如果能完全命中语料库答案则直接返回,不在经过排序。 @@ -1116,7 +1116,7 @@ ES检索和深度语义匹配是比较粗比较弱的召回模型,不用考虑 借鉴推荐系统的思想: -1.粗排阶段根据用户长期兴趣画像召回相关度较高的答案,同时减轻精排阶段的压力 +1.粗排阶段根据用户长期兴趣画像召回相关度较高的答案,同时减轻精排阶段的压力 2.精排阶段则根据粗排召回的答案列表,通过离线训练好的排序模型预测CTR,最终下发前Top N 个答案作为推荐结果。 @@ -1157,11 +1157,11 @@ ES检索和深度语义匹配是比较粗比较弱的召回模型,不用考虑 - **字典纠错:字典+规则,特定数据驱动型纠错** -![](img/18-5-4-1.jpg) +![](/assets/ch18/18-5-4-1.jpg) - **通用纠错模型:神经网络模型,其他纠错保底** -![](img/18-5-4-2.jpg) +![](/assets/ch18/18-5-4-2.jpg) ### 18.5.5 什么是指代消解?如何指代消解? @@ -1213,11 +1213,11 @@ ES检索和深度语义匹配是比较粗比较弱的召回模型,不用考虑 - 孪生网络(Siamese network) -孪生神经网络是一类包含两个或更多个相同子网络的神经网络架构。 这里相同是指它们具有相同的配置即具有相同的参数和权重。 参数更新在两个子网上共同进行。 +孪生神经网络是一类包含两个或更多个相同子网络的神经网络架构。 这里相同是指它们具有相同的配置即具有相同的参数和权重。 参数更新在两个子网上共同进行。 -孪生神经网络在涉及发现相似性或两个可比较的事物之间的关系的任务中流行。 一些例子是复述评分,其中输入是两个句子,输出是它们是多么相似的得分; 或签名验证,确定两个签名是否来自同一个人。 通常,在这样的任务中,使用两个相同的子网络来处理两个输入,并且另一个模块将取得它们的输出并产生最终输出。 下面的图片来自Bromley et al (1993)【11】。 他们为签名验证任务提出了一个孪生体系结构。 +孪生神经网络在涉及发现相似性或两个可比较的事物之间的关系的任务中流行。 一些例子是复述评分,其中输入是两个句子,输出是它们是多么相似的得分; 或签名验证,确定两个签名是否来自同一个人。 通常,在这样的任务中,使用两个相同的子网络来处理两个输入,并且另一个模块将取得它们的输出并产生最终输出。 下面的图片来自Bromley et al (1993)【11】。 他们为签名验证任务提出了一个孪生体系结构。 -![](img/18-5-6-1.png) +![](/assets/ch18/18-5-6-1.png) 孪生结构之所以在这些任务中表现的比较好,有如下几个原因 : @@ -1227,7 +1227,7 @@ ES检索和深度语义匹配是比较粗比较弱的召回模型,不用考虑 2.每个子网本质上产生其输入的表示。 (图片中的"签名特征向量")。如果输入是相同类型的,例如匹配两个句子或匹配两个图片,使用类似的模型来处理类似的输入是有意义的。 这样,就有了具有相同语义的表示向量,使得它们更容易比较。 ``` -问题回答,一些最近的研究使用孪生体系结构来评分问题和答案候选人之间的相关性[2]。 所以一个输入是一个问句,另一个输入是一个答案,输出和问题的答案是相关的。 问题和答案看起来不完全相同,但如果目标是提取相似性或它们之间的联系,孪生体系结构也可以很好地工作。 +问题回答,一些最近的研究使用孪生体系结构来评分问题和答案候选人之间的相关性[2]。 所以一个输入是一个问句,另一个输入是一个答案,输出和问题的答案是相关的。 问题和答案看起来不完全相同,但如果目标是提取相似性或它们之间的联系,孪生体系结构也可以很好地工作。 - 交互矩阵(MatchPyramid)【12】 @@ -1240,7 +1240,7 @@ $$ 基本方法:构建文本与文本的相似度矩阵,采用CNN对矩阵进行特征抽取,最后用softmax获得分类概率,评价方法为交叉熵。 -![](img/18-5-6-2.png) +![](/assets/ch18/18-5-6-2.png) 流程: @@ -1250,17 +1250,17 @@ $$ - 0-1类型,每个序列对应的词相同为1,不同为0 -![](img/18-5-6-3.png) +![](/assets/ch18/18-5-6-3.png) - cosine距离,使用预训练的Glove将词转为向量,之后计算序列对应的词的cosine距离 -![](img/18-5-6-4.png) +![](/assets/ch18/18-5-6-4.png) - 点积,同上,但是将cosine距离改为点积 - ![](img/18-5-6-5.png) + ![](/assets/ch18/18-5-6-5.png) - [x] 两层CNN @@ -1270,7 +1270,7 @@ $$ - [x] 两层MLP -最后用两层的全连接对CNN的结果进行转换,使用softmax函数得到最终分类概率。 +最后用两层的全连接对CNN的结果进行转换,使用softmax函数得到最终分类概率。 > 作者使用论文中的模型,在kaggle的quora数据集中得到一个相当不错的分数,最终小组成绩达到了第四名。 > 附实现地址:https://github.com/faneshion/MatchZoo @@ -1281,7 +1281,7 @@ $$   Annoy的目标是建立一个数据结构,使得查询一个点的最近邻点的时间复杂度是次线性。Annoy通过建立一个二叉树来使得每个点查找时间复杂度是O(log n)。 看下面这个图,随机选择两个点,以这两个节点为初始中心节点,执行聚类数为2的kmeans过程,最终产生收敛后两个聚类中心点。这两个聚类中心点之间连一条线段(灰色短线),建立一条垂直于这条灰线,并且通过灰线中心点的线(黑色粗线)。这条黑色粗线把数据空间分成两部分。在多维空间的话,这条黑色粗线可以看成等距垂直超平面。 -![](img/18-5-6-1.jpg) +![](/assets/ch18/18-5-6-1.jpg)   通过多次递归迭代划分的话,最终原始数据会形成类似下面这样一个二叉树结构。二叉树底层是叶子节点记录原始数据节点,其他中间节点记录的是分割超平面的信息。Annoy建立这样的二叉树结构是希望满足这样的一个假设: 相似的数据节点应该在二叉树上位置更接近,一个分割超平面不应该把相似的数据节点分割二叉树的不同分支上。 @@ -1295,7 +1295,7 @@ $$   问题有歧义或者匹配答案有置信度但不够高的时候触发话术澄清。简单来说,就是明确意图,意图不明确的时候可以反问用户以确认。 -![](img/18-5-7-1.jpg) +![](/assets/ch18/18-5-7-1.jpg)   意图图谱的节点代表一个个意图节点。这些“意图”之间的关系包括需求澄清(disambiguation)、需求细化(depth extension)、需求横向延展(breadth extension )等。在图所示例子中,当“阿拉斯加”的意思是“阿拉斯加州”时,与之关联的意图是城市、旅游等信息。当“阿拉斯加”的含义是“阿拉斯加犬”时,它延伸的意图是宠物狗、宠物狗护理,以及如何喂食等。 @@ -1303,209 +1303,45 @@ $$ - **DRMM+PACRR**【13】 - **DRMM+PACRR**是针对文档相关性排序的新模型,这几种模型基于此前的DRMM模型。具体来说,DRMM 模型使用的是上下文无关的term encoding编码方式,改进模型则借鉴了PACRR的思想,融合了n-grams 和不同方式编码的上下文信息。 + **DRMM+PACRR**是针对文档相关性排序的新模型,这几种模型基于此前的DRMM模型。具体来说,DRMM 模型使用的是上下文无关的term encoding编码方式,改进模型则借鉴了PACRR的思想,融合了n-grams 和不同方式编码的上下文信息。 - Context-sensitive Term Encodings构造qd相似度矩阵,卷积提取ngram信息。 - - 两层max-pooling获取最强相似信息并拼接。 - - 使用相同的MLP网络独立地计算每一个q-term encoding(矩阵的每一行)的分数,再通过一个线性层得到query与doc的相关性得分 。 + Context-sensitive Term Encodings构造qd相似度矩阵,卷积提取ngram信息。 + + 两层max-pooling获取最强相似信息并拼接。 + + 使用相同的MLP网络独立地计算每一个q-term encoding(矩阵的每一行)的分数,再通过一个线性层得到query与doc的相关性得分 。 -![](img/18-5-9-0.jpg) +![](/assets/ch18/18-5-9-0.jpg) ​ github地址:https://github.com/nlpaueb/deep-relevance-ranking - **N-grams** - **N-grams**是机器学习中NLP处理中的一个较为重要的语言模型,常用来做句子相似度比较,模糊查询,以及句子合理性,句子矫正等。 - - 如果你是一个玩LOL的人,那么当我说“正方形打野”、“你是真的皮”,“你皮任你皮”这些词或词组时,你应该能想到的下一个词可能是“大司马”,而不是“五五开”。如果你不是LOL玩家,没关系,当我说“上火”、“金罐”这两个词,你能想到的下一个词应该更可能“加多宝”,而不是“可口可乐”。 - **N-grams**正是基于这样的想法,它的第一个特点是某个词的出现依赖于其他若干个词,第二个特点是我们获得的信息越多,预测越准确。我想说,我们每个人的大脑中都有一个N-gram模型,而且是在不断完善和训练的。我们的见识与经历,都在丰富着我们的阅历,增强着我们的联想能力。 - **N-grams**模型是一种语言模型(Language Model,LM),语言模型是一个基于概率的判别模型,它的输入是一句话(单词的顺序序列),输出是这句话的概率,即这些单词的联合概率(joint probability)。 - - **N-grams中的概率计算** - - 假设我们有一个有n个词组成的句子$S=(w1,w2,...,wn)$ , 如何衡量它的概率呢?让我们假设,每个单词$wi$都要依赖于从第一个单词$w1$到它之前一个单词$wi−1$的影响: -$$ -p(S)=p(w1w2...wn)=p(w1)p(w2|w1)...p(wn|wn1...w2w1) -$$ -这个衡量方法有两个缺陷: - -- **参数空间过大**,概率$p(wn|wn-1...w2w1)$的参数有$O(n)$个。 -- **数据稀疏严重**,词同时出现的情况可能没有,组合阶数高时尤其明显。 - -为了解决第一个问题,我们引入**马尔科夫假设(Markov Assumption)**:**一个词的出现仅与它之前的若干个词有关**。 -$$ -p(w1⋯wn)=∏p(wi∣wi−1⋯w1)≈∏p(wi∣wi−1⋯wi−N+1) -$$ -如果一个词的出现仅依赖于它前面出现的一个词,那么我们就称之为 **Bi-gram**: -$$ -p(S)=p(w -1 - - w -2 - - ⋯w -n - - )=p(w -1 - - )p(w -2 - - ∣w -1 - - )⋯p(w -n - - ∣w -n−1 - - ) -$$ -如果一个词的出现仅依赖于它前面出现的两个词,那么我们就称之为 **Tri-gram**: -$$ -p(S)=p(w -1 - - w -2 - - ⋯w -n - - )=p(w -1 - - )p(w -2 - - ∣w -1 - - )⋯p(w -n - - ∣w -n−1 - - w -n−2 - - ) -$$ -N-gram的$N$可以取很高,然而现实中一般 bi-gram 和 tri-gram 就够用了。 + **N-grams**是机器学习中NLP处理中的一个较为重要的语言模型,常用来做句子相似度比较,模糊查询,以及句子合理性,句子矫正等。 -那么,如何计算其中的每一项条件概率 $p(wn∣wn−1⋯w2w1) $答案是**极大似然估计(Maximum Likelihood Estimation,MLE)**,即数频数: -$$ -p(w -n - - ∣w -n−1 - - )= -C(w -n−1 - - ) -C(w -n−1 - - w -n - - ) -$$ + 如果你是一个玩LOL的人,那么当我说“正方形打野”、“你是真的皮”,“你皮任你皮”这些词或词组时,你应该能想到的下一个词可能是“大司马”,而不是“五五开”。如果你不是LOL玩家,没关系,当我说“上火”、“金罐”这两个词,你能想到的下一个词应该更可能“加多宝”,而不是“可口可乐”。 + **N-grams**正是基于这样的想法,它的第一个特点是某个词的出现依赖于其他若干个词,第二个特点是我们获得的信息越多,预测越准确。我想说,我们每个人的大脑中都有一个N-gram模型,而且是在不断完善和训练的。我们的见识与经历,都在丰富着我们的阅历,增强着我们的联想能力。 + **N-grams**模型是一种语言模型(Language Model,LM),语言模型是一个基于概率的判别模型,它的输入是一句话(单词的顺序序列),输出是这句话的概率,即这些单词的联合概率(joint probability)。 -$$ -p(w -n - - ∣w -n−1 - - w -n−2 - - )= -C(w -n−2 - - w -n−1 - - ) -C(w -n−2 - - w -n−1 - - w -n - - ) - - -$$ + **N-grams中的概率计算** + + 假设我们有一个有n个词组成的句子$S=(w1,w2,...,wn)$ , 如何衡量它的概率呢?让我们假设,每个单词$wi$都要依赖于从第一个单词$w1$到它之前一个单词$wi−1$的影响: + $$ p(S)=p(w1w2...wn)=p(w1)p(w2|w1)...p(wn|wn1...w2w1) $$ + 这个衡量方法有两个缺陷: -$$ -p(w -n - - ∣w -n−1 - - ⋯w -2 - - w -1 - - )= -C(w -1 - - w -2 - - ⋯w -n−1 - - ) -C(w -1 - - w -2 - - ⋯w -n - - ) - + - **参数空间过大**,概率$p(wn|wn-1...w2w1)$的参数有$O(n)$个。 + - **数据稀疏严重**,词同时出现的情况可能没有,组合阶数高时尤其明显。 -$$ - -**具体地**,以Bi-gram为例,我们有这样一个由三句话组成的语料库: - -![](img/18-5-9-1.jpg) -容易统计,“I”出现了3次,“I am”出现了2次,因此能计算概率: -$$ -p(am∣I)= -3 -2 -$$ -同理,还能计算出如下概率: +**具体地**,以Bi-gram为例,我们有这样一个由三句话组成的语料库: -$p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like∣not)=1 $ +![](/assets/ch18/18-5-9-1.jpg) +容易统计,“I”出现了3次,“I am”出现了2次,因此能计算概率: +$$ p(am∣I)=32 $$ +同理,还能计算出如下概率: +$$ p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like∣not)=1 $$ ### 18.5.10 如何评估人机交互系统的效果? @@ -1537,9 +1373,9 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like ### 18.6.1 什么是个性化推荐系统? -​ 个性化推荐系统就是根据用户的历史,社交关系,兴趣点,上下文环境等信息去判断用户当前需要或潜在感兴趣的内容的一类应用。 +​ 个性化推荐系统就是根据用户的历史,社交关系,兴趣点,上下文环境等信息去判断用户当前需要或潜在感兴趣的内容的一类应用。 -​ 大数据时代,我们的生活的方方面面都出现了信息过载的问题:电子商务、电影或者视频网站、个性化音乐网络电台、社交网络、个性化阅读、基于位置的服务、个性化邮件、个性化广告.......逛淘宝、订外卖、听网络电台、看剧等等等。推荐系统在你不知不觉中将你感兴趣的内容推送给你,甚至有的时候,推荐系统比你本人更了解你自己。 +​ 大数据时代,我们的生活的方方面面都出现了信息过载的问题:电子商务、电影或者视频网站、个性化音乐网络电台、社交网络、个性化阅读、基于位置的服务、个性化邮件、个性化广告.......逛淘宝、订外卖、听网络电台、看剧等等等。推荐系统在你不知不觉中将你感兴趣的内容推送给你,甚至有的时候,推荐系统比你本人更了解你自己。 ​ 推荐系统的业务主要包括四个部分: @@ -1549,13 +1385,13 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like - 物料排序:将召回的子集的内容按照某种标准进行精细排序 - 运营策略:加入一些运营策略进行一部分的重新排序,再下发内容 - ​ 推荐系统必须要实现收集与分析数据的功能。数据收集体现为:埋点、上报、存储。而数据分析则体现为:构造画像(用户与内容)、行为归因。 + ​ 推荐系统必须要实现收集与分析数据的功能。数据收集体现为:埋点、上报、存储。而数据分析则体现为:构造画像(用户与内容)、行为归因。 - ​ 推荐系统的算法体现在两部分:**召回、排序**。召回的算法多种多样:itemCF、userCF、关联规则、embedding、序列匹配、同类型收集等等。排序的算法可以从多个角度来描述,这里我们从一个宏观的角度来描述,即排序算法可以分成五个部分:**构造样本、设计模型、确定目标函数、选择优化方法、评估**。 + ​ 推荐系统的算法体现在两部分:**召回、排序**。召回的算法多种多样:itemCF、userCF、关联规则、embedding、序列匹配、同类型收集等等。排序的算法可以从多个角度来描述,这里我们从一个宏观的角度来描述,即排序算法可以分成五个部分:**构造样本、设计模型、确定目标函数、选择优化方法、评估**。 ### 18.6.2 如何设计个性化推荐系统的推荐引擎架构? -![](img/18-6-2-1.jpg) +![](/assets/ch18/18-6-2-1.jpg) ### 18.6.3 召回模块 @@ -1564,9 +1400,9 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like - CF召回算法:user-based算法和item-based算法 - 如何做大规模在线用户CF召回? - - 离线计算每个用户的相似用户top k,存入cache - - 在线存储每个用户的点击记录 - - 在线检索相似用户点击记录 + - 离线计算每个用户的相似用户top k,存入cache + - 在线存储每个用户的点击记录 + - 在线检索相似用户点击记录 ### 18.6.4 排序模块 @@ -1581,154 +1417,149 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like - 排序算法演进 - ![](img/18-6-2-2.jpg) + ![](/assets/ch18/18-6-2-2.jpg) ### 18.6.5 离线训练 - 离线训练流程 - ![](img/18-6-5-1.jpg) + ![](/assets/ch18/18-6-5-1.jpg) - 如何线上实时反馈特征? - - 在线计算,与曝光日志一起上报,离线直接使用 + - 在线计算,与曝光日志一起上报,离线直接使用 - 如何解决曝光不足问题? - - 使用CTR的贝叶斯平滑(CTR = 曝光次数 / 点击次数)【15】 - - > - 所有新闻自身CTR(r)服从Beta分布: - > - > ![](img/18-6-5-2.png) - > - > - 某一新闻,给定展示次数时和自身CTR,点击次数服从伯努利分布,曝光次数为I,点击次数为C: - > - > ![](img/18-6-5-3.png) - > - > - 对最大似然函数求解参数α,β,则i新闻CTR后验估计: - > - > ![](img/18-5-6-6.png) - > - > - 对曝光不足的做平滑,曝光充分的影响不大 + - 使用CTR的贝叶斯平滑(CTR = 曝光次数 / 点击次数)【15】 + + > - 所有新闻自身CTR(r)服从Beta分布: + > + > ![](/assets/ch18/18-6-5-2.png) + > + > - 某一新闻,给定展示次数时和自身CTR,点击次数服从伯努利分布,曝光次数为I,点击次数为C: + > + > ![](/assets/ch18/18-6-5-3.png) + > + > - 对最大似然函数求解参数α,β,则i新闻CTR后验估计: + > + > ![](/assets/ch18/18-5-6-6.png) + > + > - 对曝光不足的做平滑,曝光充分的影响不大 ### 18.6.6 用户画像 - 用户标签 - 统计方法 - - 用户feeds内行为,标签 计数(点击率),缺点:无法加入更多特征,不方便后续优化 + - 用户feeds内行为,标签 计数(点击率),缺点:无法加入更多特征,不方便后续优化 - 基于机器学习的方法 - - 对用户长期兴趣建模 - - LR模型 - - 用户标签作为特征 + - 对用户长期兴趣建模 + - LR模型 + - 用户标签作为特征 ### 18.6.7 GBDT粗排 - 为什么需要粗排? - - 快速筛选高质量的候选集 - - 方便利用在线实时反馈特征 + - 快速筛选高质量的候选集 + - 方便利用在线实时反馈特征 - 如何做粗排的特征设计? - - 特征要相对稠密 + - 特征要相对稠密 - 如何选择合适的算法模型? - - lightgbm - - xgboost - - lightgbm比xgboot速度更快;在线预测时,线程更安全 + - lightgbm + - xgboost + - lightgbm比xgboot速度更快;在线预测时,线程更安全 ### 18.6.8 在线FM精排 - 为什么需要在线学习? - - feeds内容更新快 - - 用户兴趣会随时间变化 - - 排序模型需要快速反应用户的兴趣变化 + - feeds内容更新快 + - 用户兴趣会随时间变化 + - 排序模型需要快速反应用户的兴趣变化 - **FM模型** - ![](img/18-6-8-1.png) - $$ - - $$ + ![](/assets/ch18/18-6-8-1.png) - $$ - 𝜎(𝑦)=1/(1+exp⁡(−𝑦)) - $$ + $$ 𝜎(𝑦)=1/(1+exp⁡(−𝑦)) $$ - **采用FTRL(Follow The Regularized Leader)更新模型** - - 算法概述 + - 算法概述 - ​ FTRL是一种适用于处理超大规模数据的,含大量稀疏特征的在线学习的常见优化算法,方便实用,而且效果很好,常用于更新在线的CTR预估模型。 + ​ FTRL是一种适用于处理超大规模数据的,含大量稀疏特征的在线学习的常见优化算法,方便实用,而且效果很好,常用于更新在线的CTR预估模型。 -   FTRL算法兼顾了FOBOS和RDA两种算法的优势,既能同FOBOS保证比较高的精度,又能在损失一定精度的情况下产生更好的稀疏性。 + FTRL算法兼顾了FOBOS和RDA两种算法的优势,既能同FOBOS保证比较高的精度,又能在损失一定精度的情况下产生更好的稀疏性。 -   FTRL在处理带非光滑正则项(如L1正则)的凸优化问题上表现非常出色,不仅可以通过L1正则控制模型的稀疏度,而且收敛速度快。 + FTRL在处理带非光滑正则项(如L1正则)的凸优化问题上表现非常出色,不仅可以通过L1正则控制模型的稀疏度,而且收敛速度快。 - - 算法要点与推导 + - 算法要点与推导 - ![](H:/DeepLearning-500-questions/ch18_%E5%90%8E%E7%AB%AF%E6%9E%B6%E6%9E%84%E9%80%89%E5%9E%8B%E5%8F%8A%E5%BA%94%E7%94%A8%E5%9C%BA%E6%99%AF/img/18-6-2-1-0.png) + ![](/assets/ch18/18-6-2-1-0.png) - - 算法特性及优缺点 + - 算法特性及优缺点 - ​ 在线学习,实时性高;可以处理大规模稀疏数据;有大规模模型参数训练能力;根据不同的特征特征学习率 。 + ​ 在线学习,实时性高;可以处理大规模稀疏数据;有大规模模型参数训练能力;根据不同的特征特征学习率 。 - ​ FTRL-Proximal工程实现上的tricks: + ​ FTRL-Proximal工程实现上的tricks: -   1.saving memory + 1.saving memory - ``` -   方案1)Poisson Inclusion:对某一维度特征所来的训练样本,以p的概率接受并更新模型。 -   方案2)Bloom Filter Inclusion:用bloom filter从概率上做某一特征出现k次才更新。 - ``` + ``` +   方案1)Poisson Inclusion:对某一维度特征所来的训练样本,以p的概率接受并更新模型。 +   方案2)Bloom Filter Inclusion:用bloom filter从概率上做某一特征出现k次才更新。 + ``` -   2.浮点数重新编码 + 2.浮点数重新编码 - ``` - 1)特征权重不需要用32bit或64bit的浮点数存储,存储浪费空间。 - 2)16bit encoding,但是要注意处理rounding技术对regret带来的影响(注:python可以尝试用numpy.float16格式) - ``` + ``` + 1)特征权重不需要用32bit或64bit的浮点数存储,存储浪费空间。 + 2)16bit encoding,但是要注意处理rounding技术对regret带来的影响(注:python可以尝试用numpy.float16格式) + ``` -   3.训练若干相似model + 3.训练若干相似model - ``` - 1)对同一份训练数据序列,同时训练多个相似的model。 - 2)这些model有各自独享的一些feature,也有一些共享的feature。 - 3)出发点:有的特征维度可以是各个模型独享的,而有的各个模型共享的特征,可以用同样的数据训练。 - ``` + ``` + 1)对同一份训练数据序列,同时训练多个相似的model。 + 2)这些model有各自独享的一些feature,也有一些共享的feature。 + 3)出发点:有的特征维度可以是各个模型独享的,而有的各个模型共享的特征,可以用同样的数据训练。 + ``` -   4.Single Value Structure + 4.Single Value Structure - ``` - 1)多个model公用一个feature存储(例如放到cbase或redis中),各个model都更新这个共有的feature结构。 - 2)对于某一个model,对于他所训练的特征向量的某一维,直接计算一个迭代结果并与旧值做一个平均。 - ``` + ``` + 1)多个model公用一个feature存储(例如放到cbase或redis中),各个model都更新这个共有的feature结构。 + 2)对于某一个model,对于他所训练的特征向量的某一维,直接计算一个迭代结果并与旧值做一个平均。 + ``` -   5.使用正负样本的数目来计算梯度的和(所有的model具有同样的N和P) + 5.使用正负样本的数目来计算梯度的和(所有的model具有同样的N和P) -    ![](H:/DeepLearning-500-questions/ch18_%E5%90%8E%E7%AB%AF%E6%9E%B6%E6%9E%84%E9%80%89%E5%9E%8B%E5%8F%8A%E5%BA%94%E7%94%A8%E5%9C%BA%E6%99%AF/img/18-6-2-1-1.jpg) + ![](/assets/ch18/18-6-2-1-1.jpg) -   6.subsampling Training Data + 6.subsampling Training Data - ``` - 1)在实际中,CTR远小于50%,所以正样本更加有价值。通过对训练数据集进行subsampling,可以大大减小训练数据集的大小。 - 2)正样本全部采(至少有一个广告被点击的query数据),负样本使用一个比例r采样(完全没有广告被点击的query数据)。但是直接在这种采样上进行训练,会导致比较大的biased prediction。 - 3)解决办法:训练的时候,对样本再乘一个权重。权重直接乘到loss上面,从而梯度也会乘以这个权重。 - ``` + ``` + 1)在实际中,CTR远小于50%,所以正样本更加有价值。通过对训练数据集进行subsampling,可以大大减小训练数据集的大小。 + 2)正样本全部采(至少有一个广告被点击的query数据),负样本使用一个比例r采样(完全没有广告被点击的query数据)。但是直接在这种采样上进行训练,会导致比较大的biased prediction。 + 3)解决办法:训练的时候,对样本再乘一个权重。权重直接乘到loss上面,从而梯度也会乘以这个权重。 + ``` - - 适合场景 + - 适合场景 - 点击率模型 + 点击率模型 - - 案例 + - 案例 - [https://www.kaggle.com/jiweiliu/ftrl-starter-code/output]() + [https://www.kaggle.com/jiweiliu/ftrl-starter-code/output]() - https://github.com/Angel-ML/angel/blob/master/docs/algo/ftrl_lr_spark.md + https://github.com/Angel-ML/angel/blob/master/docs/algo/ftrl_lr_spark.md - 如何选择精排特征? - - 新增特征需保证已有特征索引不变 - - 定期离线训练淘汰无用特征,防止特征无线膨胀 - - 使用GBDT粗排预测的CTR分段结果作为特征 + - 新增特征需保证已有特征索引不变 + - 定期离线训练淘汰无用特征,防止特征无线膨胀 + - 使用GBDT粗排预测的CTR分段结果作为特征 ### 18.6.9 算法介绍 @@ -1736,31 +1567,31 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like ​ 协同过滤(Collaborative filtering, CF)算法是目前个性化推荐系统比较流行的算法之一。 - ​ 协同算法分为两个基本算法:**基于用户的协同过滤(UserCF)和基于项目的协同过滤(ItemCF)。** + ​ 协同算法分为两个基本算法:**基于用户的协同过滤(UserCF)和基于项目的协同过滤(ItemCF)。** - ![](C:\Users\XinRui\Desktop\18-6-2-3.png) +[//]: # ( ![](C:\Users\XinRui\Desktop\18-6-2-3.png)) - 基于属性的推荐算法 - - 基于用户标签的推荐 + - 基于用户标签的推荐 - ​ 统计用户最常用的标签,对于每个标签,统计被打过这个标签次数最多的物品,然后将具有这些标签的最热门的物品推荐给这个用户。这个方法非常适合新用户或者数据很少的冷启动,目前许多的app都会在新用户最初进入时让用户添加喜好标签方便为用户推送内容。 + ​ 统计用户最常用的标签,对于每个标签,统计被打过这个标签次数最多的物品,然后将具有这些标签的最热门的物品推荐给这个用户。这个方法非常适合新用户或者数据很少的冷启动,目前许多的app都会在新用户最初进入时让用户添加喜好标签方便为用户推送内容。 - - 基于商品内容的推荐算法 + - 基于商品内容的推荐算法 - ​ 利用商品的内容属性计算商品之间的相似度,是物推物的算法。这种算法不依赖用户行为,只要获取到item的内容信息就可以计算语义级别上的相似性,不存在iterm冷启动问题。缺点就是不是所有iterm都可以非常容易的抽取成有意义的特征,而且中文一词多义和一义多词的复杂性也是需要攻克的一个难题。 + ​ 利用商品的内容属性计算商品之间的相似度,是物推物的算法。这种算法不依赖用户行为,只要获取到item的内容信息就可以计算语义级别上的相似性,不存在iterm冷启动问题。缺点就是不是所有iterm都可以非常容易的抽取成有意义的特征,而且中文一词多义和一义多词的复杂性也是需要攻克的一个难题。 - 基于矩阵分解的推荐算法 ​ 原理:根据已有的评分矩阵(非常稀疏),分解为低维的用户特征矩阵(评分者对各个因子的喜好程度)以及商品特征矩阵(商品包含各个因子的程度),最后再反过来分析数据(用户特征矩阵与商品特征矩阵相乘得到新的评分矩阵)得出预测结果;这是一个非常优雅的推荐算法,因为当涉及到矩阵分解时,我们通常不会太多地去思考哪些项目将停留在所得到矩阵的列和行中。但是使用这个推荐引擎,我们清楚地看到,u是第i个用户的兴趣向量,v是第j个电影的参数向量。 - ![](img/18-6-2-4.png) + ![](/assets/ch18/18-6-2-4.png) ​ 所以我们可以用u和v的点积来估算x(第i个用户对第j个电影的评分)。我们用已知的分数构建这些向量,并使用它们来预测未知的得分。 ​ 例如,在矩阵分解之后,Ted的向量是(1.4; .8),电影A的向量是(1.4; .9),现在,我们可以通过计算(1.4; .8)和(1.4; .9)的点积,来还原电影A-Ted的得分。结果,我们得到2.68分。 - ![](img/18-6-2-5.png) + ![](/assets/ch18/18-6-2-5.png) - 基于热门内容的推荐算法 @@ -1772,7 +1603,7 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like   准确率和召回率是广泛用于信息检索和统计学分类领域的两个度量值,用来评价结果的质量。其中精度是检索出相关文档数与检索出的文档总数的比率,衡量的是检索系统的查准率;召回率是指检索出的相关文档数和文档库中所有的相关文档数的比率,衡量的是检索系统的查全率。 -![](img/18-6-3-0.jpg) +![](/assets/ch18/18-6-3-0.jpg)   一般来说,Precision就是检索出来的条目(比如:文档、网页等)有多少是准确的,Recall就是所有准确的条目有多少被检索出来了。 @@ -1782,7 +1613,7 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like 召回率 = 提取出的正确信息条数 / 样本中的信息条数 -  两者取值在0和1之间,数值越接近1,查准率或查全率就越高。 +  两者取值在0和1之间,数值越接近1,查准率或查全率就越高。 F值 = 正确率 * 召回率 * 2 / (正确率 + 召回率) (F 值即为正确率和召回率的调和平均值) @@ -1806,17 +1637,17 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like   当然希望检索结果Precision越高越好,同时Recall也越高越好,但事实上这两者在某些情况下有矛盾的。比如极端情况下,我们只搜索出了一个结果,且是准确的,那么Precision就是100%,但是Recall就很低;而如果我们把所有结果都返回,那么比如Recall是100%,但是Precision就会很低。因此在不同的场合中需要自己判断希望Precision比较高或是Recall比较高。如果是做实验研究,可以绘制Precision-Recall曲线来帮助分析。 -​ **注意:准确率和召回率是互相影响的,理想情况下肯定是做到两者都高,但是一般情况下准确率高、召回率就低,召回率低、准确率高,当然如果两者都低,那是什么地方出问题了**。一般情况,用不同的阀值,统计出一组不同阀值下的精确率和召回率,如下图: +​ **注意:准确率和召回率是互相影响的,理想情况下肯定是做到两者都高,但是一般情况下准确率高、召回率就低,召回率低、准确率高,当然如果两者都低,那是什么地方出问题了**。一般情况,用不同的阀值,统计出一组不同阀值下的精确率和召回率,如下图: -![](img/18-6-3-1.jpg) +![](/assets/ch18/18-6-3-1.jpg) **如果是做搜索,那就是保证召回的情况下提升准确率;如果做疾病监测、反垃圾,则是保准确率的条件下,提升召回。** 所以,在两者都要求高的情况下,可以用F1值来衡量。 -![F-Measure](img/18-9-2-2.png) +![F-Measure](/assets/ch18/18-9-2-2.png) -公式基本上就是这样,但是如何算图中的A、B、C、D呢?**这需要人工标注,人工标注数据需要较多时间且枯燥,如果仅仅是做实验可以用用现成的语料。当然,还有一个办法,找个一个比较成熟的算法作为基准,用该算法的结果作为样本来进行比照**,这个方法也有点问题,如果有现成的很好的算法,就不用再研究了。 +公式基本上就是这样,但是如何算图中的A、B、C、D呢?**这需要人工标注,人工标注数据需要较多时间且枯燥,如果仅仅是做实验可以用用现成的语料。当然,还有一个办法,找个一个比较成熟的算法作为基准,用该算法的结果作为样本来进行比照**,这个方法也有点问题,如果有现成的很好的算法,就不用再研究了。 - **综合评价指标(F-Measure)** @@ -1824,11 +1655,11 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like   F-Measure是Precision和Recall加权调和平均: -![F-Measure](img/18-9-2-1.png) +![F-Measure](/assets/ch18/18-9-2-1.png)   当参数α=1时,就是最常见的F1,也即 -![F-Measure](img/18-9-2-2.png) +![F-Measure](/assets/ch18/18-9-2-2.png)   可知F1综合了P和R的结果,当F1较高时则能说明试验方法比较有效。 @@ -1836,7 +1667,7 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like   E值表示查准率P和查全率R的加权平均值,当其中一个为0时,E值为1,其计算公式: -![E值](img/18-9-3-1.png) +![E值](/assets/ch18/18-9-3-1.png)   b越大,表示查准率的权重越大。 @@ -1844,11 +1675,11 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like   平均正确率表示不同查全率的点上的正确率的平均。 -- **AP和mAP(mean Average Precision)** +- **AP和mAP(mean Average Precision)** ​ mAP是为解决P(准确率),R(召回率),F-measure的单点值局限性的。为了得到 一个能够反映全局性能的指标,可以看考察下图,其中两条曲线(方块点与圆点)分布对应了两个检索系统的准确率-召回率曲线 。 - ![](img/18-6-3-2.jpg) + ![](/assets/ch18/18-6-3-2.jpg) ​ 可以看出,虽然两个系统的性能曲线有所交叠但是以圆点标示的系统的性能在绝大多数情况下要远好于用方块标示的系统。 @@ -1858,13 +1689,13 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like ​ 最理想的系统, 其包含的面积应当是1,而所有系统的包含的面积都应当大于0。这就是用以评价信息检索系统的最常用性能指标,平均准确率mAP其规范的定义如下: - ![](img/18-6-3-3.jpg) + ![](/assets/ch18/18-6-3-3.jpg) -- **ROC和AUC** +- **ROC和AUC** - ​ ROC和AUC是评价分类器的指标,上面第一个图的ABCD仍然使用,只是需要稍微变换。 + ​ ROC和AUC是评价分类器的指标,上面第一个图的ABCD仍然使用,只是需要稍微变换。 - ![](img/18-6-3-4.jpg) + ![](/assets/ch18/18-6-3-4.jpg) ROC关注两个指标 @@ -1873,9 +1704,9 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like False Positive Rate( FPR ) = FP / [ FP + TN] ,FPR代表将负例错分为正例的概率 ``` - ​ 在ROC 空间中,每个点的横坐标是FPR,纵坐标是TPR,这也就描绘了分类器在TP(真正的正例)和FP(错误的正例)间的trade-off。ROC的主要分析工具是一个画在ROC空间的曲线——ROC curve。我们知道,对于二值分类问题,实例的值往往是连续值,我们通过设定一个阈值,将实例分类到正类或者负类(比如大于阈值划分为正类)。因此我们可以变化阈值,根据不同的阈值进行分类,根据分类结果计算得到ROC空间中相应的点,连接这些点就形成ROC curve。ROC curve经过(0,0)(1,1),实际上(0, 0)和(1, 1)连线形成的ROC curve实际上代表的是一个随机分类器。一般情况下,这个曲线都应该处于(0, 0)和(1, 1)连线的上方。如图所示。 + ​ 在ROC 空间中,每个点的横坐标是FPR,纵坐标是TPR,这也就描绘了分类器在TP(真正的正例)和FP(错误的正例)间的trade-off。ROC的主要分析工具是一个画在ROC空间的曲线——ROC curve。我们知道,对于二值分类问题,实例的值往往是连续值,我们通过设定一个阈值,将实例分类到正类或者负类(比如大于阈值划分为正类)。因此我们可以变化阈值,根据不同的阈值进行分类,根据分类结果计算得到ROC空间中相应的点,连接这些点就形成ROC curve。ROC curve经过(0,0)(1,1),实际上(0, 0)和(1, 1)连线形成的ROC curve实际上代表的是一个随机分类器。一般情况下,这个曲线都应该处于(0, 0)和(1, 1)连线的上方。如图所示。 - ![](img/18-6-3-5.jpg) + ![](/assets/ch18/18-6-3-5.jpg) ​ 用ROC curve来表示分类器的performance很直观好用。可是,人们总是希望能有一个数值来标志分类器的好坏。 @@ -1885,23 +1716,23 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like ​ **P/R和ROC是两个不同的评价指标和计算方式,一般情况下,检索用前者,分类、识别等用后者。** - + ### 18.6.11 个性化推荐系统案例分析 -​ 在过去的十年中,神经网络已经取得了巨大的飞跃。如今,神经网络已经得以广泛应用,并逐渐取代传统的机器学习方法。 接下来,我要介绍一下YouTube如何使用深度学习方法来做个性化推荐。 +​ 在过去的十年中,神经网络已经取得了巨大的飞跃。如今,神经网络已经得以广泛应用,并逐渐取代传统的机器学习方法。 接下来,我要介绍一下YouTube如何使用深度学习方法来做个性化推荐。 -​ 由于体量庞大、动态库和各种观察不到的外部因素,为YouTube用户提供推荐内容是一项非常具有挑战性的任务。 +​ 由于体量庞大、动态库和各种观察不到的外部因素,为YouTube用户提供推荐内容是一项非常具有挑战性的任务。 ​ *YouTube的推荐系统算法由两个神经网络组成:一个用于候选生成,一个用于排序。如果你没时间仔细研究论文,可以看看我们下面给出的简短总结。* 【14】 -![](img/18-6-4-1.png) +![](/assets/ch18/18-6-4-1.png) ​ 以用户的浏览历史为输入,候选生成网络可以显著减小可推荐的视频数量,从庞大的库中选出一组最相关的视频。这样生成的候选视频与用户的相关性最高,然后我们会对用户评分进行预测。 ​ 这个网络的目标,只是通过协同过滤提供更广泛的个性化。 -​ ![](img/18-6-4-2.png) +​ ![](/assets/ch18/18-6-4-2.png) ​ 进行到这一步,我们得到一组规模更小但相关性更高的内容。我们的目标是仔细分析这些候选内容,以便做出最佳的选择。 @@ -1909,13 +1740,13 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like ​ 所谓排序就是根据视频描述数据和用户行为信息,使用设计好的目标函数为每个视频打分,得分最高的视频会呈献给用户。 -![](img/18-6-4-3.png) +![](/assets/ch18/18-6-4-3.png) -​ 通过这两步,我们可以从非常庞大的视频库中选择视频,并面向用户进行有针对性的推荐。这个方法还能让我们把其他来源的内容也容纳进来。 +​ 通过这两步,我们可以从非常庞大的视频库中选择视频,并面向用户进行有针对性的推荐。这个方法还能让我们把其他来源的内容也容纳进来。 -![](img/18-6-4-4.png) +![](/assets/ch18/18-6-4-4.png) -​ 推荐任务是一个极端的多类分类问题。这个预测问题的实质,是基于用户(U)和语境(C),在给定的时间t精确地从库(V)中上百万的视频类(i)中,对特定的视频观看(Wt)情况进行分类。 +​ 推荐任务是一个极端的多类分类问题。这个预测问题的实质,是基于用户(U)和语境(C),在给定的时间t精确地从库(V)中上百万的视频类(i)中,对特定的视频观看(Wt)情况进行分类。 ## 18.7 参考文献 @@ -1949,8 +1780,8 @@ $p(I∣)=0.67p(do∣I)=0.33p(Sam∣am)=0.5p(not∣do)=1p(∣Sam)=0.5p(like 【15】http://www.cs.cmu.edu/afs/cs/Web/People/xuerui/papers/ctr.pdf - .... +.... - 未完待续! +未完待续! diff --git "a/ch19_\350\275\257\344\273\266\344\270\223\345\210\251\347\224\263\350\257\267\345\217\212\346\235\203\345\210\251\344\277\235\346\212\244/\347\254\254\345\215\201\344\271\235\347\253\240_\350\275\257\344\273\266\344\270\223\345\210\251\347\224\263\350\257\267\345\217\212\346\235\203\345\210\251\344\277\235\346\212\244.md" "b/ch19_\350\275\257\344\273\266\344\270\223\345\210\251\347\224\263\350\257\267\345\217\212\346\235\203\345\210\251\344\277\235\346\212\244/\347\254\254\345\215\201\344\271\235\347\253\240_\350\275\257\344\273\266\344\270\223\345\210\251\347\224\263\350\257\267\345\217\212\346\235\203\345\210\251\344\277\235\346\212\244.md" index 9678dbbe..9015c63e 100644 --- "a/ch19_\350\275\257\344\273\266\344\270\223\345\210\251\347\224\263\350\257\267\345\217\212\346\235\203\345\210\251\344\277\235\346\212\244/\347\254\254\345\215\201\344\271\235\347\253\240_\350\275\257\344\273\266\344\270\223\345\210\251\347\224\263\350\257\267\345\217\212\346\235\203\345\210\251\344\277\235\346\212\244.md" +++ "b/ch19_\350\275\257\344\273\266\344\270\223\345\210\251\347\224\263\350\257\267\345\217\212\346\235\203\345\210\251\344\277\235\346\212\244/\347\254\254\345\215\201\344\271\235\347\253\240_\350\275\257\344\273\266\344\270\223\345\210\251\347\224\263\350\257\267\345\217\212\346\235\203\345\210\251\344\277\235\346\212\244.md" @@ -92,7 +92,7 @@ ### 19.3.3 申请国内发明专利提示 -  下边给出一个精心调整过的申请该类专利的模板。[模板下载](img/1.doc)(注意,不是这个模板也可以,但是要符合顺序) +  下边给出一个精心调整过的申请该类专利的模板。[模板下载](/assets/ch19/1.doc)(注意,不是这个模板也可以,但是要符合顺序)   注意,摘要附图以及说明书附图可以无图(仅指发明),还有一些具体的格式要求,可以自己去查询专利申请的要求,这里给出最常见的几个注意点: diff --git a/directory.md b/directory.md new file mode 100644 index 00000000..9e2f022b --- /dev/null +++ b/directory.md @@ -0,0 +1,450 @@ +# 目录 2 +## 第一章 数学基础 1 +1.1标量、向量、张量之间的联系 1 +1.2张量与矩阵的区别? 1 +1.3矩阵和向量相乘结果 1 +1.4向量和矩阵的范数归纳 1 +1.5如何判断一个矩阵为正定? 2 +1.6导数偏导计算 3 +1.7导数和偏导数有什么区别? 3 +1.8特征值分解与特征向量 3 +1.9奇异值与特征值有什么关系? 4 +1.10机器学习为什么要使用概率? 4 +1.11变量与随机变量有什么区别? 4 +1.12常见概率分布? 5 +1.13举例理解条件概率 9 +1.14联合概率与边缘概率联系区别? 10 +1.15条件概率的链式法则 10 +1.16独立性和条件独立性 11 +1.17期望、方差、协方差、相关系数总结 11 +## 第二章 机器学习基础 14 +2.1 各种常见算法图示 14 +2.2监督学习、非监督学习、半监督学习、弱监督学习? 15 +2.3 监督学习有哪些步骤 16 +2.4 多实例学习? 17 +2.5 分类网络和回归的区别? 17 +2.6 什么是神经网络? 17 +2.7 常用分类算法的优缺点? 18 +2.8 正确率能很好的评估分类算法吗? 20 +2.9 分类算法的评估方法? 20 +2.10 什么样的分类器是最好的? 22 +2.11大数据与深度学习的关系 22 +2.12 理解局部最优与全局最优 23 +2.13 理解逻辑回归 24 +2.14 逻辑回归与朴素贝叶斯有什么区别? 24 +2.15 为什么需要代价函数? 25 +2.16 代价函数作用原理  25 +2.17 为什么代价函数要非负? 26 +2.18 常见代价函数? 26 +2.19为什么用交叉熵代替二次代价函数 28 +2.20 什么是损失函数? 28 +2.21 常见的损失函数 28 +2.22 逻辑回归为什么使用对数损失函数? 30 +0.00 对数损失函数是如何度量损失的? 31 +2.23 机器学习中为什么需要梯度下降? 32 +2.24 梯度下降法缺点? 32 +2.25 梯度下降法直观理解? 32 +2.23 梯度下降法算法描述? 33 +2.24 如何对梯度下降法进行调优? 35 +2.25 随机梯度和批量梯度区别? 35 +2.26 各种梯度下降法性能比较 37 +2.27计算图的导数计算图解? 37 +2.28 线性判别分析(LDA)思想总结 39 +2.29 图解LDA核心思想 39 +2.30 二类LDA算法原理? 40 +2.30 LDA算法流程总结? 41 +2.31 LDA和PCA区别? 41 +2.32 LDA优缺点? 41 +2.33 主成分分析(PCA)思想总结 42 +2.34 图解PCA核心思想 42 +2.35 PCA算法推理 43 +2.36 PCA算法流程总结 44 +2.37 PCA算法主要优缺点 45 +2.38 降维的必要性及目的 45 +2.39 KPCA与PCA的区别? 46 +2.40模型评估 47 +2.40.1模型评估常用方法? 47 +2.40.2 经验误差与泛化误差 47 +2.40.3 图解欠拟合、过拟合 48 +2.40.4 如何解决过拟合与欠拟合? 49 +2.40.5 交叉验证的主要作用? 50 +2.40.6 k折交叉验证? 50 +2.40.7 混淆矩阵 50 +2.40.8 错误率及精度 51 +2.40.9 查准率与查全率 51 +2.40.10 ROC与AUC 52 +2.40.11如何画ROC曲线? 53 +2.40.12如何计算TPR,FPR? 54 +2.40.13如何计算Auc? 56 +2.40.14为什么使用Roc和Auc评价分类器? 56 +2.40.15 直观理解AUC 56 +2.40.16 代价敏感错误率与代价曲线 57 +2.40.17 模型有哪些比较检验方法 59 +2.40.18 偏差与方差 59 +2.40.19为什么使用标准差? 60 +2.40.20 点估计思想 61 +2.40.21 点估计优良性原则? 61 +2.40.22点估计、区间估计、中心极限定理之间的联系? 62 +2.40.23 类别不平衡产生原因? 62 +2.40.24 常见的类别不平衡问题解决方法 62 +2.41 决策树 64 +2.41.1 决策树的基本原理 64 +2.41.2 决策树的三要素? 64 +2.41.3 决策树学习基本算法 65 +2.41.4 决策树算法优缺点 65 +2.40.5熵的概念以及理解 66 +2.40.6 信息增益的理解 66 +2.40.7 剪枝处理的作用及策略? 67 +2.41 支持向量机 67 +2.41.1 什么是支持向量机 67 +2.25.2 支持向量机解决的问题? 68 +2.25.2 核函数作用? 69 +2.25.3 对偶问题 69 +2.25.4 理解支持向量回归 69 +2.25.5 理解SVM(核函数) 69 +2.25.6 常见的核函数有哪些? 69 +2.25.6 软间隔与正则化 73 +2.25.7 SVM主要特点及缺点? 73 +2.26 贝叶斯 74 +2.26.1 图解极大似然估计 74 +2.26.2 朴素贝叶斯分类器和一般的贝叶斯分类器有什么区别? 76 +2.26.4 朴素与半朴素贝叶斯分类器 76 +2.26.5 贝叶斯网三种典型结构 76 +2.26.6 什么是贝叶斯错误率 76 +2.26.7 什么是贝叶斯最优错误率 76 +2.27 EM算法解决问题及实现流程 76 +2.28 为什么会产生维数灾难? 78 +2.29怎样避免维数灾难 82 +2.30聚类和降维有什么区别与联系? 82 +2.31 GBDT和随机森林的区别 83 +2.32 四种聚类方法之比较 84 +## 第三章 深度学习基础 88 +3.1基本概念 88 +3.1.1神经网络组成? 88 +3.1.2神经网络有哪些常用模型结构? 90 +3.1.3如何选择深度学习开发平台? 92 +3.1.4为什么使用深层表示 92 +3.1.5为什么深层神经网络难以训练? 93 +3.1.6深度学习和机器学习有什么不同 94 +3.2 网络操作与计算 95 +3.2.1前向传播与反向传播? 95 +3.2.2如何计算神经网络的输出? 97 +3.2.3如何计算卷积神经网络输出值? 98 +3.2.4如何计算Pooling层输出值输出值? 101 +3.2.5实例理解反向传播 102 +3.3超参数 105 +3.3.1什么是超参数? 105 +3.3.2如何寻找超参数的最优值? 105 +3.3.3超参数搜索一般过程? 106 +3.4激活函数 106 +3.4.1为什么需要非线性激活函数? 106 +3.4.2常见的激活函数及图像 107 +3.4.3 常见激活函数的导数计算? 109 +3.4.4激活函数有哪些性质? 110 +3.4.5 如何选择激活函数? 110 +3.4.6使用ReLu激活函数的优点? 111 +3.4.7什么时候可以用线性激活函数? 111 +3.4.8怎样理解Relu(<0时)是非线性激活函数? 111 +3.4.9 Softmax函数如何应用于多分类? 112 +3.5 Batch_Size 113 +3.5.1为什么需要Batch_Size? 113 +3.5.2 Batch_Size值的选择 114 +3.5.3在合理范围内,增大 Batch_Size 有何好处? 114 +3.5.4盲目增大 Batch_Size 有何坏处? 114 +3.5.5调节 Batch_Size 对训练效果影响到底如何? 114 +3.6 归一化 115 +3.6.1归一化含义? 115 +3.6.2为什么要归一化 115 +3.6.3为什么归一化能提高求解最优解速度? 115 +3.6.4 3D图解未归一化 116 +3.6.5归一化有哪些类型? 117 +3.6.6局部响应归一化作用 117 +3.6.7理解局部响应归一化公式 117 +3.6.8什么是批归一化(Batch Normalization) 118 +3.6.9批归一化(BN)算法的优点 119 +3.6.10批归一化(BN)算法流程 119 +3.6.11批归一化和群组归一化 120 +3.6.12 Weight Normalization和Batch Normalization 120 +3.7 预训练与微调(fine tuning) 121 +3.7.1为什么无监督预训练可以帮助深度学习? 121 +3.7.2什么是模型微调fine tuning 121 +3.7.3微调时候网络参数是否更新? 122 +3.7.4 fine-tuning模型的三种状态 122 +3.8权重偏差初始化 122 +3.8.1 全都初始化为0 122 +3.8.2 全都初始化为同样的值 123 +3.8.3 初始化为小的随机数 124 +3.8.4用1/sqrt(n)校准方差 125 +3.8.5稀疏初始化(Sparse Initialazation) 125 +3.8.6初始化偏差 125 +3.9 Softmax 126 +3.9.1 Softmax定义及作用 126 +3.9.2 Softmax推导 126 +3.10 理解One Hot Encodeing原理及作用? 126 +3.11 常用的优化器有哪些 127 +3.12 Dropout 系列问题 128 +3.12.1 dropout率的选择 128 +3.27 Padding 系列问题 128 +## 第四章 经典网络 129 +4.1LetNet5 129 +4.1.1模型结构 129 +4.1.2模型结构 129 +4.1.3 模型特性 131 +4.2 AlexNet 131 +4.2.1 模型结构 131 +4.2.2模型解读 131 +4.2.3模型特性 135 +4.3 可视化ZFNet-解卷积 135 +4.3.1 基本的思想及其过程 135 +4.3.2 卷积与解卷积 136 +4.3.3卷积可视化 137 +4.3.4 ZFNe和AlexNet比较 139 +4.4 VGG 140 +4.1.1 模型结构 140 +4.1.2 模型特点 140 +4.5 Network in Network 141 +4.5.1 模型结构 141 +4.5.2 模型创新点 141 +4.6 GoogleNet 143 +4.6.1 模型结构 143 +4.6.2 Inception 结构 145 +4.6.3 模型层次关系 146 +4.7 Inception 系列 148 +4.7.1 Inception v1 148 +4.7.2 Inception v2 150 +4.7.3 Inception v3 153 +4.7.4 Inception V4 155 +4.7.5 Inception-ResNet-v2 157 +4.8 ResNet及其变体 158 +4.8.1重新审视ResNet 159 +4.8.2残差块 160 +4.8.3 ResNet架构 162 +4.8.4残差块的变体 162 +4.8.5 ResNeXt 162 +4.8.6 Densely Connected CNN 164 +4.8.7 ResNet作为小型网络的组合 165 +4.8.8 ResNet中路径的特点 166 +4.9为什么现在的CNN模型都是在GoogleNet、VGGNet或者AlexNet上调整的? 167 +## 第五章 卷积神经网络(CNN) 170 +5.1 卷积神经网络的组成层 170 +5.2 卷积如何检测边缘信息? 171 +5.2 卷积的几个基本定义? 174 +5.2.1卷积核大小 174 +5.2.2卷积核的步长 174 +5.2.3边缘填充 174 +5.2.4输入和输出通道 174 +5.3 卷积网络类型分类? 174 +5.3.1普通卷积 174 +5.3.2扩张卷积 175 +5.3.3转置卷积 176 +5.3.4可分离卷积 177 +5.3 图解12种不同类型的2D卷积? 178 +5.4 2D卷积与3D卷积有什么区别? 181 +5.4.1 2D 卷积 181 +5.4.2 3D卷积 182 +5.5 有哪些池化方法? 183 +5.5.1一般池化(General Pooling) 183 +5.5.2重叠池化(OverlappingPooling) 184 +5.5.3空金字塔池化(Spatial Pyramid Pooling) 184 +5.6 1x1卷积作用? 186 +5.7卷积层和池化层有什么区别?  187 +5.8卷积核一定越大越好? 189 +5.9每层卷积只能用一种尺寸的卷积核? 189 +5.10怎样才能减少卷积层参数量? 190 +5.11卷积操作时必须同时考虑通道和区域吗? 191 +5.12采用宽卷积的好处有什么?  192 +5.12.1窄卷积和宽卷积 192 +5.12.2 为什么采用宽卷积? 192 +5.13卷积层输出的深度与哪个部件的个数相同?  192 +5.14 如何得到卷积层输出的深度? 193 +5.15激活函数通常放在卷积神经网络的那个操作之后?  194 +5.16 如何理解最大池化层有几分缩小? 194 +5.17理解图像卷积与反卷积 194 +5.17.1图像卷积 194 +5.17.2图像反卷积 196 +5.18不同卷积后图像大小计算? 198 +5.18.1 类型划分 198 +5.18.2 计算公式 199 +5.19 步长、填充大小与输入输出关系总结? 199 +5.19.1没有0填充,单位步长 200 +5.19.2零填充,单位步长 200 +5.19.3不填充,非单位步长 202 +5.19.4零填充,非单位步长 202 +5.20 理解反卷积和棋盘效应 204 +5.20.1为什么出现棋盘现象? 204 +5.20.2 有哪些方法可以避免棋盘效应? 205 +5.21 CNN主要的计算瓶颈? 207 +5.22 CNN的参数经验设置 207 +5.23 提高泛化能力的方法总结 208 +5.23.1 主要方法 208 +5.23.2 实验证明 208 +5.24 CNN在CV与NLP领域运用的联系与区别? 213 +5.24.1联系 213 +5.24.2区别 213 +5.25 CNN凸显共性的手段? 213 +5.25.1 局部连接 213 +5.25.2 权值共享 214 +5.25.3 池化操作 215 +5.26 全卷积与Local-Conv的异同点 215 +5.27 举例理解Local-Conv的作用 215 +5.28 简述卷积神经网络进化史 216 +## 第六章 循环神经网络(RNN) 218 +6.1 RNNs和FNNs有什么区别? 218 +6.2 RNNs典型特点? 218 +6.3 RNNs能干什么? 219 +6.4 RNNs在NLP中典型应用? 220 +6.5 RNNs训练和传统ANN训练异同点? 220 +6.6常见的RNNs扩展和改进模型 221 +6.6.1 Simple RNNs(SRNs) 221 +6.6.2 Bidirectional RNNs 221 +6.6.3 Deep(Bidirectional) RNNs 222 +6.6.4 Echo State Networks(ESNs) 222 +6.6.5 Gated Recurrent Unit Recurrent Neural Networks 224 +6.6.6 LSTM Netwoorks 224 +6.6.7 Clockwork RNNs(CW-RNNs) 225 +## 第七章 目标检测 228 +7.1基于候选区域的目标检测器 228 +7.1.1滑动窗口检测器 228 +7.1.2选择性搜索 229 +7.1.3 R-CNN 230 +7.1.4边界框回归器 230 +7.1.5 Fast R-CNN 231 +7.1.6 ROI 池化 233 +7.1.7 Faster R-CNN 233 +7.1.8候选区域网络 234 +7.1.9 R-CNN 方法的性能 236 +7.2 基于区域的全卷积神经网络(R-FCN) 237 +7.3 单次目标检测器 240 +7.3.1单次检测器 241 +7.3.2滑动窗口进行预测 241 +7.3.3 SSD 243 +7.4 YOLO系列 244 +7.4.1 YOLOv1介绍 244 +7.4.2 YOLOv1模型优缺点? 252 +7.4.3 YOLOv2 253 +7.4.4 YOLOv2改进策略 254 +7.4.5 YOLOv2的训练 261 +7.4.6 YOLO9000 261 +7.4.7 YOLOv3 263 +7.4.8 YOLOv3改进 264 +## 第八章 图像分割 269 +8.1 传统的基于CNN的分割方法缺点? 269 +8.1 FCN 269 +8.1.1 FCN改变了什么? 269 +8.1.2 FCN网络结构? 270 +8.1.3全卷积网络举例? 271 +8.1.4为什么CNN对像素级别的分类很难? 271 +8.1.5全连接层和卷积层如何相互转化? 272 +8.1.6 FCN的输入图片为什么可以是任意大小? 272 +8.1.7把全连接层的权重W重塑成卷积层的滤波器有什么好处? 273 +8.1.8反卷积层理解 275 +8.1.9跳级(skip)结构 276 +8.1.10模型训练 277 +8.1.11 FCN缺点 280 +8.2 U-Net 280 +8.3 SegNet 282 +8.4空洞卷积(Dilated Convolutions) 283 +8.4 RefineNet 285 +8.5 PSPNet 286 +8.6 DeepLab系列 288 +8.6.1 DeepLabv1 288 +8.6.2 DeepLabv2 289 +8.6.3 DeepLabv3 289 +8.6.4 DeepLabv3+ 290 +8.7 Mask-R-CNN 293 +8.7.1 Mask-RCNN 的网络结构示意图 293 +8.7.2 RCNN行人检测框架 293 +8.7.3 Mask-RCNN 技术要点 294 +8.8 CNN在基于弱监督学习的图像分割中的应用 295 +8.8.1 Scribble标记 295 +8.8.2 图像级别标记 297 +8.8.3 DeepLab+bounding box+image-level labels 298 +8.8.4统一的框架 299 +## 第九章 强化学习 301 +9.1强化学习的主要特点? 301 +9.2强化学习应用实例 302 +9.3强化学习和监督式学习、非监督式学习的区别 303 +9.4 强化学习主要有哪些算法? 305 +9.5深度迁移强化学习算法 305 +9.6分层深度强化学习算法 306 +9.7深度记忆强化学习算法 306 +9.8 多智能体深度强化学习算法 307 +9.9深度强化学习算法小结 307 +## 第十章 迁移学习 309 +10.1 什么是迁移学习? 309 +10.2 什么是多任务学习? 309 +10.3 多任务学习有什么意义? 309 +10.4 什么是端到端的深度学习? 311 +10.5 端到端的深度学习举例? 311 +10.6 端到端的深度学习有什么挑战? 311 +10.7 端到端的深度学习优缺点? 312 +## 第十三章 优化算法 314 +13.1 CPU和GPU 的区别? 314 +13.2如何解决训练样本少的问题 315 +13.3 什么样的样本集不适合用深度学习? 315 +13.4 有没有可能找到比已知算法更好的算法? 316 +13.5 何为共线性, 跟过拟合有啥关联? 316 +13.6 广义线性模型是怎被应用在深度学习中? 316 +13.7 造成梯度消失的原因? 317 +13.8 权值初始化方法有哪些 317 +13.9 启发式优化算法中,如何避免陷入局部最优解? 318 +13.10 凸优化中如何改进GD方法以防止陷入局部最优解 319 +13.11 常见的损失函数? 319 +13.14 如何进行特征选择(feature selection)? 321 +13.14.1 如何考虑特征选择 321 +13.14.2 特征选择方法分类 321 +13.14.3 特征选择目的 322 +13.15 梯度消失/梯度爆炸原因,以及解决方法 322 +13.15.1 为什么要使用梯度更新规则? 322 +13.15.2 梯度消失、爆炸原因? 323 +13.15.3 梯度消失、爆炸的解决方案 324 +13.16 深度学习为什么不用二阶优化 325 +13.17 怎样优化你的深度学习系统? 326 +13.18为什么要设置单一数字评估指标? 326 +13.19满足和优化指标(Satisficing and optimizing metrics) 327 +13.20 怎样划分训练/开发/测试集 328 +13.21如何划分开发/测试集大小 329 +13.22什么时候该改变开发/测试集和指标? 329 +13.23 设置评估指标的意义? 330 +13.24 什么是可避免偏差? 331 +13.25 什么是TOP5错误率? 331 +13.26 什么是人类水平错误率? 332 +13.27 可避免偏差、几大错误率之间的关系? 332 +13.28 怎样选取可避免偏差及贝叶斯错误率? 332 +13.29 怎样减少方差? 333 +13.30贝叶斯错误率的最佳估计 333 +13.31举机器学习超过单个人类表现几个例子? 334 +13.32如何改善你的模型? 334 +13.33 理解误差分析 335 +13.34 为什么值得花时间查看错误标记数据? 336 +13.35 快速搭建初始系统的意义? 336 +13.36 为什么要在不同的划分上训练及测试? 337 +13.37 如何解决数据不匹配问题? 338 +13.38 梯度检验注意事项? 340 +13.39什么是随机梯度下降? 341 +13.40什么是批量梯度下降? 341 +13.41什么是小批量梯度下降? 341 +13.42怎么配置mini-batch梯度下降 342 +13.43 局部最优的问题 343 +13.44提升算法性能思路 346 +## 第十四章 超参数调整 358 +14.1 调试处理 358 +14.2 有哪些超参数 359 +14.3 如何选择调试值? 359 +14.4 为超参数选择合适的范围 359 +14.5 如何搜索超参数? 359 +## 第十五章 正则化 361 +15.1 什么是正则化? 361 +15.2 正则化原理? 361 +15.3 为什么要正则化? 361 +15.4 为什么正则化有利于预防过拟合? 361 +15.5 为什么正则化可以减少方差? 362 +15.6 L2正则化的理解? 362 +15.7 理解dropout 正则化 362 +15.8 有哪些dropout 正则化方法? 362 +15.8 如何实施dropout 正则化 363 +15.9 Python 实现dropout 正则化 363 +15.10 L2正则化和dropout 有什么不同? 363 +15.11 dropout有什么缺点? 363 +15.12 其他正则化方法? 364 +## 参考文献 366 diff --git a/docsify.js b/docsify.js deleted file mode 100644 index 99637119..00000000 --- a/docsify.js +++ /dev/null @@ -1,5065 +0,0 @@ -(function () { - /** - * Create a cached version of a pure function. - */ - function cached(fn) { - var cache = Object.create(null); - return function (str) { - var key = isPrimitive(str) ? str : JSON.stringify(str); - var hit = cache[key]; - return hit || (cache[key] = fn(str)) - } - } - - /** - * Hyphenate a camelCase string. - */ - var hyphenate = cached(function (str) { - return str.replace(/([A-Z])/g, function (m) { return '-' + m.toLowerCase(); }) - }); - - var hasOwn = Object.prototype.hasOwnProperty; - - /** - * Simple Object.assign polyfill - */ - var merge = - Object.assign || - function (to) { - var arguments$1 = arguments; - - for (var i = 1; i < arguments.length; i++) { - var from = Object(arguments$1[i]); - - for (var key in from) { - if (hasOwn.call(from, key)) { - to[key] = from[key]; - } - } - } - - return to - }; - - /** - * Check if value is primitive - */ - function isPrimitive(value) { - return typeof value === 'string' || typeof value === 'number' - } - - /** - * Perform no operation. - */ - function noop() {} - - /** - * Check if value is function - */ - function isFn(obj) { - return typeof obj === 'function' - } - - function config () { - var config = merge( - { - el: '#app', - repo: '', - maxLevel: 6, - subMaxLevel: 0, - loadSidebar: null, - loadNavbar: null, - homepage: 'README.md', - coverpage: '', - basePath: '', - auto2top: false, - name: '', - themeColor: '', - nameLink: window.location.pathname, - autoHeader: false, - executeScript: null, - noEmoji: false, - ga: '', - ext: '.md', - mergeNavbar: false, - formatUpdated: '', - externalLinkTarget: '_blank', - routerMode: 'hash', - noCompileLinks: [], - relativePath: false - }, - window.$docsify - ); - - var script = - document.currentScript || - [].slice - .call(document.getElementsByTagName('script')) - .filter(function (n) { return /docsify\./.test(n.src); })[0]; - - if (script) { - for (var prop in config) { - if (hasOwn.call(config, prop)) { - var val = script.getAttribute('data-' + hyphenate(prop)); - - if (isPrimitive(val)) { - config[prop] = val === '' ? true : val; - } - } - } - - if (config.loadSidebar === true) { - config.loadSidebar = '_sidebar' + config.ext; - } - if (config.loadNavbar === true) { - config.loadNavbar = '_navbar' + config.ext; - } - if (config.coverpage === true) { - config.coverpage = '_coverpage' + config.ext; - } - if (config.repo === true) { - config.repo = ''; - } - if (config.name === true) { - config.name = ''; - } - } - - window.$docsify = config; - - return config - } - - function initLifecycle(vm) { - var hooks = [ - 'init', - 'mounted', - 'beforeEach', - 'afterEach', - 'doneEach', - 'ready' - ]; - - vm._hooks = {}; - vm._lifecycle = {}; - hooks.forEach(function (hook) { - var arr = (vm._hooks[hook] = []); - vm._lifecycle[hook] = function (fn) { return arr.push(fn); }; - }); - } - - function callHook(vm, hook, data, next) { - if ( next === void 0 ) next = noop; - - var queue = vm._hooks[hook]; - - var step = function (index) { - var hook = queue[index]; - if (index >= queue.length) { - next(data); - } else if (typeof hook === 'function') { - if (hook.length === 2) { - hook(data, function (result) { - data = result; - step(index + 1); - }); - } else { - var result = hook(data); - data = result === undefined ? data : result; - step(index + 1); - } - } else { - step(index + 1); - } - }; - - step(0); - } - - var inBrowser = !false; - - var isMobile = inBrowser && document.body.clientWidth <= 600; - - /** - * @see https://github.com/MoOx/pjax/blob/master/lib/is-supported.js - */ - var supportsPushState = - inBrowser && - (function () { - // Borrowed wholesale from https://github.com/defunkt/jquery-pjax - return ( - window.history && - window.history.pushState && - window.history.replaceState && - // PushState isn’t reliable on iOS until 5. - !navigator.userAgent.match( - /((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/ - ) - ) - })(); - - var cacheNode = {}; - - /** - * Get Node - * @param {String|Element} el - * @param {Boolean} noCache - * @return {Element} - */ - function getNode(el, noCache) { - if ( noCache === void 0 ) noCache = false; - - if (typeof el === 'string') { - if (typeof window.Vue !== 'undefined') { - return find(el) - } - el = noCache ? find(el) : cacheNode[el] || (cacheNode[el] = find(el)); - } - - return el - } - - var $ = inBrowser && document; - - var body = inBrowser && $.body; - - var head = inBrowser && $.head; - - /** - * Find element - * @example - * find('nav') => document.querySelector('nav') - * find(nav, 'a') => nav.querySelector('a') - */ - function find(el, node) { - return node ? el.querySelector(node) : $.querySelector(el) - } - - /** - * Find all elements - * @example - * findAll('a') => [].slice.call(document.querySelectorAll('a')) - * findAll(nav, 'a') => [].slice.call(nav.querySelectorAll('a')) - */ - function findAll(el, node) { - return [].slice.call( - node ? el.querySelectorAll(node) : $.querySelectorAll(el) - ) - } - - function create(node, tpl) { - node = $.createElement(node); - if (tpl) { - node.innerHTML = tpl; - } - return node - } - - function appendTo(target, el) { - return target.appendChild(el) - } - - function before(target, el) { - return target.insertBefore(el, target.children[0]) - } - - function on(el, type, handler) { - isFn(type) ? - window.addEventListener(el, type) : - el.addEventListener(type, handler); - } - - function off(el, type, handler) { - isFn(type) ? - window.removeEventListener(el, type) : - el.removeEventListener(type, handler); - } - - /** - * Toggle class - * - * @example - * toggleClass(el, 'active') => el.classList.toggle('active') - * toggleClass(el, 'add', 'active') => el.classList.add('active') - */ - function toggleClass(el, type, val) { - el && el.classList[val ? type : 'toggle'](val || type); - } - - function style(content) { - appendTo(head, create('style', content)); - } - - - var dom = Object.freeze({ - getNode: getNode, - $: $, - body: body, - head: head, - find: find, - findAll: findAll, - create: create, - appendTo: appendTo, - before: before, - on: on, - off: off, - toggleClass: toggleClass, - style: style - }); - - /** - * Render github corner - * @param {Object} data - * @return {String} - */ - function corner(data) { - if (!data) { - return '' - } - if (!/\/\//.test(data)) { - data = 'https://github.com/' + data; - } - data = data.replace(/^git\+/, ''); - - return ( - "" + - '' + - '' - ) - } - - /** - * Render main content - */ - function main(config) { - var aside = - '' + - ''; - - return ( - (isMobile ? (aside + "
") : ("
" + aside)) + - '
' + - '
' + - '
' + - '
' - ) - } - - /** - * Cover Page - */ - function cover() { - var SL = ', 100%, 85%'; - var bgc = - 'linear-gradient(to left bottom, ' + - "hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 0%," + - "hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 100%)"; - - return ( - "
" + - '
' + - '
' + - '
' - ) - } - - /** - * Render tree - * @param {Array} tree - * @param {String} tpl - * @return {String} - */ - function tree(toc, tpl) { - if ( tpl === void 0 ) tpl = '
    {inner}
'; - - if (!toc || !toc.length) { - return '' - } - var innerHTML = ''; - toc.forEach(function (node) { - innerHTML += "
  • " + (node.title) + "
  • "; - if (node.children) { - innerHTML += tree(node.children, tpl); - } - }); - return tpl.replace('{inner}', innerHTML) - } - - function helper(className, content) { - return ("

    " + (content.slice(5).trim()) + "

    ") - } - - function theme(color) { - return ("") - } - - var barEl; - var timeId; - - /** - * Init progress component - */ - function init() { - var div = create('div'); - - div.classList.add('progress'); - appendTo(body, div); - barEl = div; - } - /** - * Render progress bar - */ - function progressbar (ref) { - var loaded = ref.loaded; - var total = ref.total; - var step = ref.step; - - var num; - - !barEl && init(); - - if (step) { - num = parseInt(barEl.style.width || 0, 10) + step; - num = num > 80 ? 80 : num; - } else { - num = Math.floor(loaded / total * 100); - } - - barEl.style.opacity = 1; - barEl.style.width = num >= 95 ? '100%' : num + '%'; - - if (num >= 95) { - clearTimeout(timeId); - timeId = setTimeout(function (_) { - barEl.style.opacity = 0; - barEl.style.width = '0%'; - }, 200); - } - } - - var cache = {}; - - /** - * Simple ajax get - * @param {string} url - * @param {boolean} [hasBar=false] has progress bar - * @return { then(resolve, reject), abort } - */ - function get(url, hasBar, headers) { - if ( hasBar === void 0 ) hasBar = false; - if ( headers === void 0 ) headers = {}; - - var xhr = new XMLHttpRequest(); - var on = function () { - xhr.addEventListener.apply(xhr, arguments); - }; - var cached$$1 = cache[url]; - - if (cached$$1) { - return {then: function (cb) { return cb(cached$$1.content, cached$$1.opt); }, abort: noop} - } - - xhr.open('GET', url); - for (var i in headers) { - if (hasOwn.call(headers, i)) { - xhr.setRequestHeader(i, headers[i]); - } - } - xhr.send(); - - return { - then: function (success, error) { - if ( error === void 0 ) error = noop; - - if (hasBar) { - var id = setInterval( - function (_) { return progressbar({ - step: Math.floor(Math.random() * 5 + 1) - }); }, - 500 - ); - - on('progress', progressbar); - on('loadend', function (evt) { - progressbar(evt); - clearInterval(id); - }); - } - - on('error', error); - on('load', function (ref) { - var target = ref.target; - - if (target.status >= 400) { - error(target); - } else { - var result = (cache[url] = { - content: target.response, - opt: { - updatedAt: xhr.getResponseHeader('last-modified') - } - }); - - success(result.content, result.opt); - } - }); - }, - abort: function (_) { return xhr.readyState !== 4 && xhr.abort(); } - } - } - - function replaceVar(block, color) { - block.innerHTML = block.innerHTML.replace( - /var\(\s*--theme-color.*?\)/g, - color - ); - } - - function cssVars (color) { - // Variable support - if (window.CSS && window.CSS.supports && window.CSS.supports('(--v:red)')) { - return - } - - var styleBlocks = findAll('style:not(.inserted),link'); - [].forEach.call(styleBlocks, function (block) { - if (block.nodeName === 'STYLE') { - replaceVar(block, color); - } else if (block.nodeName === 'LINK') { - var href = block.getAttribute('href'); - - if (!/\.css$/.test(href)) { - return - } - - get(href).then(function (res) { - var style$$1 = create('style', res); - - head.appendChild(style$$1); - replaceVar(style$$1, color); - }); - } - }); - } - - var RGX = /([^{]*?)\w(?=\})/g; - - var dict = { - YYYY: 'getFullYear', - YY: 'getYear', - MM: function (d) { - return d.getMonth() + 1; - }, - DD: 'getDate', - HH: 'getHours', - mm: 'getMinutes', - ss: 'getSeconds' - }; - - function tinydate (str) { - var parts=[], offset=0; - str.replace(RGX, function (key, _, idx) { - // save preceding string - parts.push(str.substring(offset, idx - 1)); - offset = idx += key.length + 1; - // save function - parts.push(function(d){ - return ('00' + (typeof dict[key]==='string' ? d[dict[key]]() : dict[key](d))).slice(-key.length); - }); - }); - - if (offset !== str.length) { - parts.push(str.substring(offset)); - } - - return function (arg) { - var out='', i=0, d=arg||new Date(); - for (; i ?(paragraph|[^\n]*)(?:\n|$))+/, - blocklatex: /^(\${2}) *((?:[^$]|\\\$)+?) *\n\1(?:\n|$)/, - list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, - html: '^ {0,3}(?:' // optional indentation - + '<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)' // (1) - + '|comment[^\\n]*(\\n+|$)' // (2) - + '|<\\?[\\s\\S]*?\\?>\\n*' // (3) - + '|\\n*' // (4) - + '|\\n*' // (5) - + '|)[\\s\\S]*?(?:\\n{2,}|$)' // (6) - + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag - + '|(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag - + ')', - def: /^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/, - table: noop, - lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, - paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/, - text: /^[^\n]+/ - }; - - block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/; - block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/; - block.def = edit(block.def) - .replace('label', block._label) - .replace('title', block._title) - .getRegex(); - - block.bullet = /(?:[*+-]|\d+\.)/; - block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; - block.item = edit(block.item, 'gm') - .replace(/bull/g, block.bullet) - .getRegex(); - - block.list = edit(block.list) - .replace(/bull/g, block.bullet) - .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))') - .replace('def', '\\n+(?=' + block.def.source + ')') - .getRegex(); - - block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' - + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' - + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' - + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' - + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' - + '|track|ul'; - block._comment = //; - block.html = edit(block.html, 'i') - .replace('comment', block._comment) - .replace('tag', block._tag) - .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/) - .getRegex(); - - block.paragraph = edit(block.paragraph) - .replace('hr', block.hr) - .replace('heading', block.heading) - .replace('lheading', block.lheading) - .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks - .getRegex(); - - block.blockquote = edit(block.blockquote) - .replace('paragraph', block.paragraph) - .getRegex(); - - /** - * Normal Block Grammar - */ - - block.normal = merge({}, block); - - /** - * GFM Block Grammar - */ - - block.gfm = merge({}, block.normal, { - fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/, - paragraph: /^/, - heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/ - }); - - block.gfm.paragraph = edit(block.paragraph) - .replace('(?!', '(?!' - + block.gfm.fences.source.replace('\\1', '\\2') + '|' - + block.list.source.replace('\\1', '\\3') + '|') - .getRegex(); - - /** - * GFM + Tables Block Grammar - */ - - block.tables = merge({}, block.gfm, { - nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/, - table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/ - }); - - /** - * Pedantic grammar - */ - - block.pedantic = merge({}, block.normal, { - html: edit( - '^ *(?:comment *(?:\\n|\\s*$)' - + '|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)' // closed tag - + '|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))') - .replace('comment', block._comment) - .replace(/tag/g, '(?!(?:' - + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' - + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' - + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b') - .getRegex(), - def: /^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/ - }); - - /** - * Block Lexer - */ - - function Lexer(options) { - this.tokens = []; - this.tokens.links = {}; - this.options = options || marked.defaults; - this.rules = block.normal; - - if (this.options.pedantic) { - this.rules = block.pedantic; - } else if (this.options.gfm) { - if (this.options.tables) { - this.rules = block.tables; - } else { - this.rules = block.gfm; - } - } - } - - /** - * Expose Block Rules - */ - - Lexer.rules = block; - - /** - * Static Lex Method - */ - - Lexer.lex = function(src, options) { - var lexer = new Lexer(options); - return lexer.lex(src); - }; - - /** - * Preprocessing - */ - - Lexer.prototype.lex = function(src) { - src = src - .replace(/\r\n|\r/g, '\n') - .replace(/\t/g, ' ') - .replace(/\u00a0/g, ' ') - .replace(/\u2424/g, '\n'); - - return this.token(src, true); - }; - - /** - * Lexing - */ - - Lexer.prototype.token = function(src, top) { - src = src.replace(/^ +$/gm, ''); - var next, - loose, - cap, - bull, - b, - item, - space, - i, - tag, - l, - isordered, - istask, - ischecked; - - while (src) { - // newline - if (cap = this.rules.newline.exec(src)) { - src = src.substring(cap[0].length); - if (cap[0].length > 1) { - this.tokens.push({ - type: 'space' - }); - } - } - - // code - if (cap = this.rules.code.exec(src)) { - src = src.substring(cap[0].length); - cap = cap[0].replace(/^ {4}/gm, ''); - this.tokens.push({ - type: 'code', - text: !this.options.pedantic - ? cap.replace(/\n+$/, '') - : cap - }); - continue; - } - - // fences (gfm) - if (cap = this.rules.fences.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'code', - lang: cap[2], - text: cap[3] || '' - }); - continue; - } - - // heading - if (cap = this.rules.heading.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'heading', - depth: cap[1].length, - text: cap[2] - }); - continue; - } - - // latex - if (cap = this.rules.blocklatex.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'blocklatex', - text: cap[2] - }); - continue; - } - - // table no leading pipe (gfm) - if (top && (cap = this.rules.nptable.exec(src))) { - item = { - type: 'table', - header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')), - align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [] - }; - - if (item.header.length === item.align.length) { - src = src.substring(cap[0].length); - - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; - } - } - - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = splitCells(item.cells[i], item.header.length); - } - - this.tokens.push(item); - - continue; - } - } - - // hr - if (cap = this.rules.hr.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'hr' - }); - continue; - } - - // blockquote - if (cap = this.rules.blockquote.exec(src)) { - src = src.substring(cap[0].length); - - this.tokens.push({ - type: 'blockquote_start' - }); - - cap = cap[0].replace(/^ *> ?/gm, ''); - - // Pass `top` to keep the current - // "toplevel" state. This is exactly - // how markdown.pl works. - this.token(cap, top); - - this.tokens.push({ - type: 'blockquote_end' - }); - - continue; - } - - // list - if (cap = this.rules.list.exec(src)) { - src = src.substring(cap[0].length); - bull = cap[2]; - isordered = bull.length > 1; - - this.tokens.push({ - type: 'list_start', - ordered: isordered, - start: isordered ? +bull : '' - }); - - // Get each top-level item. - cap = cap[0].match(this.rules.item); - - next = false; - l = cap.length; - i = 0; - - for (; i < l; i++) { - item = cap[i]; - - // Remove the list item's bullet - // so it is seen as the next token. - space = item.length; - item = item.replace(/^ *([*+-]|\d+\.) +/, ''); - - // Outdent whatever the - // list item contains. Hacky. - if (~item.indexOf('\n ')) { - space -= item.length; - item = !this.options.pedantic - ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') - : item.replace(/^ {1,4}/gm, ''); - } - - // Determine whether the next list item belongs here. - // Backpedal if it does not belong in this list. - if (this.options.smartLists && i !== l - 1) { - b = block.bullet.exec(cap[i + 1])[0]; - if (bull !== b && !(bull.length > 1 && b.length > 1)) { - src = cap.slice(i + 1).join('\n') + src; - i = l - 1; - } - } - - // Determine whether item is loose or not. - // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/ - // for discount behavior. - loose = next || /\n\n(?!\s*$)/.test(item); - if (i !== l - 1) { - next = item.charAt(item.length - 1) === '\n'; - if (!loose) loose = next; - } - - // Check for task list items - istask = /^\[[ xX]\] /.test(item); - ischecked = undefined; - if (istask) { - ischecked = item[1] !== ' '; - item = item.replace(/^\[[ xX]\] +/, ''); - } - - this.tokens.push({ - type: loose - ? 'loose_item_start' - : 'list_item_start', - task: istask, - checked: ischecked - }); - - // Recurse. - this.token(item, false); - - this.tokens.push({ - type: 'list_item_end' - }); - } - - this.tokens.push({ - type: 'list_end' - }); - - continue; - } - - // html - if (cap = this.rules.html.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: this.options.sanitize - ? 'paragraph' - : 'html', - pre: !this.options.sanitizer - && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'), - text: cap[0] - }); - continue; - } - - // def - if (top && (cap = this.rules.def.exec(src))) { - src = src.substring(cap[0].length); - if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1); - tag = cap[1].toLowerCase().replace(/\s+/g, ' '); - if (!this.tokens.links[tag]) { - this.tokens.links[tag] = { - href: cap[2], - title: cap[3] - }; - } - continue; - } - - // table (gfm) - if (top && (cap = this.rules.table.exec(src))) { - item = { - type: 'table', - header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')), - align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3] ? cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') : [] - }; - - if (item.header.length === item.align.length) { - src = src.substring(cap[0].length); - - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; - } - } - - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = splitCells( - item.cells[i].replace(/^ *\| *| *\| *$/g, ''), - item.header.length); - } - - this.tokens.push(item); - - continue; - } - } - - // lheading - if (cap = this.rules.lheading.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'heading', - depth: cap[2] === '=' ? 1 : 2, - text: cap[1] - }); - continue; - } - - // top-level paragraph - if (top && (cap = this.rules.paragraph.exec(src))) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'paragraph', - text: cap[1].charAt(cap[1].length - 1) === '\n' - ? cap[1].slice(0, -1) - : cap[1] - }); - continue; - } - - // text - if (cap = this.rules.text.exec(src)) { - // Top-level should never reach here. - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'text', - text: cap[0] - }); - continue; - } - - if (src) { - throw new Error('Infinite loop on byte: ' + src.charCodeAt(0)); - } - } - - return this.tokens; - }; - - /** - * Inline-Level Grammar - */ - - var inline = { - escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, - autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, - url: noop, - tag: '^comment' - + '|^' // self-closing tag - + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag - + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. - + '|^' // declaration, e.g. - + '|^', // CDATA section - link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/, - reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/, - nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/, - strong: /^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)|^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)/, - em: /^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*][\s\S]*?[^\s])\*(?!\*)|^_([^\s_])_(?!_)|^\*([^\s*])\*(?!\*)/, - code: /^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/, - inlinelatex: /^(\${1,2}) *((?:[^\\$]|\\\S)+?) *\1(?!\$)/, - br: /^ {2,}\n(?!\s*$)/, - del: noop, - text: /^[\s\S]+?(?=[\\?@\[\]\\^_`{|}~])/g; - - inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/; - inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/; - inline.autolink = edit(inline.autolink) - .replace('scheme', inline._scheme) - .replace('email', inline._email) - .getRegex(); - - inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/; - - inline.tag = edit(inline.tag) - .replace('comment', block._comment) - .replace('attribute', inline._attribute) - .getRegex(); - - inline._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/; - inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f()\\]*\)|[^\s\x00-\x1f()\\])*?)/; - inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/; - - inline.link = edit(inline.link) - .replace('label', inline._label) - .replace('href', inline._href) - .replace('title', inline._title) - .getRegex(); - - inline.reflink = edit(inline.reflink) - .replace('label', inline._label) - .getRegex(); - - /** - * Normal Inline Grammar - */ - - inline.normal = merge({}, inline); - - /** - * Pedantic Inline Grammar - */ - - inline.pedantic = merge({}, inline.normal, { - strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, - em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/, - link: edit(/^!?\[(label)\]\((.*?)\)/) - .replace('label', inline._label) - .getRegex(), - reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/) - .replace('label', inline._label) - .getRegex() - }); - - /** - * GFM Inline Grammar - */ - - inline.gfm = merge({}, inline.normal, { - escape: edit(inline.escape).replace('])', '~|])').getRegex(), - url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/) - .replace('email', inline._email) - .getRegex(), - _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/, - del: /^~~(?=\S)([\s\S]*?\S)~~/, - text: edit(inline.text) - .replace(']|', '~]|') - .replace('|', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|') - .getRegex() - }); - - /** - * GFM + Line Breaks Inline Grammar - */ - - inline.breaks = merge({}, inline.gfm, { - br: edit(inline.br).replace('{2,}', '*').getRegex(), - text: edit(inline.gfm.text).replace('{2,}', '*').getRegex() - }); - - /** - * Inline Lexer & Compiler - */ - - function InlineLexer(links, options) { - this.options = options || marked.defaults; - this.links = links; - this.rules = inline.normal; - this.renderer = this.options.renderer || new Renderer(); - this.renderer.latex = this.renderer.latex || Renderer.prototype.latex - this.renderer.options = this.options; - - if (!this.links) { - throw new Error('Tokens array requires a `links` property.'); - } - - if (this.options.pedantic) { - this.rules = inline.pedantic; - } else if (this.options.gfm) { - if (this.options.breaks) { - this.rules = inline.breaks; - } else { - this.rules = inline.gfm; - } - } - } - - /** - * Expose Inline Rules - */ - - InlineLexer.rules = inline; - - /** - * Static Lexing/Compiling Method - */ - - InlineLexer.output = function(src, links, options) { - var inline = new InlineLexer(links, options); - return inline.output(src); - }; - - /** - * Lexing/Compiling - */ - - InlineLexer.prototype.output = function(src) { - var out = '', - link, - text, - href, - title, - cap; - - while (src) { - // escape - if (cap = this.rules.escape.exec(src)) { - src = src.substring(cap[0].length); - out += cap[1]; - continue; - } - - // autolink - if (cap = this.rules.autolink.exec(src)) { - src = src.substring(cap[0].length); - if (cap[2] === '@') { - text = escape(this.mangle(cap[1])); - href = 'mailto:' + text; - } else { - text = escape(cap[1]); - href = text; - } - out += this.renderer.link(href, null, text); - continue; - } - - // url (gfm) - if (!this.inLink && (cap = this.rules.url.exec(src))) { - cap[0] = this.rules._backpedal.exec(cap[0])[0]; - src = src.substring(cap[0].length); - if (cap[2] === '@') { - text = escape(cap[0]); - href = 'mailto:' + text; - } else { - text = escape(cap[0]); - if (cap[1] === 'www.') { - href = 'http://' + text; - } else { - href = text; - } - } - out += this.renderer.link(href, null, text); - continue; - } - - // tag - if (cap = this.rules.tag.exec(src)) { - if (!this.inLink && /^/i.test(cap[0])) { - this.inLink = false; - } - src = src.substring(cap[0].length); - out += this.options.sanitize - ? this.options.sanitizer - ? this.options.sanitizer(cap[0]) - : escape(cap[0]) - : cap[0] - continue; - } - - // link - if (cap = this.rules.link.exec(src)) { - src = src.substring(cap[0].length); - this.inLink = true; - href = cap[2]; - if (this.options.pedantic) { - link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href); - - if (link) { - href = link[1]; - title = link[3]; - } else { - title = ''; - } - } else { - title = cap[3] ? cap[3].slice(1, -1) : ''; - } - href = href.trim().replace(/^<([\s\S]*)>$/, '$1'); - out += this.outputLink(cap, { - href: InlineLexer.escapes(href), - title: InlineLexer.escapes(title) - }); - this.inLink = false; - continue; - } - - // reflink, nolink - if ((cap = this.rules.reflink.exec(src)) - || (cap = this.rules.nolink.exec(src))) { - src = src.substring(cap[0].length); - link = (cap[2] || cap[1]).replace(/\s+/g, ' '); - link = this.links[link.toLowerCase()]; - if (!link || !link.href) { - out += cap[0].charAt(0); - src = cap[0].substring(1) + src; - continue; - } - this.inLink = true; - out += this.outputLink(cap, link); - this.inLink = false; - continue; - } - - // strong - if (cap = this.rules.strong.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.strong(this.output(cap[4] || cap[3] || cap[2] || cap[1])); - continue; - } - - // em - if (cap = this.rules.em.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.em(this.output(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1])); - continue; - } - - // code - if (cap = this.rules.code.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.codespan(escape(cap[2].trim(), true)); - continue; - } - - // latex - if (cap = this.rules.inlinelatex.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.latex(cap[2], '$$'===cap[1]) - continue; - } - - // br - if (cap = this.rules.br.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.br(); - continue; - } - - // del (gfm) - if (cap = this.rules.del.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.del(this.output(cap[1])); - continue; - } - - // text - if (cap = this.rules.text.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.text(escape(this.smartypants(cap[0]))); - continue; - } - - if (src) { - throw new Error('Infinite loop on byte: ' + src.charCodeAt(0)); - } - } - - return out; - }; - - InlineLexer.escapes = function(text) { - return text ? text.replace(InlineLexer.rules._escapes, '$1') : text; - } - - /** - * Compile Link - */ - - InlineLexer.prototype.outputLink = function(cap, link) { - var href = link.href, - title = link.title ? escape(link.title) : null; - - return cap[0].charAt(0) !== '!' - ? this.renderer.link(href, title, this.output(cap[1])) - : this.renderer.image(href, title, escape(cap[1])); - }; - - /** - * Smartypants Transformations - */ - - InlineLexer.prototype.smartypants = function(text) { - if (!this.options.smartypants) return text; - return text - // em-dashes - .replace(/---/g, '\u2014') - // en-dashes - .replace(/--/g, '\u2013') - // opening singles - .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018') - // closing singles & apostrophes - .replace(/'/g, '\u2019') - // opening doubles - .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c') - // closing doubles - .replace(/"/g, '\u201d') - // ellipses - .replace(/\.{3}/g, '\u2026'); - }; - - /** - * Mangle Links - */ - - InlineLexer.prototype.mangle = function(text) { - if (!this.options.mangle) return text; - var out = '', - l = text.length, - i = 0, - ch; - - for (; i < l; i++) { - ch = text.charCodeAt(i); - if (Math.random() > 0.5) { - ch = 'x' + ch.toString(16); - } - out += '&#' + ch + ';'; - } - - return out; - }; - - /** - * Renderer - */ - - function Renderer(options) { - this.options = options || marked.defaults; - } - - Renderer.prototype.code = function(code, lang, escaped) { - if (this.options.highlight) { - var out = this.options.highlight(code, lang); - if (out != null && out !== code) { - escaped = true; - code = out; - } - } - - if (!lang) { - return '
    '
    -          + (escaped ? code : escape(code, true))
    -          + '
    '; - } - - return '
    '
    -        + (escaped ? code : escape(code, true))
    -        + '
    \n'; - }; - - Renderer.prototype.blockquote = function(quote) { - return '
    \n' + quote + '
    \n'; - }; - - Renderer.prototype.html = function(html) { - return html; - }; - - Renderer.prototype.latex = function(text, block=false) { - var out; - try { - if (marked.defaults.latexRender) { - var html = marked.defaults.latexRender(text); - if (block) { - out = '
    ' + html + '
    '; - }else{ - out = html; - } - } else { - console.log('No latexRender'); - } - } catch (e) { - console.info('Failed to render latex: "' + text + '"'); - out = '$$' + escape(text) + '$$'; - } - return out; - }; - - Renderer.prototype.heading = function(text, level, raw) { - if (this.options.headerIds) { - return '' - + text - + '\n'; - } - // ignore IDs - return '' + text + '\n'; - }; - - Renderer.prototype.hr = function() { - return this.options.xhtml ? '
    \n' : '
    \n'; - }; - - Renderer.prototype.list = function(body, ordered, start) { - var type = ordered ? 'ol' : 'ul', - startatt = (ordered && start !== 1) ? (' start="' + start + '"') : ''; - return '<' + type + startatt + '>\n' + body + '\n'; - }; - - Renderer.prototype.listitem = function(text) { - return '
  • ' + text + '
  • \n'; - }; - - Renderer.prototype.checkbox = function(checked) { - return ' '; - } - - Renderer.prototype.paragraph = function(text) { - return '

    ' + text + '

    \n'; - }; - - Renderer.prototype.table = function(header, body) { - if (body) body = '' + body + ''; - - return '\n' - + '\n' - + header - + '\n' - + body - + '
    \n'; - }; - - Renderer.prototype.tablerow = function(content) { - return '\n' + content + '\n'; - }; - - Renderer.prototype.tablecell = function(content, flags) { - var type = flags.header ? 'th' : 'td'; - var tag = flags.align - ? '<' + type + ' align="' + flags.align + '">' - : '<' + type + '>'; - return tag + content + '\n'; - }; - - // span level renderer - Renderer.prototype.strong = function(text) { - return '' + text + ''; - }; - - Renderer.prototype.em = function(text) { - return '' + text + ''; - }; - - Renderer.prototype.codespan = function(text) { - return '' + text + ''; - }; - - Renderer.prototype.br = function() { - return this.options.xhtml ? '
    ' : '
    '; - }; - - Renderer.prototype.del = function(text) { - return '' + text + ''; - }; - - Renderer.prototype.link = function(href, title, text) { - if (this.options.sanitize) { - try { - var prot = decodeURIComponent(unescape(href)) - .replace(/[^\w:]/g, '') - .toLowerCase(); - } catch (e) { - return text; - } - if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) { - return text; - } - } - if (this.options.baseUrl && !originIndependentUrl.test(href)) { - href = resolveUrl(this.options.baseUrl, href); - } - try { - href = encodeURI(href).replace(/%25/g, '%'); - } catch (e) { - return text; - } - var out = '
    '; - return out; - }; - - Renderer.prototype.image = function(href, title, text) { - if (this.options.baseUrl && !originIndependentUrl.test(href)) { - href = resolveUrl(this.options.baseUrl, href); - } - var out = '' + text + '' : '>'; - return out; - }; - - Renderer.prototype.text = function(text) { - return text; - }; - - /** - * TextRenderer - * returns only the textual part of the token - */ - - function TextRenderer() {} - - // no need for block level renderers - - TextRenderer.prototype.strong = - TextRenderer.prototype.em = - TextRenderer.prototype.codespan = - TextRenderer.prototype.del = - TextRenderer.prototype.text = function (text) { - return text; - } - - TextRenderer.prototype.link = - TextRenderer.prototype.image = function(href, title, text) { - return '' + text; - } - - TextRenderer.prototype.br = function() { - return ''; - } - - /** - * Parsing & Compiling - */ - - function Parser(options) { - this.tokens = []; - this.token = null; - this.options = options || marked.defaults; - this.options.renderer = this.options.renderer || new Renderer(); - this.renderer = this.options.renderer; - this.renderer.options = this.options; - } - - /** - * Static Parse Method - */ - - Parser.parse = function(src, options) { - var parser = new Parser(options); - return parser.parse(src); - }; - - /** - * Parse Loop - */ - - Parser.prototype.parse = function(src) { - this.inline = new InlineLexer(src.links, this.options); - // use an InlineLexer with a TextRenderer to extract pure text - this.inlineText = new InlineLexer( - src.links, - merge({}, this.options, {renderer: new TextRenderer()}) - ); - this.tokens = src.reverse(); - - var out = ''; - while (this.next()) { - out += this.tok(); - } - - return out; - }; - - /** - * Next Token - */ - - Parser.prototype.next = function() { - return this.token = this.tokens.pop(); - }; - - /** - * Preview Next Token - */ - - Parser.prototype.peek = function() { - return this.tokens[this.tokens.length - 1] || 0; - }; - - /** - * Parse Text Tokens - */ - - Parser.prototype.parseText = function() { - var body = this.token.text; - - while (this.peek().type === 'text') { - body += '\n' + this.next().text; - } - - return this.inline.output(body); - }; - - /** - * Parse Current Token - */ - - Parser.prototype.tok = function() { - switch (this.token.type) { - case 'space': { - return ''; - } - case 'hr': { - return this.renderer.hr(); - } - case 'heading': { - return this.renderer.heading( - this.inline.output(this.token.text), - this.token.depth, - unescape(this.inlineText.output(this.token.text))); - } - case 'blocklatex': { - return this.renderer.latex(this.token.text, true) - } - case 'code': { - return this.renderer.code(this.token.text, - this.token.lang, - this.token.escaped); - } - case 'table': { - var header = '', - body = '', - i, - row, - cell, - j; - - // header - cell = ''; - for (i = 0; i < this.token.header.length; i++) { - cell += this.renderer.tablecell( - this.inline.output(this.token.header[i]), - { header: true, align: this.token.align[i] } - ); - } - header += this.renderer.tablerow(cell); - - for (i = 0; i < this.token.cells.length; i++) { - row = this.token.cells[i]; - - cell = ''; - for (j = 0; j < row.length; j++) { - cell += this.renderer.tablecell( - this.inline.output(row[j]), - { header: false, align: this.token.align[j] } - ); - } - - body += this.renderer.tablerow(cell); - } - return this.renderer.table(header, body); - } - case 'blockquote_start': { - body = ''; - - while (this.next().type !== 'blockquote_end') { - body += this.tok(); - } - - return this.renderer.blockquote(body); - } - case 'list_start': { - body = ''; - var ordered = this.token.ordered, - start = this.token.start; - - while (this.next().type !== 'list_end') { - body += this.tok(); - } - - return this.renderer.list(body, ordered, start); - } - case 'list_item_start': { - body = ''; - - if (this.token.task) { - body += this.renderer.checkbox(this.token.checked); - } - - while (this.next().type !== 'list_item_end') { - body += this.token.type === 'text' - ? this.parseText() - : this.tok(); - } - - return this.renderer.listitem(body); - } - case 'loose_item_start': { - body = ''; - - while (this.next().type !== 'list_item_end') { - body += this.tok(); - } - - return this.renderer.listitem(body); - } - case 'html': { - // TODO parse inline content if parameter markdown=1 - return this.renderer.html(this.token.text); - } - case 'paragraph': { - return this.renderer.paragraph(this.inline.output(this.token.text)); - } - case 'text': { - return this.renderer.paragraph(this.parseText()); - } - } - }; - - /** - * Helpers - */ - - function escape(html, encode) { - return html - .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); - } - - function unescape(html) { - // explicitly match decimal, hex, and named HTML entities - return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function(_, n) { - n = n.toLowerCase(); - if (n === 'colon') return ':'; - if (n.charAt(0) === '#') { - return n.charAt(1) === 'x' - ? String.fromCharCode(parseInt(n.substring(2), 16)) - : String.fromCharCode(+n.substring(1)); - } - return ''; - }); - } - - function edit(regex, opt) { - regex = regex.source || regex; - opt = opt || ''; - return { - replace: function(name, val) { - val = val.source || val; - val = val.replace(/(^|[^\[])\^/g, '$1'); - regex = regex.replace(name, val); - return this; - }, - getRegex: function() { - return new RegExp(regex, opt); - } - }; - } - - function resolveUrl(base, href) { - if (!baseUrls[' ' + base]) { - // we can ignore everything in base after the last slash of its path component, - // but we might need to add _that_ - // https://tools.ietf.org/html/rfc3986#section-3 - if (/^[^:]+:\/*[^/]*$/.test(base)) { - baseUrls[' ' + base] = base + '/'; - } else { - baseUrls[' ' + base] = base.replace(/[^/]*$/, ''); - } - } - base = baseUrls[' ' + base]; - - if (href.slice(0, 2) === '//') { - return base.replace(/:[\s\S]*/, ':') + href; - } else if (href.charAt(0) === '/') { - return base.replace(/(:\/*[^/]*)[\s\S]*/, '$1') + href; - } else { - return base + href; - } - } - var baseUrls = {}; - var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; - - function noop() {} - noop.exec = noop; - - function merge(obj) { - var i = 1, - target, - key; - - for (; i < arguments.length; i++) { - target = arguments[i]; - for (key in target) { - if (Object.prototype.hasOwnProperty.call(target, key)) { - obj[key] = target[key]; - } - } - } - - return obj; - } - - function splitCells(tableRow, count) { - var cells = tableRow.replace(/([^\\])\|/g, '$1 |').split(/ +\| */), - i = 0; - - if (cells.length > count) { - cells.splice(count); - } else { - while (cells.length < count) cells.push(''); - } - - for (; i < cells.length; i++) { - cells[i] = cells[i].replace(/\\\|/g, '|'); - } - return cells; - } - - /** - * Marked - */ - - function marked(src, opt, callback) { - // throw error in case of non string input - if (typeof src === 'undefined' || src === null) { - throw new Error('marked(): input parameter is undefined or null'); - } - if (typeof src !== 'string') { - throw new Error('marked(): input parameter is of type ' - + Object.prototype.toString.call(src) + ', string expected'); - } - - if (callback || typeof opt === 'function') { - if (!callback) { - callback = opt; - opt = null; - } - - opt = merge({}, marked.defaults, opt || {}); - - var highlight = opt.highlight, - tokens, - pending, - i = 0; - - try { - tokens = Lexer.lex(src, opt) - } catch (e) { - return callback(e); - } - - pending = tokens.length; - - var done = function(err) { - if (err) { - opt.highlight = highlight; - return callback(err); - } - - var out; - - try { - out = Parser.parse(tokens, opt); - } catch (e) { - err = e; - } - - opt.highlight = highlight; - - return err - ? callback(err) - : callback(null, out); - }; - - if (!highlight || highlight.length < 3) { - return done(); - } - - delete opt.highlight; - - if (!pending) return done(); - - for (; i < tokens.length; i++) { - (function(token) { - if (token.type !== 'code') { - return --pending || done(); - } - return highlight(token.text, token.lang, function(err, code) { - if (err) return done(err); - if (code == null || code === token.text) { - return --pending || done(); - } - token.text = code; - token.escaped = true; - --pending || done(); - }); - })(tokens[i]); - } - - return; - } - try { - if (opt) opt = merge({}, marked.defaults, opt); - return Parser.parse(Lexer.lex(src, opt), opt); - } catch (e) { - e.message += '\nPlease report this to https://github.com/markedjs/marked.'; - if ((opt || marked.defaults).silent) { - return '

    An error occurred:

    '
    -            + escape(e.message + '', true)
    -            + '
    '; - } - throw e; - } - } - - /** - * Options - */ - - marked.options = - marked.setOptions = function(opt) { - merge(marked.defaults, opt); - return marked; - }; - - marked.getDefaults = function () { - return { - baseUrl: null, - breaks: false, - gfm: true, - headerIds: true, - headerPrefix: '', - highlight: null, - langPrefix: 'language-', - mangle: true, - pedantic: false, - renderer: new Renderer(), - sanitize: false, - sanitizer: null, - silent: false, - smartLists: false, - smartypants: false, - tables: true, - xhtml: false - }; - } - - marked.defaults = marked.getDefaults(); - - /** - * Expose - */ - - marked.Parser = Parser; - marked.parser = Parser.parse; - - marked.Renderer = Renderer; - marked.TextRenderer = TextRenderer; - - marked.Lexer = Lexer; - marked.lexer = Lexer.lex; - - marked.InlineLexer = InlineLexer; - marked.inlineLexer = InlineLexer.output; - - marked.parse = marked; - - { - module.exports = marked; - } - })(commonjsGlobal || (typeof window !== 'undefined' ? window : commonjsGlobal)); - }); - - var prism = createCommonjsModule(function (module) { - /* ********************************************** - Begin prism-core.js - ********************************************** */ - - var _self = (typeof window !== 'undefined') - ? window // if in browser - : ( - (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) - ? self // if in worker - : {} // if in node js - ); - - /** - * Prism: Lightweight, robust, elegant syntax highlighting - * MIT license http://www.opensource.org/licenses/mit-license.php/ - * @author Lea Verou http://lea.verou.me - */ - - var Prism = (function(){ - - // Private helper vars - var lang = /\blang(?:uage)?-([\w-]+)\b/i; - var uniqueId = 0; - - var _ = _self.Prism = { - manual: _self.Prism && _self.Prism.manual, - disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler, - util: { - encode: function (tokens) { - if (tokens instanceof Token) { - return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); - } else if (_.util.type(tokens) === 'Array') { - return tokens.map(_.util.encode); - } else { - return tokens.replace(/&/g, '&').replace(/ text.length) { - // Something went terribly wrong, ABORT, ABORT! - return; - } - - if (str instanceof Token) { - continue; - } - - if (greedy && i != strarr.length - 1) { - pattern.lastIndex = pos; - var match = pattern.exec(text); - if (!match) { - break; - } - - var from = match.index + (lookbehind ? match[1].length : 0), - to = match.index + match[0].length, - k = i, - p = pos; - - for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) { - p += strarr[k].length; - // Move the index i to the element in strarr that is closest to from - if (from >= p) { - ++i; - pos = p; - } - } - - // If strarr[i] is a Token, then the match starts inside another Token, which is invalid - if (strarr[i] instanceof Token) { - continue; - } - - // Number of tokens to delete and replace with the new match - delNum = k - i; - str = text.slice(pos, p); - match.index -= pos; - } else { - pattern.lastIndex = 0; - - var match = pattern.exec(str), - delNum = 1; - } - - if (!match) { - if (oneshot) { - break; - } - - continue; - } - - if(lookbehind) { - lookbehindLength = match[1] ? match[1].length : 0; - } - - var from = match.index + lookbehindLength, - match = match[0].slice(lookbehindLength), - to = from + match.length, - before = str.slice(0, from), - after = str.slice(to); - - var args = [i, delNum]; - - if (before) { - ++i; - pos += before.length; - args.push(before); - } - - var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy); - - args.push(wrapped); - - if (after) { - args.push(after); - } - - Array.prototype.splice.apply(strarr, args); - - if (delNum != 1) - { _.matchGrammar(text, strarr, grammar, i, pos, true, token); } - - if (oneshot) - { break; } - } - } - } - }, - - tokenize: function(text, grammar, language) { - var strarr = [text]; - - var rest = grammar.rest; - - if (rest) { - for (var token in rest) { - grammar[token] = rest[token]; - } - - delete grammar.rest; - } - - _.matchGrammar(text, strarr, grammar, 0, 0, false); - - return strarr; - }, - - hooks: { - all: {}, - - add: function (name, callback) { - var hooks = _.hooks.all; - - hooks[name] = hooks[name] || []; - - hooks[name].push(callback); - }, - - run: function (name, env) { - var callbacks = _.hooks.all[name]; - - if (!callbacks || !callbacks.length) { - return; - } - - for (var i=0, callback; callback = callbacks[i++];) { - callback(env); - } - } - } - }; - - var Token = _.Token = function(type, content, alias, matchedStr, greedy) { - this.type = type; - this.content = content; - this.alias = alias; - // Copy of the full string this token was created from - this.length = (matchedStr || "").length|0; - this.greedy = !!greedy; - }; - - Token.stringify = function(o, language, parent) { - if (typeof o == 'string') { - return o; - } - - if (_.util.type(o) === 'Array') { - return o.map(function(element) { - return Token.stringify(element, language, o); - }).join(''); - } - - var env = { - type: o.type, - content: Token.stringify(o.content, language, parent), - tag: 'span', - classes: ['token', o.type], - attributes: {}, - language: language, - parent: parent - }; - - if (o.alias) { - var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; - Array.prototype.push.apply(env.classes, aliases); - } - - _.hooks.run('wrap', env); - - var attributes = Object.keys(env.attributes).map(function(name) { - return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"'; - }).join(' '); - - return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + ''; - - }; - - if (!_self.document) { - if (!_self.addEventListener) { - // in Node.js - return _self.Prism; - } - - if (!_.disableWorkerMessageHandler) { - // In worker - _self.addEventListener('message', function (evt) { - var message = JSON.parse(evt.data), - lang = message.language, - code = message.code, - immediateClose = message.immediateClose; - - _self.postMessage(_.highlight(code, _.languages[lang], lang)); - if (immediateClose) { - _self.close(); - } - }, false); - } - - return _self.Prism; - } - - //Get current script and highlight - var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop(); - - if (script) { - _.filename = script.src; - - if (!_.manual && !script.hasAttribute('data-manual')) { - if(document.readyState !== "loading") { - if (window.requestAnimationFrame) { - window.requestAnimationFrame(_.highlightAll); - } else { - window.setTimeout(_.highlightAll, 16); - } - } - else { - document.addEventListener('DOMContentLoaded', _.highlightAll); - } - } - } - - return _self.Prism; - - })(); - - if ('object' !== 'undefined' && module.exports) { - module.exports = Prism; - } - - // hack for components to work correctly in node.js - if (typeof commonjsGlobal !== 'undefined') { - commonjsGlobal.Prism = Prism; - } - - - /* ********************************************** - Begin prism-markup.js - ********************************************** */ - - Prism.languages.markup = { - 'comment': //, - 'prolog': /<\?[\s\S]+?\?>/, - 'doctype': //i, - 'cdata': //i, - 'tag': { - pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i, - greedy: true, - inside: { - 'tag': { - pattern: /^<\/?[^\s>\/]+/i, - inside: { - 'punctuation': /^<\/?/, - 'namespace': /^[^\s>\/:]+:/ - } - }, - 'attr-value': { - pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i, - inside: { - 'punctuation': [ - /^=/, - { - pattern: /(^|[^\\])["']/, - lookbehind: true - } - ] - } - }, - 'punctuation': /\/?>/, - 'attr-name': { - pattern: /[^\s>\/]+/, - inside: { - 'namespace': /^[^\s>\/:]+:/ - } - } - - } - }, - 'entity': /&#?[\da-z]{1,8};/i - }; - - Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = - Prism.languages.markup['entity']; - - // Plugin to make entity title show the real entity, idea by Roman Komarov - Prism.hooks.add('wrap', function(env) { - - if (env.type === 'entity') { - env.attributes['title'] = env.content.replace(/&/, '&'); - } - }); - - Prism.languages.xml = Prism.languages.markup; - Prism.languages.html = Prism.languages.markup; - Prism.languages.mathml = Prism.languages.markup; - Prism.languages.svg = Prism.languages.markup; - - - /* ********************************************** - Begin prism-css.js - ********************************************** */ - - Prism.languages.css = { - 'comment': /\/\*[\s\S]*?\*\//, - 'atrule': { - pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i, - inside: { - 'rule': /@[\w-]+/ - // See rest below - } - }, - 'url': /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i, - 'selector': /[^{}\s][^{};]*?(?=\s*\{)/, - 'string': { - pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, - greedy: true - }, - 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i, - 'important': /\B!important\b/i, - 'function': /[-a-z0-9]+(?=\()/i, - 'punctuation': /[(){};:]/ - }; - - Prism.languages.css['atrule'].inside.rest = Prism.languages.css; - - if (Prism.languages.markup) { - Prism.languages.insertBefore('markup', 'tag', { - 'style': { - pattern: /()[\s\S]*?(?=<\/style>)/i, - lookbehind: true, - inside: Prism.languages.css, - alias: 'language-css', - greedy: true - } - }); - - Prism.languages.insertBefore('inside', 'attr-value', { - 'style-attr': { - pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i, - inside: { - 'attr-name': { - pattern: /^\s*style/i, - inside: Prism.languages.markup.tag.inside - }, - 'punctuation': /^\s*=\s*['"]|['"]\s*$/, - 'attr-value': { - pattern: /.+/i, - inside: Prism.languages.css - } - }, - alias: 'language-css' - } - }, Prism.languages.markup.tag); - } - - /* ********************************************** - Begin prism-clike.js - ********************************************** */ - - Prism.languages.clike = { - 'comment': [ - { - pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, - lookbehind: true - }, - { - pattern: /(^|[^\\:])\/\/.*/, - lookbehind: true, - greedy: true - } - ], - 'string': { - pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, - greedy: true - }, - 'class-name': { - pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i, - lookbehind: true, - inside: { - punctuation: /[.\\]/ - } - }, - 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, - 'boolean': /\b(?:true|false)\b/, - 'function': /[a-z0-9_]+(?=\()/i, - 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, - 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, - 'punctuation': /[{}[\];(),.:]/ - }; - - - /* ********************************************** - Begin prism-javascript.js - ********************************************** */ - - Prism.languages.javascript = Prism.languages.extend('clike', { - 'keyword': /\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/, - 'number': /\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/, - // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) - 'function': /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i, - 'operator': /-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ - }); - - Prism.languages.insertBefore('javascript', 'keyword', { - 'regex': { - pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/, - lookbehind: true, - greedy: true - }, - // This must be declared before keyword because we use "function" inside the look-forward - 'function-variable': { - pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i, - alias: 'function' - }, - 'constant': /\b[A-Z][A-Z\d_]*\b/ - }); - - Prism.languages.insertBefore('javascript', 'string', { - 'template-string': { - pattern: /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/, - greedy: true, - inside: { - 'interpolation': { - pattern: /\${[^}]+}/, - inside: { - 'interpolation-punctuation': { - pattern: /^\${|}$/, - alias: 'punctuation' - }, - rest: null // See below - } - }, - 'string': /[\s\S]+/ - } - } - }); - Prism.languages.javascript['template-string'].inside['interpolation'].inside.rest = Prism.languages.javascript; - - if (Prism.languages.markup) { - Prism.languages.insertBefore('markup', 'tag', { - 'script': { - pattern: /()[\s\S]*?(?=<\/script>)/i, - lookbehind: true, - inside: Prism.languages.javascript, - alias: 'language-javascript', - greedy: true - } - }); - } - - Prism.languages.js = Prism.languages.javascript; - - - /* ********************************************** - Begin prism-file-highlight.js - ********************************************** */ - - (function () { - if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) { - return; - } - - self.Prism.fileHighlight = function() { - - var Extensions = { - 'js': 'javascript', - 'py': 'python', - 'rb': 'ruby', - 'ps1': 'powershell', - 'psm1': 'powershell', - 'sh': 'bash', - 'bat': 'batch', - 'h': 'c', - 'tex': 'latex' - }; - - Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { - var src = pre.getAttribute('data-src'); - - var language, parent = pre; - var lang = /\blang(?:uage)?-([\w-]+)\b/i; - while (parent && !lang.test(parent.className)) { - parent = parent.parentNode; - } - - if (parent) { - language = (pre.className.match(lang) || [, ''])[1]; - } - - if (!language) { - var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; - language = Extensions[extension] || extension; - } - - var code = document.createElement('code'); - code.className = 'language-' + language; - - pre.textContent = ''; - - code.textContent = 'Loading…'; - - pre.appendChild(code); - - var xhr = new XMLHttpRequest(); - - xhr.open('GET', src, true); - - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - - if (xhr.status < 400 && xhr.responseText) { - code.textContent = xhr.responseText; - - Prism.highlightElement(code); - } - else if (xhr.status >= 400) { - code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; - } - else { - code.textContent = '✖ Error: File does not exist or is empty'; - } - } - }; - - xhr.send(null); - }); - - if (Prism.plugins.toolbar) { - Prism.plugins.toolbar.registerButton('download-file', function (env) { - var pre = env.element.parentNode; - if (!pre || !/pre/i.test(pre.nodeName) || !pre.hasAttribute('data-src') || !pre.hasAttribute('data-download-link')) { - return; - } - var src = pre.getAttribute('data-src'); - var a = document.createElement('a'); - a.textContent = pre.getAttribute('data-download-link-label') || 'Download'; - a.setAttribute('download', ''); - a.href = src; - return a; - }); - } - - }; - - document.addEventListener('DOMContentLoaded', self.Prism.fileHighlight); - - })(); - }); - - /** - * Gen toc tree - * @link https://github.com/killercup/grock/blob/5280ae63e16c5739e9233d9009bc235ed7d79a50/styles/solarized/assets/js/behavior.coffee#L54-L81 - * @param {Array} toc - * @param {Number} maxLevel - * @return {Array} - */ - function genTree(toc, maxLevel) { - var headlines = []; - var last = {}; - - toc.forEach(function (headline) { - var level = headline.level || 1; - var len = level - 1; - - if (level > maxLevel) { - return - } - if (last[len]) { - last[len].children = (last[len].children || []).concat(headline); - } else { - headlines.push(headline); - } - last[level] = headline; - }); - - return headlines - } - - var cache$1 = {}; - var re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g; - - function lower(string) { - return string.toLowerCase() - } - - function slugify(str) { - if (typeof str !== 'string') { - return '' - } - - var slug = str - .trim() - .replace(/[A-Z]+/g, lower) - .replace(/<[^>\d]+>/g, '') - .replace(re, '') - .replace(/\s/g, '-') - .replace(/-+/g, '-') - .replace(/^(\d)/, '_$1'); - var count = cache$1[slug]; - - count = hasOwn.call(cache$1, slug) ? count + 1 : 0; - cache$1[slug] = count; - - if (count) { - slug = slug + '-' + count; - } - - return slug - } - - slugify.clear = function () { - cache$1 = {}; - }; - - function replace(m, $1) { - return '' + $1 + '' - } - - function emojify(text) { - return text - .replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, function (m) { return m.replace(/:/g, '__colon__'); }) - .replace(/:(\w+?):/ig, (inBrowser && window.emojify) || replace) - .replace(/__colon__/g, ':') - } - - var decode = decodeURIComponent; - var encode = encodeURIComponent; - - function parseQuery(query) { - var res = {}; - - query = query.trim().replace(/^(\?|#|&)/, ''); - - if (!query) { - return res - } - - // Simple parse - query.split('&').forEach(function (param) { - var parts = param.replace(/\+/g, ' ').split('='); - - res[parts[0]] = parts[1] && decode(parts[1]); - }); - - return res - } - - function stringifyQuery(obj, ignores) { - if ( ignores === void 0 ) ignores = []; - - var qs = []; - - for (var key in obj) { - if (ignores.indexOf(key) > -1) { - continue - } - qs.push( - obj[key] ? - ((encode(key)) + "=" + (encode(obj[key]))).toLowerCase() : - encode(key) - ); - } - - return qs.length ? ("?" + (qs.join('&'))) : '' - } - - var isAbsolutePath = cached(function (path) { - return /(:|(\/{2}))/g.test(path) - }); - - var getParentPath = cached(function (path) { - return /\/$/g.test(path) ? - path : - (path = path.match(/(\S*\/)[^/]+$/)) ? path[1] : '' - }); - - var cleanPath = cached(function (path) { - return path.replace(/^\/+/, '/').replace(/([^:])\/{2,}/g, '$1/') - }); - - var resolvePath = cached(function (path) { - var segments = path.replace(/^\//, '').split('/'); - var resolved = []; - for (var i = 0, len = segments.length; i < len; i++) { - var segment = segments[i]; - if (segment === '..') { - resolved.pop(); - } else if (segment !== '.') { - resolved.push(segment); - } - } - return '/' + resolved.join('/') - }); - - function getPath() { - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - - return cleanPath(args.join('/')) - } - - var replaceSlug = cached(function (path) { - return path.replace('#', '?id=') - }); - - Prism.languages['markup-templating'] = {}; - - Object.defineProperties(Prism.languages['markup-templating'], { - buildPlaceholders: { - // Tokenize all inline templating expressions matching placeholderPattern - // If the replaceFilter function is provided, it will be called with every match. - // If it returns false, the match will not be replaced. - value: function (env, language, placeholderPattern, replaceFilter) { - if (env.language !== language) { - return; - } - - env.tokenStack = []; - - env.code = env.code.replace(placeholderPattern, function(match) { - if (typeof replaceFilter === 'function' && !replaceFilter(match)) { - return match; - } - var i = env.tokenStack.length; - // Check for existing strings - while (env.code.indexOf('___' + language.toUpperCase() + i + '___') !== -1) - { ++i; } - - // Create a sparse array - env.tokenStack[i] = match; - - return '___' + language.toUpperCase() + i + '___'; - }); - - // Switch the grammar to markup - env.grammar = Prism.languages.markup; - } - }, - tokenizePlaceholders: { - // Replace placeholders with proper tokens after tokenizing - value: function (env, language) { - if (env.language !== language || !env.tokenStack) { - return; - } - - // Switch the grammar back - env.grammar = Prism.languages[language]; - - var j = 0; - var keys = Object.keys(env.tokenStack); - var walkTokens = function (tokens) { - if (j >= keys.length) { - return; - } - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (typeof token === 'string' || (token.content && typeof token.content === 'string')) { - var k = keys[j]; - var t = env.tokenStack[k]; - var s = typeof token === 'string' ? token : token.content; - - var index = s.indexOf('___' + language.toUpperCase() + k + '___'); - if (index > -1) { - ++j; - var before = s.substring(0, index); - var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar, language), 'language-' + language, t); - var after = s.substring(index + ('___' + language.toUpperCase() + k + '___').length); - var replacement; - if (before || after) { - replacement = [before, middle, after].filter(function (v) { return !!v; }); - walkTokens(replacement); - } else { - replacement = middle; - } - if (typeof token === 'string') { - Array.prototype.splice.apply(tokens, [i, 1].concat(replacement)); - } else { - token.content = replacement; - } - - if (j >= keys.length) { - break; - } - } - } else if (token.content && typeof token.content !== 'string') { - walkTokens(token.content); - } - } - }; - - walkTokens(env.tokens); - } - } - }); - - // See https://github.com/PrismJS/prism/pull/1367 - var cachedLinks = {}; - - function getAndRemoveConfig(str) { - if ( str === void 0 ) str = ''; - - var config = {}; - - if (str) { - str = str - .replace(/^'/, '') - .replace(/'$/, '') - .replace(/(?:^|\s):([\w-]+)=?([\w-]+)?/g, function (m, key, value) { - config[key] = (value && value.replace(/"/g, '')) || true; - return '' - }) - .trim(); - } - - return {str: str, config: config} - } - - var compileMedia = { - markdown: function markdown(url) { - return { - url: url - } - }, - mermaid: function mermaid(url) { - return { - url: url - } - }, - iframe: function iframe(url, title) { - return { - html: ("") - } - }, - video: function video(url, title) { - return { - html: ("") - } - }, - audio: function audio(url, title) { - return { - html: ("") - } - }, - code: function code(url, title) { - var lang = url.match(/\.(\w+)$/); - - lang = title || (lang && lang[1]); - if (lang === 'md') { - lang = 'markdown'; - } - - return { - url: url, - lang: lang - } - } - }; - - var Compiler = function Compiler(config, router) { - var this$1 = this; - - this.config = config; - this.router = router; - this.cacheTree = {}; - this.toc = []; - this.cacheTOC = {}; - this.linkTarget = config.externalLinkTarget || '_blank'; - this.contentBase = router.getBasePath(); - - var renderer = this._initRenderer(); - var compile; - var mdConf = config.markdown || {}; - - if (isFn(mdConf)) { - compile = mdConf(marked, renderer); - } else { - marked.setOptions( - merge(mdConf, { - renderer: merge(renderer, mdConf.renderer) - }) - ); - compile = marked; - } - - this._marked = compile; - this.compile = function (text) { - var isCached = true; - var result = cached(function (_) { - isCached = false; - var html = ''; - - if (!text) { - return text - } - - if (isPrimitive(text)) { - html = compile(text); - } else { - html = compile.parser(text); - } - - html = config.noEmoji ? html : emojify(html); - slugify.clear(); - - return html - })(text); - - var curFileName = this$1.router.parse().file; - - if (isCached) { - this$1.toc = this$1.cacheTOC[curFileName]; - } else { - this$1.cacheTOC[curFileName] = [].concat( this$1.toc ); - } - - return result - }; - }; - - Compiler.prototype.compileEmbed = function compileEmbed (href, title) { - var ref = getAndRemoveConfig(title); - var str = ref.str; - var config = ref.config; - var embed; - title = str; - - if (config.include) { - if (!isAbsolutePath(href)) { - href = getPath( - this.contentBase, - getParentPath(this.router.getCurrentPath()), - href - ); - } - - var media; - if (config.type && (media = compileMedia[config.type])) { - embed = media.call(this, href, title); - embed.type = config.type; - } else { - var type = 'code'; - if (/\.(md|markdown)/.test(href)) { - type = 'markdown'; - } else if (/\.mmd/.test(href)) { - type = 'mermaid'; - } else if (/\.html?/.test(href)) { - type = 'iframe'; - } else if (/\.(mp4|ogg)/.test(href)) { - type = 'video'; - } else if (/\.mp3/.test(href)) { - type = 'audio'; - } - embed = compileMedia[type].call(this, href, title); - embed.type = type; - } - embed.fragment = config.fragment; - - return embed - } - }; - - Compiler.prototype._matchNotCompileLink = function _matchNotCompileLink (link) { - var links = this.config.noCompileLinks || []; - - for (var i = 0; i < links.length; i++) { - var n = links[i]; - var re = cachedLinks[n] || (cachedLinks[n] = new RegExp(("^" + n + "$"))); - - if (re.test(link)) { - return link - } - } - }; - - Compiler.prototype._initRenderer = function _initRenderer () { - var renderer = new marked.Renderer(); - var ref = this; - var linkTarget = ref.linkTarget; - var router = ref.router; - var contentBase = ref.contentBase; - var _self = this; - var origin = {}; - - /** - * Render anchor tag - * @link https://github.com/markedjs/marked#overriding-renderer-methods - */ - origin.heading = renderer.heading = function (text, level) { - var ref = getAndRemoveConfig(text); - var str = ref.str; - var config = ref.config; - var nextToc = {level: level, title: str}; - - if (/{docsify-ignore}/g.test(str)) { - str = str.replace('{docsify-ignore}', ''); - nextToc.title = str; - nextToc.ignoreSubHeading = true; - } - - if (/{docsify-ignore-all}/g.test(str)) { - str = str.replace('{docsify-ignore-all}', ''); - nextToc.title = str; - nextToc.ignoreAllSubs = true; - } - - var slug = slugify(config.id || str); - var url = router.toURL(router.getCurrentPath(), {id: slug}); - nextToc.slug = url; - _self.toc.push(nextToc); - - return ("
    " + str + "") - }; - // Highlight code - origin.code = renderer.code = function (code, lang) { - if ( lang === void 0 ) lang = ''; - - code = code.replace(/@DOCSIFY_QM@/g, '`'); - var hl = prism.highlight( - code, - prism.languages[lang] || prism.languages.markup - ); - - return ("
    " + hl + "
    ") - }; - origin.link = renderer.link = function (href, title, text) { - if ( title === void 0 ) title = ''; - - var attrs = ''; - - var ref = getAndRemoveConfig(title); - var str = ref.str; - var config = ref.config; - title = str; - - if ( - !isAbsolutePath(href) && - !_self._matchNotCompileLink(href) && - !config.ignore - ) { - if (href === _self.config.homepage) { - href = 'README'; - } - href = router.toURL(href, null, router.getCurrentPath()); - } else { - attrs += href.indexOf('mailto:') === 0 ? '' : (" target=\"" + linkTarget + "\""); - } - - if (config.target) { - attrs += ' target=' + config.target; - } - - if (config.disabled) { - attrs += ' disabled'; - href = 'javascript:void(0)'; - } - - if (title) { - attrs += " title=\"" + title + "\""; - } - - return ("" + text + "") - }; - origin.paragraph = renderer.paragraph = function (text) { - var result; - if (/^!>/.test(text)) { - result = helper('tip', text); - } else if (/^\?>/.test(text)) { - result = helper('warn', text); - } else { - result = "

    " + text + "

    "; - } - return result - }; - origin.image = renderer.image = function (href, title, text) { - var url = href; - var attrs = ''; - - var ref = getAndRemoveConfig(title); - var str = ref.str; - var config = ref.config; - title = str; - - if (config['no-zoom']) { - attrs += ' data-no-zoom'; - } - - if (title) { - attrs += " title=\"" + title + "\""; - } - - var size = config.size; - if (size) { - var sizes = size.split('x'); - if (sizes[1]) { - attrs += 'width=' + sizes[0] + ' height=' + sizes[1]; - } else { - attrs += 'width=' + sizes[0]; - } - } - - if (!isAbsolutePath(href)) { - url = getPath(contentBase, getParentPath(router.getCurrentPath()), href); - } - - return ("\""") - }; - origin.list = renderer.list = function (body, ordered, start) { - var isTaskList = /
  • /.test(body.split('class="task-list"')[0]); - var isStartReq = start && start > 1; - var tag = ordered ? 'ol' : 'ul'; - var tagAttrs = [ - (isTaskList ? 'class="task-list"' : ''), - (isStartReq ? ("start=\"" + start + "\"") : '') - ].join(' ').trim(); - - return ("<" + tag + " " + tagAttrs + ">" + body + "") - }; - origin.listitem = renderer.listitem = function (text) { - var isTaskItem = /^(]*>)/.test(text); - var html = isTaskItem ? ("
  • ") : ("
  • " + text + "
  • "); - - return html - }; - - renderer.origin = origin; - - return renderer - }; - - /** - * Compile sidebar - */ - Compiler.prototype.sidebar = function sidebar (text, level) { - var ref = this; - var toc = ref.toc; - var currentPath = this.router.getCurrentPath(); - var html = ''; - - if (text) { - html = this.compile(text); - } else { - for (var i = 0; i < toc.length; i++) { - if (toc[i].ignoreSubHeading) { - var deletedHeaderLevel = toc[i].level; - toc.splice(i, 1); - // Remove headers who are under current header - for (var j = i; deletedHeaderLevel < toc[j].level && j < toc.length; j++) { - toc.splice(j, 1) && j-- && i++; - } - i--; - } - } - var tree$$1 = this.cacheTree[currentPath] || genTree(toc, level); - html = tree(tree$$1, '
      {inner}
    '); - this.cacheTree[currentPath] = tree$$1; - } - - return html - }; - - /** - * Compile sub sidebar - */ - Compiler.prototype.subSidebar = function subSidebar (level) { - if (!level) { - this.toc = []; - return - } - var currentPath = this.router.getCurrentPath(); - var ref = this; - var cacheTree = ref.cacheTree; - var toc = ref.toc; - - toc[0] && toc[0].ignoreAllSubs && toc.splice(0); - toc[0] && toc[0].level === 1 && toc.shift(); - - for (var i = 0; i < toc.length; i++) { - toc[i].ignoreSubHeading && toc.splice(i, 1) && i--; - } - var tree$$1 = cacheTree[currentPath] || genTree(toc, level); - - cacheTree[currentPath] = tree$$1; - this.toc = []; - return tree(tree$$1) - }; - - Compiler.prototype.article = function article (text) { - return this.compile(text) - }; - - /** - * Compile cover page - */ - Compiler.prototype.cover = function cover$$1 (text) { - var cacheToc = this.toc.slice(); - var html = this.compile(text); - - this.toc = cacheToc.slice(); - - return html - }; - - var title = $.title; - /** - * Toggle button - */ - function btn(el) { - var toggle = function (_) { return body.classList.toggle('close'); }; - - el = getNode(el); - if (el == null) { - return - } - on(el, 'click', function (e) { - e.stopPropagation(); - toggle(); - }); - - isMobile && - on( - body, - 'click', - function (_) { return body.classList.contains('close') && toggle(); } - ); - } - - function collapse(el) { - el = getNode(el); - if (el == null) { - return - } - on(el, 'click', function (ref) { - var target = ref.target; - - if ( - target.nodeName === 'A' && - target.nextSibling && - target.nextSibling.classList.contains('app-sub-sidebar') - ) { - toggleClass(target.parentNode, 'collapse'); - } - }); - } - - function sticky() { - var cover = getNode('section.cover'); - if (!cover) { - return - } - var coverHeight = cover.getBoundingClientRect().height; - - if (window.pageYOffset >= coverHeight || cover.classList.contains('hidden')) { - toggleClass(body, 'add', 'sticky'); - } else { - toggleClass(body, 'remove', 'sticky'); - } - } - - /** - * Get and active link - * @param {object} router - * @param {string|element} el - * @param {Boolean} isParent acitve parent - * @param {Boolean} autoTitle auto set title - * @return {element} - */ - function getAndActive(router, el, isParent, autoTitle) { - el = getNode(el); - var links = []; - if (el != null) { - links = findAll(el, 'a'); - } - var hash = decodeURI(router.toURL(router.getCurrentPath())); - var target; - - links.sort(function (a, b) { return b.href.length - a.href.length; }).forEach(function (a) { - var href = a.getAttribute('href'); - var node = isParent ? a.parentNode : a; - - if (hash.indexOf(href) === 0 && !target) { - target = a; - toggleClass(node, 'add', 'active'); - } else { - toggleClass(node, 'remove', 'active'); - } - }); - - if (autoTitle) { - $.title = target ? (target.title || ((target.innerText) + " - " + title)) : title; - } - - return target - } - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Tweezer = function () { - function Tweezer() { - var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - _classCallCheck(this, Tweezer); - - this.duration = opts.duration || 1000; - this.ease = opts.easing || this._defaultEase; - this.start = opts.start; - this.end = opts.end; - - this.frame = null; - this.next = null; - this.isRunning = false; - this.events = {}; - this.direction = this.start < this.end ? 'up' : 'down'; - } - - _createClass(Tweezer, [{ - key: 'begin', - value: function begin() { - if (!this.isRunning && this.next !== this.end) { - this.frame = window.requestAnimationFrame(this._tick.bind(this)); - } - return this; - } - }, { - key: 'stop', - value: function stop() { - window.cancelAnimationFrame(this.frame); - this.isRunning = false; - this.frame = null; - this.timeStart = null; - this.next = null; - return this; - } - }, { - key: 'on', - value: function on(name, handler) { - this.events[name] = this.events[name] || []; - this.events[name].push(handler); - return this; - } - }, { - key: 'emit', - value: function emit(name, val) { - var _this = this; - - var e = this.events[name]; - e && e.forEach(function (handler) { - return handler.call(_this, val); - }); - } - }, { - key: '_tick', - value: function _tick(currentTime) { - this.isRunning = true; - - var lastTick = this.next || this.start; - - if (!this.timeStart) { this.timeStart = currentTime; } - this.timeElapsed = currentTime - this.timeStart; - this.next = Math.round(this.ease(this.timeElapsed, this.start, this.end - this.start, this.duration)); - - if (this._shouldTick(lastTick)) { - this.emit('tick', this.next); - this.frame = window.requestAnimationFrame(this._tick.bind(this)); - } else { - this.emit('tick', this.end); - this.emit('done', null); - } - } - }, { - key: '_shouldTick', - value: function _shouldTick(lastTick) { - return { - up: this.next < this.end && lastTick <= this.next, - down: this.next > this.end && lastTick >= this.next - }[this.direction]; - } - }, { - key: '_defaultEase', - value: function _defaultEase(t, b, c, d) { - if ((t /= d / 2) < 1) { return c / 2 * t * t + b; } - return -c / 2 * (--t * (t - 2) - 1) + b; - } - }]); - - return Tweezer; - }(); - - var nav = {}; - var hoverOver = false; - var scroller = null; - var enableScrollEvent = true; - var coverHeight = 0; - - function scrollTo(el) { - if (scroller) { - scroller.stop(); - } - enableScrollEvent = false; - scroller = new Tweezer({ - start: window.pageYOffset, - end: el.getBoundingClientRect().top + window.pageYOffset, - duration: 500 - }) - .on('tick', function (v) { return window.scrollTo(0, v); }) - .on('done', function () { - enableScrollEvent = true; - scroller = null; - }) - .begin(); - } - - function highlight(path) { - if (!enableScrollEvent) { - return - } - var sidebar = getNode('.sidebar'); - var anchors = findAll('.anchor'); - var wrap = find(sidebar, '.sidebar-nav'); - var active = find(sidebar, 'li.active'); - var doc = document.documentElement; - var top = ((doc && doc.scrollTop) || document.body.scrollTop) - coverHeight; - var last; - - for (var i = 0, len = anchors.length; i < len; i += 1) { - var node = anchors[i]; - - if (node.offsetTop > top) { - if (!last) { - last = node; - } - break - } else { - last = node; - } - } - if (!last) { - return - } - var li = nav[getNavKey(decodeURIComponent(path), last.getAttribute('data-id'))]; - - if (!li || li === active) { - return - } - - active && active.classList.remove('active'); - li.classList.add('active'); - active = li; - - // Scroll into view - // https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297 - if (!hoverOver && body.classList.contains('sticky')) { - var height = sidebar.clientHeight; - var curOffset = 0; - var cur = active.offsetTop + active.clientHeight + 40; - var isInView = - active.offsetTop >= wrap.scrollTop && cur <= wrap.scrollTop + height; - var notThan = cur - curOffset < height; - var top$1 = isInView ? wrap.scrollTop : notThan ? curOffset : cur - height; - - sidebar.scrollTop = top$1; - } - } - - function getNavKey(path, id) { - return (path + "?id=" + id) - } - - function scrollActiveSidebar(router) { - var cover = find('.cover.show'); - coverHeight = cover ? cover.offsetHeight : 0; - - var sidebar = getNode('.sidebar'); - var lis = []; - if (sidebar != null) { - lis = findAll(sidebar, 'li'); - } - - for (var i = 0, len = lis.length; i < len; i += 1) { - var li = lis[i]; - var a = li.querySelector('a'); - if (!a) { - continue - } - var href = a.getAttribute('href'); - - if (href !== '/') { - var ref = router.parse(href); - var id = ref.query.id; - var path$1 = ref.path; - if (id) { - href = getNavKey(path$1, id); - } - } - - if (href) { - nav[decodeURIComponent(href)] = li; - } - } - - if (isMobile) { - return - } - var path = router.getCurrentPath(); - off('scroll', function () { return highlight(path); }); - on('scroll', function () { return highlight(path); }); - on(sidebar, 'mouseover', function () { - hoverOver = true; - }); - on(sidebar, 'mouseleave', function () { - hoverOver = false; - }); - } - - function scrollIntoView(path, id) { - if (!id) { - return - } - - var section = find('#' + id); - section && scrollTo(section); - - var li = nav[getNavKey(path, id)]; - var sidebar = getNode('.sidebar'); - var active = find(sidebar, 'li.active'); - active && active.classList.remove('active'); - li && li.classList.add('active'); - } - - var scrollEl = $.scrollingElement || $.documentElement; - - function scroll2Top(offset) { - if ( offset === void 0 ) offset = 0; - - scrollEl.scrollTop = offset === true ? 0 : Number(offset); - } - - var cached$1 = {}; - - function walkFetchEmbed(ref, cb) { - var embedTokens = ref.embedTokens; - var compile = ref.compile; - var fetch = ref.fetch; - - var token; - var step = 0; - var count = 1; - - if (!embedTokens.length) { - return cb({}) - } - - while ((token = embedTokens[step++])) { - var next = (function (token) { - return function (text) { - var embedToken; - if (text) { - if (token.embed.type === 'markdown') { - embedToken = compile.lexer(text); - } else if (token.embed.type === 'code') { - if (token.embed.fragment) { - var fragment = token.embed.fragment; - var pattern = new RegExp(("(?:###|\\/\\/\\/)\\s*\\[" + fragment + "\\]([\\s\\S]*)(?:###|\\/\\/\\/)\\s*\\[" + fragment + "\\]")); - text = ((text.match(pattern) || [])[1] || '').trim(); - } - embedToken = compile.lexer( - '```' + - token.embed.lang + - '\n' + - text.replace(/`/g, '@DOCSIFY_QM@') + - '\n```\n' - ); - } else if (token.embed.type === 'mermaid') { - embedToken = [ - {type: 'html', text: ("
    \n" + text + "\n
    ")} - ]; - embedToken.links = {}; - } else { - embedToken = [{type: 'html', text: text}]; - embedToken.links = {}; - } - } - cb({token: token, embedToken: embedToken}); - if (++count >= step) { - cb({}); - } - } - })(token); - - if (token.embed.url) { - { - get(token.embed.url).then(next); - } - } else { - next(token.embed.html); - } - } - } - - function prerenderEmbed(ref, done) { - var compiler = ref.compiler; - var raw = ref.raw; if ( raw === void 0 ) raw = ''; - var fetch = ref.fetch; - - var hit = cached$1[raw]; - if (hit) { - var copy = hit.slice(); - copy.links = hit.links; - return done(copy) - } - - var compile = compiler._marked; - var tokens = compile.lexer(raw); - var embedTokens = []; - var linkRE = compile.InlineLexer.rules.link; - var links = tokens.links; - - tokens.forEach(function (token, index) { - if (token.type === 'paragraph') { - token.text = token.text.replace( - new RegExp(linkRE.source, 'g'), - function (src, filename, href, title) { - var embed = compiler.compileEmbed(href, title); - - if (embed) { - embedTokens.push({ - index: index, - embed: embed - }); - } - - return src - } - ); - } - }); - - var moveIndex = 0; - walkFetchEmbed({compile: compile, embedTokens: embedTokens, fetch: fetch}, function (ref) { - var embedToken = ref.embedToken; - var token = ref.token; - - if (token) { - var index = token.index + moveIndex; - - merge(links, embedToken.links); - - tokens = tokens - .slice(0, index) - .concat(embedToken, tokens.slice(index + 1)); - moveIndex += embedToken.length - 1; - } else { - cached$1[raw] = tokens.concat(); - tokens.links = cached$1[raw].links = links; - done(tokens); - } - }); - } - - function executeScript() { - var script = findAll('.markdown-section>script') - .filter(function (s) { return !/template/.test(s.type); })[0]; - if (!script) { - return false - } - var code = script.innerText.trim(); - if (!code) { - return false - } - - setTimeout(function (_) { - window.__EXECUTE_RESULT__ = new Function(code)(); - }, 0); - } - - function formatUpdated(html, updated, fn) { - updated = - typeof fn === 'function' ? - fn(updated) : - typeof fn === 'string' ? - tinydate(fn)(new Date(updated)) : - updated; - - return html.replace(/{docsify-updated}/g, updated) - } - - function renderMain(html) { - if (!html) { - html = '

    404 - Not found

    '; - } - - this._renderTo('.markdown-section', html); - // Render sidebar with the TOC - !this.config.loadSidebar && this._renderSidebar(); - - // Execute script - if ( - this.config.executeScript !== false && - typeof window.Vue !== 'undefined' && - !executeScript() - ) { - setTimeout(function (_) { - var vueVM = window.__EXECUTE_RESULT__; - vueVM && vueVM.$destroy && vueVM.$destroy(); - window.__EXECUTE_RESULT__ = new window.Vue().$mount('#main'); - }, 0); - } else { - this.config.executeScript && executeScript(); - } - } - - function renderNameLink(vm) { - var el = getNode('.app-name-link'); - var nameLink = vm.config.nameLink; - var path = vm.route.path; - - if (!el) { - return - } - - if (isPrimitive(vm.config.nameLink)) { - el.setAttribute('href', nameLink); - } else if (typeof nameLink === 'object') { - var match = Object.keys(nameLink).filter(function (key) { return path.indexOf(key) > -1; })[0]; - - el.setAttribute('href', nameLink[match]); - } - } - - function renderMixin(proto) { - proto._renderTo = function (el, content, replace) { - var node = getNode(el); - if (node) { - node[replace ? 'outerHTML' : 'innerHTML'] = content; - } - }; - - proto._renderSidebar = function (text) { - var ref = this.config; - var maxLevel = ref.maxLevel; - var subMaxLevel = ref.subMaxLevel; - var loadSidebar = ref.loadSidebar; - - this._renderTo('.sidebar-nav', this.compiler.sidebar(text, maxLevel)); - var activeEl = getAndActive(this.router, '.sidebar-nav', true, true); - if (loadSidebar && activeEl) { - activeEl.parentNode.innerHTML += - this.compiler.subSidebar(subMaxLevel) || ''; - } else { - // Reset toc - this.compiler.subSidebar(); - } - // Bind event - this._bindEventOnRendered(activeEl); - }; - - proto._bindEventOnRendered = function (activeEl) { - var ref = this.config; - var autoHeader = ref.autoHeader; - var auto2top = ref.auto2top; - - scrollActiveSidebar(this.router); - - if (autoHeader && activeEl) { - var main$$1 = getNode('#main'); - var firstNode = main$$1.children[0]; - if (firstNode && firstNode.tagName !== 'H1') { - var h1 = create('h1'); - h1.innerText = activeEl.innerText; - before(main$$1, h1); - } - } - - auto2top && scroll2Top(auto2top); - }; - - proto._renderNav = function (text) { - text && this._renderTo('nav', this.compiler.compile(text)); - if (this.config.loadNavbar) { - getAndActive(this.router, 'nav'); - } - }; - - proto._renderMain = function (text, opt, next) { - var this$1 = this; - if ( opt === void 0 ) opt = {}; - - if (!text) { - return renderMain.call(this, text) - } - - callHook(this, 'beforeEach', text, function (result) { - var html; - var callback = function () { - if (opt.updatedAt) { - html = formatUpdated(html, opt.updatedAt, this$1.config.formatUpdated); - } - - callHook(this$1, 'afterEach', html, function (text) { return renderMain.call(this$1, text); }); - }; - if (this$1.isHTML) { - html = this$1.result = text; - callback(); - next(); - } else { - prerenderEmbed( - { - compiler: this$1.compiler, - raw: result - }, - function (tokens) { - html = this$1.compiler.compile(tokens); - callback(); - next(); - } - ); - } - }); - }; - - proto._renderCover = function (text, coverOnly) { - var el = getNode('.cover'); - - toggleClass(getNode('main'), coverOnly ? 'add' : 'remove', 'hidden'); - if (!text) { - toggleClass(el, 'remove', 'show'); - return - } - toggleClass(el, 'add', 'show'); - - var html = this.coverIsHTML ? text : this.compiler.cover(text); - - var m = html - .trim() - .match('

    ([^<]*?)

    $'); - - if (m) { - if (m[2] === 'color') { - el.style.background = m[1] + (m[3] || ''); - } else { - var path = m[1]; - - toggleClass(el, 'add', 'has-mask'); - if (!isAbsolutePath(m[1])) { - path = getPath(this.router.getBasePath(), m[1]); - } - el.style.backgroundImage = "url(" + path + ")"; - el.style.backgroundSize = 'cover'; - el.style.backgroundPosition = 'center center'; - } - html = html.replace(m[0], ''); - } - - this._renderTo('.cover-main', html); - sticky(); - }; - - proto._updateRender = function () { - // Render name link - renderNameLink(this); - }; - } - - function initRender(vm) { - var config = vm.config; - - // Init markdown compiler - vm.compiler = new Compiler(config, vm.router); - if (inBrowser) { - window.__current_docsify_compiler__ = vm.compiler; - } - - var id = config.el || '#app'; - var navEl = find('nav') || create('nav'); - - var el = find(id); - var html = ''; - var navAppendToTarget = body; - - if (el) { - if (config.repo) { - html += corner(config.repo); - } - if (config.coverpage) { - html += cover(); - } - - if (config.logo) { - var isBase64 = /^data:image/.test(config.logo); - var isExternal = /(?:http[s]?:)?\/\//.test(config.logo); - var isRelative = /^\./.test(config.logo); - - if (!isBase64 && !isExternal && !isRelative) { - config.logo = getPath(vm.router.getBasePath(), config.logo); - } - } - - html += main(config); - // Render main app - vm._renderTo(el, html, true); - } else { - vm.rendered = true; - } - - if (config.mergeNavbar && isMobile) { - navAppendToTarget = find('.sidebar'); - } else { - navEl.classList.add('app-nav'); - - if (!config.repo) { - navEl.classList.add('no-badge'); - } - } - - // Add nav - if (config.loadNavbar) { - before(navAppendToTarget, navEl); - } - - if (config.themeColor) { - $.head.appendChild( - create('div', theme(config.themeColor)).firstElementChild - ); - // Polyfll - cssVars(config.themeColor); - } - vm._updateRender(); - toggleClass(body, 'ready'); - } - - var cached$2 = {}; - - function getAlias(path, alias, last) { - var match = Object.keys(alias).filter(function (key) { - var re = cached$2[key] || (cached$2[key] = new RegExp(("^" + key + "$"))); - return re.test(path) && path !== last - })[0]; - - return match ? - getAlias(path.replace(cached$2[match], alias[match]), alias, path) : - path - } - - function getFileName(path, ext) { - return new RegExp(("\\.(" + (ext.replace(/^\./, '')) + "|html)$"), 'g').test(path) ? - path : - /\/$/g.test(path) ? (path + "README" + ext) : ("" + path + ext) - } - - var History = function History(config) { - this.config = config; - }; - - History.prototype.getBasePath = function getBasePath () { - return this.config.basePath - }; - - History.prototype.getFile = function getFile (path, isRelative) { - if ( path === void 0 ) path = this.getCurrentPath(); - - var ref = this; - var config = ref.config; - var base = this.getBasePath(); - var ext = typeof config.ext === 'string' ? config.ext : '.md'; - - path = config.alias ? getAlias(path, config.alias) : path; - path = getFileName(path, ext); - path = path === ("/README" + ext) ? config.homepage || path : path; - path = isAbsolutePath(path) ? path : getPath(base, path); - - if (isRelative) { - path = path.replace(new RegExp(("^" + base)), ''); - } - - return path - }; - - History.prototype.onchange = function onchange (cb) { - if ( cb === void 0 ) cb = noop; - - cb(); - }; - - History.prototype.getCurrentPath = function getCurrentPath () {}; - - History.prototype.normalize = function normalize () {}; - - History.prototype.parse = function parse () {}; - - History.prototype.toURL = function toURL (path, params, currentRoute) { - var local = currentRoute && path[0] === '#'; - var route = this.parse(replaceSlug(path)); - - route.query = merge({}, route.query, params); - path = route.path + stringifyQuery(route.query); - path = path.replace(/\.md(\?)|\.md$/, '$1'); - - if (local) { - var idIndex = currentRoute.indexOf('?'); - path = - (idIndex > 0 ? currentRoute.substring(0, idIndex) : currentRoute) + path; - } - - if (this.config.relativePath && path.indexOf('/') !== 0) { - var currentDir = currentRoute.substring(0, currentRoute.lastIndexOf('/') + 1); - return cleanPath(resolvePath(currentDir + path)) - } - return cleanPath('/' + path) - }; - - function replaceHash(path) { - var i = location.href.indexOf('#'); - location.replace(location.href.slice(0, i >= 0 ? i : 0) + '#' + path); - } - - var HashHistory = (function (History$$1) { - function HashHistory(config) { - History$$1.call(this, config); - this.mode = 'hash'; - } - - if ( History$$1 ) HashHistory.__proto__ = History$$1; - HashHistory.prototype = Object.create( History$$1 && History$$1.prototype ); - HashHistory.prototype.constructor = HashHistory; - - HashHistory.prototype.getBasePath = function getBasePath () { - var path = window.location.pathname || ''; - var base = this.config.basePath; - - return /^(\/|https?:)/g.test(base) ? base : cleanPath(path + '/' + base) - }; - - HashHistory.prototype.getCurrentPath = function getCurrentPath () { - // We can't use location.hash here because it's not - // consistent across browsers - Firefox will pre-decode it! - var href = location.href; - var index = href.indexOf('#'); - return index === -1 ? '' : href.slice(index + 1) - }; - - HashHistory.prototype.onchange = function onchange (cb) { - if ( cb === void 0 ) cb = noop; - - on('hashchange', cb); - }; - - HashHistory.prototype.normalize = function normalize () { - var path = this.getCurrentPath(); - - path = replaceSlug(path); - - if (path.charAt(0) === '/') { - return replaceHash(path) - } - replaceHash('/' + path); - }; - - /** - * Parse the url - * @param {string} [path=location.herf] - * @return {object} { path, query } - */ - HashHistory.prototype.parse = function parse (path) { - if ( path === void 0 ) path = location.href; - - var query = ''; - - var hashIndex = path.indexOf('#'); - if (hashIndex >= 0) { - path = path.slice(hashIndex + 1); - } - - var queryIndex = path.indexOf('?'); - if (queryIndex >= 0) { - query = path.slice(queryIndex + 1); - path = path.slice(0, queryIndex); - } - - return { - path: path, - file: this.getFile(path, true), - query: parseQuery(query) - } - }; - - HashHistory.prototype.toURL = function toURL (path, params, currentRoute) { - return '#' + History$$1.prototype.toURL.call(this, path, params, currentRoute) - }; - - return HashHistory; - }(History)); - - var HTML5History = (function (History$$1) { - function HTML5History(config) { - History$$1.call(this, config); - this.mode = 'history'; - } - - if ( History$$1 ) HTML5History.__proto__ = History$$1; - HTML5History.prototype = Object.create( History$$1 && History$$1.prototype ); - HTML5History.prototype.constructor = HTML5History; - - HTML5History.prototype.getCurrentPath = function getCurrentPath () { - var base = this.getBasePath(); - var path = window.location.pathname; - - if (base && path.indexOf(base) === 0) { - path = path.slice(base.length); - } - - return (path || '/') + window.location.search + window.location.hash - }; - - HTML5History.prototype.onchange = function onchange (cb) { - if ( cb === void 0 ) cb = noop; - - on('click', function (e) { - var el = e.target.tagName === 'A' ? e.target : e.target.parentNode; - - if (el.tagName === 'A' && !/_blank/.test(el.target)) { - e.preventDefault(); - var url = el.href; - window.history.pushState({key: url}, '', url); - cb(); - } - }); - - on('popstate', cb); - }; - - /** - * Parse the url - * @param {string} [path=location.href] - * @return {object} { path, query } - */ - HTML5History.prototype.parse = function parse (path) { - if ( path === void 0 ) path = location.href; - - var query = ''; - - var queryIndex = path.indexOf('?'); - if (queryIndex >= 0) { - query = path.slice(queryIndex + 1); - path = path.slice(0, queryIndex); - } - - var base = getPath(location.origin); - var baseIndex = path.indexOf(base); - - if (baseIndex > -1) { - path = path.slice(baseIndex + base.length); - } - - return { - path: path, - file: this.getFile(path), - query: parseQuery(query) - } - }; - - return HTML5History; - }(History)); - - function routerMixin(proto) { - proto.route = {}; - } - - var lastRoute = {}; - - function updateRender(vm) { - vm.router.normalize(); - vm.route = vm.router.parse(); - body.setAttribute('data-page', vm.route.file); - } - - function initRouter(vm) { - var config = vm.config; - var mode = config.routerMode || 'hash'; - var router; - - if (mode === 'history' && supportsPushState) { - router = new HTML5History(config); - } else { - router = new HashHistory(config); - } - - vm.router = router; - updateRender(vm); - lastRoute = vm.route; - - router.onchange(function (_) { - updateRender(vm); - vm._updateRender(); - - if (lastRoute.path === vm.route.path) { - vm.$resetEvents(); - return - } - - vm.$fetch(); - lastRoute = vm.route; - }); - } - - function eventMixin(proto) { - proto.$resetEvents = function () { - scrollIntoView(this.route.path, this.route.query.id); - - if (this.config.loadNavbar) { - getAndActive(this.router, 'nav'); - } - }; - } - - function initEvent(vm) { - // Bind toggle button - btn('button.sidebar-toggle', vm.router); - collapse('.sidebar', vm.router); - // Bind sticky effect - if (vm.config.coverpage) { - !isMobile && on('scroll', sticky); - } else { - body.classList.add('sticky'); - } - } - - function loadNested(path, qs, file, next, vm, first) { - path = first ? path : path.replace(/\/$/, ''); - path = getParentPath(path); - - if (!path) { - return - } - - get( - vm.router.getFile(path + file) + qs, - false, - vm.config.requestHeaders - ).then(next, function (_) { return loadNested(path, qs, file, next, vm); }); - } - - function fetchMixin(proto) { - var last; - - var abort = function () { return last && last.abort && last.abort(); }; - var request = function (url, hasbar, requestHeaders) { - abort(); - last = get(url, true, requestHeaders); - return last - }; - - var get404Path = function (path, config) { - var notFoundPage = config.notFoundPage; - var ext = config.ext; - var defaultPath = '_404' + (ext || '.md'); - var key; - var path404; - - switch (typeof notFoundPage) { - case 'boolean': - path404 = defaultPath; - break - case 'string': - path404 = notFoundPage; - break - - case 'object': - key = Object.keys(notFoundPage) - .sort(function (a, b) { return b.length - a.length; }) - .find(function (key) { return path.match(new RegExp('^' + key)); }); - - path404 = (key && notFoundPage[key]) || defaultPath; - break - - default: - break - } - - return path404 - }; - - proto._loadSideAndNav = function (path, qs, loadSidebar, cb) { - var this$1 = this; - - return function () { - if (!loadSidebar) { - return cb() - } - - var fn = function (result) { - this$1._renderSidebar(result); - cb(); - }; - - // Load sidebar - loadNested(path, qs, loadSidebar, fn, this$1, true); - } - }; - - proto._fetch = function (cb) { - var this$1 = this; - if ( cb === void 0 ) cb = noop; - - var ref = this.route; - var path = ref.path; - var query = ref.query; - var qs = stringifyQuery(query, ['id']); - var ref$1 = this.config; - var loadNavbar = ref$1.loadNavbar; - var requestHeaders = ref$1.requestHeaders; - var loadSidebar = ref$1.loadSidebar; - // Abort last request - - var file = this.router.getFile(path); - var req = request(file + qs, true, requestHeaders); - - // Current page is html - this.isHTML = /\.html$/g.test(file); - - // Load main content - req.then( - function (text, opt) { return this$1._renderMain( - text, - opt, - this$1._loadSideAndNav(path, qs, loadSidebar, cb) - ); }, - function (_) { - this$1._fetchFallbackPage(file, qs, cb) || this$1._fetch404(file, qs, cb); - } - ); - - // Load nav - loadNavbar && - loadNested( - path, - qs, - loadNavbar, - function (text) { return this$1._renderNav(text); }, - this, - true - ); - }; - - proto._fetchCover = function () { - var this$1 = this; - - var ref = this.config; - var coverpage = ref.coverpage; - var requestHeaders = ref.requestHeaders; - var query = this.route.query; - var root = getParentPath(this.route.path); - - if (coverpage) { - var path = null; - var routePath = this.route.path; - if (typeof coverpage === 'string') { - if (routePath === '/') { - path = coverpage; - } - } else if (Array.isArray(coverpage)) { - path = coverpage.indexOf(routePath) > -1 && '_coverpage'; - } else { - var cover = coverpage[routePath]; - path = cover === true ? '_coverpage' : cover; - } - - var coverOnly = Boolean(path) && this.config.onlyCover; - if (path) { - path = this.router.getFile(root + path); - this.coverIsHTML = /\.html$/g.test(path); - get(path + stringifyQuery(query, ['id']), false, requestHeaders).then( - function (text) { return this$1._renderCover(text, coverOnly); } - ); - } else { - this._renderCover(null, coverOnly); - } - return coverOnly - } - }; - - proto.$fetch = function (cb) { - var this$1 = this; - if ( cb === void 0 ) cb = noop; - - var done = function () { - callHook(this$1, 'doneEach'); - cb(); - }; - - var onlyCover = this._fetchCover(); - - if (onlyCover) { - done(); - } else { - this._fetch(function () { - this$1.$resetEvents(); - done(); - }); - } - }; - - proto._fetchFallbackPage = function (path, qs, cb) { - var this$1 = this; - if ( cb === void 0 ) cb = noop; - - var ref = this.config; - var requestHeaders = ref.requestHeaders; - var fallbackLanguages = ref.fallbackLanguages; - var loadSidebar = ref.loadSidebar; - - if (!fallbackLanguages) { - return false - } - - var local = path.split('/')[1]; - - if (fallbackLanguages.indexOf(local) === -1) { - return false - } - var newPath = path.replace(new RegExp(("^/" + local)), ''); - var req = request(newPath + qs, true, requestHeaders); - - req.then( - function (text, opt) { return this$1._renderMain( - text, - opt, - this$1._loadSideAndNav(path, qs, loadSidebar, cb) - ); }, - function () { return this$1._fetch404(path, qs, cb); } - ); - - return true - }; - /** - * Load the 404 page - * @param path - * @param qs - * @param cb - * @returns {*} - * @private - */ - proto._fetch404 = function (path, qs, cb) { - var this$1 = this; - if ( cb === void 0 ) cb = noop; - - var ref = this.config; - var loadSidebar = ref.loadSidebar; - var requestHeaders = ref.requestHeaders; - var notFoundPage = ref.notFoundPage; - - var fnLoadSideAndNav = this._loadSideAndNav(path, qs, loadSidebar, cb); - if (notFoundPage) { - var path404 = get404Path(path, this.config); - - request(this.router.getFile(path404), true, requestHeaders).then( - function (text, opt) { return this$1._renderMain(text, opt, fnLoadSideAndNav); }, - function () { return this$1._renderMain(null, {}, fnLoadSideAndNav); } - ); - return true - } - - this._renderMain(null, {}, fnLoadSideAndNav); - return false - }; - } - - function initFetch(vm) { - var ref = vm.config; - var loadSidebar = ref.loadSidebar; - - // Server-Side Rendering - if (vm.rendered) { - var activeEl = getAndActive(vm.router, '.sidebar-nav', true, true); - if (loadSidebar && activeEl) { - activeEl.parentNode.innerHTML += window.__SUB_SIDEBAR__; - } - vm._bindEventOnRendered(activeEl); - vm.$resetEvents(); - callHook(vm, 'doneEach'); - callHook(vm, 'ready'); - } else { - vm.$fetch(function (_) { return callHook(vm, 'ready'); }); - } - } - - function initMixin(proto) { - proto._init = function () { - var vm = this; - vm.config = config(); - - initLifecycle(vm); // Init hooks - initPlugin(vm); // Install plugins - callHook(vm, 'init'); - initRouter(vm); // Add router - initRender(vm); // Render base DOM - initEvent(vm); // Bind events - initFetch(vm); // Fetch data - callHook(vm, 'mounted'); - }; - } - - function initPlugin(vm) { - [].concat(vm.config.plugins).forEach(function (fn) { return isFn(fn) && fn(vm._lifecycle, vm); }); - } - - - - var util = Object.freeze({ - cached: cached, - hyphenate: hyphenate, - hasOwn: hasOwn, - merge: merge, - isPrimitive: isPrimitive, - noop: noop, - isFn: isFn, - inBrowser: inBrowser, - isMobile: isMobile, - supportsPushState: supportsPushState, - parseQuery: parseQuery, - stringifyQuery: stringifyQuery, - isAbsolutePath: isAbsolutePath, - getParentPath: getParentPath, - cleanPath: cleanPath, - resolvePath: resolvePath, - getPath: getPath, - replaceSlug: replaceSlug - }); - - function initGlobalAPI () { - window.Docsify = { - util: util, - dom: dom, - get: get, - slugify: slugify, - version: '4.9.4' - }; - window.DocsifyCompiler = Compiler; - window.marked = marked; - window.Prism = prism; - } - - /** - * Fork https://github.com/bendrucker/document-ready/blob/master/index.js - */ - function ready(callback) { - var state = document.readyState; - - if (state === 'complete' || state === 'interactive') { - return setTimeout(callback, 0) - } - - document.addEventListener('DOMContentLoaded', callback); - } - - function Docsify() { - this._init(); - } - - var proto = Docsify.prototype; - - initMixin(proto); - routerMixin(proto); - renderMixin(proto); - fetchMixin(proto); - eventMixin(proto); - - /** - * Global API - */ - initGlobalAPI(); - - /** - * Run Docsify - */ - ready(function (_) { return new Docsify(); }); - - }()); - \ No newline at end of file diff --git a/English version/ch01_MathematicalBasis/Chapter 1_MathematicalBasis.md b/en-us/ch01_MathematicalBasis/MathematicalBasis.md similarity index 99% rename from English version/ch01_MathematicalBasis/Chapter 1_MathematicalBasis.md rename to en-us/ch01_MathematicalBasis/MathematicalBasis.md index 35e69777..b9898258 100644 --- a/English version/ch01_MathematicalBasis/Chapter 1_MathematicalBasis.md +++ b/en-us/ch01_MathematicalBasis/MathematicalBasis.md @@ -389,7 +389,7 @@ P(A/B) = P(A\cap B) / P(B) $$ Description: The event or subset $A$ and $B$ in the same sample space $\Omega$, if an element randomly selected from $\Omega$ belongs to $B$, then the next randomly selected element The probability of belonging to $A$ is defined as the conditional probability of $A$ on the premise of $B$. -![conditional probability](img/ch1/conditional_probability.jpg) +![conditional probability](/assets/ch1/conditional_probability.jpg) According to the Venn diagram, it can be clearly seen that in the event of event B, the probability of event A occurring is $P(A\bigcap B)$ divided by $P(B)$. Example: A couple has two children. What is the probability that one of them is a girl and the other is a girl? (I have encountered interviews and written tests) diff --git a/English version/ch01_MathematicalBasis/readme.md b/en-us/ch01_MathematicalBasis/readme.md similarity index 100% rename from English version/ch01_MathematicalBasis/readme.md rename to en-us/ch01_MathematicalBasis/readme.md diff --git a/English version/ch02_MachineLearningFoundation/Chapter 2_TheBasisOfMachineLearning.md b/en-us/ch02_MachineLearningFoundation/TheBasisOfMachineLearning.md similarity index 99% rename from English version/ch02_MachineLearningFoundation/Chapter 2_TheBasisOfMachineLearning.md rename to en-us/ch02_MachineLearningFoundation/TheBasisOfMachineLearning.md index 6c311a3c..829d2538 100644 --- a/English version/ch02_MachineLearningFoundation/Chapter 2_TheBasisOfMachineLearning.md +++ b/en-us/ch02_MachineLearningFoundation/TheBasisOfMachineLearning.md @@ -12,19 +12,19 @@ Machine Learning (ML), as the name suggests, lets the machine learn. Here, the m |Regression Algorithm|Clustering Algorithm|Regularization Method| |:-:|:-:|:-:| -|![](img/ch2/2.1/1.jpg)|![](img/ch2/2.1/2.jpg)|![](img/ch2/2.1/3.jpg )| +|![](/assets/ch2/2.1/1.jpg)|![](/assets/ch2/2.1/2.jpg)|![](/assets/ch2/2.1/3.jpg )| | Decision Tree Learning | Bayesian Methods | Kernel-Based Algorithms | |:-:|:-:|:-:| -|![](img/ch2/2.2.4.png)|![](img/ch2/2.1/5.jpg)|![](img/ch2/2.1/6.jpg )| +|![](/assets/ch2/2.2.4.png)|![](/assets/ch2/2.1/5.jpg)|![](/assets/ch2/2.1/6.jpg )| |Clustering Algorithm|Association Rule Learning|Artificial Neural Network| |:-:|:-:|:-:| -|![](img/ch2/2.1/7.jpg)|![](img/ch2/2.2.8.png)|![](img/ch2/2.2.09.png )| +|![](/assets/ch2/2.1/7.jpg)|![](/assets/ch2/2.2.8.png)|![](/assets/ch2/2.2.09.png )| |Deep Learning|Lower Dimensional Algorithm|Integrated Algorithm| |:-:|:-:|:-:| -|![](img/ch2/2.2.10.png)|![](img/ch2/2.2.11.png)|![](img/ch2/2.2.12.png )| +|![](/assets/ch2/2.2.10.png)|![](/assets/ch2/2.2.11.png)|![](/assets/ch2/2.2.12.png )| ## 2.3 Supervised learning, unsupervised learning, semi-supervised learning, weak supervision learning? There are different ways to model a problem, depending on the type of data. According to different learning methods and input data, machine learning is mainly divided into the following four learning methods. @@ -95,7 +95,7 @@ For example, Full Connected (FC) neural network, its rules include: **Neural Network Architecture** The picture below is a neural network system, which consists of many layers. The input layer is responsible for receiving information, such as a picture of a cat. The output layer is the result of the computer's judgment on this input information, it is not a cat. The hidden layer is the transfer and processing of input information. - ![](img/ch2/2.5.1.png) + ![](/assets/ch2/2.5.1.png) ## 2.7 Understanding Local Optimization and Global Optimization @@ -138,7 +138,7 @@ Therefore, when using the classification model or the regression model in the ac 3) False negatives (FN): the number of instances that are incorrectly divided into negative examples, that is, the number of instances that are actually positive but are classified as negative by the classifier; 4) True negatives(TN): The number of negative cases that are correctly divided into negative examples, which are actually negative examples and are divided into negative examples by the classifier. -![](img/ch2/2.9/1.png) +![](/assets/ch2/2.9/1.png) The figure above is the confusion matrix of these four terms, and the following is explained: 1) P = TP + FN represents the number of samples that are actually positive examples. @@ -184,7 +184,7 @@ In order to integrate the classification of multiple categories and evaluate the The ROC curve is an abbreviation for (Receiver Operating Characteristic Curve), which is a performance evaluation curve with sensitivity (true positive rate) as the ordinate and 1-specific (false positive rate) as the abscissa. . The ROC curves of different models for the same data set can be plotted in the same Cartesian coordinate system. The closer the ROC curve is to the upper left corner, the more reliable the corresponding model is. The model can also be evaluated by the area under the ROC curve (Area Under Curve, AUC). The larger the AUC, the more reliable the model. -![](img/ch2/2.7.3.png) +![](/assets/ch2/2.7.3.png) Figure 2.7.3 ROC curve @@ -283,7 +283,7 @@ $$ Suppose there are two parameters, $A$ and $B$, in the function. When the parameters change, it is assumed that the function state will also change. As shown below: -![](img/ch2/2.16/1.jpg) +![](/assets/ch2/2.16/1.jpg) To fit the discrete points in the graph, we need to find the best $A$ and $B$ as possible to make this line more representative of all the data. How to find the optimal solution, which needs to be solved using the cost function, taking the squared error cost function as an example, assuming the function is $h(x)=\theta_0x$. The main idea of ​​the square error cost function is to make the difference between the value given by the actual data and the corresponding value of the fitted line, and find the difference between the fitted line and the actual line. In practical applications, in order to avoid the impact of individual extreme data, a similar variance is used to take one-half of the variance to reduce the impact of individual data. Therefore, the cost function is derived: @@ -294,7 +294,7 @@ $$ **The optimal solution is the minimum value of the cost function**$\min J(\theta_0, \theta_1) ​$. If it is a parameter, the cost function is generally visualized by a two-dimensional curve. If it is 2 parameters, the cost function can see the effect through the 3D image. The more parameters, the more complicated. When the parameter is 2, the cost function is a three-dimensional image. -![](img/ch2/2.16/2.jpg) +![](/assets/ch2/2.16/2.jpg) ### 2.10.3 Why is the cost function non-negative? There is a lower bound on the objective function. In the optimization process, if the optimization algorithm can reduce the objective function continuously, according to the monotonically bounded criterion, the optimization algorithm can prove that the convergence is effective. @@ -319,7 +319,7 @@ Where $z ​$ represents the input of the neuron and $\sigma ​$ represents the *Note*: The activation function commonly used in neural networks is the sigmoid function. The curve of this function is as follows: -![](img/ch2/2.18/1.jpg) +![](/assets/ch2/2.18/1.jpg) Compare the two points of 0.88 and 0.98 as shown: Assume that the target is to converge to 1.0. 0.88 is farther from the target 1.0, the gradient is larger, and the weight adjustment is larger. 0.98 is closer to the target 1.0, the gradient is smaller, and the weight adjustment is smaller. The adjustment plan is reasonable. @@ -569,7 +569,7 @@ Gradient concepts need to be noted: ### 2.12.3 Gradient descent method intuitive understanding? Classical illustration of the gradient descent method: -![](img/ch2/2.25/1.png) +![](/assets/ch2/2.25/1.png) Visualization example: > From the above picture, if at the beginning, we are somewhere on a mountain, because there are strangers everywhere, we don’t know the way down the mountain, so we can only explore the steps based on intuition, in the process, Every time you go to a position, it will solve the gradient of the current position, go down one step along the negative direction of the gradient, that is, the current steepest position, and then continue to solve the current position gradient, and the steepest position along this step. The easiest place to go down the mountain. Constantly cycle through the gradients, and so on, step by step, until we feel that we have reached the foot of the mountain. Of course, if we go on like this, it is possible that we cannot go to the foot of the mountain, but to the low point of a certain local peak. @@ -784,7 +784,7 @@ If you summarize the LDA idea in one sentence, that is, "the variance within the ### 2.14.2 Graphical LDA Core Ideas Assume that there are two types of data, red and blue. These data features are two-dimensional, as shown in the following figure. Our goal is to project these data into one dimension, so that the projection points of each type of similar data are as close as possible, and the different types of data are as far as possible, that is, the distance between the red and blue data centers in the figure is as large as possible. -![](img/ch2/2.29/1.png) +![](/assets/ch2/2.29/1.png) The left and right images are two different projections. @@ -885,7 +885,7 @@ The PCA can solve the problem that there are too many data features or cumbersom Suppose the data set is m n-dimensional, $(x^{(1)}, x^{(2)}, \cdots, x^{(m)})$. If n=2, you need to reduce the dimension to $n'=1$. Now you want to find the data of a dimension that represents these two dimensions. The figure below has $u_1, u_2$ two vector directions, but which vector is what we want, can better represent the original data set? -![](img/ch2/2.34/1.png) +![](/assets/ch2/2.34/1.png) As can be seen from the figure, $u_1$ is better than $u_2$, why? There are two main evaluation indicators: 1. The sample point is close enough to this line. @@ -1048,7 +1048,7 @@ Noise: Describes the lower bound of the expected generalization error that any l - The smaller the Variance, the higher the generalization of the model; conversely, the lower the ability of the model to generalize. - If the model has a good fitting effect on the training set, but the fitting effect on the test set is relatively poor, the variance is large, indicating that the stability of the model is poor. This phenomenon may be due to the model training set. Caused by the fit. As shown in the right column of the figure below. -> ![](img/ch2/2.16.20.1.png) +> ![](/assets/ch2/2.16.20.1.png) > ### 2.16.3 Empirical error and generalization error @@ -1061,7 +1061,7 @@ Generalization error: The error of the model on the new sample set (test set) is Under-fitting is different from over-fitting plots depending on the coordinate method. 1. **The horizontal axis is the number of training samples and the vertical axis is the error** -![](img/ch2/2.16.4.1.jpg) +![](/assets/ch2/2.16.4.1.jpg) As shown in the figure above, we can visually see the difference between under-fitting and over-fitting: @@ -1073,7 +1073,7 @@ The model is normal: there are relatively low deviations and variances on both t 2. **The horizontal axis is the complexity of the model and the vertical axis is the error** -![](img/ch2/2.16.4.2.png) +![](/assets/ch2/2.16.4.2.png) The red line is the Error on the test set, and the blue line is the Error on the training set. @@ -1085,7 +1085,7 @@ The model is normal: the model complexity control is optimal at point B. 3. **The horizontal axis is the regular term coefficient and the vertical axis is the error** -![](img/ch2/2.16.4.3.png) +![](/assets/ch2/2.16.4.3.png) The red line is the Error on the test set, and the blue line is the Error on the training set. @@ -1182,7 +1182,7 @@ The ROC curve is calculated by setting a continuous variable to a plurality of d For classifiers, or classification algorithms, the evaluation indicators mainly include precision, recall, and F-score. The figure below is an example of a ROC curve. -![](img/ch2/2.40.10/1.png) +![](/assets/ch2/2.40.10/1.png) The abscissa of the ROC curve is the false positive rate (FPR) and the ordinate is the true positive rate (TPR). among them $$ @@ -1206,7 +1206,7 @@ step: 3. Select a different threshold each time to get a set of FPR and TPR, which is a point on the ROC curve. In this way, a total of 20 sets of FPR and TPR values ​​were obtained. The FPR and TPR are briefly understood as follows: 4. Draw according to each coordinate point in 3). -![](img/ch2/2.40.11/1.jpg) +![](/assets/ch2/2.40.11/1.jpg) ### 2.16.13 How to calculate TPR, FPR? 1. Analysis of data @@ -1291,7 +1291,7 @@ Because the ROC curve has a very good property: when the distribution of positiv ### 2.16.17 Intuitive understanding of AUC The figure below shows the values ​​of the three AUCs: -![](img/ch2/2.40.15/1.png) +![](/assets/ch2/2.40.15/1.png) AUC is an evaluation index to measure the pros and cons of the two-category model, indicating the probability that the positive example is in front of the negative example. Other evaluation indicators have accuracy, accuracy, and recall rate, and AUC is more common than the three. Generally, in the classification model, the prediction results are expressed in the form of probability. If the accuracy is to be calculated, a threshold is usually set manually to convert the corresponding probability into a category, which greatly affects the accuracy of the model. Rate calculation. @@ -1299,19 +1299,19 @@ Example: Now suppose that a trained two-classifier predicts 10 positive and negative samples (5 positive cases and 5 negative examples). The best prediction result obtained by sorting the scores in high to low is [1, 1, 1, 1, 1, 0, 0, 0, 0, 0], that is, 5 positive examples are ranked in front of 5 negative examples, and the positive example is 100% in front of the negative example. Then draw its ROC curve, since it is 10 samples, we need to draw 10 points in addition to the origin, as follows: -![](img/ch2/2.16.17-1.png) +![](/assets/ch2/2.16.17-1.png) The method of traversing starts from left to right according to the score of the sample prediction result. Starting from the origin, every time you encounter 1, move the y-axis in the positive direction of the y-axis with a minimum step size of 1 unit, here is 1/5=0.2; every time you encounter 0, move to the x-axis positive direction, the x-axis minimum step size is 1 Unit, here is also 0.2. It is not difficult to see that the AUC of the above figure is equal to 1, which confirms that the probability that the positive example is in front of the negative example is indeed 100%. Assume that the prediction result sequence is [1, 1, 1, 1, 0, 1, 0, 0, 0, 0]. -![](img/ch2/2.16.17-2.png) +![](/assets/ch2/2.16.17-2.png) Calculate the AUC of the above figure is 0.96 and the probability of calculating the positive example is 0.8 × 1 + 0.2 × 0.8 = 0.96 in front of the negative example, and the area of ​​the shadow in the upper left corner is the probability that the negative example is in front of the positive example. × 0.2 = 0.04. Assume that the prediction result sequence is [1, 1, 1, 0, 1, 0, 1, 0, 0, 0]. -![](img/ch2/2.16.17-3.png) +![](/assets/ch2/2.16.17-3.png) Calculate the AUC of the above figure is 0.88 and the probability of calculating the positive example and the front of the negative example is equal to 0.6 × 1 + 0.2 × 0.8 + 0.2 × 0.6 = 0.88. The area of ​​the shaded part in the upper left corner is the negative example in front of the positive example. The probability is 0.2 × 0.2 × 3 = 0.12. @@ -1319,7 +1319,7 @@ Calculate the AUC of the above figure is 0.88 and the probability of calculating Different errors can come at different costs. Taking the dichotomy as an example, set the cost matrix as follows: -![](img/ch2/2-1.png) +![](/assets/ch2/2-1.png) When the judgment is correct, the value is 0. When it is incorrect, it is $Cost_{01} $ and $Cost_{10} $ respectively. @@ -1353,7 +1353,7 @@ Note: Each point of the ROC corresponds to a line on the cost plane. For example, on the ROC (TPR, FPR), FNR=1-TPR is calculated, and a line segment from (0, FPR) to (1, FNR) is drawn on the cost plane, and the area is the expected overall cost under the condition. The area under the bounds of all segments, the expected overall cost of the learner under all conditions. -![](img/ch2/2.16.18.1.png) +![](/assets/ch2/2.16.18.1.png) ### 2.16.19 What are the comparison test methods for the model? Correctness analysis: model stability analysis, robustness analysis, convergence analysis, trend analysis, extreme value analysis, etc. @@ -1442,7 +1442,7 @@ Pruning: Decision trees are easy to overfit, generally requiring pruning, reduci ### 2.17.3 Decision Tree Learning Basic Algorithm -![](img/ch2/2-5.png) +![](/assets/ch2/2-5.png) ### 2.17.4 Advantages and disadvantages of decision tree algorithms @@ -1530,7 +1530,7 @@ Support Vector Machine (SVM): The meaning is a classifier that supports vector o In a two-dimensional environment, points R, S, G and other points near the middle black line can be seen as support vectors, which can determine the specific parameters of the classifier, black line. -![](img/ch2/2-6.png) +![](/assets/ch2/2-6.png) The support vector machine is a two-class model. Its purpose is to find a hyperplane to segment the sample. The principle of segmentation is to maximize the interval and finally transform it into a convex quadratic programming problem. The simple to complex models include: @@ -1752,7 +1752,7 @@ LR mainly relies on feature structure, and must combine cross-characteristics an The principle of maximum likelihood estimation is illustrated by a picture, as shown in the following figure: -![](img/ch2/2.19.1.1.png) +![](/assets/ch2/2.19.1.1.png) Example: There are two boxes with the same shape. There are 99 white balls and 1 black ball in the 1st box. There are 1 white ball and 99 black balls in the 2nd box. In one experiment, the black ball was taken out. Which box was taken out from? @@ -1867,7 +1867,7 @@ $$ $$ Then, estimate the conditional probability for each attribute (here, for continuous attributes, assume they follow a normal distribution) -![](img/ch2/2.19.5C.png) +![](/assets/ch2/2.19.5C.png) Then there is $$ @@ -1954,7 +1954,7 @@ The above is the M step of the EM algorithm, $\sum\limits_{z^{(i)}}Q_i(z^{(i)})l Considering the formula (a) in the previous section, there are hidden variables in the expression. It is difficult to find the parameter estimation directly. The EM algorithm is used to iteratively solve the maximum value of the lower bound until convergence. -![](img/ch2/2.20.1.jpg) +![](/assets/ch2/2.20.1.jpg) The purple part of the picture is our target model $p(x|\theta)$. The model is complex and difficult to find analytical solutions. In order to eliminate the influence of the hidden variable $z^{(i)}$, we can choose one not. The $r(x|\theta)$ model containing $z^{(i)}$ is such that it satisfies the condition $r(x|\theta) \leq p(x|\theta) $. @@ -1999,23 +1999,23 @@ If the data set contains 10 photos, the photo contains both triangle and circle -![](img/ch2/2.21.1.1.png) +![](/assets/ch2/2.21.1.1.png) Figure 2.21.1.a As can be seen from the above figure, if only one feature is classified, the triangle and the circle are almost evenly distributed on this line segment, and it is difficult to linearly classify 10 photos. So what happens when you add a feature: -![](img/ch2/2.21.1.2.png) +![](/assets/ch2/2.21.1.2.png) Figure 2.21.1.b After adding a feature, we found that we still couldn't find a straight line to separate the cat from the dog. So, consider adding another feature: -![](img/ch2/2.21.1.3.png) +![](/assets/ch2/2.21.1.3.png) Figure 2.21.1.c -![](img/ch2/2.21.1.4.png) +![](/assets/ch2/2.21.1.4.png) Figure 2.21.1.d @@ -2033,25 +2033,25 @@ By analogy, if you continue to increase the number of features, the sample densi Let's look at what happens when you map the classification results of high-dimensional space to low-dimensional space. -![](img/ch2/2.21.1.5.png) +![](/assets/ch2/2.21.1.5.png) Figure 2.21.1.e The above figure is the result of mapping the 3D feature space to the 2D feature space. Although the training samples are linearly separable in the high dimensional feature space, the results are reversed after mapping to the low dimensional space. In fact, increasing the number of features makes the high-dimensional space linearly separable, which is equivalent to training a complex nonlinear classifier in a low-dimensional space. However, this nonlinear classifier is too "smart" to learn only a few special cases. If it is used to identify test samples that have not appeared in the training sample, the results are usually not ideal and can cause over-fitting problems. -![](img/ch2/2.21.1.6a.png) +![](/assets/ch2/2.21.1.6a.png) Figure 2.21.1.f The linear classifier with only two features shown in the above figure is divided into some training samples. The accuracy does not seem to be as high as in Figure 2.21.1.e. However, the generalization ability ratio of linear classifiers with two features is shown. A linear classifier with three features is stronger. Because the linear classifier with two features learns not only the special case, but an overall trend, which can be better distinguished for those samples that have never appeared before. In other words, by reducing the number of features, over-fitting problems can be avoided, thereby avoiding "dimensionality disasters." -![](img/ch2/2.21.1.6.png) +![](/assets/ch2/2.21.1.6.png) From another perspective, the "dimensional disaster" is explained. Assuming that there is only one feature, the range of features is 0 to 1, and the eigenvalues ​​of each triangle and circle are unique. If we want the training sample to cover 20% of the eigenvalue range, then we need 20% of the total number of triangles and circles. After we add a feature, 45% (0.452 = 0.2) of the total number of triangles and circles is needed to continue covering 20% ​​of the eigenvalue range. After continuing to add a feature, 58% (0.583 = 0.2) of the total number of triangles and circles is required. As the number of features increases, more training samples are needed to cover 20% of the eigenvalue range. If there are not enough training samples, there may be over-fitting problems. Through the above example, we can see that the more the number of features, the more sparse the training samples will be, the less accurate the parameter estimates of the classifier will be, and the over-fitting problem will be more likely to occur. Another effect of the "dimension disaster" is that the sparsity of the training samples is not evenly distributed. The training samples at the center are more sparse than the surrounding training samples. -![](img/ch2/2.21.1.7.png) +![](/assets/ch2/2.21.1.7.png) Suppose there is a two-dimensional feature space, such as the rectangle shown in Figure 8, with an inscribed circle inside the rectangle. As the sample closer to the center of the circle is sparse, those samples located at the four corners of the rectangle are more difficult to classify than the samples within the circle. When the dimension becomes larger, the capacity of the feature hyperspace does not change, but the capacity of the unit circle tends to zero. In the high-dimensional space, most of the training data resides in the corner of the feature hyperspace. Data scattered in the corner is harder to classify than data in the center. @@ -2073,13 +2073,13 @@ Clustering is used to find the distribution structure inherent in data, either a 1) In some recommendation systems, the type of new user needs to be determined, but it is not easy to define the “user type”. In this case, the original user data can be clustered first, and each cluster is clustered according to the clustering result. Defined as a class, and then based on these classes to train the classification model to identify the type of new user. -![](img/ch2/2.21.3.1.png) +![](/assets/ch2/2.21.3.1.png) 2) Dimensionality reduction is an important method to alleviate the dimensionality disaster. It is to transform the original high-dimensional attribute space into a low-dimensional "subspace" through some mathematical transformation. It is based on the assumption that although the data samples that people usually observe are high-dimensional, what is actually related to the learning task is a low-dimensional distribution. Therefore, the description of the data can be realized through the most important feature dimensions, which is helpful for the subsequent classification. For example, the Titanic on Kaggle was still a problem. By giving a person a number of characteristics such as age, name, gender, fare, etc., to determine whether it can survive in a shipwreck. This requires first feature screening to identify the main features and make the learned models more generalizable. Both clustering and dimensionality reduction can be used as preprocessing steps for classification and other issues. -![](img/ch2/2-19.jpg) +![](/assets/ch2/2-19.jpg) But although they can achieve the reduction of data. However, the two objects are different, the clustering is for data points, and the dimension reduction is for the characteristics of the data. In addition, they have a variety of implementation methods. K-means, hierarchical clustering, density-based clustering, etc. are commonly used in clustering; PCA, Isomap, LLE, etc. are commonly used in dimension reduction. @@ -2120,7 +2120,7 @@ Steps: According to the order of hierarchical decomposition, whether it is bottom-up or top-down, the hierarchical clustering algorithm is divided into a condensed hierarchical clustering algorithm and a split hierarchical clustering algorithm. The strategy of condensed hierarchical clustering is to first treat each object as a cluster, then merge the clusters into larger and larger clusters until all objects are in one cluster, or a certain termination condition is satisfied. Most hierarchical clusters belong to agglomerative hierarchical clustering, which differ only in the definition of similarity between clusters. The four widely used methods for measuring the distance between clusters are as follows: -![](img/ch2/2-20.gif) +![](/assets/ch2/2-20.gif) Here is the flow of the condensed hierarchical clustering algorithm using the minimum distance: @@ -2148,7 +2148,7 @@ In 1965, Professor Zade of the University of California, Berkeley, first propose The FCM algorithm is an algorithm that determines the degree to which each data point belongs to a certain cluster degree by membership degree. This clustering algorithm is an improvement of the traditional hard clustering algorithm. -![](img/ch2/2-21.gif) +![](/assets/ch2/2-21.gif) Algorithm flow: @@ -2168,7 +2168,7 @@ In the experiment, IRIS [13] data set in the international UCI database dedicate Based on the previous algorithm principles and algorithm flow, the programming operation is performed by matlab, and the clustering results shown in Table 1 are obtained. -![](img/ch2/2-22.gif) +![](/assets/ch2/2-22.gif) As shown in Table 1, for the four clustering algorithms, compare them in three aspects: diff --git a/English version/ch02_MachineLearningFoundation/readme.md b/en-us/ch02_MachineLearningFoundation/readme.md similarity index 100% rename from English version/ch02_MachineLearningFoundation/readme.md rename to en-us/ch02_MachineLearningFoundation/readme.md diff --git a/English version/ch03_DeepLearningFoundation/ChapterIII_DeepLearningFoundation.md b/en-us/ch03_DeepLearningFoundation/DeepLearningFoundation.md similarity index 98% rename from English version/ch03_DeepLearningFoundation/ChapterIII_DeepLearningFoundation.md rename to en-us/ch03_DeepLearningFoundation/DeepLearningFoundation.md index e91b2883..cd6a580f 100644 --- a/English version/ch03_DeepLearningFoundation/ChapterIII_DeepLearningFoundation.md +++ b/en-us/ch03_DeepLearningFoundation/DeepLearningFoundation.md @@ -14,7 +14,7 @@ The feature neuron model in the multi-layer perceptron is called the perceptron The simple perceptron is shown below: -![](img/ch3/3-1.png) +![](/assets/ch3/3-1.png) Where $x_1$, $x_2$, $x_3$ is the input to the perceptron, and its output is: @@ -46,30 +46,30 @@ $$ Set the appropriate $x$ and $b$ , a simple perceptual unit's NAND gate is expressed as follows: -![](img/ch3/3-2.png) +![](/assets/ch3/3-2.png) When the input is $0$, $1$, the perceptron output is $ 0 * (-2) + 1 * (-2) + 3 = 1$. More complex perceptrons are composed of simple perceptron units: -![](img/ch3/3-3.png) +![](/assets/ch3/3-3.png) **Multilayer Perceptron** The multi-layer perceptron is promoted by the perceptron. The most important feature is that there are multiple neuron layers, so it is also called deep neural network. Each neuron in the $i$ layer of the multilayer perceptron is connected to each neuron in the $i-1$ layer compared to a separate perceptron. -![](img/ch3/3.1.1.5.png) +![](/assets/ch3/3.1.1.5.png) The output layer can have more than $1$ neurons. The hidden layer can have only $1 $ layers, or it can have multiple layers. The output layer is a neural network of multiple neurons such as the following: -![](img/ch3/3.1.1.6.png) +![](/assets/ch3/3.1.1.6.png) ### 3.1.2 What are the common model structures of neural networks? The figure below contains most of the commonly used models: -![](img/ch3/3-7.jpg) +![](/assets/ch3/3-7.jpg) ### 3.1.3 How to choose a deep learning development platform? @@ -108,14 +108,14 @@ Some platforms are specifically developed for deep learning research and applica The reason for the disappearance of the gradient is affected by many factors, such as the size of the learning rate, the initialization of the network parameters, and the edge effect of the activation function. In the deep neural network, the gradient calculated by each neuron is passed to the previous layer, and the gradient received by the shallower neurons is affected by all previous layer gradients. If the calculated gradient value is very small, as the number of layers increases, the obtained gradient update information will decay exponentially, and the gradient disappears. The figure below shows the learning rate of different hidden layers: -![](img/ch3/3-8.png) +![](/assets/ch3/3-8.png) 2. Exploding Gradient In a network structure such as a deep network or a Recurrent Neural Network (RNN), gradients can accumulate in the process of network update, becoming a very large gradient, resulting in a large update of the network weight value, making the network unstable; In extreme cases, the weight value will even overflow and become a $NaN$ value, which cannot be updated anymore. 3. Degeneration of the weight matrix results in a reduction in the effective degrees of freedom of the model. The degradation rate of learning in the parameter space is slowed down, which leads to the reduction of the effective dimension of the model. The available degrees of freedom of the network contribute to the gradient norm in learning. As the number of multiplication matrices (ie, network depth) increases, The product of the matrix becomes more and more degraded. In nonlinear networks with hard saturated boundaries (such as ReLU networks), as the depth increases, the degradation process becomes faster and faster. The visualization of this degradation process is shown in a 2014 paper by Duvenaud et al: -![](img/ch3/3-9.jpg) +![](/assets/ch3/3-9.jpg) As the depth increases, the input space (shown in the upper left corner) is twisted into thinner and thinner filaments at each point in the input space, and only one direction orthogonal to the filament affects the response of the network. In this direction, the network is actually very sensitive to change. @@ -129,9 +129,9 @@ Traditional machine learning needs to define some manual features to purposefull -![](img/ch3/3.1.6.1.png) +![](/assets/ch3/3.1.6.1.png) -![](img/ch3/3-11.jpg) +![](/assets/ch3/3-11.jpg) ## 3.2 Network Operations and Calculations @@ -141,7 +141,7 @@ There are two main types of neural network calculations: forward propagation (FP ** Forward Propagation** -![](img/ch3/3.2.1.1.png) +![](/assets/ch3/3.2.1.1.png) Suppose the upper node $ i, j, k, ... $ and so on are connected to the node $ w $ of this layer, so what is the value of the node $ w $? That is, the weighting operation is performed by the nodes of $i, j, k, ... $ above and the corresponding connection weights, and the final result is added with an offset term (for simplicity in the figure) Finally, through a non-linear function (ie activation function), such as $ReLu $, $ sigmoid $ and other functions, the final result is the output of this layer node $ w $. @@ -149,7 +149,7 @@ Finally, through this method of layer by layer operation, the output layer resul **Backpropagation** -![](img/ch3/3.2.1.2.png) +![](/assets/ch3/3.2.1.2.png) Because of the final result of our forward propagation, taking the classification as an example, there is always an error in the end. How to reduce the error? One algorithm that is widely used at present is the gradient descent algorithm, but the gradient requires the partial derivative. The Chinese alphabet is used as an example to explain: @@ -157,7 +157,7 @@ Let the final error be $ E $ and the activation function of the output layer be ### 3.2.2 How to calculate the output of the neural network? -![](img/ch3/3.2.2.1.png) +![](/assets/ch3/3.2.2.1.png) As shown in the figure above, the input layer has three nodes, which we numbered as 1, 2, and 3; the four nodes of the hidden layer are numbered 4, 5, 6, and 7; the last two nodes of the output layer are numbered 8. 9. For example, node 4 of the hidden layer is connected to the three nodes 1, 2, and 3 of the input layer, and the weights on the connection are $ w_{41}, w_{42}, w_{43} $. @@ -185,7 +185,7 @@ For the same reason, we can also calculate $ y_2 $. So that the output values Suppose there is a 5\*5 image, convolved with a 3\*3 filter, and I want a 3\*3 Feature Map, as shown below: -![](img/ch3/3.2.3.1.png) +![](/assets/ch3/3.2.3.1.png) $ x_{i,j} $ represents the $ j $ column element of the $ i $ line of the image. $ w_{m,n} $ means filter $ m $ line $ n $ column weight. $ w_b $ represents the offset of $filter$. Table $a_i, _j$ shows the feature map $ i$ line $ j $ column element. $f$ represents the activation function, here the $ReLU$ function is used as an example. @@ -211,15 +211,15 @@ $$ The calculation process is illustrated as follows: -![](img/ch3/3.2.3.2.png) +![](/assets/ch3/3.2.3.2.png) By analogy, all Feature Maps are calculated. -![](img/ch3/3.2.3.4.png) +![](/assets/ch3/3.2.3.4.png) When the stride is 2, the Feature Map is calculated as follows -![](img/ch3/3.2.3.5.png) +![](/assets/ch3/3.2.3.5.png) Note: Image size, stride, and the size of the Feature Map after convolution are related. They satisfy the following relationship: @@ -252,7 +252,7 @@ Where $D$ is the depth; $F$ is the size of the filter; $w_{d,m,n}$ represents th There can be multiple filters per convolutional layer. After each filter is convolved with the original image, you get a Feature Map. The depth (number) of the Feature Map after convolution is the same as the number of filters in the convolutional layer. The following illustration shows the calculation of a convolutional layer with two filters. $7*7*3$ Input, after two convolutions of $3*3*3$ filter (step size is $2$), get the output of $3*3*2$. The Zero padding in the figure is $1$, which is a $0$ around the input element. -![](img/ch3/3.2.3.6.png) +![](/assets/ch3/3.2.3.6.png) The above is the calculation method of the convolutional layer. This is a partial connection and weight sharing: each layer of neurons is only connected to the upper layer of neurons (convolution calculation rules), and the weight of the filter is the same for all neurons in the previous layer. For a convolutional layer containing two $3 * 3 * 3 $ fitlers, the number of parameters is only $ (3 * 3 * 3+1) * 2 = 56 $, and the number of parameters is the same as the previous one. The number of layers of neurons is irrelevant. Compared to a fully connected neural network, the number of parameters is greatly reduced. @@ -260,7 +260,7 @@ The above is the calculation method of the convolutional layer. This is a partia The main role of the Pooling layer is to downsample, further reducing the number of parameters by removing unimportant samples from the Feature Map. There are many ways to pooling, the most common one is Max Pooling. Max Pooling actually takes the maximum value in the sample of n\*n as the sampled value after sampling. The figure below is 2\*2 max pooling: -![](img/ch3/3.2.4.1.png) +![](/assets/ch3/3.2.4.1.png) In addition to Max Pooing, Average Pooling is also commonly used - taking the average of each sample. For a Feature Map with a depth of $ D $ , each layer does Pooling independently, so the depth after Pooling is still $ D $. @@ -269,7 +269,7 @@ For a Feature Map with a depth of $ D $ , each layer does Pooling independently, A typical three-layer neural network is as follows: -![](img/ch3/3.2.5.1.png) +![](/assets/ch3/3.2.5.1.png) Where Layer $ L_1 $ is the input layer, Layer $ L_2 $ is the hidden layer, and Layer $ L_3 $ is the output layer. @@ -279,11 +279,11 @@ If the input and output are the same, it is a self-encoding model. If the raw da Suppose you have the following network layer: -![](img/ch3/3.2.5.2.png) +![](/assets/ch3/3.2.5.2.png) The input layer contains neurons $ i_1, i_2 $, offset $ b_1 $; the hidden layer contains neurons $ h_1, h_2 $, offset $ b_2 $, and the output layer is $ o_1, o_2 $, $ W_i $ is the weight of the connection between the layers, and the activation function is the $sigmoid $ function. Take the initial value of the above parameters, as shown below: -![](img/ch3/3.2.5.3.png) +![](/assets/ch3/3.2.5.3.png) among them: @@ -365,7 +365,7 @@ $$ The following diagram can be more intuitive to see how the error propagates back: -![](img/ch3/3.2.5.4.png) +![](/assets/ch3/3.2.5.4.png) ### 3.2.6 What is the meaning of the neural network more "deep"? @@ -429,7 +429,7 @@ Among them, the search process requires a search algorithm, generally: grid sear The function image is as follows: -![](img/ch3/3-26.png) +![](/assets/ch3/3-26.png) 2. tanh activation function @@ -437,7 +437,7 @@ Among them, the search process requires a search algorithm, generally: grid sear The function image is as follows: -![](img/ch3/3-27.png) +![](/assets/ch3/3-27.png) 3. Relu activation function @@ -445,7 +445,7 @@ Among them, the search process requires a search algorithm, generally: grid sear The function image is as follows: -![](img/ch3/3-28.png) +![](/assets/ch3/3-28.png) 4. Leak Relu activation function @@ -458,7 +458,7 @@ Among them, the search process requires a search algorithm, generally: grid sear The image is as follows ($ a = 0.5 $): -![](img/ch3/3-29.png) +![](/assets/ch3/3-29.png) 5. SoftPlus activation function @@ -466,7 +466,7 @@ Among them, the search process requires a search algorithm, generally: grid sear The function image is as follows: -![](img/ch3/3-30.png) +![](/assets/ch3/3-30.png) 6. softmax function @@ -478,7 +478,7 @@ Among them, the search process requires a search algorithm, generally: grid sear For common activation functions, the derivative is calculated as follows: -![](img/ch3/3-31.png) +![](/assets/ch3/3-31.png) ### 3.4.4 What are the properties of the activation function? @@ -517,7 +517,7 @@ The following are common choices: The Relu activation function image is as follows: -![](img/ch3/3-32.png) +![](/assets/ch3/3-32.png) According to the image, it can be seen that it has the following characteristics: @@ -543,15 +543,15 @@ $$ From the following figure, the neural network contains the input layer, and then processed by two feature layers. Finally, the softmax analyzer can get the probability under different conditions. Here, it needs to be divided into three categories, and finally get $ y=0. , y=1, y=2 probability value of $. -![](img/ch3/3.4.9.1.png) +![](/assets/ch3/3.4.9.1.png) Continuing with the picture below, the three inputs pass through softmax to get an array of $[0.05, 0.10, 0.85] $, which is the function of soft. -![](img/ch3/3.4.9.2.png) +![](/assets/ch3/3.4.9.2.png) The more visual mapping process is shown below: -![****](img/ch3/3.4.9.3.png) +![****](/assets/ch3/3.4.9.3.png) In the case of softmax, the original output is $3,1,-3$, which is mapped to the value of $(0,1)$ by the softmax function, and the sum of these values ​​is $1 $( Satisfy the nature of the probability), then we can understand it as a probability, when we finally select the output node, we can select the node with the highest probability (that is, the value corresponds to the largest) as our prediction target! @@ -668,7 +668,7 @@ At this time, a batch-grading learning method (Mini-batches Learning) can be emp ### 3.6.3 Why can normalization improve the solution speed? -![](img/ch3/3.6.3.1.png) +![](/assets/ch3/3.6.3.1.png) The above figure is the optimal solution finding process that represents whether the data is uniform (the circle can be understood as a contour). The left image shows the search process without normalization, and the right image shows the normalized search process. @@ -684,7 +684,7 @@ Suppose $w1$ ranges in $[-10, 10]$, while $w2$ ranges in $[-100, 100]$, the grad This will result in a more bias toward the direction of $ w1 $ during the search. Go out of the "L" shape, or become the "Zigzag" shape. -![](img/ch3/3-37.png) +![](/assets/ch3/3-37.png) ### 3.6.5 What types of normalization? @@ -742,7 +742,7 @@ among them, A simple diagram is as follows: -![](img/ch3/3.6.7.1.png) +![](/assets/ch3/3.6.7.1.png) ### 3.6.8 What is Batch Normalization? @@ -892,7 +892,7 @@ Deviation Initialization Trap: Both are initialized to the same value. Take a three-layer network as an example: First look at the structure -![](img/ch3/3.8.2.1.png) +![](/assets/ch3/3.8.2.1.png) Its expression is: @@ -1051,8 +1051,8 @@ tf.train.RMSPropOptimizer ### 3.12.2 Why is regularization helpful in preventing overfitting? -![](img/ch3/3.12.2.1.png) -![](img/ch3/3.12.2.2.png) +![](/assets/ch3/3.12.2.1.png) +![](/assets/ch3/3.12.2.2.png) The left picture is high deviation, the right picture is high variance, and the middle is Just Right, which we saw in the previous lesson. diff --git a/English version/ch03_DeepLearningFoundation/readme.md b/en-us/ch03_DeepLearningFoundation/readme.md similarity index 100% rename from English version/ch03_DeepLearningFoundation/readme.md rename to en-us/ch03_DeepLearningFoundation/readme.md diff --git a/English version/ch04_ClassicNetwork/ChapterIV_ClassicNetwork.md b/en-us/ch04_ClassicNetwork/ClassicNetwork.md similarity index 98% rename from English version/ch04_ClassicNetwork/ChapterIV_ClassicNetwork.md rename to en-us/ch04_ClassicNetwork/ClassicNetwork.md index 6c694e11..da66e84c 100644 --- a/English version/ch04_ClassicNetwork/ChapterIV_ClassicNetwork.md +++ b/en-us/ch04_ClassicNetwork/ClassicNetwork.md @@ -9,7 +9,7 @@ LeNet-5 is a Convolutional Neural Network (CNN) $^{[1]}$ proposed by $LeCun$ for ### 4.1.2 Model structure -![](img/ch4/LeNet-5.jpg) +![](/assets/ch4/LeNet-5.jpg) Figure 4.1 LeNet-5 network structure @@ -31,7 +31,7 @@ Table 4.1 LeNet-5 Network Parameter Configuration > > $^*$ $C_3$ Convolutional layer training parameters are not directly connected to all feature maps in $S_2$, but are connected using the sampling feature as shown in Figure 4.2 (sparse connection). The generated 16 channel feature maps are mapped according to the adjacent three feature maps, the adjacent four feature maps, the non-adjacent four feature maps, and all six feature maps. The calculated number of parameters is calculated as $6\ Times(25\times3+1)+6\times(25\times4+1)+3\times(25\times4+1)+1\times(25\times6+1)=1516$, explained in the original paper There are two reasons for using this sampling method: the number of connections is not too large (the computing power of the current year is weak); forcing the combination of different feature maps can make the mapped feature maps learn different feature patterns. -![FeatureMap](img/ch4/featureMap.jpg) +![FeatureMap](/assets/ch4/featureMap.jpg) Figure 4.2 Sparse connection between feature maps between $S_2$ and $C_3$ @@ -53,7 +53,7 @@ AlexNet is the first deep convolutional neural network applied to image classifi ### 4.2.2 Model structure -![](img/ch4/alexnet.png) +![](/assets/ch4/alexnet.png) Figure 4.3 AlexNet network structure @@ -100,15 +100,15 @@ ZFNet is a large convolutional network based on AlexNet from $Matthew$ $D. Zeile ### 4.3.2 Model structure -![](img/ch4/image21.jpeg) +![](/assets/ch4/image21.jpeg) Figure 4.4 ZFNet network structure diagram (original structure diagram and AlexNet style structure diagram) As shown in Figure 4.4, ZFNet is similar to AlexNet. It is a convolutional neural network consisting of 8 layers of networks, including 5 layers of convolutional layers and 3 layers of fully connected layers. The biggest difference between the two network architectures is that the ZFNet first-layer convolution replaces the convolution of the first-order convolution kernel $11\times11\times3/4$ in AlexNet with a convolution kernel of $7\times7\times3/2$. nuclear. In Figure 4.5, ZFNet contains more intermediate frequency information in the feature map of the first layer output than AlexNet, while the characteristic map of the first layer output of AlexNet is mostly low frequency or high frequency information, and the lack of intermediate frequency features leads to The characteristics of the subsequent network level as shown in Figure 4.5(c) are not detailed enough, and the root cause of this problem is that the convolution kernel and step size adopted by AlexNet in the first layer are too large. -![](img/ch4/zfnet-layer1.png) +![](/assets/ch4/zfnet-layer1.png) -![](img/ch4/zfnet-layer2.png) +![](/assets/ch4/zfnet-layer2.png) Figure 4.5 (a) Characteristic map of the first layer output of ZFNet (b) Characteristic map of the first layer output of AlexNet (c) Characteristic map of the output of the second layer of AlexNet (d) Characteristic map of the output of the second layer of ZFNet @@ -148,7 +148,7 @@ NetwThe ork In Network (NIN) was proposed by $Min Lin$ et al. to achieve the bes ### 4.4.2 Model Structure -![](img/ch4/image23.jpeg) +![](/assets/ch4/image23.png) Figure 4.6 NIN network structure NIN consists of three layers of multi-layer perceptual convolutional layer (MLPConv Layer). Each layer of multi-layer perceptual convolutional layer is composed of several layers of local fully connected layers and nonlinear activation functions instead of traditional convolutional layers. Linear convolution kernel used. In network inference, the multi-layer perceptron calculates the local features of the input feature map, and the weights of the products corresponding to the local feature maps of each window are shared. The convolution operation is completely consistent, the biggest difference is that the multilayer perceptron performs a nonlinear mapping of local features, while the traditional convolution method is linear. NIN's network parameter configuration table 4.4 is shown (the original paper does not give the network parameters, the parameters in the table are the compiler combined network structure diagram and CIFAR-100 data set with $3\times3$ convolution as an example). @@ -181,7 +181,7 @@ VGGNet is a deep convolutional network structure proposed by the Visual Geometry ### 4.5.2 Model structure -![](img/ch4/vgg16.png) +![](/assets/ch4/vgg16.png) Figure 4.7 VGG16 network structure @@ -225,19 +225,19 @@ Table 4.5 VGG16 network parameter configuration As the winner of the ILSVRC classification task in 2014, GoogLeNet pressured VGGNet and other models with an error rate of 6.65%. Compared with the previous two championships ZFNet and AlexNet, the accuracy of the classification is greatly improved. From the name **GoogLe**Net, you can know that this is a network structure designed by Google engineers, and the name Goog**LeNet** is a tribute to LeNet$^{[0]}$. The core part of GoogLeNet is its internal subnet structure, Inception, which is inspired by NIN and has undergone four iterations (Inception$_{v1-4}$). -![](img/ch4/img_inception_01.png) +![](/assets/ch4/img_inception_01.png) Figure 4.8 Inception performance comparison chart ### 4.6.2 Model Structure -![](img/ch4/image25.jpeg) +![](/assets/ch4/image25.jpeg) Figure 4.9 GoogLeNet network structure As shown in Figure 4.9, GoogLeNet extends the width of the network in addition to the depth of the previous convolutional neural network structure. The entire network is composed of a number of block subnetworks. This subnet constitutes the Inception structure. Figure 4.9 shows four versions of Inception: $Inception_{v1}$ uses different convolution kernels in the same layer and merges the convolution results; $Inception_{v2}$ combines the stacking of different convolution kernels, and The convolution results are merged; $Inception_{v3}$ is a deep combination attempt on the basis of $v_2$; the $Inception_{v4} $ structure is more complex than the previous version, nested in the subnet The internet. -![](img/ch4/img_inception_02.png) -![](img/ch4/img_inception_05.png) -![](img/ch4/img_inception_03.png) -![](img/ch4/img_inception_04.png) +![](/assets/ch4/img_inception_02.png) +![](/assets/ch4/img_inception_05.png) +![](/assets/ch4/img_inception_03.png) +![](/assets/ch4/img_inception_04.png) Figure 4.10 Inception$_{v1-4}$ structure diagram Table 4.6 Inception$_{v1}$ Network Parameter Configuration in GoogLeNet diff --git a/English version/ch04_ClassicNetwork/readme.md b/en-us/ch04_ClassicNetwork/readme.md similarity index 100% rename from English version/ch04_ClassicNetwork/readme.md rename to en-us/ch04_ClassicNetwork/readme.md diff --git a/index.html b/index.html deleted file mode 100644 index f78a8439..00000000 --- a/index.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - 深度学习500问 - - - - - - - - - -
    - - - - - - - - - - - diff --git a/index.md b/index.md new file mode 100644 index 00000000..0fd0fba8 --- /dev/null +++ b/index.md @@ -0,0 +1,25 @@ +--- +# https://vitepress.dev/reference/default-theme-home-page +layout: home + +hero: + name: "DeepLearning-500-questions" + text: "Deep learning Q&A" + tagline: My great project tagline + actions: + - theme: brand + text: Get started! + link: /README + - theme: alt + text: Directory preview + link: /directory + +features: + - title: Feature A + details: Lorem ipsum dolor sit amet, consectetur adipiscing elit + - title: Feature B + details: Lorem ipsum dolor sit amet, consectetur adipiscing elit + - title: Feature C + details: Lorem ipsum dolor sit amet, consectetur adipiscing elit +--- + diff --git a/package.json b/package.json new file mode 100644 index 00000000..4f539d39 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "type": "module", + "devDependencies": { + "markdown-it-mathjax3": "^4.3.2", + "vitepress": "1.2.3" + }, + "scripts": { + "dev": "vitepress dev --host --open", + "build": "vitepress build", + "preview": "pnpm build && vitepress preview --host --open" + } +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 00000000..f9b3ba94 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,1374 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +devDependencies: + markdown-it-mathjax3: + specifier: ^4.3.2 + version: 4.3.2 + vitepress: + specifier: 1.2.3 + version: 1.2.3(@algolia/client-search@4.22.1)(markdown-it-mathjax3@4.3.2)(search-insights@2.13.0) + +packages: + + /@algolia/autocomplete-core@1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1)(search-insights@2.13.0): + resolution: {integrity: sha512-009HdfugtGCdC4JdXUbVJClA0q0zh24yyePn+KUGk3rP7j8FEe/m5Yo/z65gn6nP/cM39PxpzqKrL7A6fP6PPw==} + dependencies: + '@algolia/autocomplete-plugin-algolia-insights': 1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1)(search-insights@2.13.0) + '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1) + transitivePeerDependencies: + - '@algolia/client-search' + - algoliasearch + - search-insights + dev: true + + /@algolia/autocomplete-plugin-algolia-insights@1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1)(search-insights@2.13.0): + resolution: {integrity: sha512-a/yTUkcO/Vyy+JffmAnTWbr4/90cLzw+CC3bRbhnULr/EM0fGNvM13oQQ14f2moLMcVDyAx/leczLlAOovhSZg==} + peerDependencies: + search-insights: '>= 1 < 3' + dependencies: + '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1) + search-insights: 2.13.0 + transitivePeerDependencies: + - '@algolia/client-search' + - algoliasearch + dev: true + + /@algolia/autocomplete-preset-algolia@1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1): + resolution: {integrity: sha512-d4qlt6YmrLMYy95n5TB52wtNDr6EgAIPH81dvvvW8UmuWRgxEtY0NJiPwl/h95JtG2vmRM804M0DSwMCNZlzRA==} + peerDependencies: + '@algolia/client-search': '>= 4.9.1 < 6' + algoliasearch: '>= 4.9.1 < 6' + dependencies: + '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1) + '@algolia/client-search': 4.22.1 + algoliasearch: 4.22.1 + dev: true + + /@algolia/autocomplete-shared@1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1): + resolution: {integrity: sha512-Wnm9E4Ye6Rl6sTTqjoymD+l8DjSTHsHboVRYrKgEt8Q7UHm9nYbqhN/i0fhUYA3OAEH7WA8x3jfpnmJm3rKvaQ==} + peerDependencies: + '@algolia/client-search': '>= 4.9.1 < 6' + algoliasearch: '>= 4.9.1 < 6' + dependencies: + '@algolia/client-search': 4.22.1 + algoliasearch: 4.22.1 + dev: true + + /@algolia/cache-browser-local-storage@4.22.1: + resolution: {integrity: sha512-Sw6IAmOCvvP6QNgY9j+Hv09mvkvEIDKjYW8ow0UDDAxSXy664RBNQk3i/0nt7gvceOJ6jGmOTimaZoY1THmU7g==} + dependencies: + '@algolia/cache-common': 4.22.1 + dev: true + + /@algolia/cache-common@4.22.1: + resolution: {integrity: sha512-TJMBKqZNKYB9TptRRjSUtevJeQVXRmg6rk9qgFKWvOy8jhCPdyNZV1nB3SKGufzvTVbomAukFR8guu/8NRKBTA==} + dev: true + + /@algolia/cache-in-memory@4.22.1: + resolution: {integrity: sha512-ve+6Ac2LhwpufuWavM/aHjLoNz/Z/sYSgNIXsinGofWOysPilQZPUetqLj8vbvi+DHZZaYSEP9H5SRVXnpsNNw==} + dependencies: + '@algolia/cache-common': 4.22.1 + dev: true + + /@algolia/client-account@4.22.1: + resolution: {integrity: sha512-k8m+oegM2zlns/TwZyi4YgCtyToackkOpE+xCaKCYfBfDtdGOaVZCM5YvGPtK+HGaJMIN/DoTL8asbM3NzHonw==} + dependencies: + '@algolia/client-common': 4.22.1 + '@algolia/client-search': 4.22.1 + '@algolia/transporter': 4.22.1 + dev: true + + /@algolia/client-analytics@4.22.1: + resolution: {integrity: sha512-1ssi9pyxyQNN4a7Ji9R50nSdISIumMFDwKNuwZipB6TkauJ8J7ha/uO60sPJFqQyqvvI+px7RSNRQT3Zrvzieg==} + dependencies: + '@algolia/client-common': 4.22.1 + '@algolia/client-search': 4.22.1 + '@algolia/requester-common': 4.22.1 + '@algolia/transporter': 4.22.1 + dev: true + + /@algolia/client-common@4.22.1: + resolution: {integrity: sha512-IvaL5v9mZtm4k4QHbBGDmU3wa/mKokmqNBqPj0K7lcR8ZDKzUorhcGp/u8PkPC/e0zoHSTvRh7TRkGX3Lm7iOQ==} + dependencies: + '@algolia/requester-common': 4.22.1 + '@algolia/transporter': 4.22.1 + dev: true + + /@algolia/client-personalization@4.22.1: + resolution: {integrity: sha512-sl+/klQJ93+4yaqZ7ezOttMQ/nczly/3GmgZXJ1xmoewP5jmdP/X/nV5U7EHHH3hCUEHeN7X1nsIhGPVt9E1cQ==} + dependencies: + '@algolia/client-common': 4.22.1 + '@algolia/requester-common': 4.22.1 + '@algolia/transporter': 4.22.1 + dev: true + + /@algolia/client-search@4.22.1: + resolution: {integrity: sha512-yb05NA4tNaOgx3+rOxAmFztgMTtGBi97X7PC3jyNeGiwkAjOZc2QrdZBYyIdcDLoI09N0gjtpClcackoTN0gPA==} + dependencies: + '@algolia/client-common': 4.22.1 + '@algolia/requester-common': 4.22.1 + '@algolia/transporter': 4.22.1 + dev: true + + /@algolia/logger-common@4.22.1: + resolution: {integrity: sha512-OnTFymd2odHSO39r4DSWRFETkBufnY2iGUZNrMXpIhF5cmFE8pGoINNPzwg02QLBlGSaLqdKy0bM8S0GyqPLBg==} + dev: true + + /@algolia/logger-console@4.22.1: + resolution: {integrity: sha512-O99rcqpVPKN1RlpgD6H3khUWylU24OXlzkavUAMy6QZd1776QAcauE3oP8CmD43nbaTjBexZj2nGsBH9Tc0FVA==} + dependencies: + '@algolia/logger-common': 4.22.1 + dev: true + + /@algolia/requester-browser-xhr@4.22.1: + resolution: {integrity: sha512-dtQGYIg6MteqT1Uay3J/0NDqD+UciHy3QgRbk7bNddOJu+p3hzjTRYESqEnoX/DpEkaNYdRHUKNylsqMpgwaEw==} + dependencies: + '@algolia/requester-common': 4.22.1 + dev: true + + /@algolia/requester-common@4.22.1: + resolution: {integrity: sha512-dgvhSAtg2MJnR+BxrIFqlLtkLlVVhas9HgYKMk2Uxiy5m6/8HZBL40JVAMb2LovoPFs9I/EWIoFVjOrFwzn5Qg==} + dev: true + + /@algolia/requester-node-http@4.22.1: + resolution: {integrity: sha512-JfmZ3MVFQkAU+zug8H3s8rZ6h0ahHZL/SpMaSasTCGYR5EEJsCc8SI5UZ6raPN2tjxa5bxS13BRpGSBUens7EA==} + dependencies: + '@algolia/requester-common': 4.22.1 + dev: true + + /@algolia/transporter@4.22.1: + resolution: {integrity: sha512-kzWgc2c9IdxMa3YqA6TN0NW5VrKYYW/BELIn7vnLyn+U/RFdZ4lxxt9/8yq3DKV5snvoDzzO4ClyejZRdV3lMQ==} + dependencies: + '@algolia/cache-common': 4.22.1 + '@algolia/logger-common': 4.22.1 + '@algolia/requester-common': 4.22.1 + dev: true + + /@babel/helper-string-parser@7.23.4: + resolution: {integrity: sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-validator-identifier@7.22.20: + resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/parser@7.24.5: + resolution: {integrity: sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg==} + engines: {node: '>=6.0.0'} + hasBin: true + dependencies: + '@babel/types': 7.24.0 + dev: true + + /@babel/types@7.24.0: + resolution: {integrity: sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-string-parser': 7.23.4 + '@babel/helper-validator-identifier': 7.22.20 + to-fast-properties: 2.0.0 + dev: true + + /@docsearch/css@3.6.0: + resolution: {integrity: sha512-+sbxb71sWre+PwDK7X2T8+bhS6clcVMLwBPznX45Qu6opJcgRjAp7gYSDzVFp187J+feSj5dNBN1mJoi6ckkUQ==} + dev: true + + /@docsearch/js@3.6.0(@algolia/client-search@4.22.1)(search-insights@2.13.0): + resolution: {integrity: sha512-QujhqINEElrkIfKwyyyTfbsfMAYCkylInLYMRqHy7PHc8xTBQCow73tlo/Kc7oIwBrCLf0P3YhjlOeV4v8hevQ==} + dependencies: + '@docsearch/react': 3.6.0(@algolia/client-search@4.22.1)(search-insights@2.13.0) + preact: 10.19.6 + transitivePeerDependencies: + - '@algolia/client-search' + - '@types/react' + - react + - react-dom + - search-insights + dev: true + + /@docsearch/react@3.6.0(@algolia/client-search@4.22.1)(search-insights@2.13.0): + resolution: {integrity: sha512-HUFut4ztcVNmqy9gp/wxNbC7pTOHhgVVkHVGCACTuLhUKUhKAF9KYHJtMiLUJxEqiFLQiuri1fWF8zqwM/cu1w==} + peerDependencies: + '@types/react': '>= 16.8.0 < 19.0.0' + react: '>= 16.8.0 < 19.0.0' + react-dom: '>= 16.8.0 < 19.0.0' + search-insights: '>= 1 < 3' + peerDependenciesMeta: + '@types/react': + optional: true + react: + optional: true + react-dom: + optional: true + search-insights: + optional: true + dependencies: + '@algolia/autocomplete-core': 1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1)(search-insights@2.13.0) + '@algolia/autocomplete-preset-algolia': 1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1) + '@docsearch/css': 3.6.0 + algoliasearch: 4.22.1 + search-insights: 2.13.0 + transitivePeerDependencies: + - '@algolia/client-search' + dev: true + + /@esbuild/aix-ppc64@0.21.5: + resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm64@0.21.5: + resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm@0.21.5: + resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64@0.21.5: + resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64@0.21.5: + resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64@0.21.5: + resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64@0.21.5: + resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64@0.21.5: + resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64@0.21.5: + resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm@0.21.5: + resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32@0.21.5: + resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-loong64@0.21.5: + resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el@0.21.5: + resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64@0.21.5: + resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64@0.21.5: + resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x@0.21.5: + resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64@0.21.5: + resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64@0.21.5: + resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-x64@0.21.5: + resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/sunos-x64@0.21.5: + resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64@0.21.5: + resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32@0.21.5: + resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64@0.21.5: + resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@jridgewell/sourcemap-codec@1.4.15: + resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + dev: true + + /@rollup/rollup-android-arm-eabi@4.17.2: + resolution: {integrity: sha512-NM0jFxY8bB8QLkoKxIQeObCaDlJKewVlIEkuyYKm5An1tdVZ966w2+MPQ2l8LBZLjR+SgyV+nRkTIunzOYBMLQ==} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-android-arm64@4.17.2: + resolution: {integrity: sha512-yeX/Usk7daNIVwkq2uGoq2BYJKZY1JfyLTaHO/jaiSwi/lsf8fTFoQW/n6IdAsx5tx+iotu2zCJwz8MxI6D/Bw==} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-arm64@4.17.2: + resolution: {integrity: sha512-kcMLpE6uCwls023+kknm71ug7MZOrtXo+y5p/tsg6jltpDtgQY1Eq5sGfHcQfb+lfuKwhBmEURDga9N0ol4YPw==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-x64@4.17.2: + resolution: {integrity: sha512-AtKwD0VEx0zWkL0ZjixEkp5tbNLzX+FCqGG1SvOu993HnSz4qDI6S4kGzubrEJAljpVkhRSlg5bzpV//E6ysTQ==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm-gnueabihf@4.17.2: + resolution: {integrity: sha512-3reX2fUHqN7sffBNqmEyMQVj/CKhIHZd4y631duy0hZqI8Qoqf6lTtmAKvJFYa6bhU95B1D0WgzHkmTg33In0A==} + cpu: [arm] + os: [linux] + libc: [glibc] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm-musleabihf@4.17.2: + resolution: {integrity: sha512-uSqpsp91mheRgw96xtyAGP9FW5ChctTFEoXP0r5FAzj/3ZRv3Uxjtc7taRQSaQM/q85KEKjKsZuiZM3GyUivRg==} + cpu: [arm] + os: [linux] + libc: [musl] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-gnu@4.17.2: + resolution: {integrity: sha512-EMMPHkiCRtE8Wdk3Qhtciq6BndLtstqZIroHiiGzB3C5LDJmIZcSzVtLRbwuXuUft1Cnv+9fxuDtDxz3k3EW2A==} + cpu: [arm64] + os: [linux] + libc: [glibc] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-musl@4.17.2: + resolution: {integrity: sha512-NMPylUUZ1i0z/xJUIx6VUhISZDRT+uTWpBcjdv0/zkp7b/bQDF+NfnfdzuTiB1G6HTodgoFa93hp0O1xl+/UbA==} + cpu: [arm64] + os: [linux] + libc: [musl] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-powerpc64le-gnu@4.17.2: + resolution: {integrity: sha512-T19My13y8uYXPw/L/k0JYaX1fJKFT/PWdXiHr8mTbXWxjVF1t+8Xl31DgBBvEKclw+1b00Chg0hxE2O7bTG7GQ==} + cpu: [ppc64] + os: [linux] + libc: [glibc] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-riscv64-gnu@4.17.2: + resolution: {integrity: sha512-BOaNfthf3X3fOWAB+IJ9kxTgPmMqPPH5f5k2DcCsRrBIbWnaJCgX2ll77dV1TdSy9SaXTR5iDXRL8n7AnoP5cg==} + cpu: [riscv64] + os: [linux] + libc: [glibc] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-s390x-gnu@4.17.2: + resolution: {integrity: sha512-W0UP/x7bnn3xN2eYMql2T/+wpASLE5SjObXILTMPUBDB/Fg/FxC+gX4nvCfPBCbNhz51C+HcqQp2qQ4u25ok6g==} + cpu: [s390x] + os: [linux] + libc: [glibc] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-gnu@4.17.2: + resolution: {integrity: sha512-Hy7pLwByUOuyaFC6mAr7m+oMC+V7qyifzs/nW2OJfC8H4hbCzOX07Ov0VFk/zP3kBsELWNFi7rJtgbKYsav9QQ==} + cpu: [x64] + os: [linux] + libc: [glibc] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-musl@4.17.2: + resolution: {integrity: sha512-h1+yTWeYbRdAyJ/jMiVw0l6fOOm/0D1vNLui9iPuqgRGnXA0u21gAqOyB5iHjlM9MMfNOm9RHCQ7zLIzT0x11Q==} + cpu: [x64] + os: [linux] + libc: [musl] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-arm64-msvc@4.17.2: + resolution: {integrity: sha512-tmdtXMfKAjy5+IQsVtDiCfqbynAQE/TQRpWdVataHmhMb9DCoJxp9vLcCBjEQWMiUYxO1QprH/HbY9ragCEFLA==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-ia32-msvc@4.17.2: + resolution: {integrity: sha512-7II/QCSTAHuE5vdZaQEwJq2ZACkBpQDOmQsE6D6XUbnBHW8IAhm4eTufL6msLJorzrHDFv3CF8oCA/hSIRuZeQ==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-x64-msvc@4.17.2: + resolution: {integrity: sha512-TGGO7v7qOq4CYmSBVEYpI1Y5xDuCEnbVC5Vth8mOsW0gDSzxNrVERPc790IGHsrT2dQSimgMr9Ub3Y1Jci5/8w==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@shikijs/core@1.9.1: + resolution: {integrity: sha512-EmUful2MQtY8KgCF1OkBtOuMcvaZEvmdubhW0UHCGXi21O9dRLeADVCj+k6ZS+de7Mz9d2qixOXJ+GLhcK3pXg==} + dev: true + + /@shikijs/transformers@1.9.1: + resolution: {integrity: sha512-wPrGTpBURQ95IKPIhPQE3bGsANpPPtea1+aVHZp0aYtgxfL5UM3QbJ5rNdCuhcyjz/JNp5ZvSItOr+ayJxebJQ==} + dependencies: + shiki: 1.9.1 + dev: true + + /@types/estree@1.0.5: + resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + dev: true + + /@types/linkify-it@5.0.0: + resolution: {integrity: sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==} + dev: true + + /@types/markdown-it@14.1.1: + resolution: {integrity: sha512-4NpsnpYl2Gt1ljyBGrKMxFYAYvpqbnnkgP/i/g+NLpjEUa3obn1XJCur9YbEXKDAkaXqsR1LbDnGEJ0MmKFxfg==} + dependencies: + '@types/linkify-it': 5.0.0 + '@types/mdurl': 2.0.0 + dev: true + + /@types/mdurl@2.0.0: + resolution: {integrity: sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==} + dev: true + + /@types/web-bluetooth@0.0.20: + resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} + dev: true + + /@vitejs/plugin-vue@5.0.5(vite@5.3.1)(vue@3.4.27): + resolution: {integrity: sha512-LOjm7XeIimLBZyzinBQ6OSm3UBCNVCpLkxGC0oWmm2YPzVZoxMsdvNVimLTBzpAnR9hl/yn1SHGuRfe6/Td9rQ==} + engines: {node: ^18.0.0 || >=20.0.0} + peerDependencies: + vite: ^5.0.0 + vue: ^3.2.25 + dependencies: + vite: 5.3.1 + vue: 3.4.27 + dev: true + + /@vue/compiler-core@3.4.27: + resolution: {integrity: sha512-E+RyqY24KnyDXsCuQrI+mlcdW3ALND6U7Gqa/+bVwbcpcR3BRRIckFoz7Qyd4TTlnugtwuI7YgjbvsLmxb+yvg==} + dependencies: + '@babel/parser': 7.24.5 + '@vue/shared': 3.4.27 + entities: 4.5.0 + estree-walker: 2.0.2 + source-map-js: 1.2.0 + dev: true + + /@vue/compiler-dom@3.4.27: + resolution: {integrity: sha512-kUTvochG/oVgE1w5ViSr3KUBh9X7CWirebA3bezTbB5ZKBQZwR2Mwj9uoSKRMFcz4gSMzzLXBPD6KpCLb9nvWw==} + dependencies: + '@vue/compiler-core': 3.4.27 + '@vue/shared': 3.4.27 + dev: true + + /@vue/compiler-sfc@3.4.27: + resolution: {integrity: sha512-nDwntUEADssW8e0rrmE0+OrONwmRlegDA1pD6QhVeXxjIytV03yDqTey9SBDiALsvAd5U4ZrEKbMyVXhX6mCGA==} + dependencies: + '@babel/parser': 7.24.5 + '@vue/compiler-core': 3.4.27 + '@vue/compiler-dom': 3.4.27 + '@vue/compiler-ssr': 3.4.27 + '@vue/shared': 3.4.27 + estree-walker: 2.0.2 + magic-string: 0.30.10 + postcss: 8.4.38 + source-map-js: 1.2.0 + dev: true + + /@vue/compiler-ssr@3.4.27: + resolution: {integrity: sha512-CVRzSJIltzMG5FcidsW0jKNQnNRYC8bT21VegyMMtHmhW3UOI7knmUehzswXLrExDLE6lQCZdrhD4ogI7c+vuw==} + dependencies: + '@vue/compiler-dom': 3.4.27 + '@vue/shared': 3.4.27 + dev: true + + /@vue/devtools-api@7.3.4: + resolution: {integrity: sha512-E5dJlLW+NgGb+WS33y99ioOJL2OXpVhje6VwXGJ/q5fNizJDpe67Ml0GBSrlYOKNSjZs2mwcZd7B3e12th3Q0g==} + dependencies: + '@vue/devtools-kit': 7.3.4 + dev: true + + /@vue/devtools-kit@7.3.4: + resolution: {integrity: sha512-DalQZWaFLRyA4qfKT0WT7e+q2AwvYoTwd0pWqswHqcpviXw+oU6FlSJHMrEACB3lBHjN1KBS9Kh527sWIe1vcg==} + dependencies: + '@vue/devtools-shared': 7.3.4 + birpc: 0.2.17 + hookable: 5.5.3 + mitt: 3.0.1 + perfect-debounce: 1.0.0 + speakingurl: 14.0.1 + superjson: 2.2.1 + dev: true + + /@vue/devtools-shared@7.3.4: + resolution: {integrity: sha512-5S5cHh7oWLZdboujnLteR3rT8UGfKHfA34aGLyFRB/B5TqBxmeLW1Rq32xW6TCDEy4isoYsYHGwJVp6DQcpiDA==} + dependencies: + rfdc: 1.4.1 + dev: true + + /@vue/reactivity@3.4.27: + resolution: {integrity: sha512-kK0g4NknW6JX2yySLpsm2jlunZJl2/RJGZ0H9ddHdfBVHcNzxmQ0sS0b09ipmBoQpY8JM2KmUw+a6sO8Zo+zIA==} + dependencies: + '@vue/shared': 3.4.27 + dev: true + + /@vue/runtime-core@3.4.27: + resolution: {integrity: sha512-7aYA9GEbOOdviqVvcuweTLe5Za4qBZkUY7SvET6vE8kyypxVgaT1ixHLg4urtOlrApdgcdgHoTZCUuTGap/5WA==} + dependencies: + '@vue/reactivity': 3.4.27 + '@vue/shared': 3.4.27 + dev: true + + /@vue/runtime-dom@3.4.27: + resolution: {integrity: sha512-ScOmP70/3NPM+TW9hvVAz6VWWtZJqkbdf7w6ySsws+EsqtHvkhxaWLecrTorFxsawelM5Ys9FnDEMt6BPBDS0Q==} + dependencies: + '@vue/runtime-core': 3.4.27 + '@vue/shared': 3.4.27 + csstype: 3.1.3 + dev: true + + /@vue/server-renderer@3.4.27(vue@3.4.27): + resolution: {integrity: sha512-dlAMEuvmeA3rJsOMJ2J1kXU7o7pOxgsNHVr9K8hB3ImIkSuBrIdy0vF66h8gf8Tuinf1TK3mPAz2+2sqyf3KzA==} + peerDependencies: + vue: 3.4.27 + dependencies: + '@vue/compiler-ssr': 3.4.27 + '@vue/shared': 3.4.27 + vue: 3.4.27 + dev: true + + /@vue/shared@3.4.27: + resolution: {integrity: sha512-DL3NmY2OFlqmYYrzp39yi3LDkKxa5vZVwxWdQ3rG0ekuWscHraeIbnI8t+aZK7qhYqEqWKTUdijadunb9pnrgA==} + dev: true + + /@vueuse/core@10.11.0(vue@3.4.27): + resolution: {integrity: sha512-x3sD4Mkm7PJ+pcq3HX8PLPBadXCAlSDR/waK87dz0gQE+qJnaaFhc/dZVfJz+IUYzTMVGum2QlR7ImiJQN4s6g==} + dependencies: + '@types/web-bluetooth': 0.0.20 + '@vueuse/metadata': 10.11.0 + '@vueuse/shared': 10.11.0(vue@3.4.27) + vue-demi: 0.14.8(vue@3.4.27) + transitivePeerDependencies: + - '@vue/composition-api' + - vue + dev: true + + /@vueuse/integrations@10.11.0(focus-trap@7.5.4)(vue@3.4.27): + resolution: {integrity: sha512-Pp6MtWEIr+NDOccWd8j59Kpjy5YDXogXI61Kb1JxvSfVBO8NzFQkmrKmSZz47i+ZqHnIzxaT38L358yDHTncZg==} + peerDependencies: + async-validator: ^4 + axios: ^1 + change-case: ^4 + drauu: ^0.3 + focus-trap: ^7 + fuse.js: ^6 + idb-keyval: ^6 + jwt-decode: ^3 + nprogress: ^0.2 + qrcode: ^1.5 + sortablejs: ^1 + universal-cookie: ^6 + peerDependenciesMeta: + async-validator: + optional: true + axios: + optional: true + change-case: + optional: true + drauu: + optional: true + focus-trap: + optional: true + fuse.js: + optional: true + idb-keyval: + optional: true + jwt-decode: + optional: true + nprogress: + optional: true + qrcode: + optional: true + sortablejs: + optional: true + universal-cookie: + optional: true + dependencies: + '@vueuse/core': 10.11.0(vue@3.4.27) + '@vueuse/shared': 10.11.0(vue@3.4.27) + focus-trap: 7.5.4 + vue-demi: 0.14.8(vue@3.4.27) + transitivePeerDependencies: + - '@vue/composition-api' + - vue + dev: true + + /@vueuse/metadata@10.11.0: + resolution: {integrity: sha512-kQX7l6l8dVWNqlqyN3ePW3KmjCQO3ZMgXuBMddIu83CmucrsBfXlH+JoviYyRBws/yLTQO8g3Pbw+bdIoVm4oQ==} + dev: true + + /@vueuse/shared@10.11.0(vue@3.4.27): + resolution: {integrity: sha512-fyNoIXEq3PfX1L3NkNhtVQUSRtqYwJtJg+Bp9rIzculIZWHTkKSysujrOk2J+NrRulLTQH9+3gGSfYLWSEWU1A==} + dependencies: + vue-demi: 0.14.8(vue@3.4.27) + transitivePeerDependencies: + - '@vue/composition-api' + - vue + dev: true + + /algoliasearch@4.22.1: + resolution: {integrity: sha512-jwydKFQJKIx9kIZ8Jm44SdpigFwRGPESaxZBaHSV0XWN2yBJAOT4mT7ppvlrpA4UGzz92pqFnVKr/kaZXrcreg==} + dependencies: + '@algolia/cache-browser-local-storage': 4.22.1 + '@algolia/cache-common': 4.22.1 + '@algolia/cache-in-memory': 4.22.1 + '@algolia/client-account': 4.22.1 + '@algolia/client-analytics': 4.22.1 + '@algolia/client-common': 4.22.1 + '@algolia/client-personalization': 4.22.1 + '@algolia/client-search': 4.22.1 + '@algolia/logger-common': 4.22.1 + '@algolia/logger-console': 4.22.1 + '@algolia/requester-browser-xhr': 4.22.1 + '@algolia/requester-common': 4.22.1 + '@algolia/requester-node-http': 4.22.1 + '@algolia/transporter': 4.22.1 + dev: true + + /ansi-colors@4.1.3: + resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} + engines: {node: '>=6'} + dev: true + + /birpc@0.2.17: + resolution: {integrity: sha512-+hkTxhot+dWsLpp3gia5AkVHIsKlZybNT5gIYiDlNzJrmYPcTM9k5/w2uaj3IPpd7LlEYpmCj4Jj1nC41VhDFg==} + dev: true + + /boolbase@1.0.0: + resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} + dev: true + + /cheerio-select@1.6.0: + resolution: {integrity: sha512-eq0GdBvxVFbqWgmCm7M3XGs1I8oLy/nExUnh6oLqmBditPO9AqQJrkslDpMun/hZ0yyTs8L0m85OHp4ho6Qm9g==} + dependencies: + css-select: 4.3.0 + css-what: 6.1.0 + domelementtype: 2.3.0 + domhandler: 4.3.1 + domutils: 2.8.0 + dev: true + + /cheerio@1.0.0-rc.10: + resolution: {integrity: sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw==} + engines: {node: '>= 6'} + dependencies: + cheerio-select: 1.6.0 + dom-serializer: 1.4.1 + domhandler: 4.3.1 + htmlparser2: 6.1.0 + parse5: 6.0.1 + parse5-htmlparser2-tree-adapter: 6.0.1 + tslib: 2.6.2 + dev: true + + /commander@6.2.1: + resolution: {integrity: sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==} + engines: {node: '>= 6'} + dev: true + + /commander@9.2.0: + resolution: {integrity: sha512-e2i4wANQiSXgnrBlIatyHtP1odfUp0BbV5Y5nEGbxtIrStkEOAAzCUirvLBNXHLr7kwLvJl6V+4V3XV9x7Wd9w==} + engines: {node: ^12.20.0 || >=14} + dev: true + + /copy-anything@3.0.5: + resolution: {integrity: sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==} + engines: {node: '>=12.13'} + dependencies: + is-what: 4.1.16 + dev: true + + /css-select@4.3.0: + resolution: {integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==} + dependencies: + boolbase: 1.0.0 + css-what: 6.1.0 + domhandler: 4.3.1 + domutils: 2.8.0 + nth-check: 2.1.1 + dev: true + + /css-what@6.1.0: + resolution: {integrity: sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==} + engines: {node: '>= 6'} + dev: true + + /csstype@3.1.3: + resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + dev: true + + /dom-serializer@1.4.1: + resolution: {integrity: sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==} + dependencies: + domelementtype: 2.3.0 + domhandler: 4.3.1 + entities: 2.2.0 + dev: true + + /domelementtype@2.3.0: + resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} + dev: true + + /domhandler@3.3.0: + resolution: {integrity: sha512-J1C5rIANUbuYK+FuFL98650rihynUOEzRLxW+90bKZRWB6A1X1Tf82GxR1qAWLyfNPRvjqfip3Q5tdYlmAa9lA==} + engines: {node: '>= 4'} + dependencies: + domelementtype: 2.3.0 + dev: true + + /domhandler@4.3.1: + resolution: {integrity: sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==} + engines: {node: '>= 4'} + dependencies: + domelementtype: 2.3.0 + dev: true + + /domutils@2.8.0: + resolution: {integrity: sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==} + dependencies: + dom-serializer: 1.4.1 + domelementtype: 2.3.0 + domhandler: 4.3.1 + dev: true + + /entities@2.2.0: + resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==} + dev: true + + /entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + dev: true + + /esbuild@0.21.5: + resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.21.5 + '@esbuild/android-arm': 0.21.5 + '@esbuild/android-arm64': 0.21.5 + '@esbuild/android-x64': 0.21.5 + '@esbuild/darwin-arm64': 0.21.5 + '@esbuild/darwin-x64': 0.21.5 + '@esbuild/freebsd-arm64': 0.21.5 + '@esbuild/freebsd-x64': 0.21.5 + '@esbuild/linux-arm': 0.21.5 + '@esbuild/linux-arm64': 0.21.5 + '@esbuild/linux-ia32': 0.21.5 + '@esbuild/linux-loong64': 0.21.5 + '@esbuild/linux-mips64el': 0.21.5 + '@esbuild/linux-ppc64': 0.21.5 + '@esbuild/linux-riscv64': 0.21.5 + '@esbuild/linux-s390x': 0.21.5 + '@esbuild/linux-x64': 0.21.5 + '@esbuild/netbsd-x64': 0.21.5 + '@esbuild/openbsd-x64': 0.21.5 + '@esbuild/sunos-x64': 0.21.5 + '@esbuild/win32-arm64': 0.21.5 + '@esbuild/win32-ia32': 0.21.5 + '@esbuild/win32-x64': 0.21.5 + dev: true + + /escape-goat@3.0.0: + resolution: {integrity: sha512-w3PwNZJwRxlp47QGzhuEBldEqVHHhh8/tIPcl6ecf2Bou99cdAt0knihBV0Ecc7CGxYduXVBDheH1K2oADRlvw==} + engines: {node: '>=10'} + dev: true + + /esm@3.2.25: + resolution: {integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==} + engines: {node: '>=6'} + dev: true + + /estree-walker@2.0.2: + resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + dev: true + + /focus-trap@7.5.4: + resolution: {integrity: sha512-N7kHdlgsO/v+iD/dMoJKtsSqs5Dz/dXZVebRgJw23LDk+jMi/974zyiOYDziY2JPp8xivq9BmUGwIJMiuSBi7w==} + dependencies: + tabbable: 6.2.0 + dev: true + + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /hookable@5.5.3: + resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==} + dev: true + + /htmlparser2@5.0.1: + resolution: {integrity: sha512-vKZZra6CSe9qsJzh0BjBGXo8dvzNsq/oGvsjfRdOrrryfeD9UOBEEQdeoqCRmKZchF5h2zOBMQ6YuQ0uRUmdbQ==} + dependencies: + domelementtype: 2.3.0 + domhandler: 3.3.0 + domutils: 2.8.0 + entities: 2.2.0 + dev: true + + /htmlparser2@6.1.0: + resolution: {integrity: sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==} + dependencies: + domelementtype: 2.3.0 + domhandler: 4.3.1 + domutils: 2.8.0 + entities: 2.2.0 + dev: true + + /is-what@4.1.16: + resolution: {integrity: sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==} + engines: {node: '>=12.13'} + dev: true + + /juice@8.1.0: + resolution: {integrity: sha512-FLzurJrx5Iv1e7CfBSZH68dC04EEvXvvVvPYB7Vx1WAuhCp1ZPIMtqxc+WTWxVkpTIC2Ach/GAv0rQbtGf6YMA==} + engines: {node: '>=10.0.0'} + hasBin: true + dependencies: + cheerio: 1.0.0-rc.10 + commander: 6.2.1 + mensch: 0.3.4 + slick: 1.12.2 + web-resource-inliner: 6.0.1 + transitivePeerDependencies: + - encoding + dev: true + + /magic-string@0.30.10: + resolution: {integrity: sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + + /mark.js@8.11.1: + resolution: {integrity: sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==} + dev: true + + /markdown-it-mathjax3@4.3.2: + resolution: {integrity: sha512-TX3GW5NjmupgFtMJGRauioMbbkGsOXAAt1DZ/rzzYmTHqzkO1rNAdiMD4NiruurToPApn2kYy76x02QN26qr2w==} + dependencies: + juice: 8.1.0 + mathjax-full: 3.2.2 + transitivePeerDependencies: + - encoding + dev: true + + /mathjax-full@3.2.2: + resolution: {integrity: sha512-+LfG9Fik+OuI8SLwsiR02IVdjcnRCy5MufYLi0C3TdMT56L/pjB0alMVGgoWJF8pN9Rc7FESycZB9BMNWIid5w==} + dependencies: + esm: 3.2.25 + mhchemparser: 4.2.1 + mj-context-menu: 0.6.1 + speech-rule-engine: 4.0.7 + dev: true + + /mensch@0.3.4: + resolution: {integrity: sha512-IAeFvcOnV9V0Yk+bFhYR07O3yNina9ANIN5MoXBKYJ/RLYPurd2d0yw14MDhpr9/momp0WofT1bPUh3hkzdi/g==} + dev: true + + /mhchemparser@4.2.1: + resolution: {integrity: sha512-kYmyrCirqJf3zZ9t/0wGgRZ4/ZJw//VwaRVGA75C4nhE60vtnIzhl9J9ndkX/h6hxSN7pjg/cE0VxbnNM+bnDQ==} + dev: true + + /mime@2.6.0: + resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} + engines: {node: '>=4.0.0'} + hasBin: true + dev: true + + /minisearch@6.3.0: + resolution: {integrity: sha512-ihFnidEeU8iXzcVHy74dhkxh/dn8Dc08ERl0xwoMMGqp4+LvRSCgicb+zGqWthVokQKvCSxITlh3P08OzdTYCQ==} + dev: true + + /mitt@3.0.1: + resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} + dev: true + + /mj-context-menu@0.6.1: + resolution: {integrity: sha512-7NO5s6n10TIV96d4g2uDpG7ZDpIhMh0QNfGdJw/W47JswFcosz457wqz/b5sAKvl12sxINGFCn80NZHKwxQEXA==} + dev: true + + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: true + + /node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + dependencies: + whatwg-url: 5.0.0 + dev: true + + /nth-check@2.1.1: + resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} + dependencies: + boolbase: 1.0.0 + dev: true + + /parse5-htmlparser2-tree-adapter@6.0.1: + resolution: {integrity: sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==} + dependencies: + parse5: 6.0.1 + dev: true + + /parse5@6.0.1: + resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} + dev: true + + /perfect-debounce@1.0.0: + resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} + dev: true + + /picocolors@1.0.0: + resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + dev: true + + /postcss@8.4.38: + resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.0 + source-map-js: 1.2.0 + dev: true + + /preact@10.19.6: + resolution: {integrity: sha512-gympg+T2Z1fG1unB8NH29yHJwnEaCH37Z32diPDku316OTnRPeMbiRV9kTrfZpocXjdfnWuFUl/Mj4BHaf6gnw==} + dev: true + + /rfdc@1.4.1: + resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} + dev: true + + /rollup@4.17.2: + resolution: {integrity: sha512-/9ClTJPByC0U4zNLowV1tMBe8yMEAxewtR3cUNX5BoEpGH3dQEWpJLr6CLp0fPdYRF/fzVOgvDb1zXuakwF5kQ==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + dependencies: + '@types/estree': 1.0.5 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.17.2 + '@rollup/rollup-android-arm64': 4.17.2 + '@rollup/rollup-darwin-arm64': 4.17.2 + '@rollup/rollup-darwin-x64': 4.17.2 + '@rollup/rollup-linux-arm-gnueabihf': 4.17.2 + '@rollup/rollup-linux-arm-musleabihf': 4.17.2 + '@rollup/rollup-linux-arm64-gnu': 4.17.2 + '@rollup/rollup-linux-arm64-musl': 4.17.2 + '@rollup/rollup-linux-powerpc64le-gnu': 4.17.2 + '@rollup/rollup-linux-riscv64-gnu': 4.17.2 + '@rollup/rollup-linux-s390x-gnu': 4.17.2 + '@rollup/rollup-linux-x64-gnu': 4.17.2 + '@rollup/rollup-linux-x64-musl': 4.17.2 + '@rollup/rollup-win32-arm64-msvc': 4.17.2 + '@rollup/rollup-win32-ia32-msvc': 4.17.2 + '@rollup/rollup-win32-x64-msvc': 4.17.2 + fsevents: 2.3.3 + dev: true + + /search-insights@2.13.0: + resolution: {integrity: sha512-Orrsjf9trHHxFRuo9/rzm0KIWmgzE8RMlZMzuhZOJ01Rnz3D0YBAe+V6473t6/H6c7irs6Lt48brULAiRWb3Vw==} + dev: true + + /shiki@1.9.1: + resolution: {integrity: sha512-8PDkgb5ja3nfujTjvC4VytL6wGOGCtFAClUb2r3QROevYXxcq+/shVJK5s6gy0HZnjaJgFxd6BpPqpRfqne5rA==} + dependencies: + '@shikijs/core': 1.9.1 + dev: true + + /slick@1.12.2: + resolution: {integrity: sha512-4qdtOGcBjral6YIBCWJ0ljFSKNLz9KkhbWtuGvUyRowl1kxfuE1x/Z/aJcaiilpb3do9bl5K7/1h9XC5wWpY/A==} + dev: true + + /source-map-js@1.2.0: + resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} + engines: {node: '>=0.10.0'} + dev: true + + /speakingurl@14.0.1: + resolution: {integrity: sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==} + engines: {node: '>=0.10.0'} + dev: true + + /speech-rule-engine@4.0.7: + resolution: {integrity: sha512-sJrL3/wHzNwJRLBdf6CjJWIlxC04iYKkyXvYSVsWVOiC2DSkHmxsqOhEeMsBA9XK+CHuNcsdkbFDnoUfAsmp9g==} + hasBin: true + dependencies: + commander: 9.2.0 + wicked-good-xpath: 1.3.0 + xmldom-sre: 0.1.31 + dev: true + + /superjson@2.2.1: + resolution: {integrity: sha512-8iGv75BYOa0xRJHK5vRLEjE2H/i4lulTjzpUXic3Eg8akftYjkmQDa8JARQ42rlczXyFR3IeRoeFCc7RxHsYZA==} + engines: {node: '>=16'} + dependencies: + copy-anything: 3.0.5 + dev: true + + /tabbable@6.2.0: + resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==} + dev: true + + /to-fast-properties@2.0.0: + resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} + engines: {node: '>=4'} + dev: true + + /tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + dev: true + + /tslib@2.6.2: + resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + dev: true + + /valid-data-url@3.0.1: + resolution: {integrity: sha512-jOWVmzVceKlVVdwjNSenT4PbGghU0SBIizAev8ofZVgivk/TVHXSbNL8LP6M3spZvkR9/QolkyJavGSX5Cs0UA==} + engines: {node: '>=10'} + dev: true + + /vite@5.3.1: + resolution: {integrity: sha512-XBmSKRLXLxiaPYamLv3/hnP/KXDai1NDexN0FpkTaZXTfycHvkRHoenpgl/fvuK/kPbB6xAgoyiryAhQNxYmAQ==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@types/node': ^18.0.0 || >=20.0.0 + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + dependencies: + esbuild: 0.21.5 + postcss: 8.4.38 + rollup: 4.17.2 + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /vitepress@1.2.3(@algolia/client-search@4.22.1)(markdown-it-mathjax3@4.3.2)(search-insights@2.13.0): + resolution: {integrity: sha512-GvEsrEeNLiDE1+fuwDAYJCYLNZDAna+EtnXlPajhv/MYeTjbNK6Bvyg6NoTdO1sbwuQJ0vuJR99bOlH53bo6lg==} + hasBin: true + peerDependencies: + markdown-it-mathjax3: ^4 + postcss: ^8 + peerDependenciesMeta: + markdown-it-mathjax3: + optional: true + postcss: + optional: true + dependencies: + '@docsearch/css': 3.6.0 + '@docsearch/js': 3.6.0(@algolia/client-search@4.22.1)(search-insights@2.13.0) + '@shikijs/core': 1.9.1 + '@shikijs/transformers': 1.9.1 + '@types/markdown-it': 14.1.1 + '@vitejs/plugin-vue': 5.0.5(vite@5.3.1)(vue@3.4.27) + '@vue/devtools-api': 7.3.4 + '@vue/shared': 3.4.27 + '@vueuse/core': 10.11.0(vue@3.4.27) + '@vueuse/integrations': 10.11.0(focus-trap@7.5.4)(vue@3.4.27) + focus-trap: 7.5.4 + mark.js: 8.11.1 + markdown-it-mathjax3: 4.3.2 + minisearch: 6.3.0 + shiki: 1.9.1 + vite: 5.3.1 + vue: 3.4.27 + transitivePeerDependencies: + - '@algolia/client-search' + - '@types/node' + - '@types/react' + - '@vue/composition-api' + - async-validator + - axios + - change-case + - drauu + - fuse.js + - idb-keyval + - jwt-decode + - less + - lightningcss + - nprogress + - qrcode + - react + - react-dom + - sass + - search-insights + - sortablejs + - stylus + - sugarss + - terser + - typescript + - universal-cookie + dev: true + + /vue-demi@0.14.8(vue@3.4.27): + resolution: {integrity: sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + peerDependencies: + '@vue/composition-api': ^1.0.0-rc.1 + vue: ^3.0.0-0 || ^2.6.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + dependencies: + vue: 3.4.27 + dev: true + + /vue@3.4.27: + resolution: {integrity: sha512-8s/56uK6r01r1icG/aEOHqyMVxd1bkYcSe9j8HcKtr/xTOFWvnzIVTehNW+5Yt89f+DLBe4A569pnZLS5HzAMA==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@vue/compiler-dom': 3.4.27 + '@vue/compiler-sfc': 3.4.27 + '@vue/runtime-dom': 3.4.27 + '@vue/server-renderer': 3.4.27(vue@3.4.27) + '@vue/shared': 3.4.27 + dev: true + + /web-resource-inliner@6.0.1: + resolution: {integrity: sha512-kfqDxt5dTB1JhqsCUQVFDj0rmY+4HLwGQIsLPbyrsN9y9WV/1oFDSx3BQ4GfCv9X+jVeQ7rouTqwK53rA/7t8A==} + engines: {node: '>=10.0.0'} + dependencies: + ansi-colors: 4.1.3 + escape-goat: 3.0.0 + htmlparser2: 5.0.1 + mime: 2.6.0 + node-fetch: 2.7.0 + valid-data-url: 3.0.1 + transitivePeerDependencies: + - encoding + dev: true + + /webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + dev: true + + /whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + dev: true + + /wicked-good-xpath@1.3.0: + resolution: {integrity: sha512-Gd9+TUn5nXdwj/hFsPVx5cuHHiF5Bwuc30jZ4+ronF1qHK5O7HD0sgmXWSEgwKquT3ClLoKPVbO6qGwVwLzvAw==} + dev: true + + /xmldom-sre@0.1.31: + resolution: {integrity: sha512-f9s+fUkX04BxQf+7mMWAp5zk61pciie+fFLC9hX9UVvCeJQfNHRHXpeo5MPcR0EUf57PYLdt+ZO4f3Ipk2oZUw==} + engines: {node: '>=0.1'} + dev: true diff --git a/English version/ch01_MathematicalBasis/img/ch1/conditional_probability.jpg b/public/assets/ch1/conditional_probability.jpg similarity index 100% rename from English version/ch01_MathematicalBasis/img/ch1/conditional_probability.jpg rename to public/assets/ch1/conditional_probability.jpg diff --git a/English version/ch01_MathematicalBasis/img/ch1/prob_distribution_1.png b/public/assets/ch1/prob_distribution_1.png similarity index 100% rename from English version/ch01_MathematicalBasis/img/ch1/prob_distribution_1.png rename to public/assets/ch1/prob_distribution_1.png diff --git a/English version/ch01_MathematicalBasis/img/ch1/prob_distribution_2.png b/public/assets/ch1/prob_distribution_2.png similarity index 100% rename from English version/ch01_MathematicalBasis/img/ch1/prob_distribution_2.png rename to public/assets/ch1/prob_distribution_2.png diff --git a/English version/ch01_MathematicalBasis/img/ch1/prob_distribution_3.png b/public/assets/ch1/prob_distribution_3.png similarity index 100% rename from English version/ch01_MathematicalBasis/img/ch1/prob_distribution_3.png rename to public/assets/ch1/prob_distribution_3.png diff --git a/English version/ch01_MathematicalBasis/img/ch1/prob_distribution_4.png b/public/assets/ch1/prob_distribution_4.png similarity index 100% rename from English version/ch01_MathematicalBasis/img/ch1/prob_distribution_4.png rename to public/assets/ch1/prob_distribution_4.png diff --git a/English version/ch01_MathematicalBasis/img/ch1/prob_distribution_5.png b/public/assets/ch1/prob_distribution_5.png similarity index 100% rename from English version/ch01_MathematicalBasis/img/ch1/prob_distribution_5.png rename to public/assets/ch1/prob_distribution_5.png diff --git a/English version/ch01_MathematicalBasis/img/ch1/prob_distribution_6.png b/public/assets/ch1/prob_distribution_6.png similarity index 100% rename from English version/ch01_MathematicalBasis/img/ch1/prob_distribution_6.png rename to public/assets/ch1/prob_distribution_6.png diff --git a/English version/ch01_MathematicalBasis/img/ch1/prob_distribution_7.png b/public/assets/ch1/prob_distribution_7.png similarity index 100% rename from English version/ch01_MathematicalBasis/img/ch1/prob_distribution_7.png rename to public/assets/ch1/prob_distribution_7.png diff --git "a/ch10_\345\274\272\345\214\226\345\255\246\344\271\240/img/ch10/10-1.png" b/public/assets/ch10/10-1.png similarity index 100% rename from "ch10_\345\274\272\345\214\226\345\255\246\344\271\240/img/ch10/10-1.png" rename to public/assets/ch10/10-1.png diff --git "a/ch10_\345\274\272\345\214\226\345\255\246\344\271\240/img/ch10/10-2.png" b/public/assets/ch10/10-2.png similarity index 100% rename from "ch10_\345\274\272\345\214\226\345\255\246\344\271\240/img/ch10/10-2.png" rename to public/assets/ch10/10-2.png diff --git "a/ch10_\345\274\272\345\214\226\345\255\246\344\271\240/img/ch10/10-3.png" b/public/assets/ch10/10-3.png similarity index 100% rename from "ch10_\345\274\272\345\214\226\345\255\246\344\271\240/img/ch10/10-3.png" rename to public/assets/ch10/10-3.png diff --git "a/ch10_\345\274\272\345\214\226\345\255\246\344\271\240/img/ch10/10-4.png" b/public/assets/ch10/10-4.png similarity index 100% rename from "ch10_\345\274\272\345\214\226\345\255\246\344\271\240/img/ch10/10-4.png" rename to public/assets/ch10/10-4.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/00864b9c79b810761fec244e89a0ea08.jpg" b/public/assets/ch11/00864b9c79b810761fec244e89a0ea08.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/00864b9c79b810761fec244e89a0ea08.jpg" rename to public/assets/ch11/00864b9c79b810761fec244e89a0ea08.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/02cf7802ec9aabdccf710442cda04ccb.jpg" b/public/assets/ch11/02cf7802ec9aabdccf710442cda04ccb.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/02cf7802ec9aabdccf710442cda04ccb.jpg" rename to public/assets/ch11/02cf7802ec9aabdccf710442cda04ccb.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/07e7da7afdea5c38f470b3a06d8137e2.jpg" b/public/assets/ch11/07e7da7afdea5c38f470b3a06d8137e2.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/07e7da7afdea5c38f470b3a06d8137e2.jpg" rename to public/assets/ch11/07e7da7afdea5c38f470b3a06d8137e2.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/0854b7278c50c5e2b0bbe61d273721c1.jpg" b/public/assets/ch11/0854b7278c50c5e2b0bbe61d273721c1.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/0854b7278c50c5e2b0bbe61d273721c1.jpg" rename to public/assets/ch11/0854b7278c50c5e2b0bbe61d273721c1.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/09cb64cf3f3ceb5d87369e41c29d34bf.jpg" b/public/assets/ch11/09cb64cf3f3ceb5d87369e41c29d34bf.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/09cb64cf3f3ceb5d87369e41c29d34bf.jpg" rename to public/assets/ch11/09cb64cf3f3ceb5d87369e41c29d34bf.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/0b5d1ded61af9b38fedb2746a7dda23e.jpg" b/public/assets/ch11/0b5d1ded61af9b38fedb2746a7dda23e.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/0b5d1ded61af9b38fedb2746a7dda23e.jpg" rename to public/assets/ch11/0b5d1ded61af9b38fedb2746a7dda23e.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/0f3a57ffdefd178a4db06b52c2d53b58.jpg" b/public/assets/ch11/0f3a57ffdefd178a4db06b52c2d53b58.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/0f3a57ffdefd178a4db06b52c2d53b58.jpg" rename to public/assets/ch11/0f3a57ffdefd178a4db06b52c2d53b58.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/103de3658cbb97ad4c24bafe28f9d957.jpg" b/public/assets/ch11/103de3658cbb97ad4c24bafe28f9d957.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/103de3658cbb97ad4c24bafe28f9d957.jpg" rename to public/assets/ch11/103de3658cbb97ad4c24bafe28f9d957.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542808441403.png" b/public/assets/ch11/1542808441403.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542808441403.png" rename to public/assets/ch11/1542808441403.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542812321831.png" b/public/assets/ch11/1542812321831.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542812321831.png" rename to public/assets/ch11/1542812321831.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542812440636.png" b/public/assets/ch11/1542812440636.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542812440636.png" rename to public/assets/ch11/1542812440636.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542812748062.png" b/public/assets/ch11/1542812748062.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542812748062.png" rename to public/assets/ch11/1542812748062.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542817257337.png" b/public/assets/ch11/1542817257337.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542817257337.png" rename to public/assets/ch11/1542817257337.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542817481582.png" b/public/assets/ch11/1542817481582.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542817481582.png" rename to public/assets/ch11/1542817481582.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542820738631.png" b/public/assets/ch11/1542820738631.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542820738631.png" rename to public/assets/ch11/1542820738631.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542820752570.png" b/public/assets/ch11/1542820752570.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542820752570.png" rename to public/assets/ch11/1542820752570.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542820774326.png" b/public/assets/ch11/1542820774326.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542820774326.png" rename to public/assets/ch11/1542820774326.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542820797637.png" b/public/assets/ch11/1542820797637.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542820797637.png" rename to public/assets/ch11/1542820797637.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542821989163.png" b/public/assets/ch11/1542821989163.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542821989163.png" rename to public/assets/ch11/1542821989163.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822045307.png" b/public/assets/ch11/1542822045307.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822045307.png" rename to public/assets/ch11/1542822045307.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822087844.png" b/public/assets/ch11/1542822087844.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822087844.png" rename to public/assets/ch11/1542822087844.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822226596.png" b/public/assets/ch11/1542822226596.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822226596.png" rename to public/assets/ch11/1542822226596.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822305161.png" b/public/assets/ch11/1542822305161.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822305161.png" rename to public/assets/ch11/1542822305161.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822326035.png" b/public/assets/ch11/1542822326035.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822326035.png" rename to public/assets/ch11/1542822326035.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822355361.png" b/public/assets/ch11/1542822355361.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822355361.png" rename to public/assets/ch11/1542822355361.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822398717.png" b/public/assets/ch11/1542822398717.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822398717.png" rename to public/assets/ch11/1542822398717.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822474045.png" b/public/assets/ch11/1542822474045.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822474045.png" rename to public/assets/ch11/1542822474045.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822558549.png" b/public/assets/ch11/1542822558549.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822558549.png" rename to public/assets/ch11/1542822558549.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822578502.png" b/public/assets/ch11/1542822578502.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822578502.png" rename to public/assets/ch11/1542822578502.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822851294.png" b/public/assets/ch11/1542822851294.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822851294.png" rename to public/assets/ch11/1542822851294.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822971212.png" b/public/assets/ch11/1542822971212.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542822971212.png" rename to public/assets/ch11/1542822971212.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823019007.png" b/public/assets/ch11/1542823019007.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823019007.png" rename to public/assets/ch11/1542823019007.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823210556.png" b/public/assets/ch11/1542823210556.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823210556.png" rename to public/assets/ch11/1542823210556.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823438846.png" b/public/assets/ch11/1542823438846.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823438846.png" rename to public/assets/ch11/1542823438846.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823455820.png" b/public/assets/ch11/1542823455820.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823455820.png" rename to public/assets/ch11/1542823455820.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823474720.png" b/public/assets/ch11/1542823474720.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823474720.png" rename to public/assets/ch11/1542823474720.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823505559.png" b/public/assets/ch11/1542823505559.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823505559.png" rename to public/assets/ch11/1542823505559.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823539428.png" b/public/assets/ch11/1542823539428.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823539428.png" rename to public/assets/ch11/1542823539428.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823589390.png" b/public/assets/ch11/1542823589390.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823589390.png" rename to public/assets/ch11/1542823589390.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823632598.png" b/public/assets/ch11/1542823632598.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823632598.png" rename to public/assets/ch11/1542823632598.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823895008.png" b/public/assets/ch11/1542823895008.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542823895008.png" rename to public/assets/ch11/1542823895008.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824091867.png" b/public/assets/ch11/1542824091867.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824091867.png" rename to public/assets/ch11/1542824091867.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824195602.png" b/public/assets/ch11/1542824195602.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824195602.png" rename to public/assets/ch11/1542824195602.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824318155.png" b/public/assets/ch11/1542824318155.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824318155.png" rename to public/assets/ch11/1542824318155.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824486343.png" b/public/assets/ch11/1542824486343.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824486343.png" rename to public/assets/ch11/1542824486343.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824497736.png" b/public/assets/ch11/1542824497736.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824497736.png" rename to public/assets/ch11/1542824497736.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824918145.png" b/public/assets/ch11/1542824918145.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542824918145.png" rename to public/assets/ch11/1542824918145.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825063804.png" b/public/assets/ch11/1542825063804.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825063804.png" rename to public/assets/ch11/1542825063804.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825205225.png" b/public/assets/ch11/1542825205225.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825205225.png" rename to public/assets/ch11/1542825205225.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825237816.png" b/public/assets/ch11/1542825237816.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825237816.png" rename to public/assets/ch11/1542825237816.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825575318.png" b/public/assets/ch11/1542825575318.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825575318.png" rename to public/assets/ch11/1542825575318.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825908870.png" b/public/assets/ch11/1542825908870.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825908870.png" rename to public/assets/ch11/1542825908870.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825965528.png" b/public/assets/ch11/1542825965528.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542825965528.png" rename to public/assets/ch11/1542825965528.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826334834.png" b/public/assets/ch11/1542826334834.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826334834.png" rename to public/assets/ch11/1542826334834.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826461988.png" b/public/assets/ch11/1542826461988.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826461988.png" rename to public/assets/ch11/1542826461988.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826471739.png" b/public/assets/ch11/1542826471739.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826471739.png" rename to public/assets/ch11/1542826471739.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826475517.png" b/public/assets/ch11/1542826475517.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826475517.png" rename to public/assets/ch11/1542826475517.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826542007.png" b/public/assets/ch11/1542826542007.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826542007.png" rename to public/assets/ch11/1542826542007.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826743056.png" b/public/assets/ch11/1542826743056.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826743056.png" rename to public/assets/ch11/1542826743056.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826809443.png" b/public/assets/ch11/1542826809443.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826809443.png" rename to public/assets/ch11/1542826809443.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826826991.png" b/public/assets/ch11/1542826826991.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542826826991.png" rename to public/assets/ch11/1542826826991.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542827203409.png" b/public/assets/ch11/1542827203409.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542827203409.png" rename to public/assets/ch11/1542827203409.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542828076050.png" b/public/assets/ch11/1542828076050.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542828076050.png" rename to public/assets/ch11/1542828076050.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542828185735.png" b/public/assets/ch11/1542828185735.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542828185735.png" rename to public/assets/ch11/1542828185735.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542828483223.png" b/public/assets/ch11/1542828483223.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1542828483223.png" rename to public/assets/ch11/1542828483223.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/img/ch11/1542972502781.png" b/public/assets/ch11/1542972502781.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/img/ch11/1542972502781.png" rename to public/assets/ch11/1542972502781.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/img/ch11/1542973960796.png" b/public/assets/ch11/1542973960796.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/img/ch11/1542973960796.png" rename to public/assets/ch11/1542973960796.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/img/ch11/1542974131814.png" b/public/assets/ch11/1542974131814.png similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/img/ch11/1542974131814.png" rename to public/assets/ch11/1542974131814.png diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1cb62df2f6209e4c20fe5592dcc62918.jpg" b/public/assets/ch11/1cb62df2f6209e4c20fe5592dcc62918.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1cb62df2f6209e4c20fe5592dcc62918.jpg" rename to public/assets/ch11/1cb62df2f6209e4c20fe5592dcc62918.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1dffeb6986cf18354dafed0e1c08e09f.jpg" b/public/assets/ch11/1dffeb6986cf18354dafed0e1c08e09f.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/1dffeb6986cf18354dafed0e1c08e09f.jpg" rename to public/assets/ch11/1dffeb6986cf18354dafed0e1c08e09f.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/20c3e041d5f5fdd3eceec976060c8b89.jpg" b/public/assets/ch11/20c3e041d5f5fdd3eceec976060c8b89.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/20c3e041d5f5fdd3eceec976060c8b89.jpg" rename to public/assets/ch11/20c3e041d5f5fdd3eceec976060c8b89.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/2c8363bdbb6739578197ca68d05d362c.jpg" b/public/assets/ch11/2c8363bdbb6739578197ca68d05d362c.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/2c8363bdbb6739578197ca68d05d362c.jpg" rename to public/assets/ch11/2c8363bdbb6739578197ca68d05d362c.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/3d0802d34834b3aa3a8290fc194bc5be.jpg" b/public/assets/ch11/3d0802d34834b3aa3a8290fc194bc5be.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/3d0802d34834b3aa3a8290fc194bc5be.jpg" rename to public/assets/ch11/3d0802d34834b3aa3a8290fc194bc5be.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/3ea390bee08e90a87c4990322469592e.jpg" b/public/assets/ch11/3ea390bee08e90a87c4990322469592e.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/3ea390bee08e90a87c4990322469592e.jpg" rename to public/assets/ch11/3ea390bee08e90a87c4990322469592e.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/40f2c27caa934c2d220d1d43ba0cef51.jpg" b/public/assets/ch11/40f2c27caa934c2d220d1d43ba0cef51.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/40f2c27caa934c2d220d1d43ba0cef51.jpg" rename to public/assets/ch11/40f2c27caa934c2d220d1d43ba0cef51.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/42d0f131b458659a0e642a3d0a156b09.jpg" b/public/assets/ch11/42d0f131b458659a0e642a3d0a156b09.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/42d0f131b458659a0e642a3d0a156b09.jpg" rename to public/assets/ch11/42d0f131b458659a0e642a3d0a156b09.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/4761dc00b96100769281e7c90011d09b.jpg" b/public/assets/ch11/4761dc00b96100769281e7c90011d09b.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/4761dc00b96100769281e7c90011d09b.jpg" rename to public/assets/ch11/4761dc00b96100769281e7c90011d09b.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/4abacd82901988c3e0a98bdb07b2abc6.jpg" b/public/assets/ch11/4abacd82901988c3e0a98bdb07b2abc6.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/4abacd82901988c3e0a98bdb07b2abc6.jpg" rename to public/assets/ch11/4abacd82901988c3e0a98bdb07b2abc6.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/4f913ade7e7a16426fd809f6ac0af7b2.jpg" b/public/assets/ch11/4f913ade7e7a16426fd809f6ac0af7b2.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/4f913ade7e7a16426fd809f6ac0af7b2.jpg" rename to public/assets/ch11/4f913ade7e7a16426fd809f6ac0af7b2.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/52de242e850347b9f0b7a7ad8dfa84b0.jpg" b/public/assets/ch11/52de242e850347b9f0b7a7ad8dfa84b0.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/52de242e850347b9f0b7a7ad8dfa84b0.jpg" rename to public/assets/ch11/52de242e850347b9f0b7a7ad8dfa84b0.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/5dc622ed6ec524048bee9be3da965903.jpg" b/public/assets/ch11/5dc622ed6ec524048bee9be3da965903.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/5dc622ed6ec524048bee9be3da965903.jpg" rename to public/assets/ch11/5dc622ed6ec524048bee9be3da965903.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/5de65e5b7d2026c108b653d3ea60ffc2.jpg" b/public/assets/ch11/5de65e5b7d2026c108b653d3ea60ffc2.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/5de65e5b7d2026c108b653d3ea60ffc2.jpg" rename to public/assets/ch11/5de65e5b7d2026c108b653d3ea60ffc2.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/602723a1d3ce0f3abe7c591a8e4bb6ec.jpg" b/public/assets/ch11/602723a1d3ce0f3abe7c591a8e4bb6ec.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/602723a1d3ce0f3abe7c591a8e4bb6ec.jpg" rename to public/assets/ch11/602723a1d3ce0f3abe7c591a8e4bb6ec.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/631e5aab4e0680c374793804817bfbb6.jpg" b/public/assets/ch11/631e5aab4e0680c374793804817bfbb6.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/631e5aab4e0680c374793804817bfbb6.jpg" rename to public/assets/ch11/631e5aab4e0680c374793804817bfbb6.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/65162f4b973a249a4f9788b2af998bdb.jpg" b/public/assets/ch11/65162f4b973a249a4f9788b2af998bdb.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/65162f4b973a249a4f9788b2af998bdb.jpg" rename to public/assets/ch11/65162f4b973a249a4f9788b2af998bdb.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/693ac94b61c21e30e846aa9ecfb1883c.jpg" b/public/assets/ch11/693ac94b61c21e30e846aa9ecfb1883c.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/693ac94b61c21e30e846aa9ecfb1883c.jpg" rename to public/assets/ch11/693ac94b61c21e30e846aa9ecfb1883c.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/6fe355b691b487cc87f5ba4afd2dda3d.jpg" b/public/assets/ch11/6fe355b691b487cc87f5ba4afd2dda3d.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/6fe355b691b487cc87f5ba4afd2dda3d.jpg" rename to public/assets/ch11/6fe355b691b487cc87f5ba4afd2dda3d.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/71fcf4fee7500478ada89e52d72dcda1.jpg" b/public/assets/ch11/71fcf4fee7500478ada89e52d72dcda1.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/71fcf4fee7500478ada89e52d72dcda1.jpg" rename to public/assets/ch11/71fcf4fee7500478ada89e52d72dcda1.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/7caec88931b25c3a023021bccab48ae3.jpg" b/public/assets/ch11/7caec88931b25c3a023021bccab48ae3.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/7caec88931b25c3a023021bccab48ae3.jpg" rename to public/assets/ch11/7caec88931b25c3a023021bccab48ae3.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/857c3d2e84a6e9d5d31965252bcc9202.jpg" b/public/assets/ch11/857c3d2e84a6e9d5d31965252bcc9202.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/857c3d2e84a6e9d5d31965252bcc9202.jpg" rename to public/assets/ch11/857c3d2e84a6e9d5d31965252bcc9202.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/8d017ade0d332c15d1a242a61fd447ec.jpg" b/public/assets/ch11/8d017ade0d332c15d1a242a61fd447ec.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/8d017ade0d332c15d1a242a61fd447ec.jpg" rename to public/assets/ch11/8d017ade0d332c15d1a242a61fd447ec.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/8d428fc8967ec734bd394cacfbfba40f.jpg" b/public/assets/ch11/8d428fc8967ec734bd394cacfbfba40f.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/8d428fc8967ec734bd394cacfbfba40f.jpg" rename to public/assets/ch11/8d428fc8967ec734bd394cacfbfba40f.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/93f17238115b84db66ab5d56cfddacdd.jpg" b/public/assets/ch11/93f17238115b84db66ab5d56cfddacdd.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/93f17238115b84db66ab5d56cfddacdd.jpg" rename to public/assets/ch11/93f17238115b84db66ab5d56cfddacdd.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/966b912ade32d8171f18d2ea79b91b04.jpg" b/public/assets/ch11/966b912ade32d8171f18d2ea79b91b04.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/966b912ade32d8171f18d2ea79b91b04.jpg" rename to public/assets/ch11/966b912ade32d8171f18d2ea79b91b04.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/9898eb379bf1d726962b5928cfed69b0.jpg" b/public/assets/ch11/9898eb379bf1d726962b5928cfed69b0.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/9898eb379bf1d726962b5928cfed69b0.jpg" rename to public/assets/ch11/9898eb379bf1d726962b5928cfed69b0.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/a1122fb92521b6d3c484d264560473dc.jpg" b/public/assets/ch11/a1122fb92521b6d3c484d264560473dc.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/a1122fb92521b6d3c484d264560473dc.jpg" rename to public/assets/ch11/a1122fb92521b6d3c484d264560473dc.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/a2a7e5cc9e4325b6f23d79efec9c51da.jpg" b/public/assets/ch11/a2a7e5cc9e4325b6f23d79efec9c51da.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/a2a7e5cc9e4325b6f23d79efec9c51da.jpg" rename to public/assets/ch11/a2a7e5cc9e4325b6f23d79efec9c51da.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/a3db84158d9b6454adff88dbe4fa5d28.jpg" b/public/assets/ch11/a3db84158d9b6454adff88dbe4fa5d28.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/a3db84158d9b6454adff88dbe4fa5d28.jpg" rename to public/assets/ch11/a3db84158d9b6454adff88dbe4fa5d28.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/a814da5329927aca7b2a02cefb2e3f44.jpg" b/public/assets/ch11/a814da5329927aca7b2a02cefb2e3f44.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/a814da5329927aca7b2a02cefb2e3f44.jpg" rename to public/assets/ch11/a814da5329927aca7b2a02cefb2e3f44.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/aa10d36f758430dd4ff72d2bf6a76a6c.jpg" b/public/assets/ch11/aa10d36f758430dd4ff72d2bf6a76a6c.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/aa10d36f758430dd4ff72d2bf6a76a6c.jpg" rename to public/assets/ch11/aa10d36f758430dd4ff72d2bf6a76a6c.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/ab78b954fa6c763bdc99072fb5a1f670.jpg" b/public/assets/ch11/ab78b954fa6c763bdc99072fb5a1f670.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/ab78b954fa6c763bdc99072fb5a1f670.jpg" rename to public/assets/ch11/ab78b954fa6c763bdc99072fb5a1f670.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/ad24cbd2e510f912a72a82a2acfe92de.jpg" b/public/assets/ch11/ad24cbd2e510f912a72a82a2acfe92de.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/ad24cbd2e510f912a72a82a2acfe92de.jpg" rename to public/assets/ch11/ad24cbd2e510f912a72a82a2acfe92de.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/b1630ca5d004d4b430672c8b8ce7fb90.jpg" b/public/assets/ch11/b1630ca5d004d4b430672c8b8ce7fb90.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/b1630ca5d004d4b430672c8b8ce7fb90.jpg" rename to public/assets/ch11/b1630ca5d004d4b430672c8b8ce7fb90.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/b4513fe8c46d8e429d9f5526fd66c57a.jpg" b/public/assets/ch11/b4513fe8c46d8e429d9f5526fd66c57a.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/b4513fe8c46d8e429d9f5526fd66c57a.jpg" rename to public/assets/ch11/b4513fe8c46d8e429d9f5526fd66c57a.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/c8e12bd34619cf9e3111be3e728b3aa6.jpg" b/public/assets/ch11/c8e12bd34619cf9e3111be3e728b3aa6.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/c8e12bd34619cf9e3111be3e728b3aa6.jpg" rename to public/assets/ch11/c8e12bd34619cf9e3111be3e728b3aa6.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/cf52633ba21fdb92e33853b80eb07ee0.jpg" b/public/assets/ch11/cf52633ba21fdb92e33853b80eb07ee0.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/cf52633ba21fdb92e33853b80eb07ee0.jpg" rename to public/assets/ch11/cf52633ba21fdb92e33853b80eb07ee0.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/d8427680025580b726d99b1143bffd94.jpg" b/public/assets/ch11/d8427680025580b726d99b1143bffd94.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/d8427680025580b726d99b1143bffd94.jpg" rename to public/assets/ch11/d8427680025580b726d99b1143bffd94.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/dd15dfa395f495d41806595f58f3754d.jpg" b/public/assets/ch11/dd15dfa395f495d41806595f58f3754d.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/dd15dfa395f495d41806595f58f3754d.jpg" rename to public/assets/ch11/dd15dfa395f495d41806595f58f3754d.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/e654d14df0b44ee4e8a0e505c654044b.jpg" b/public/assets/ch11/e654d14df0b44ee4e8a0e505c654044b.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/e654d14df0b44ee4e8a0e505c654044b.jpg" rename to public/assets/ch11/e654d14df0b44ee4e8a0e505c654044b.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/f0cccba910e0833cb8455d4fe84a7dc8.jpg" b/public/assets/ch11/f0cccba910e0833cb8455d4fe84a7dc8.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/f0cccba910e0833cb8455d4fe84a7dc8.jpg" rename to public/assets/ch11/f0cccba910e0833cb8455d4fe84a7dc8.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/f852afecfb647f6b2727c4dcbabb1323.jpg" b/public/assets/ch11/f852afecfb647f6b2727c4dcbabb1323.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/f852afecfb647f6b2727c4dcbabb1323.jpg" rename to public/assets/ch11/f852afecfb647f6b2727c4dcbabb1323.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/fa08900e89bfd53cc28345d21bc6aca0.jpg" b/public/assets/ch11/fa08900e89bfd53cc28345d21bc6aca0.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/fa08900e89bfd53cc28345d21bc6aca0.jpg" rename to public/assets/ch11/fa08900e89bfd53cc28345d21bc6aca0.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/fa99e7c6f1985ddc380d04d4eb3adf26.jpg" b/public/assets/ch11/fa99e7c6f1985ddc380d04d4eb3adf26.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/fa99e7c6f1985ddc380d04d4eb3adf26.jpg" rename to public/assets/ch11/fa99e7c6f1985ddc380d04d4eb3adf26.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/fcbe02803e45f6455a4602b645b472c5.jpg" b/public/assets/ch11/fcbe02803e45f6455a4602b645b472c5.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/fcbe02803e45f6455a4602b645b472c5.jpg" rename to public/assets/ch11/fcbe02803e45f6455a4602b645b472c5.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/fed8fcb90eedfa6d3c4b11464c3440cb.jpg" b/public/assets/ch11/fed8fcb90eedfa6d3c4b11464c3440cb.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/fed8fcb90eedfa6d3c4b11464c3440cb.jpg" rename to public/assets/ch11/fed8fcb90eedfa6d3c4b11464c3440cb.jpg diff --git "a/ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/ffdf5ed6d284f09e2f3c8d3e062c9bc2.jpg" b/public/assets/ch11/ffdf5ed6d284f09e2f3c8d3e062c9bc2.jpg similarity index 100% rename from "ch11_\350\277\201\347\247\273\345\255\246\344\271\240/media/ffdf5ed6d284f09e2f3c8d3e062c9bc2.jpg" rename to public/assets/ch11/ffdf5ed6d284f09e2f3c8d3e062c9bc2.jpg diff --git "a/ch12_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203/img/ch12/1.bmp" b/public/assets/ch12/1.bmp similarity index 100% rename from "ch12_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203/img/ch12/1.bmp" rename to public/assets/ch12/1.bmp diff --git "a/ch12_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203/img/ch12/\345\216\206\345\271\264\345\206\240\345\206\233.png" "b/public/assets/ch12/\345\216\206\345\271\264\345\206\240\345\206\233.png" similarity index 100% rename from "ch12_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203/img/ch12/\345\216\206\345\271\264\345\206\240\345\206\233.png" rename to "public/assets/ch12/\345\216\206\345\271\264\345\206\240\345\206\233.png" diff --git "a/ch12_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203/img/ch12/\347\275\221\347\273\234\347\273\223\346\236\204\346\274\224\350\277\233.png" "b/public/assets/ch12/\347\275\221\347\273\234\347\273\223\346\236\204\346\274\224\350\277\233.png" similarity index 100% rename from "ch12_\347\275\221\347\273\234\346\220\255\345\273\272\345\217\212\350\256\255\347\273\203/img/ch12/\347\275\221\347\273\234\347\273\223\346\236\204\346\274\224\350\277\233.png" rename to "public/assets/ch12/\347\275\221\347\273\234\347\273\223\346\236\204\346\274\224\350\277\233.png" diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_15_1.png" b/public/assets/ch13/figure_13_15_1.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_15_1.png" rename to public/assets/ch13/figure_13_15_1.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_15_2.png" b/public/assets/ch13/figure_13_15_2.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_15_2.png" rename to public/assets/ch13/figure_13_15_2.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_18_1.png" b/public/assets/ch13/figure_13_18_1.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_18_1.png" rename to public/assets/ch13/figure_13_18_1.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_19_1.png" b/public/assets/ch13/figure_13_19_1.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_19_1.png" rename to public/assets/ch13/figure_13_19_1.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_36_1.png" b/public/assets/ch13/figure_13_36_1.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_36_1.png" rename to public/assets/ch13/figure_13_36_1.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_1.png" b/public/assets/ch13/figure_13_43_1.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_1.png" rename to public/assets/ch13/figure_13_43_1.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_2.png" b/public/assets/ch13/figure_13_43_2.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_2.png" rename to public/assets/ch13/figure_13_43_2.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_3.png" b/public/assets/ch13/figure_13_43_3.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_3.png" rename to public/assets/ch13/figure_13_43_3.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_4.png" b/public/assets/ch13/figure_13_43_4.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_4.png" rename to public/assets/ch13/figure_13_43_4.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_5.png" b/public/assets/ch13/figure_13_43_5.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_5.png" rename to public/assets/ch13/figure_13_43_5.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_6.png" b/public/assets/ch13/figure_13_43_6.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_6.png" rename to public/assets/ch13/figure_13_43_6.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_7.png" b/public/assets/ch13/figure_13_43_7.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_7.png" rename to public/assets/ch13/figure_13_43_7.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_8.png" b/public/assets/ch13/figure_13_43_8.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_43_8.png" rename to public/assets/ch13/figure_13_43_8.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_4_1.png" b/public/assets/ch13/figure_13_4_1.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_4_1.png" rename to public/assets/ch13/figure_13_4_1.png diff --git "a/ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_7_1.png" b/public/assets/ch13/figure_13_7_1.png similarity index 100% rename from "ch13_\344\274\230\345\214\226\347\256\227\346\263\225/img/ch13/figure_13_7_1.png" rename to public/assets/ch13/figure_13_7_1.png diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/14.14.png" b/public/assets/ch14/14.14.png similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/14.14.png" rename to public/assets/ch14/14.14.png diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/NASNet\347\232\204RNN\346\216\247\345\210\266\345\231\250.png" "b/public/assets/ch14/NASNet\347\232\204RNN\346\216\247\345\210\266\345\231\250.png" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/NASNet\347\232\204RNN\346\216\247\345\210\266\345\231\250.png" rename to "public/assets/ch14/NASNet\347\232\204RNN\346\216\247\345\210\266\345\231\250.png" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/NAS\346\220\234\347\264\242\347\255\226\347\225\245.png" "b/public/assets/ch14/NAS\346\220\234\347\264\242\347\255\226\347\225\245.png" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/NAS\346\220\234\347\264\242\347\255\226\347\225\245.png" rename to "public/assets/ch14/NAS\346\220\234\347\264\242\347\255\226\347\225\245.png" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/RNN\346\216\247\345\210\266\345\231\250.png" "b/public/assets/ch14/RNN\346\216\247\345\210\266\345\231\250.png" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/RNN\346\216\247\345\210\266\345\231\250.png" rename to "public/assets/ch14/RNN\346\216\247\345\210\266\345\231\250.png" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/cycle\350\241\260\345\207\217.jpeg" "b/public/assets/ch14/cycle\350\241\260\345\207\217.jpeg" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/cycle\350\241\260\345\207\217.jpeg" rename to "public/assets/ch14/cycle\350\241\260\345\207\217.jpeg" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\344\270\215\345\220\214\345\255\246\344\271\240\347\216\207.jpg" "b/public/assets/ch14/\344\270\215\345\220\214\345\255\246\344\271\240\347\216\207.jpg" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\344\270\215\345\220\214\345\255\246\344\271\240\347\216\207.jpg" rename to "public/assets/ch14/\344\270\215\345\220\214\345\255\246\344\271\240\347\216\207.jpg" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\344\275\231\345\274\246cycle\350\241\260\345\207\217.jpeg" "b/public/assets/ch14/\344\275\231\345\274\246cycle\350\241\260\345\207\217.jpeg" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\344\275\231\345\274\246cycle\350\241\260\345\207\217.jpeg" rename to "public/assets/ch14/\344\275\231\345\274\246cycle\350\241\260\345\207\217.jpeg" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" "b/public/assets/ch14/\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" rename to "public/assets/ch14/\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\345\231\252\345\243\260\347\272\277\346\200\247\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" "b/public/assets/ch14/\345\231\252\345\243\260\347\272\277\346\200\247\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\345\231\252\345\243\260\347\272\277\346\200\247\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" rename to "public/assets/ch14/\345\231\252\345\243\260\347\272\277\346\200\247\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\345\244\232\351\241\271\345\274\217\350\241\260\345\207\217.jpeg" "b/public/assets/ch14/\345\244\232\351\241\271\345\274\217\350\241\260\345\207\217.jpeg" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\345\244\232\351\241\271\345\274\217\350\241\260\345\207\217.jpeg" rename to "public/assets/ch14/\345\244\232\351\241\271\345\274\217\350\241\260\345\207\217.jpeg" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\346\200\235\347\273\264\345\257\274\345\233\276.png" "b/public/assets/ch14/\346\200\235\347\273\264\345\257\274\345\233\276.png" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\346\200\235\347\273\264\345\257\274\345\233\276.png" rename to "public/assets/ch14/\346\200\235\347\273\264\345\257\274\345\233\276.png" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\346\214\207\346\225\260\350\241\260\345\207\217.jpeg" "b/public/assets/ch14/\346\214\207\346\225\260\350\241\260\345\207\217.jpeg" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\346\214\207\346\225\260\350\241\260\345\207\217.jpeg" rename to "public/assets/ch14/\346\214\207\346\225\260\350\241\260\345\207\217.jpeg" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\347\272\277\346\200\247\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" "b/public/assets/ch14/\347\272\277\346\200\247\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\347\272\277\346\200\247\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" rename to "public/assets/ch14/\347\272\277\346\200\247\344\275\231\345\274\246\350\241\260\345\207\217.jpeg" diff --git "a/ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\351\200\206\346\227\266\350\241\260\345\207\217.jpeg" "b/public/assets/ch14/\351\200\206\346\227\266\350\241\260\345\207\217.jpeg" similarity index 100% rename from "ch14_\350\266\205\345\217\202\346\225\260\350\260\203\346\225\264/img/ch14/\351\200\206\346\227\266\350\241\260\345\207\217.jpeg" rename to "public/assets/ch14/\351\200\206\346\227\266\350\241\260\345\207\217.jpeg" diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cpu_gpu.png" b/public/assets/ch15/cpu_gpu.png similarity index 100% rename from "ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cpu_gpu.png" rename to public/assets/ch15/cpu_gpu.png diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cpu_specs.png" b/public/assets/ch15/cpu_specs.png similarity index 100% rename from "ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cpu_specs.png" rename to public/assets/ch15/cpu_specs.png diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cuda8.0.png" b/public/assets/ch15/cuda8.0.png similarity index 100% rename from "ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cuda8.0.png" rename to public/assets/ch15/cuda8.0.png diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cuda9.0.png" b/public/assets/ch15/cuda9.0.png similarity index 100% rename from "ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cuda9.0.png" rename to public/assets/ch15/cuda9.0.png diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cuda_software_arch.png" b/public/assets/ch15/cuda_software_arch.png similarity index 100% rename from "ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cuda_software_arch.png" rename to public/assets/ch15/cuda_software_arch.png diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cudacore.jpg" b/public/assets/ch15/cudacore.jpg similarity index 100% rename from "ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/cudacore.jpg" rename to public/assets/ch15/cudacore.jpg diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/gpu_memory.png" b/public/assets/ch15/gpu_memory.png similarity index 100% rename from "ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/gpu_memory.png" rename to public/assets/ch15/gpu_memory.png diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/gpu_memory_arch.png" b/public/assets/ch15/gpu_memory_arch.png similarity index 100% rename from "ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/gpu_memory_arch.png" rename to public/assets/ch15/gpu_memory_arch.png diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/gpu_specs.png" b/public/assets/ch15/gpu_specs.png similarity index 100% rename from "ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/gpu_specs.png" rename to public/assets/ch15/gpu_specs.png diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/gtx.png" b/public/assets/ch15/gtx.png similarity index 100% rename from "ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/gtx.png" rename to public/assets/ch15/gtx.png diff --git "a/ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/mat_mul_gpu.png" b/public/assets/ch15/mat_mul_gpu.png similarity index 100% rename from "ch15_GPU\345\222\214\346\241\206\346\236\266\351\200\211\345\236\213/img/ch15/mat_mul_gpu.png" rename to public/assets/ch15/mat_mul_gpu.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/1.png" b/public/assets/ch17/1.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/1.png" rename to public/assets/ch17/1.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/10.png" b/public/assets/ch17/10.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/10.png" rename to public/assets/ch17/10.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/11.png" b/public/assets/ch17/11.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/11.png" rename to public/assets/ch17/11.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/12.png" b/public/assets/ch17/12.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/12.png" rename to public/assets/ch17/12.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/13.png" b/public/assets/ch17/13.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/13.png" rename to public/assets/ch17/13.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/14.png" b/public/assets/ch17/14.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/14.png" rename to public/assets/ch17/14.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/15.png" b/public/assets/ch17/15.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/15.png" rename to public/assets/ch17/15.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/16.png" b/public/assets/ch17/16.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/16.png" rename to public/assets/ch17/16.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/17.png" b/public/assets/ch17/17.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/17.png" rename to public/assets/ch17/17.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/18.png" b/public/assets/ch17/18.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/18.png" rename to public/assets/ch17/18.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/19.png" b/public/assets/ch17/19.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/19.png" rename to public/assets/ch17/19.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/2.png" b/public/assets/ch17/2.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/2.png" rename to public/assets/ch17/2.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/20.png" b/public/assets/ch17/20.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/20.png" rename to public/assets/ch17/20.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/21.png" b/public/assets/ch17/21.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/21.png" rename to public/assets/ch17/21.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/22.png" b/public/assets/ch17/22.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/22.png" rename to public/assets/ch17/22.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/23.png" b/public/assets/ch17/23.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/23.png" rename to public/assets/ch17/23.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/24.png" b/public/assets/ch17/24.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/24.png" rename to public/assets/ch17/24.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/25.png" b/public/assets/ch17/25.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/25.png" rename to public/assets/ch17/25.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/26.png" b/public/assets/ch17/26.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/26.png" rename to public/assets/ch17/26.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/27.png" b/public/assets/ch17/27.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/27.png" rename to public/assets/ch17/27.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/3.jpg" b/public/assets/ch17/3.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/3.jpg" rename to public/assets/ch17/3.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/3.png" b/public/assets/ch17/3.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/3.png" rename to public/assets/ch17/3.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/4.jpg" b/public/assets/ch17/4.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/4.jpg" rename to public/assets/ch17/4.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/4.png" b/public/assets/ch17/4.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/4.png" rename to public/assets/ch17/4.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/5.jpg" b/public/assets/ch17/5.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/5.jpg" rename to public/assets/ch17/5.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/5.png" b/public/assets/ch17/5.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/5.png" rename to public/assets/ch17/5.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/6.png" b/public/assets/ch17/6.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/6.png" rename to public/assets/ch17/6.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/7.png" b/public/assets/ch17/7.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/7.png" rename to public/assets/ch17/7.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/8.png" b/public/assets/ch17/8.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/8.png" rename to public/assets/ch17/8.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/9.png" b/public/assets/ch17/9.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/9.png" rename to public/assets/ch17/9.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/MDL1.png" b/public/assets/ch17/MDL1.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/MDL1.png" rename to public/assets/ch17/MDL1.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/QNNPACK1.jpeg" b/public/assets/ch17/QNNPACK1.jpeg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/QNNPACK1.jpeg" rename to public/assets/ch17/QNNPACK1.jpeg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/QNNPACK2.jpeg" b/public/assets/ch17/QNNPACK2.jpeg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/QNNPACK2.jpeg" rename to public/assets/ch17/QNNPACK2.jpeg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/QNNPACK3.jpeg" b/public/assets/ch17/QNNPACK3.jpeg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/QNNPACK3.jpeg" rename to public/assets/ch17/QNNPACK3.jpeg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/QNNPACK4.jpeg" b/public/assets/ch17/QNNPACK4.jpeg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/QNNPACK4.jpeg" rename to public/assets/ch17/QNNPACK4.jpeg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/framework_design.png" b/public/assets/ch17/framework_design.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/framework_design.png" rename to public/assets/ch17/framework_design.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/maca_com.jpg" b/public/assets/ch17/maca_com.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/maca_com.jpg" rename to public/assets/ch17/maca_com.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/mace-arch.png" b/public/assets/ch17/mace-arch.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/mace-arch.png" rename to public/assets/ch17/mace-arch.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/mace-work-flow-zh.png" b/public/assets/ch17/mace-work-flow-zh.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/mace-work-flow-zh.png" rename to public/assets/ch17/mace-work-flow-zh.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/mv1.jpg" b/public/assets/ch17/mv1.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/mv1.jpg" rename to public/assets/ch17/mv1.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/mv2.jpg" b/public/assets/ch17/mv2.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/mv2.jpg" rename to public/assets/ch17/mv2.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/mv3.jpg" b/public/assets/ch17/mv3.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/mv3.jpg" rename to public/assets/ch17/mv3.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/packflow1.jpg" b/public/assets/ch17/packflow1.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/packflow1.jpg" rename to public/assets/ch17/packflow1.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/packflow2.jpg" b/public/assets/ch17/packflow2.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/packflow2.jpg" rename to public/assets/ch17/packflow2.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/packflow3.jpg" b/public/assets/ch17/packflow3.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/packflow3.jpg" rename to public/assets/ch17/packflow3.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/packflow4.jpg" b/public/assets/ch17/packflow4.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/packflow4.jpg" rename to public/assets/ch17/packflow4.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/packflow5.jpg" b/public/assets/ch17/packflow5.jpg similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/packflow5.jpg" rename to public/assets/ch17/packflow5.jpg diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/tensorRT1.png" b/public/assets/ch17/tensorRT1.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/tensorRT1.png" rename to public/assets/ch17/tensorRT1.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/tensorRT2.png" b/public/assets/ch17/tensorRT2.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/tensorRT2.png" rename to public/assets/ch17/tensorRT2.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/tensorRT3.png" b/public/assets/ch17/tensorRT3.png similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/tensorRT3.png" rename to public/assets/ch17/tensorRT3.png diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/tflite_artc.JPEG" b/public/assets/ch17/tflite_artc.JPEG similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/tflite_artc.JPEG" rename to public/assets/ch17/tflite_artc.JPEG diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/\344\275\216\347\247\251\345\210\206\350\247\243\346\250\241\345\236\213\345\216\213\347\274\251\345\212\240\351\200\237.jpg" "b/public/assets/ch17/\344\275\216\347\247\251\345\210\206\350\247\243\346\250\241\345\236\213\345\216\213\347\274\251\345\212\240\351\200\237.jpg" similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/\344\275\216\347\247\251\345\210\206\350\247\243\346\250\241\345\236\213\345\216\213\347\274\251\345\212\240\351\200\237.jpg" rename to "public/assets/ch17/\344\275\216\347\247\251\345\210\206\350\247\243\346\250\241\345\236\213\345\216\213\347\274\251\345\212\240\351\200\237.jpg" diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/\345\211\252\346\236\235\347\262\222\345\272\246\345\210\206\347\261\273.png" "b/public/assets/ch17/\345\211\252\346\236\235\347\262\222\345\272\246\345\210\206\347\261\273.png" similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/\345\211\252\346\236\235\347\262\222\345\272\246\345\210\206\347\261\273.png" rename to "public/assets/ch17/\345\211\252\346\236\235\347\262\222\345\272\246\345\210\206\347\261\273.png" diff --git "a/ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/\347\275\221\347\273\234\350\222\270\351\246\217.png" "b/public/assets/ch17/\347\275\221\347\273\234\350\222\270\351\246\217.png" similarity index 100% rename from "ch17_\346\250\241\345\236\213\345\216\213\347\274\251\343\200\201\345\212\240\351\200\237\345\217\212\347\247\273\345\212\250\347\253\257\351\203\250\347\275\262/img/ch17/\347\275\221\347\273\234\350\222\270\351\246\217.png" rename to "public/assets/ch17/\347\275\221\347\273\234\350\222\270\351\246\217.png" diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-10-1.png" b/public/assets/ch18/18-2-10-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-10-1.png" rename to public/assets/ch18/18-2-10-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-10-2.png" b/public/assets/ch18/18-2-10-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-10-2.png" rename to public/assets/ch18/18-2-10-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-2.png" b/public/assets/ch18/18-2-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-2.png" rename to public/assets/ch18/18-2-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-3-1.png" b/public/assets/ch18/18-2-3-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-3-1.png" rename to public/assets/ch18/18-2-3-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-3-2.png" b/public/assets/ch18/18-2-3-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-3-2.png" rename to public/assets/ch18/18-2-3-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-4-1.png" b/public/assets/ch18/18-2-4-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-2-4-1.png" rename to public/assets/ch18/18-2-4-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-4-2.png" b/public/assets/ch18/18-2-4-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-4-2.png" rename to public/assets/ch18/18-2-4-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-5-1.png" b/public/assets/ch18/18-2-5-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-5-1.png" rename to public/assets/ch18/18-2-5-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-5-2.png" b/public/assets/ch18/18-2-5-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-5-2.png" rename to public/assets/ch18/18-2-5-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-6-1.png" b/public/assets/ch18/18-2-6-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-6-1.png" rename to public/assets/ch18/18-2-6-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-6-2.png" b/public/assets/ch18/18-2-6-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-6-2.png" rename to public/assets/ch18/18-2-6-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-9-1.png" b/public/assets/ch18/18-2-9-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-9-1.png" rename to public/assets/ch18/18-2-9-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-9-2.png" b/public/assets/ch18/18-2-9-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-9-2.png" rename to public/assets/ch18/18-2-9-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-9-3.png" b/public/assets/ch18/18-2-9-3.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-9-3.png" rename to public/assets/ch18/18-2-9-3.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-9-4.png" b/public/assets/ch18/18-2-9-4.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-9-4.png" rename to public/assets/ch18/18-2-9-4.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-4-1.png" b/public/assets/ch18/18-4-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-4-1.png" rename to public/assets/ch18/18-4-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-4-2.png" b/public/assets/ch18/18-4-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-4-2.png" rename to public/assets/ch18/18-4-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-4-3.png" b/public/assets/ch18/18-4-3.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-4-3.png" rename to public/assets/ch18/18-4-3.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-4-4.png" b/public/assets/ch18/18-4-4.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-4-4.png" rename to public/assets/ch18/18-4-4.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-5.png" b/public/assets/ch18/18-4-5.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-4-5.png" rename to public/assets/ch18/18-4-5.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-1-1.jpg" b/public/assets/ch18/18-5-1-1.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-1-1.jpg" rename to public/assets/ch18/18-5-1-1.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-2-1.png" b/public/assets/ch18/18-5-2-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-2-1.png" rename to public/assets/ch18/18-5-2-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-2-2.jpg" b/public/assets/ch18/18-5-2-2.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-2-2.jpg" rename to public/assets/ch18/18-5-2-2.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-4-1.jpg" b/public/assets/ch18/18-5-4-1.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-4-1.jpg" rename to public/assets/ch18/18-5-4-1.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-4-2.jpg" b/public/assets/ch18/18-5-4-2.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-4-2.jpg" rename to public/assets/ch18/18-5-4-2.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-1.jpg" b/public/assets/ch18/18-5-6-1.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-1.jpg" rename to public/assets/ch18/18-5-6-1.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-1.png" b/public/assets/ch18/18-5-6-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-1.png" rename to public/assets/ch18/18-5-6-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-2.png" b/public/assets/ch18/18-5-6-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-2.png" rename to public/assets/ch18/18-5-6-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-3.png" b/public/assets/ch18/18-5-6-3.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-3.png" rename to public/assets/ch18/18-5-6-3.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-4.png" b/public/assets/ch18/18-5-6-4.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-4.png" rename to public/assets/ch18/18-5-6-4.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-5.png" b/public/assets/ch18/18-5-6-5.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-5.png" rename to public/assets/ch18/18-5-6-5.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-6.png" b/public/assets/ch18/18-5-6-6.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-6-6.png" rename to public/assets/ch18/18-5-6-6.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-7-1.jpg" b/public/assets/ch18/18-5-7-1.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-7-1.jpg" rename to public/assets/ch18/18-5-7-1.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-8-1.png" b/public/assets/ch18/18-5-8-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-8-1.png" rename to public/assets/ch18/18-5-8-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-8-2.png" b/public/assets/ch18/18-5-8-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-8-2.png" rename to public/assets/ch18/18-5-8-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-9-0.jpg" b/public/assets/ch18/18-5-9-0.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-9-0.jpg" rename to public/assets/ch18/18-5-9-0.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-9-1.jpg" b/public/assets/ch18/18-5-9-1.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-5-9-1.jpg" rename to public/assets/ch18/18-5-9-1.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-1-0.png" b/public/assets/ch18/18-6-2-1-0.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-1-0.png" rename to public/assets/ch18/18-6-2-1-0.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-1-1.jpg" b/public/assets/ch18/18-6-2-1-1.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-1-1.jpg" rename to public/assets/ch18/18-6-2-1-1.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-1.jpg" b/public/assets/ch18/18-6-2-1.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-1.jpg" rename to public/assets/ch18/18-6-2-1.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-2.jpg" b/public/assets/ch18/18-6-2-2.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-2.jpg" rename to public/assets/ch18/18-6-2-2.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-3.jpg" b/public/assets/ch18/18-6-2-3.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-3.jpg" rename to public/assets/ch18/18-6-2-3.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-3.png" b/public/assets/ch18/18-6-2-3.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-3.png" rename to public/assets/ch18/18-6-2-3.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-4.png" b/public/assets/ch18/18-6-2-4.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-4.png" rename to public/assets/ch18/18-6-2-4.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-5.png" b/public/assets/ch18/18-6-2-5.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-2-5.png" rename to public/assets/ch18/18-6-2-5.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-0.jpg" b/public/assets/ch18/18-6-3-0.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-0.jpg" rename to public/assets/ch18/18-6-3-0.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-1.jpg" b/public/assets/ch18/18-6-3-1.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-1.jpg" rename to public/assets/ch18/18-6-3-1.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-2.jpg" b/public/assets/ch18/18-6-3-2.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-2.jpg" rename to public/assets/ch18/18-6-3-2.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-3.jpg" b/public/assets/ch18/18-6-3-3.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-3.jpg" rename to public/assets/ch18/18-6-3-3.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-4.jpg" b/public/assets/ch18/18-6-3-4.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-4.jpg" rename to public/assets/ch18/18-6-3-4.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-5.jpg" b/public/assets/ch18/18-6-3-5.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-3-5.jpg" rename to public/assets/ch18/18-6-3-5.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-4-1.png" b/public/assets/ch18/18-6-4-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-4-1.png" rename to public/assets/ch18/18-6-4-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-4-2.png" b/public/assets/ch18/18-6-4-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-4-2.png" rename to public/assets/ch18/18-6-4-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-4-3.png" b/public/assets/ch18/18-6-4-3.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-4-3.png" rename to public/assets/ch18/18-6-4-3.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-4-4.png" b/public/assets/ch18/18-6-4-4.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-4-4.png" rename to public/assets/ch18/18-6-4-4.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-5-1.jpg" b/public/assets/ch18/18-6-5-1.jpg similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-5-1.jpg" rename to public/assets/ch18/18-6-5-1.jpg diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-5-2.png" b/public/assets/ch18/18-6-5-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-5-2.png" rename to public/assets/ch18/18-6-5-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-5-3.png" b/public/assets/ch18/18-6-5-3.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-5-3.png" rename to public/assets/ch18/18-6-5-3.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-5-4.png" b/public/assets/ch18/18-6-5-4.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-5-4.png" rename to public/assets/ch18/18-6-5-4.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-8-1.png" b/public/assets/ch18/18-6-8-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/18-6-8-1.png" rename to public/assets/ch18/18-6-8-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-9-2-1.png" b/public/assets/ch18/18-9-2-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-9-2-1.png" rename to public/assets/ch18/18-9-2-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-9-2-2.png" b/public/assets/ch18/18-9-2-2.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-9-2-2.png" rename to public/assets/ch18/18-9-2-2.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-9-3-1.png" b/public/assets/ch18/18-9-3-1.png similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-9-3-1.png" rename to public/assets/ch18/18-9-3-1.png diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-10-1.png" "b/public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-10-1.png" similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-10-1.png" rename to "public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-10-1.png" diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-3-1.png" "b/public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-3-1.png" similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-3-1.png" rename to "public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-3-1.png" diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-4-1.png" "b/public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-4-1.png" similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-2-4-1.png" rename to "public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-2-4-1.png" diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-4-5.png" "b/public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-4-5.png" similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\343\200\201\347\246\273\347\272\277\345\217\212\345\256\236\346\227\266\350\256\241\347\256\227/img/18-4-5.png" rename to "public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-4-5.png" diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-1.jpg" "b/public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-1.jpg" similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-1.jpg" rename to "public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-1.jpg" diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-1.png" "b/public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-1.png" similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-1.png" rename to "public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-1.png" diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-2.png" "b/public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-2.png" similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-2.png" rename to "public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/18-5-2-2.png" diff --git "a/ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/emnlp2018.pdf" "b/public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/emnlp2018.pdf" similarity index 100% rename from "ch18_\345\220\216\347\253\257\346\236\266\346\236\204\351\200\211\345\236\213\345\217\212\345\272\224\347\224\250\345\234\272\346\231\257/img/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/emnlp2018.pdf" rename to "public/assets/ch18/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/emnlp2018.pdf" diff --git "a/ch19_\350\275\257\344\273\266\344\270\223\345\210\251\347\224\263\350\257\267\345\217\212\346\235\203\345\210\251\344\277\235\346\212\244/img/1.doc" b/public/assets/ch19/1.doc similarity index 100% rename from "ch19_\350\275\257\344\273\266\344\270\223\345\210\251\347\224\263\350\257\267\345\217\212\346\235\203\345\210\251\344\277\235\346\212\244/img/1.doc" rename to public/assets/ch19/1.doc diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-1.png b/public/assets/ch2/2-1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-1.png rename to public/assets/ch2/2-1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-10.png b/public/assets/ch2/2-10.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-10.png rename to public/assets/ch2/2-10.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-11.png b/public/assets/ch2/2-11.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-11.png rename to public/assets/ch2/2-11.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-12.png b/public/assets/ch2/2-12.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-12.png rename to public/assets/ch2/2-12.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-13.png b/public/assets/ch2/2-13.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-13.png rename to public/assets/ch2/2-13.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-14.png b/public/assets/ch2/2-14.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-14.png rename to public/assets/ch2/2-14.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-15.png b/public/assets/ch2/2-15.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-15.png rename to public/assets/ch2/2-15.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-16.png b/public/assets/ch2/2-16.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-16.png rename to public/assets/ch2/2-16.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-17.png b/public/assets/ch2/2-17.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-17.png rename to public/assets/ch2/2-17.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-18.jpg b/public/assets/ch2/2-18.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-18.jpg rename to public/assets/ch2/2-18.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-19.jpg b/public/assets/ch2/2-19.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-19.jpg rename to public/assets/ch2/2-19.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-2.png b/public/assets/ch2/2-2.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-2.png rename to public/assets/ch2/2-2.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-20.gif b/public/assets/ch2/2-20.gif similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-20.gif rename to public/assets/ch2/2-20.gif diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-21.gif b/public/assets/ch2/2-21.gif similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-21.gif rename to public/assets/ch2/2-21.gif diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-22.gif b/public/assets/ch2/2-22.gif similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-22.gif rename to public/assets/ch2/2-22.gif diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-4.png b/public/assets/ch2/2-4.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-4.png rename to public/assets/ch2/2-4.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-5.png b/public/assets/ch2/2-5.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-5.png rename to public/assets/ch2/2-5.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-6.png b/public/assets/ch2/2-6.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-6.png rename to public/assets/ch2/2-6.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-7.png b/public/assets/ch2/2-7.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-7.png rename to public/assets/ch2/2-7.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-8.png b/public/assets/ch2/2-8.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-8.png rename to public/assets/ch2/2-8.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2-9.png b/public/assets/ch2/2-9.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2-9.png rename to public/assets/ch2/2-9.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.1/1.jpg b/public/assets/ch2/2.1/1.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.1/1.jpg rename to public/assets/ch2/2.1/1.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.1/10.jpg b/public/assets/ch2/2.1/10.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.1/10.jpg rename to public/assets/ch2/2.1/10.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.1/12.jpg b/public/assets/ch2/2.1/12.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.1/12.jpg rename to public/assets/ch2/2.1/12.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.1/2.jpg b/public/assets/ch2/2.1/2.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.1/2.jpg rename to public/assets/ch2/2.1/2.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.1/3.jpg b/public/assets/ch2/2.1/3.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.1/3.jpg rename to public/assets/ch2/2.1/3.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.1/4.png b/public/assets/ch2/2.1/4.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.1/4.png rename to public/assets/ch2/2.1/4.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.1/5.jpg b/public/assets/ch2/2.1/5.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.1/5.jpg rename to public/assets/ch2/2.1/5.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.1/6.jpg b/public/assets/ch2/2.1/6.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.1/6.jpg rename to public/assets/ch2/2.1/6.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.1/7.jpg b/public/assets/ch2/2.1/7.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.1/7.jpg rename to public/assets/ch2/2.1/7.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.1/8.jpg b/public/assets/ch2/2.1/8.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.1/8.jpg rename to public/assets/ch2/2.1/8.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.1/9.png b/public/assets/ch2/2.1/9.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.1/9.png rename to public/assets/ch2/2.1/9.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.16.17-1.png b/public/assets/ch2/2.16.17-1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.16.17-1.png rename to public/assets/ch2/2.16.17-1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.16.17-2.png b/public/assets/ch2/2.16.17-2.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.16.17-2.png rename to public/assets/ch2/2.16.17-2.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.16.17-3.png b/public/assets/ch2/2.16.17-3.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.16.17-3.png rename to public/assets/ch2/2.16.17-3.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.16.18.1.png b/public/assets/ch2/2.16.18.1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.16.18.1.png rename to public/assets/ch2/2.16.18.1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.16.20.1.png b/public/assets/ch2/2.16.20.1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.16.20.1.png rename to public/assets/ch2/2.16.20.1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.16.4.1.jpg b/public/assets/ch2/2.16.4.1.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.16.4.1.jpg rename to public/assets/ch2/2.16.4.1.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.16.4.2.png b/public/assets/ch2/2.16.4.2.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.16.4.2.png rename to public/assets/ch2/2.16.4.2.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.16.4.3.png b/public/assets/ch2/2.16.4.3.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.16.4.3.png rename to public/assets/ch2/2.16.4.3.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.16/1.jpg b/public/assets/ch2/2.16/1.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.16/1.jpg rename to public/assets/ch2/2.16/1.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.16/2.jpg b/public/assets/ch2/2.16/2.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.16/2.jpg rename to public/assets/ch2/2.16/2.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.18/1.jpg b/public/assets/ch2/2.18/1.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.18/1.jpg rename to public/assets/ch2/2.18/1.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.19.1.1.png b/public/assets/ch2/2.19.1.1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.19.1.1.png rename to public/assets/ch2/2.19.1.1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.19.5A.jpg b/public/assets/ch2/2.19.5A.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.19.5A.jpg rename to public/assets/ch2/2.19.5A.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.19.5B.jpg b/public/assets/ch2/2.19.5B.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.19.5B.jpg rename to public/assets/ch2/2.19.5B.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.19.5C.png b/public/assets/ch2/2.19.5C.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.19.5C.png rename to public/assets/ch2/2.19.5C.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.2.09.png b/public/assets/ch2/2.2.09.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.2.09.png rename to public/assets/ch2/2.2.09.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.2.10.png b/public/assets/ch2/2.2.10.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.2.10.png rename to public/assets/ch2/2.2.10.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.2.11.png b/public/assets/ch2/2.2.11.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.2.11.png rename to public/assets/ch2/2.2.11.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.2.12.png b/public/assets/ch2/2.2.12.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.2.12.png rename to public/assets/ch2/2.2.12.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.2.4.png b/public/assets/ch2/2.2.4.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.2.4.png rename to public/assets/ch2/2.2.4.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.2.8.png b/public/assets/ch2/2.2.8.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.2.8.png rename to public/assets/ch2/2.2.8.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.20.1.jpg b/public/assets/ch2/2.20.1.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.20.1.jpg rename to public/assets/ch2/2.20.1.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.1.png b/public/assets/ch2/2.21.1.1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.1.png rename to public/assets/ch2/2.21.1.1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.2.png b/public/assets/ch2/2.21.1.2.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.2.png rename to public/assets/ch2/2.21.1.2.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.3.png b/public/assets/ch2/2.21.1.3.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.3.png rename to public/assets/ch2/2.21.1.3.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.4.png b/public/assets/ch2/2.21.1.4.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.4.png rename to public/assets/ch2/2.21.1.4.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.5.png b/public/assets/ch2/2.21.1.5.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.5.png rename to public/assets/ch2/2.21.1.5.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.6.png b/public/assets/ch2/2.21.1.6.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.6.png rename to public/assets/ch2/2.21.1.6.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.6a.png b/public/assets/ch2/2.21.1.6a.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.6a.png rename to public/assets/ch2/2.21.1.6a.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.7.png b/public/assets/ch2/2.21.1.7.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.21.1.7.png rename to public/assets/ch2/2.21.1.7.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.21.3.1.png b/public/assets/ch2/2.21.3.1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.21.3.1.png rename to public/assets/ch2/2.21.3.1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.25/1.png b/public/assets/ch2/2.25/1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.25/1.png rename to public/assets/ch2/2.25/1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.27/1.png b/public/assets/ch2/2.27/1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.27/1.png rename to public/assets/ch2/2.27/1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.27/2.png b/public/assets/ch2/2.27/2.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.27/2.png rename to public/assets/ch2/2.27/2.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.29/1.png b/public/assets/ch2/2.29/1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.29/1.png rename to public/assets/ch2/2.29/1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.34/1.png b/public/assets/ch2/2.34/1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.34/1.png rename to public/assets/ch2/2.34/1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.40.10/1.png b/public/assets/ch2/2.40.10/1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.40.10/1.png rename to public/assets/ch2/2.40.10/1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.40.11/1.jpg b/public/assets/ch2/2.40.11/1.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.40.11/1.jpg rename to public/assets/ch2/2.40.11/1.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.40.15/1.png b/public/assets/ch2/2.40.15/1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.40.15/1.png rename to public/assets/ch2/2.40.15/1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.40.3/1.jpg b/public/assets/ch2/2.40.3/1.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.40.3/1.jpg rename to public/assets/ch2/2.40.3/1.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.40.3/1.png b/public/assets/ch2/2.40.3/1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.40.3/1.png rename to public/assets/ch2/2.40.3/1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.40.3/2.20.1.jpg b/public/assets/ch2/2.40.3/2.20.1.jpg similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.40.3/2.20.1.jpg rename to public/assets/ch2/2.40.3/2.20.1.jpg diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.40.3/2.png b/public/assets/ch2/2.40.3/2.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.40.3/2.png rename to public/assets/ch2/2.40.3/2.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.40.3/3.png b/public/assets/ch2/2.40.3/3.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.40.3/3.png rename to public/assets/ch2/2.40.3/3.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.5.1.png b/public/assets/ch2/2.5.1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.5.1.png rename to public/assets/ch2/2.5.1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.6/1.png b/public/assets/ch2/2.6/1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.6/1.png rename to public/assets/ch2/2.6/1.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.7.3.png b/public/assets/ch2/2.7.3.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.7.3.png rename to public/assets/ch2/2.7.3.png diff --git a/English version/ch02_MachineLearningFoundation/img/ch2/2.9/1.png b/public/assets/ch2/2.9/1.png similarity index 100% rename from English version/ch02_MachineLearningFoundation/img/ch2/2.9/1.png rename to public/assets/ch2/2.9/1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-1.png b/public/assets/ch3/3-1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-1.png rename to public/assets/ch3/3-1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-10.jpg b/public/assets/ch3/3-10.jpg similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-10.jpg rename to public/assets/ch3/3-10.jpg diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-11.jpg b/public/assets/ch3/3-11.jpg similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-11.jpg rename to public/assets/ch3/3-11.jpg diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-12.png b/public/assets/ch3/3-12.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-12.png rename to public/assets/ch3/3-12.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-13.png b/public/assets/ch3/3-13.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-13.png rename to public/assets/ch3/3-13.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-14.png b/public/assets/ch3/3-14.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-14.png rename to public/assets/ch3/3-14.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-15.png b/public/assets/ch3/3-15.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-15.png rename to public/assets/ch3/3-15.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-16.png b/public/assets/ch3/3-16.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-16.png rename to public/assets/ch3/3-16.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-17.gif b/public/assets/ch3/3-17.gif similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-17.gif rename to public/assets/ch3/3-17.gif diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-18.png b/public/assets/ch3/3-18.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-18.png rename to public/assets/ch3/3-18.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-19.png b/public/assets/ch3/3-19.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-19.png rename to public/assets/ch3/3-19.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-2.png b/public/assets/ch3/3-2.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-2.png rename to public/assets/ch3/3-2.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-20.gif b/public/assets/ch3/3-20.gif similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-20.gif rename to public/assets/ch3/3-20.gif diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-21.png b/public/assets/ch3/3-21.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-21.png rename to public/assets/ch3/3-21.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-22.png b/public/assets/ch3/3-22.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-22.png rename to public/assets/ch3/3-22.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-23.png b/public/assets/ch3/3-23.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-23.png rename to public/assets/ch3/3-23.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-24.png b/public/assets/ch3/3-24.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-24.png rename to public/assets/ch3/3-24.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-25.png b/public/assets/ch3/3-25.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-25.png rename to public/assets/ch3/3-25.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-26.png b/public/assets/ch3/3-26.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-26.png rename to public/assets/ch3/3-26.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-27.png b/public/assets/ch3/3-27.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-27.png rename to public/assets/ch3/3-27.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-28.png b/public/assets/ch3/3-28.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-28.png rename to public/assets/ch3/3-28.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-29.png b/public/assets/ch3/3-29.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-29.png rename to public/assets/ch3/3-29.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-3.png b/public/assets/ch3/3-3.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-3.png rename to public/assets/ch3/3-3.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-30.png b/public/assets/ch3/3-30.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-30.png rename to public/assets/ch3/3-30.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-31.png b/public/assets/ch3/3-31.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-31.png rename to public/assets/ch3/3-31.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-32.png b/public/assets/ch3/3-32.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-32.png rename to public/assets/ch3/3-32.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-33.png b/public/assets/ch3/3-33.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-33.png rename to public/assets/ch3/3-33.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-34.png b/public/assets/ch3/3-34.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-34.png rename to public/assets/ch3/3-34.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-35.jpg b/public/assets/ch3/3-35.jpg similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-35.jpg rename to public/assets/ch3/3-35.jpg diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-36.png b/public/assets/ch3/3-36.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-36.png rename to public/assets/ch3/3-36.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-37.png b/public/assets/ch3/3-37.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-37.png rename to public/assets/ch3/3-37.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-38.png b/public/assets/ch3/3-38.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-38.png rename to public/assets/ch3/3-38.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-39.jpg b/public/assets/ch3/3-39.jpg similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-39.jpg rename to public/assets/ch3/3-39.jpg diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-4.png b/public/assets/ch3/3-4.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-4.png rename to public/assets/ch3/3-4.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-40.png b/public/assets/ch3/3-40.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-40.png rename to public/assets/ch3/3-40.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-41.png b/public/assets/ch3/3-41.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-41.png rename to public/assets/ch3/3-41.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-5.png b/public/assets/ch3/3-5.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-5.png rename to public/assets/ch3/3-5.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-6.png b/public/assets/ch3/3-6.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-6.png rename to public/assets/ch3/3-6.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-7.jpg b/public/assets/ch3/3-7.jpg similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-7.jpg rename to public/assets/ch3/3-7.jpg diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-8.png b/public/assets/ch3/3-8.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-8.png rename to public/assets/ch3/3-8.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3-9.jpg b/public/assets/ch3/3-9.jpg similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3-9.jpg rename to public/assets/ch3/3-9.jpg diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.1.1.5.png b/public/assets/ch3/3.1.1.5.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.1.1.5.png rename to public/assets/ch3/3.1.1.5.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.1.1.6.png b/public/assets/ch3/3.1.1.6.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.1.1.6.png rename to public/assets/ch3/3.1.1.6.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.1.6.1.png b/public/assets/ch3/3.1.6.1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.1.6.1.png rename to public/assets/ch3/3.1.6.1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.12.2.1.png b/public/assets/ch3/3.12.2.1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.12.2.1.png rename to public/assets/ch3/3.12.2.1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.12.2.2.png b/public/assets/ch3/3.12.2.2.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.12.2.2.png rename to public/assets/ch3/3.12.2.2.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.1.1.png b/public/assets/ch3/3.2.1.1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.1.1.png rename to public/assets/ch3/3.2.1.1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.1.2.png b/public/assets/ch3/3.2.1.2.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.1.2.png rename to public/assets/ch3/3.2.1.2.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.2.1.png b/public/assets/ch3/3.2.2.1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.2.1.png rename to public/assets/ch3/3.2.2.1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.3.1.png b/public/assets/ch3/3.2.3.1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.3.1.png rename to public/assets/ch3/3.2.3.1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.3.2.png b/public/assets/ch3/3.2.3.2.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.3.2.png rename to public/assets/ch3/3.2.3.2.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.3.4.png b/public/assets/ch3/3.2.3.4.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.3.4.png rename to public/assets/ch3/3.2.3.4.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.3.5.png b/public/assets/ch3/3.2.3.5.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.3.5.png rename to public/assets/ch3/3.2.3.5.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.3.6.png b/public/assets/ch3/3.2.3.6.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.3.6.png rename to public/assets/ch3/3.2.3.6.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.4.1.png b/public/assets/ch3/3.2.4.1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.4.1.png rename to public/assets/ch3/3.2.4.1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.5.1.png b/public/assets/ch3/3.2.5.1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.5.1.png rename to public/assets/ch3/3.2.5.1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.5.2.png b/public/assets/ch3/3.2.5.2.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.5.2.png rename to public/assets/ch3/3.2.5.2.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.5.3.png b/public/assets/ch3/3.2.5.3.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.5.3.png rename to public/assets/ch3/3.2.5.3.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.2.5.4.png b/public/assets/ch3/3.2.5.4.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.2.5.4.png rename to public/assets/ch3/3.2.5.4.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.4.9.1.png b/public/assets/ch3/3.4.9.1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.4.9.1.png rename to public/assets/ch3/3.4.9.1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.4.9.2.png b/public/assets/ch3/3.4.9.2.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.4.9.2.png rename to public/assets/ch3/3.4.9.2.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.4.9.3.png b/public/assets/ch3/3.4.9.3.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.4.9.3.png rename to public/assets/ch3/3.4.9.3.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.6.3.1.png b/public/assets/ch3/3.6.3.1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.6.3.1.png rename to public/assets/ch3/3.6.3.1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.6.7.1.png b/public/assets/ch3/3.6.7.1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.6.7.1.png rename to public/assets/ch3/3.6.7.1.png diff --git a/English version/ch03_DeepLearningFoundation/img/ch3/3.8.2.1.png b/public/assets/ch3/3.8.2.1.png similarity index 100% rename from English version/ch03_DeepLearningFoundation/img/ch3/3.8.2.1.png rename to public/assets/ch3/3.8.2.1.png diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/learnrate1.png" b/public/assets/ch3/learnrate1.png similarity index 100% rename from "ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/learnrate1.png" rename to public/assets/ch3/learnrate1.png diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/learnrate2.png" b/public/assets/ch3/learnrate2.png similarity index 100% rename from "ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/learnrate2.png" rename to public/assets/ch3/learnrate2.png diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/learnrate3.png" b/public/assets/ch3/learnrate3.png similarity index 100% rename from "ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/learnrate3.png" rename to public/assets/ch3/learnrate3.png diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/learnrate4.png" b/public/assets/ch3/learnrate4.png similarity index 100% rename from "ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/learnrate4.png" rename to public/assets/ch3/learnrate4.png diff --git "a/ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/learnrate5.png" b/public/assets/ch3/learnrate5.png similarity index 100% rename from "ch03_\346\267\261\345\272\246\345\255\246\344\271\240\345\237\272\347\241\200/img/ch3/learnrate5.png" rename to public/assets/ch3/learnrate5.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/LeNet-5.jpg b/public/assets/ch4/LeNet-5.jpg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/LeNet-5.jpg rename to public/assets/ch4/LeNet-5.jpg diff --git a/English version/ch04_ClassicNetwork/img/ch4/alexnet.png b/public/assets/ch4/alexnet.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/alexnet.png rename to public/assets/ch4/alexnet.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/featureMap.jpg b/public/assets/ch4/featureMap.jpg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/featureMap.jpg rename to public/assets/ch4/featureMap.jpg diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image1.png" b/public/assets/ch4/image1.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image1.png" rename to public/assets/ch4/image1.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image10.png b/public/assets/ch4/image10.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image10.png rename to public/assets/ch4/image10.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image11.GIF b/public/assets/ch4/image11.GIF similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image11.GIF rename to public/assets/ch4/image11.GIF diff --git a/English version/ch04_ClassicNetwork/img/ch4/image12.png b/public/assets/ch4/image12.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image12.png rename to public/assets/ch4/image12.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image13.png b/public/assets/ch4/image13.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image13.png rename to public/assets/ch4/image13.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image14.png b/public/assets/ch4/image14.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image14.png rename to public/assets/ch4/image14.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image15.jpeg b/public/assets/ch4/image15.jpeg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image15.jpeg rename to public/assets/ch4/image15.jpeg diff --git a/English version/ch04_ClassicNetwork/img/ch4/image18.jpeg b/public/assets/ch4/image18.jpeg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image18.jpeg rename to public/assets/ch4/image18.jpeg diff --git a/English version/ch04_ClassicNetwork/img/ch4/image19.jpeg b/public/assets/ch4/image19.jpeg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image19.jpeg rename to public/assets/ch4/image19.jpeg diff --git a/English version/ch04_ClassicNetwork/img/ch4/image2.jpeg b/public/assets/ch4/image2.jpeg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image2.jpeg rename to public/assets/ch4/image2.jpeg diff --git a/English version/ch04_ClassicNetwork/img/ch4/image20.jpeg b/public/assets/ch4/image20.jpeg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image20.jpeg rename to public/assets/ch4/image20.jpeg diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image21.jpeg" b/public/assets/ch4/image21.jpeg similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image21.jpeg" rename to public/assets/ch4/image21.jpeg diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image21.png" b/public/assets/ch4/image21.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image21.png" rename to public/assets/ch4/image21.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image22.jpeg b/public/assets/ch4/image22.jpeg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image22.jpeg rename to public/assets/ch4/image22.jpeg diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image23.png" b/public/assets/ch4/image23.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image23.png" rename to public/assets/ch4/image23.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image24.png b/public/assets/ch4/image24.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image24.png rename to public/assets/ch4/image24.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image25.jpeg b/public/assets/ch4/image25.jpeg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image25.jpeg rename to public/assets/ch4/image25.jpeg diff --git a/English version/ch04_ClassicNetwork/img/ch4/image26.png b/public/assets/ch4/image26.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image26.png rename to public/assets/ch4/image26.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image27.jpeg b/public/assets/ch4/image27.jpeg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image27.jpeg rename to public/assets/ch4/image27.jpeg diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image27.png" b/public/assets/ch4/image27.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image27.png" rename to public/assets/ch4/image27.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image28.jpeg b/public/assets/ch4/image28.jpeg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image28.jpeg rename to public/assets/ch4/image28.jpeg diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image28.png" b/public/assets/ch4/image28.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image28.png" rename to public/assets/ch4/image28.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image3.png b/public/assets/ch4/image3.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image3.png rename to public/assets/ch4/image3.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image31.png" b/public/assets/ch4/image31.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image31.png" rename to public/assets/ch4/image31.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image32.png" b/public/assets/ch4/image32.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image32.png" rename to public/assets/ch4/image32.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image33.png b/public/assets/ch4/image33.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image33.png rename to public/assets/ch4/image33.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image34.png" b/public/assets/ch4/image34.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image34.png" rename to public/assets/ch4/image34.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image35.png" b/public/assets/ch4/image35.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image35.png" rename to public/assets/ch4/image35.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image36.png" b/public/assets/ch4/image36.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image36.png" rename to public/assets/ch4/image36.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image37.png" b/public/assets/ch4/image37.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image37.png" rename to public/assets/ch4/image37.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image38.png" b/public/assets/ch4/image38.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image38.png" rename to public/assets/ch4/image38.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image39.png b/public/assets/ch4/image39.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image39.png rename to public/assets/ch4/image39.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image4.png b/public/assets/ch4/image4.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image4.png rename to public/assets/ch4/image4.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image40.png b/public/assets/ch4/image40.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image40.png rename to public/assets/ch4/image40.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image41.png b/public/assets/ch4/image41.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image41.png rename to public/assets/ch4/image41.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image42.png b/public/assets/ch4/image42.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image42.png rename to public/assets/ch4/image42.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image43.png b/public/assets/ch4/image43.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image43.png rename to public/assets/ch4/image43.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image44.png b/public/assets/ch4/image44.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image44.png rename to public/assets/ch4/image44.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image45.png b/public/assets/ch4/image45.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image45.png rename to public/assets/ch4/image45.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image46.png" b/public/assets/ch4/image46.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image46.png" rename to public/assets/ch4/image46.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image47.png" b/public/assets/ch4/image47.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image47.png" rename to public/assets/ch4/image47.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image48.png b/public/assets/ch4/image48.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image48.png rename to public/assets/ch4/image48.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image49.png b/public/assets/ch4/image49.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image49.png rename to public/assets/ch4/image49.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image5.png b/public/assets/ch4/image5.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image5.png rename to public/assets/ch4/image5.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image50.png b/public/assets/ch4/image50.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image50.png rename to public/assets/ch4/image50.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image51.png b/public/assets/ch4/image51.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image51.png rename to public/assets/ch4/image51.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image52.png b/public/assets/ch4/image52.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image52.png rename to public/assets/ch4/image52.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image53.png b/public/assets/ch4/image53.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image53.png rename to public/assets/ch4/image53.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image54.png b/public/assets/ch4/image54.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image54.png rename to public/assets/ch4/image54.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image55.png b/public/assets/ch4/image55.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image55.png rename to public/assets/ch4/image55.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image56.png b/public/assets/ch4/image56.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image56.png rename to public/assets/ch4/image56.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image6.png b/public/assets/ch4/image6.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image6.png rename to public/assets/ch4/image6.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image60.jpeg b/public/assets/ch4/image60.jpeg similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image60.jpeg rename to public/assets/ch4/image60.jpeg diff --git a/English version/ch04_ClassicNetwork/img/ch4/image61.png b/public/assets/ch4/image61.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image61.png rename to public/assets/ch4/image61.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image62.png b/public/assets/ch4/image62.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image62.png rename to public/assets/ch4/image62.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image63.png" b/public/assets/ch4/image63.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/image63.png" rename to public/assets/ch4/image63.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image7.png b/public/assets/ch4/image7.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image7.png rename to public/assets/ch4/image7.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image8.png b/public/assets/ch4/image8.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image8.png rename to public/assets/ch4/image8.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/image9.png b/public/assets/ch4/image9.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/image9.png rename to public/assets/ch4/image9.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/img_inception_01.png" b/public/assets/ch4/img_inception_01.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/img_inception_01.png" rename to public/assets/ch4/img_inception_01.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/img_inception_02.png" b/public/assets/ch4/img_inception_02.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/img_inception_02.png" rename to public/assets/ch4/img_inception_02.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/img_inception_03.png" b/public/assets/ch4/img_inception_03.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/img_inception_03.png" rename to public/assets/ch4/img_inception_03.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/img_inception_04.png" b/public/assets/ch4/img_inception_04.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/img_inception_04.png" rename to public/assets/ch4/img_inception_04.png diff --git "a/ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/img_inception_05.png" b/public/assets/ch4/img_inception_05.png similarity index 100% rename from "ch04_\347\273\217\345\205\270\347\275\221\347\273\234/img/ch4/img_inception_05.png" rename to public/assets/ch4/img_inception_05.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/vgg16.png b/public/assets/ch4/vgg16.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/vgg16.png rename to public/assets/ch4/vgg16.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/zfnet-layer1.png b/public/assets/ch4/zfnet-layer1.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/zfnet-layer1.png rename to public/assets/ch4/zfnet-layer1.png diff --git a/English version/ch04_ClassicNetwork/img/ch4/zfnet-layer2.png b/public/assets/ch4/zfnet-layer2.png similarity index 100% rename from English version/ch04_ClassicNetwork/img/ch4/zfnet-layer2.png rename to public/assets/ch4/zfnet-layer2.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.11-1.png" b/public/assets/ch5/5.11-1.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.11-1.png" rename to public/assets/ch5/5.11-1.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.12-1.png" b/public/assets/ch5/5.12-1.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.12-1.png" rename to public/assets/ch5/5.12-1.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.13-1.png" b/public/assets/ch5/5.13-1.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.13-1.png" rename to public/assets/ch5/5.13-1.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.13-2.png" b/public/assets/ch5/5.13-2.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.13-2.png" rename to public/assets/ch5/5.13-2.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.14.1.png" b/public/assets/ch5/5.14.1.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.14.1.png" rename to public/assets/ch5/5.14.1.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.19.1-2.png" b/public/assets/ch5/5.19.1-2.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.19.1-2.png" rename to public/assets/ch5/5.19.1-2.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.19.1-3.png" b/public/assets/ch5/5.19.1-3.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.19.1-3.png" rename to public/assets/ch5/5.19.1-3.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.19.2-5.png" b/public/assets/ch5/5.19.2-5.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.19.2-5.png" rename to public/assets/ch5/5.19.2-5.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.27.1.png" b/public/assets/ch5/5.27.1.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.27.1.png" rename to public/assets/ch5/5.27.1.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.27.2.png" b/public/assets/ch5/5.27.2.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.27.2.png" rename to public/assets/ch5/5.27.2.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.27.3.png" b/public/assets/ch5/5.27.3.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.27.3.png" rename to public/assets/ch5/5.27.3.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.6.1.png" b/public/assets/ch5/5.6.1.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.6.1.png" rename to public/assets/ch5/5.6.1.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.6.2.png" b/public/assets/ch5/5.6.2.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.6.2.png" rename to public/assets/ch5/5.6.2.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.8-1.png" b/public/assets/ch5/5.8-1.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/5.8-1.png" rename to public/assets/ch5/5.8-1.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/Image-process.png" b/public/assets/ch5/Image-process.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/Image-process.png" rename to public/assets/ch5/Image-process.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/NLP.png" b/public/assets/ch5/NLP.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/NLP.png" rename to public/assets/ch5/NLP.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/audio-recognition.png" b/public/assets/ch5/audio-recognition.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/audio-recognition.png" rename to public/assets/ch5/audio-recognition.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/audio.png" b/public/assets/ch5/audio.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/audio.png" rename to public/assets/ch5/audio.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-blur-gaussian.jpg" b/public/assets/ch5/cat-blur-gaussian.jpg similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-blur-gaussian.jpg" rename to public/assets/ch5/cat-blur-gaussian.jpg diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-boxblur.jpg" b/public/assets/ch5/cat-boxblur.jpg similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-boxblur.jpg" rename to public/assets/ch5/cat-boxblur.jpg diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-crop.png" b/public/assets/ch5/cat-crop.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-crop.png" rename to public/assets/ch5/cat-crop.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-edgeDetect-2.jpg" b/public/assets/ch5/cat-edgeDetect-2.jpg similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-edgeDetect-2.jpg" rename to public/assets/ch5/cat-edgeDetect-2.jpg diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-edgeDetect.jpg" b/public/assets/ch5/cat-edgeDetect.jpg similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-edgeDetect.jpg" rename to public/assets/ch5/cat-edgeDetect.jpg diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-sharpen.jpg" b/public/assets/ch5/cat-sharpen.jpg similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat-sharpen.jpg" rename to public/assets/ch5/cat-sharpen.jpg diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat.jpg" b/public/assets/ch5/cat.jpg similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/cat.jpg" rename to public/assets/ch5/cat.jpg diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/conv-same.png" b/public/assets/ch5/conv-same.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/conv-same.png" rename to public/assets/ch5/conv-same.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/conv-valid.png" b/public/assets/ch5/conv-valid.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/conv-valid.png" rename to public/assets/ch5/conv-valid.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/conv.png" b/public/assets/ch5/conv.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/conv.png" rename to public/assets/ch5/conv.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/convolution.png" b/public/assets/ch5/convolution.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/convolution.png" rename to public/assets/ch5/convolution.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/full-connected.png" b/public/assets/ch5/full-connected.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/full-connected.png" rename to public/assets/ch5/full-connected.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/general_pooling.png" b/public/assets/ch5/general_pooling.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/general_pooling.png" rename to public/assets/ch5/general_pooling.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img1.png" b/public/assets/ch5/img1.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img1.png" rename to public/assets/ch5/img1.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img10.png" b/public/assets/ch5/img10.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img10.png" rename to public/assets/ch5/img10.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img11.png" b/public/assets/ch5/img11.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img11.png" rename to public/assets/ch5/img11.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img12.png" b/public/assets/ch5/img12.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img12.png" rename to public/assets/ch5/img12.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img13.png" b/public/assets/ch5/img13.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img13.png" rename to public/assets/ch5/img13.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img14.png" b/public/assets/ch5/img14.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img14.png" rename to public/assets/ch5/img14.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img15.png" b/public/assets/ch5/img15.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img15.png" rename to public/assets/ch5/img15.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img16.png" b/public/assets/ch5/img16.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img16.png" rename to public/assets/ch5/img16.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img17.png" b/public/assets/ch5/img17.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img17.png" rename to public/assets/ch5/img17.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img18.png" b/public/assets/ch5/img18.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img18.png" rename to public/assets/ch5/img18.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img19.png" b/public/assets/ch5/img19.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img19.png" rename to public/assets/ch5/img19.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img2.png" b/public/assets/ch5/img2.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img2.png" rename to public/assets/ch5/img2.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img20.png" b/public/assets/ch5/img20.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img20.png" rename to public/assets/ch5/img20.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img21.png" b/public/assets/ch5/img21.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img21.png" rename to public/assets/ch5/img21.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img22.png" b/public/assets/ch5/img22.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img22.png" rename to public/assets/ch5/img22.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img23.png" b/public/assets/ch5/img23.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img23.png" rename to public/assets/ch5/img23.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img24.png" b/public/assets/ch5/img24.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img24.png" rename to public/assets/ch5/img24.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img25.png" b/public/assets/ch5/img25.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img25.png" rename to public/assets/ch5/img25.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img26.png" b/public/assets/ch5/img26.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img26.png" rename to public/assets/ch5/img26.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img27.png" b/public/assets/ch5/img27.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img27.png" rename to public/assets/ch5/img27.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img28.png" b/public/assets/ch5/img28.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img28.png" rename to public/assets/ch5/img28.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img29.png" b/public/assets/ch5/img29.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img29.png" rename to public/assets/ch5/img29.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img3.png" b/public/assets/ch5/img3.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img3.png" rename to public/assets/ch5/img3.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img30.png" b/public/assets/ch5/img30.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img30.png" rename to public/assets/ch5/img30.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img31.png" b/public/assets/ch5/img31.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img31.png" rename to public/assets/ch5/img31.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img32.png" b/public/assets/ch5/img32.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img32.png" rename to public/assets/ch5/img32.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img33.png" b/public/assets/ch5/img33.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img33.png" rename to public/assets/ch5/img33.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img34.png" b/public/assets/ch5/img34.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img34.png" rename to public/assets/ch5/img34.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img35.png" b/public/assets/ch5/img35.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img35.png" rename to public/assets/ch5/img35.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img36.png" b/public/assets/ch5/img36.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img36.png" rename to public/assets/ch5/img36.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img37.png" b/public/assets/ch5/img37.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img37.png" rename to public/assets/ch5/img37.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img38.png" b/public/assets/ch5/img38.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img38.png" rename to public/assets/ch5/img38.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img39.png" b/public/assets/ch5/img39.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img39.png" rename to public/assets/ch5/img39.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img4.png" b/public/assets/ch5/img4.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img4.png" rename to public/assets/ch5/img4.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img40.png" b/public/assets/ch5/img40.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img40.png" rename to public/assets/ch5/img40.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img41.png" b/public/assets/ch5/img41.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img41.png" rename to public/assets/ch5/img41.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img42.png" b/public/assets/ch5/img42.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img42.png" rename to public/assets/ch5/img42.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img43.png" b/public/assets/ch5/img43.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img43.png" rename to public/assets/ch5/img43.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img44.png" b/public/assets/ch5/img44.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img44.png" rename to public/assets/ch5/img44.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img45.png" b/public/assets/ch5/img45.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img45.png" rename to public/assets/ch5/img45.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img46.png" b/public/assets/ch5/img46.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img46.png" rename to public/assets/ch5/img46.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img47.png" b/public/assets/ch5/img47.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img47.png" rename to public/assets/ch5/img47.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img48.png" b/public/assets/ch5/img48.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img48.png" rename to public/assets/ch5/img48.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img49.png" b/public/assets/ch5/img49.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img49.png" rename to public/assets/ch5/img49.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img5.png" b/public/assets/ch5/img5.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img5.png" rename to public/assets/ch5/img5.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img50.png" b/public/assets/ch5/img50.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img50.png" rename to public/assets/ch5/img50.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img51.png" b/public/assets/ch5/img51.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img51.png" rename to public/assets/ch5/img51.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img52.png" b/public/assets/ch5/img52.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img52.png" rename to public/assets/ch5/img52.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img53.png" b/public/assets/ch5/img53.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img53.png" rename to public/assets/ch5/img53.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img54.png" b/public/assets/ch5/img54.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img54.png" rename to public/assets/ch5/img54.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img55.png" b/public/assets/ch5/img55.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img55.png" rename to public/assets/ch5/img55.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img56.png" b/public/assets/ch5/img56.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img56.png" rename to public/assets/ch5/img56.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img57.png" b/public/assets/ch5/img57.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img57.png" rename to public/assets/ch5/img57.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img58.png" b/public/assets/ch5/img58.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img58.png" rename to public/assets/ch5/img58.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img59.png" b/public/assets/ch5/img59.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img59.png" rename to public/assets/ch5/img59.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img6.png" b/public/assets/ch5/img6.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img6.png" rename to public/assets/ch5/img6.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img60.png" b/public/assets/ch5/img60.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img60.png" rename to public/assets/ch5/img60.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img61.png" b/public/assets/ch5/img61.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img61.png" rename to public/assets/ch5/img61.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img62.png" b/public/assets/ch5/img62.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img62.png" rename to public/assets/ch5/img62.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img63.png" b/public/assets/ch5/img63.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img63.png" rename to public/assets/ch5/img63.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img64.png" b/public/assets/ch5/img64.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img64.png" rename to public/assets/ch5/img64.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img65.png" b/public/assets/ch5/img65.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img65.png" rename to public/assets/ch5/img65.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img66.png" b/public/assets/ch5/img66.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img66.png" rename to public/assets/ch5/img66.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img7.png" b/public/assets/ch5/img7.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img7.png" rename to public/assets/ch5/img7.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img8.png" b/public/assets/ch5/img8.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img8.png" rename to public/assets/ch5/img8.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img9.png" b/public/assets/ch5/img9.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/img9.png" rename to public/assets/ch5/img9.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/local-connected.png" b/public/assets/ch5/local-connected.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/local-connected.png" rename to public/assets/ch5/local-connected.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/local-conv.png" b/public/assets/ch5/local-conv.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/local-conv.png" rename to public/assets/ch5/local-conv.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/overlap_pooling.png" b/public/assets/ch5/overlap_pooling.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/overlap_pooling.png" rename to public/assets/ch5/overlap_pooling.png diff --git "a/ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/spatial_pooling.png" b/public/assets/ch5/spatial_pooling.png similarity index 100% rename from "ch05_\345\215\267\347\247\257\347\245\236\347\273\217\347\275\221\347\273\234(CNN)/img/ch5/spatial_pooling.png" rename to public/assets/ch5/spatial_pooling.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.1.jpg" b/public/assets/ch6/6.1.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.1.jpg" rename to public/assets/ch6/6.1.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.10.jpg" b/public/assets/ch6/6.10.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.10.jpg" rename to public/assets/ch6/6.10.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.11.jpg" b/public/assets/ch6/6.11.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.11.jpg" rename to public/assets/ch6/6.11.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.12.jpg" b/public/assets/ch6/6.12.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.12.jpg" rename to public/assets/ch6/6.12.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.13.jpg" b/public/assets/ch6/6.13.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.13.jpg" rename to public/assets/ch6/6.13.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.14.jpg" b/public/assets/ch6/6.14.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.14.jpg" rename to public/assets/ch6/6.14.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.15.jpg" b/public/assets/ch6/6.15.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.15.jpg" rename to public/assets/ch6/6.15.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.16.jpg" b/public/assets/ch6/6.16.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.16.jpg" rename to public/assets/ch6/6.16.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.17.jpg" b/public/assets/ch6/6.17.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.17.jpg" rename to public/assets/ch6/6.17.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.18.jpg" b/public/assets/ch6/6.18.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.18.jpg" rename to public/assets/ch6/6.18.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.19.jpg" b/public/assets/ch6/6.19.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.19.jpg" rename to public/assets/ch6/6.19.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.2.jpg" b/public/assets/ch6/6.2.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.2.jpg" rename to public/assets/ch6/6.2.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.3.jpg" b/public/assets/ch6/6.3.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.3.jpg" rename to public/assets/ch6/6.3.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.4.jpg" b/public/assets/ch6/6.4.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.4.jpg" rename to public/assets/ch6/6.4.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.5.jpg" b/public/assets/ch6/6.5.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.5.jpg" rename to public/assets/ch6/6.5.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.6.jpg" b/public/assets/ch6/6.6.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.6.jpg" rename to public/assets/ch6/6.6.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.7.jpg" b/public/assets/ch6/6.7.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.7.jpg" rename to public/assets/ch6/6.7.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.8.jpg" b/public/assets/ch6/6.8.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.8.jpg" rename to public/assets/ch6/6.8.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.9.jpg" b/public/assets/ch6/6.9.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/6.9.jpg" rename to public/assets/ch6/6.9.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM1.png" b/public/assets/ch6/LSTM1.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM1.png" rename to public/assets/ch6/LSTM1.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM10.png" b/public/assets/ch6/LSTM10.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM10.png" rename to public/assets/ch6/LSTM10.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM11.png" b/public/assets/ch6/LSTM11.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM11.png" rename to public/assets/ch6/LSTM11.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM12.png" b/public/assets/ch6/LSTM12.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM12.png" rename to public/assets/ch6/LSTM12.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM2.png" b/public/assets/ch6/LSTM2.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM2.png" rename to public/assets/ch6/LSTM2.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM3.png" b/public/assets/ch6/LSTM3.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM3.png" rename to public/assets/ch6/LSTM3.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM4.png" b/public/assets/ch6/LSTM4.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM4.png" rename to public/assets/ch6/LSTM4.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM5.png" b/public/assets/ch6/LSTM5.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM5.png" rename to public/assets/ch6/LSTM5.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM6.png" b/public/assets/ch6/LSTM6.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM6.png" rename to public/assets/ch6/LSTM6.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM7.png" b/public/assets/ch6/LSTM7.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM7.png" rename to public/assets/ch6/LSTM7.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM8.png" b/public/assets/ch6/LSTM8.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM8.png" rename to public/assets/ch6/LSTM8.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM9.png" b/public/assets/ch6/LSTM9.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/LSTM9.png" rename to public/assets/ch6/LSTM9.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.1_1.jpg" b/public/assets/ch6/figure_6.1_1.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.1_1.jpg" rename to public/assets/ch6/figure_6.1_1.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.1_1.png" b/public/assets/ch6/figure_6.1_1.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.1_1.png" rename to public/assets/ch6/figure_6.1_1.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.1_1.vsd" b/public/assets/ch6/figure_6.1_1.vsd similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.1_1.vsd" rename to public/assets/ch6/figure_6.1_1.vsd diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.2_1.png" b/public/assets/ch6/figure_6.2_1.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.2_1.png" rename to public/assets/ch6/figure_6.2_1.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.2_1.vsd" b/public/assets/ch6/figure_6.2_1.vsd similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.2_1.vsd" rename to public/assets/ch6/figure_6.2_1.vsd diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.2_2.jpg" b/public/assets/ch6/figure_6.2_2.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.2_2.jpg" rename to public/assets/ch6/figure_6.2_2.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.2_2.png" b/public/assets/ch6/figure_6.2_2.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.2_2.png" rename to public/assets/ch6/figure_6.2_2.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.2_2.vsd" b/public/assets/ch6/figure_6.2_2.vsd similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.2_2.vsd" rename to public/assets/ch6/figure_6.2_2.vsd diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.4_1.png" b/public/assets/ch6/figure_6.4_1.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.4_1.png" rename to public/assets/ch6/figure_6.4_1.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.1_1.png" b/public/assets/ch6/figure_6.6.1_1.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.1_1.png" rename to public/assets/ch6/figure_6.6.1_1.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.1_1.vsd" b/public/assets/ch6/figure_6.6.1_1.vsd similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.1_1.vsd" rename to public/assets/ch6/figure_6.6.1_1.vsd diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.2_1.png" b/public/assets/ch6/figure_6.6.2_1.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.2_1.png" rename to public/assets/ch6/figure_6.6.2_1.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.2_1.vsd" b/public/assets/ch6/figure_6.6.2_1.vsd similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.2_1.vsd" rename to public/assets/ch6/figure_6.6.2_1.vsd diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.3_1.png" b/public/assets/ch6/figure_6.6.3_1.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.3_1.png" rename to public/assets/ch6/figure_6.6.3_1.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.3_1.vsd" b/public/assets/ch6/figure_6.6.3_1.vsd similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.3_1.vsd" rename to public/assets/ch6/figure_6.6.3_1.vsd diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_1.png" b/public/assets/ch6/figure_6.6.4_1.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_1.png" rename to public/assets/ch6/figure_6.6.4_1.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_1.vsdx" b/public/assets/ch6/figure_6.6.4_1.vsdx similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_1.vsdx" rename to public/assets/ch6/figure_6.6.4_1.vsdx diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_2.png" b/public/assets/ch6/figure_6.6.4_2.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_2.png" rename to public/assets/ch6/figure_6.6.4_2.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_2.vsdx" b/public/assets/ch6/figure_6.6.4_2.vsdx similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_2.vsdx" rename to public/assets/ch6/figure_6.6.4_2.vsdx diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_3.png" b/public/assets/ch6/figure_6.6.4_3.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_3.png" rename to public/assets/ch6/figure_6.6.4_3.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_3.vsdx" b/public/assets/ch6/figure_6.6.4_3.vsdx similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.4_3.vsdx" rename to public/assets/ch6/figure_6.6.4_3.vsdx diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.5_1.png" b/public/assets/ch6/figure_6.6.5_1.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.5_1.png" rename to public/assets/ch6/figure_6.6.5_1.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.5_1.vsdx" b/public/assets/ch6/figure_6.6.5_1.vsdx similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.5_1.vsdx" rename to public/assets/ch6/figure_6.6.5_1.vsdx diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.6_1.png" b/public/assets/ch6/figure_6.6.6_1.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.6_1.png" rename to public/assets/ch6/figure_6.6.6_1.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.6_1.vsdx" b/public/assets/ch6/figure_6.6.6_1.vsdx similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.6_1.vsdx" rename to public/assets/ch6/figure_6.6.6_1.vsdx diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.6_2.png" b/public/assets/ch6/figure_6.6.6_2.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.6_2.png" rename to public/assets/ch6/figure_6.6.6_2.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.6_2.vsdx" b/public/assets/ch6/figure_6.6.6_2.vsdx similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.6_2.vsdx" rename to public/assets/ch6/figure_6.6.6_2.vsdx diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.7_1.png" b/public/assets/ch6/figure_6.6.7_1.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.7_1.png" rename to public/assets/ch6/figure_6.6.7_1.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.7_1.vsdx" b/public/assets/ch6/figure_6.6.7_1.vsdx similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/figure_6.6.7_1.vsdx" rename to public/assets/ch6/figure_6.6.7_1.vsdx diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/rnnbp.png" b/public/assets/ch6/rnnbp.png similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/rnnbp.png" rename to public/assets/ch6/rnnbp.png diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/sigmoid.jpg" b/public/assets/ch6/sigmoid.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/sigmoid.jpg" rename to public/assets/ch6/sigmoid.jpg diff --git "a/ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/tanh.jpg" b/public/assets/ch6/tanh.jpg similarity index 100% rename from "ch06_\345\276\252\347\216\257\347\245\236\347\273\217\347\275\221\347\273\234(RNN)/img/ch6/tanh.jpg" rename to public/assets/ch6/tanh.jpg diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/7.1-gan_structure.png" b/public/assets/ch7/7.1-gan_structure.png old mode 100755 new mode 100644 similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/7.1-gan_structure.png" rename to public/assets/ch7/7.1-gan_structure.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/7.1.png" b/public/assets/ch7/7.1.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/7.1.png" rename to public/assets/ch7/7.1.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/7.4.3-2.png" b/public/assets/ch7/7.4.3-2.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/7.4.3-2.png" rename to public/assets/ch7/7.4.3-2.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/7.4.3.png" b/public/assets/ch7/7.4.3.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/7.4.3.png" rename to public/assets/ch7/7.4.3.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/Boundary_map.png" b/public/assets/ch7/Boundary_map.png old mode 100755 new mode 100644 similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/Boundary_map.png" rename to public/assets/ch7/Boundary_map.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/CGAN-ACGAN.png" b/public/assets/ch7/CGAN-ACGAN.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/CGAN-ACGAN.png" rename to public/assets/ch7/CGAN-ACGAN.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/CGAN\347\275\221\347\273\234\347\273\223\346\236\204.png" "b/public/assets/ch7/CGAN\347\275\221\347\273\234\347\273\223\346\236\204.png" old mode 100755 new mode 100644 similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/CGAN\347\275\221\347\273\234\347\273\223\346\236\204.png" rename to "public/assets/ch7/CGAN\347\275\221\347\273\234\347\273\223\346\236\204.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/CycleGAN\346\250\241\345\236\213\347\244\272\346\204\217\345\233\276.png" "b/public/assets/ch7/CycleGAN\346\250\241\345\236\213\347\244\272\346\204\217\345\233\276.png" similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/CycleGAN\346\250\241\345\236\213\347\244\272\346\204\217\345\233\276.png" rename to "public/assets/ch7/CycleGAN\346\250\241\345\236\213\347\244\272\346\204\217\345\233\276.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/CycleGAN\347\273\223\346\236\234\344\276\213\345\255\220.png" "b/public/assets/ch7/CycleGAN\347\273\223\346\236\234\344\276\213\345\255\220.png" similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/CycleGAN\347\273\223\346\236\234\344\276\213\345\255\220.png" rename to "public/assets/ch7/CycleGAN\347\273\223\346\236\234\344\276\213\345\255\220.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/DCGAN\347\273\223\346\236\204\345\233\276.png" "b/public/assets/ch7/DCGAN\347\273\223\346\236\204\345\233\276.png" similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/DCGAN\347\273\223\346\236\204\345\233\276.png" rename to "public/assets/ch7/DCGAN\347\273\223\346\236\204\345\233\276.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/Domain Adaption.png" b/public/assets/ch7/Domain Adaption.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/Domain Adaption.png" rename to public/assets/ch7/Domain Adaption.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/GAN Appl.png" b/public/assets/ch7/GAN Appl.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/GAN Appl.png" rename to public/assets/ch7/GAN Appl.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/GAN overview.png" b/public/assets/ch7/GAN overview.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/GAN overview.png" rename to public/assets/ch7/GAN overview.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/GAN-semi-Supervised.png" b/public/assets/ch7/GAN-semi-Supervised.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/GAN-semi-Supervised.png" rename to public/assets/ch7/GAN-semi-Supervised.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/GAN_ALL.png" b/public/assets/ch7/GAN_ALL.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/GAN_ALL.png" rename to public/assets/ch7/GAN_ALL.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/GAN\347\273\223\346\236\204\345\257\271\346\257\224.png" "b/public/assets/ch7/GAN\347\273\223\346\236\204\345\257\271\346\257\224.png" similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/GAN\347\273\223\346\236\204\345\257\271\346\257\224.png" rename to "public/assets/ch7/GAN\347\273\223\346\236\204\345\257\271\346\257\224.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/InfoGAN.png" b/public/assets/ch7/InfoGAN.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/InfoGAN.png" rename to public/assets/ch7/InfoGAN.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/LSGAN\344\272\244\345\217\211\347\206\265\344\270\216\346\234\200\345\260\217\344\272\214\344\271\230\346\215\237\345\244\261\345\257\271\346\257\224\345\233\276.png" "b/public/assets/ch7/LSGAN\344\272\244\345\217\211\347\206\265\344\270\216\346\234\200\345\260\217\344\272\214\344\271\230\346\215\237\345\244\261\345\257\271\346\257\224\345\233\276.png" similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/LSGAN\344\272\244\345\217\211\347\206\265\344\270\216\346\234\200\345\260\217\344\272\214\344\271\230\346\215\237\345\244\261\345\257\271\346\257\224\345\233\276.png" rename to "public/assets/ch7/LSGAN\344\272\244\345\217\211\347\206\265\344\270\216\346\234\200\345\260\217\344\272\214\344\271\230\346\215\237\345\244\261\345\257\271\346\257\224\345\233\276.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/MAD_GAN.png" b/public/assets/ch7/MAD_GAN.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/MAD_GAN.png" rename to public/assets/ch7/MAD_GAN.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/MRGAN.png" b/public/assets/ch7/MRGAN.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/MRGAN.png" rename to public/assets/ch7/MRGAN.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/StackGAN PGAN.png" b/public/assets/ch7/StackGAN PGAN.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/StackGAN PGAN.png" rename to public/assets/ch7/StackGAN PGAN.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/Triple-GAN.png" b/public/assets/ch7/Triple-GAN.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/Triple-GAN.png" rename to public/assets/ch7/Triple-GAN.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/VAE.png" b/public/assets/ch7/VAE.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/VAE.png" rename to public/assets/ch7/VAE.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/VAEGAN.png" b/public/assets/ch7/VAEGAN.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/VAEGAN.png" rename to public/assets/ch7/VAEGAN.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/Wass\350\267\235\347\246\273\351\232\217\350\277\255\344\273\243\346\254\241\346\225\260\345\217\230\345\214\226.png" "b/public/assets/ch7/Wass\350\267\235\347\246\273\351\232\217\350\277\255\344\273\243\346\254\241\346\225\260\345\217\230\345\214\226.png" similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/Wass\350\267\235\347\246\273\351\232\217\350\277\255\344\273\243\346\254\241\346\225\260\345\217\230\345\214\226.png" rename to "public/assets/ch7/Wass\350\267\235\347\246\273\351\232\217\350\277\255\344\273\243\346\254\241\346\225\260\345\217\230\345\214\226.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/ch7.pdf" b/public/assets/ch7/ch7.pdf similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/ch7.pdf" rename to public/assets/ch7/ch7.pdf diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/coupleGAN.png" b/public/assets/ch7/coupleGAN.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/coupleGAN.png" rename to public/assets/ch7/coupleGAN.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/cycleGAN\346\225\260\346\215\256\345\242\236\345\271\277.png" "b/public/assets/ch7/cycleGAN\346\225\260\346\215\256\345\242\236\345\271\277.png" similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/cycleGAN\346\225\260\346\215\256\345\242\236\345\271\277.png" rename to "public/assets/ch7/cycleGAN\346\225\260\346\215\256\345\242\236\345\271\277.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/f-divergence.png" b/public/assets/ch7/f-divergence.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/f-divergence.png" rename to public/assets/ch7/f-divergence.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/lsgan loss compare.png" b/public/assets/ch7/lsgan loss compare.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/lsgan loss compare.png" rename to public/assets/ch7/lsgan loss compare.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/lsgan\345\206\263\347\255\226\351\235\242\347\244\272\346\204\217\345\233\276.png" "b/public/assets/ch7/lsgan\345\206\263\347\255\226\351\235\242\347\244\272\346\204\217\345\233\276.png" similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/lsgan\345\206\263\347\255\226\351\235\242\347\244\272\346\204\217\345\233\276.png" rename to "public/assets/ch7/lsgan\345\206\263\347\255\226\351\235\242\347\244\272\346\204\217\345\233\276.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/mode_dropping.png" b/public/assets/ch7/mode_dropping.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/mode_dropping.png" rename to public/assets/ch7/mode_dropping.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/model_collpsing.png" b/public/assets/ch7/model_collpsing.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/model_collpsing.png" rename to public/assets/ch7/model_collpsing.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/mv_boxes.png" b/public/assets/ch7/mv_boxes.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/mv_boxes.png" rename to public/assets/ch7/mv_boxes.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/part1.png" b/public/assets/ch7/part1.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/part1.png" rename to public/assets/ch7/part1.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/part2-3.png" b/public/assets/ch7/part2-3.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/part2-3.png" rename to public/assets/ch7/part2-3.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/part4.png" b/public/assets/ch7/part4.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/part4.png" rename to public/assets/ch7/part4.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pixHD_Loss.png" b/public/assets/ch7/pix2pixHD_Loss.png old mode 100755 new mode 100644 similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pixHD_Loss.png" rename to public/assets/ch7/pix2pixHD_Loss.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pixHD\347\275\221\347\273\234\347\273\223\346\236\204.png" "b/public/assets/ch7/pix2pixHD\347\275\221\347\273\234\347\273\223\346\236\204.png" old mode 100755 new mode 100644 similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pixHD\347\275\221\347\273\234\347\273\223\346\236\204.png" rename to "public/assets/ch7/pix2pixHD\347\275\221\347\273\234\347\273\223\346\236\204.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pix_Loss.png" b/public/assets/ch7/pix2pix_Loss.png old mode 100755 new mode 100644 similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pix_Loss.png" rename to public/assets/ch7/pix2pix_Loss.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pix\346\250\241\345\236\213\347\244\272\346\204\217\345\233\276.png" "b/public/assets/ch7/pix2pix\346\250\241\345\236\213\347\244\272\346\204\217\345\233\276.png" old mode 100755 new mode 100644 similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pix\346\250\241\345\236\213\347\244\272\346\204\217\345\233\276.png" rename to "public/assets/ch7/pix2pix\346\250\241\345\236\213\347\244\272\346\204\217\345\233\276.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pix\347\273\223\346\236\234\347\244\272\344\276\213.png" "b/public/assets/ch7/pix2pix\347\273\223\346\236\234\347\244\272\344\276\213.png" old mode 100755 new mode 100644 similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pix\347\273\223\346\236\234\347\244\272\344\276\213.png" rename to "public/assets/ch7/pix2pix\347\273\223\346\236\234\347\244\272\344\276\213.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pix\350\257\255\344\271\211\345\234\260\345\233\276L1loss\347\273\223\346\236\234.png" "b/public/assets/ch7/pix2pix\350\257\255\344\271\211\345\234\260\345\233\276L1loss\347\273\223\346\236\234.png" old mode 100755 new mode 100644 similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pix2pix\350\257\255\344\271\211\345\234\260\345\233\276L1loss\347\273\223\346\236\234.png" rename to "public/assets/ch7/pix2pix\350\257\255\344\271\211\345\234\260\345\233\276L1loss\347\273\223\346\236\234.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pixCNN.png" b/public/assets/ch7/pixCNN.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pixCNN.png" rename to public/assets/ch7/pixCNN.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pixRNN.png" b/public/assets/ch7/pixRNN.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/pixRNN.png" rename to public/assets/ch7/pixRNN.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/seqGAN\346\250\241\345\236\213.png" "b/public/assets/ch7/seqGAN\346\250\241\345\236\213.png" similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/seqGAN\346\250\241\345\236\213.png" rename to "public/assets/ch7/seqGAN\346\250\241\345\236\213.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/starGAN\345\212\240\345\205\245mask\347\244\272\346\204\217\345\233\276.png" "b/public/assets/ch7/starGAN\345\212\240\345\205\245mask\347\244\272\346\204\217\345\233\276.png" similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/starGAN\345\212\240\345\205\245mask\347\244\272\346\204\217\345\233\276.png" rename to "public/assets/ch7/starGAN\345\212\240\345\205\245mask\347\244\272\346\204\217\345\233\276.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/starGAN\346\250\241\345\236\213\347\273\223\346\236\204.png" "b/public/assets/ch7/starGAN\346\250\241\345\236\213\347\273\223\346\236\204.png" similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/starGAN\346\250\241\345\236\213\347\273\223\346\236\204.png" rename to "public/assets/ch7/starGAN\346\250\241\345\236\213\347\273\223\346\236\204.png" diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/two_trans_diff_dis_wgan.png" b/public/assets/ch7/two_trans_diff_dis_wgan.png similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/two_trans_diff_dis_wgan.png" rename to public/assets/ch7/two_trans_diff_dis_wgan.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/two_trans_wgan.jpeg" b/public/assets/ch7/two_trans_wgan.jpeg similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/two_trans_wgan.jpeg" rename to public/assets/ch7/two_trans_wgan.jpeg diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/upsample.png" b/public/assets/ch7/upsample.png old mode 100755 new mode 100644 similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/upsample.png" rename to public/assets/ch7/upsample.png diff --git "a/ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/\350\257\255\344\271\211\347\274\226\350\276\221.png" "b/public/assets/ch7/\350\257\255\344\271\211\347\274\226\350\276\221.png" old mode 100755 new mode 100644 similarity index 100% rename from "ch07_\347\224\237\346\210\220\345\257\271\346\212\227\347\275\221\347\273\234(GAN)/img/ch7/\350\257\255\344\271\211\347\274\226\350\276\221.png" rename to "public/assets/ch7/\350\257\255\344\271\211\347\274\226\350\276\221.png" diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.1.png" b/public/assets/ch8/8.1.1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.1.png" rename to public/assets/ch8/8.1.1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.10.png" b/public/assets/ch8/8.1.10.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.10.png" rename to public/assets/ch8/8.1.10.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.11.gif" b/public/assets/ch8/8.1.11.gif similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.11.gif" rename to public/assets/ch8/8.1.11.gif diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.12.png" b/public/assets/ch8/8.1.12.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.12.png" rename to public/assets/ch8/8.1.12.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.13.png" b/public/assets/ch8/8.1.13.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.13.png" rename to public/assets/ch8/8.1.13.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.14.png" b/public/assets/ch8/8.1.14.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.14.png" rename to public/assets/ch8/8.1.14.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.15.png" b/public/assets/ch8/8.1.15.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.15.png" rename to public/assets/ch8/8.1.15.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.16.png" b/public/assets/ch8/8.1.16.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.16.png" rename to public/assets/ch8/8.1.16.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.17.png" b/public/assets/ch8/8.1.17.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.17.png" rename to public/assets/ch8/8.1.17.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.18.png" b/public/assets/ch8/8.1.18.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.18.png" rename to public/assets/ch8/8.1.18.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.19.png" b/public/assets/ch8/8.1.19.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.19.png" rename to public/assets/ch8/8.1.19.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.2.png" b/public/assets/ch8/8.1.2.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.2.png" rename to public/assets/ch8/8.1.2.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.20.png" b/public/assets/ch8/8.1.20.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.20.png" rename to public/assets/ch8/8.1.20.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.3.png" b/public/assets/ch8/8.1.3.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.3.png" rename to public/assets/ch8/8.1.3.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.4.png" b/public/assets/ch8/8.1.4.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.4.png" rename to public/assets/ch8/8.1.4.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.5.png" b/public/assets/ch8/8.1.5.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.5.png" rename to public/assets/ch8/8.1.5.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.6.png" b/public/assets/ch8/8.1.6.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.6.png" rename to public/assets/ch8/8.1.6.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.7.png" b/public/assets/ch8/8.1.7.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.7.png" rename to public/assets/ch8/8.1.7.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.8.png" b/public/assets/ch8/8.1.8.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.8.png" rename to public/assets/ch8/8.1.8.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.9.png" b/public/assets/ch8/8.1.9.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.1.9.png" rename to public/assets/ch8/8.1.9.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.1-1.png" b/public/assets/ch8/8.2.1-1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.1-1.png" rename to public/assets/ch8/8.2.1-1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.1.png" b/public/assets/ch8/8.2.1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.1.png" rename to public/assets/ch8/8.2.1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.2-1.png" b/public/assets/ch8/8.2.2-1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.2-1.png" rename to public/assets/ch8/8.2.2-1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.2-2.png" b/public/assets/ch8/8.2.2-2.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.2-2.png" rename to public/assets/ch8/8.2.2-2.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.2.png" b/public/assets/ch8/8.2.2.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.2.png" rename to public/assets/ch8/8.2.2.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-1.png" b/public/assets/ch8/8.2.3-1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-1.png" rename to public/assets/ch8/8.2.3-1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-2.png" b/public/assets/ch8/8.2.3-2.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-2.png" rename to public/assets/ch8/8.2.3-2.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-3.png" b/public/assets/ch8/8.2.3-3.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-3.png" rename to public/assets/ch8/8.2.3-3.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-4.png" b/public/assets/ch8/8.2.3-4.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-4.png" rename to public/assets/ch8/8.2.3-4.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-5.png" b/public/assets/ch8/8.2.3-5.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-5.png" rename to public/assets/ch8/8.2.3-5.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-6.png" b/public/assets/ch8/8.2.3-6.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-6.png" rename to public/assets/ch8/8.2.3-6.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-7.png" b/public/assets/ch8/8.2.3-7.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3-7.png" rename to public/assets/ch8/8.2.3-7.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3.png" b/public/assets/ch8/8.2.3.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.3.png" rename to public/assets/ch8/8.2.3.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4-1.png" b/public/assets/ch8/8.2.4-1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4-1.png" rename to public/assets/ch8/8.2.4-1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4-2.png" b/public/assets/ch8/8.2.4-2.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4-2.png" rename to public/assets/ch8/8.2.4-2.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4-3.png" b/public/assets/ch8/8.2.4-3.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4-3.png" rename to public/assets/ch8/8.2.4-3.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4-4.png" b/public/assets/ch8/8.2.4-4.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4-4.png" rename to public/assets/ch8/8.2.4-4.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4-5.png" b/public/assets/ch8/8.2.4-5.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4-5.png" rename to public/assets/ch8/8.2.4-5.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4.png" b/public/assets/ch8/8.2.4.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.4.png" rename to public/assets/ch8/8.2.4.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.5.png" b/public/assets/ch8/8.2.5.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.5.png" rename to public/assets/ch8/8.2.5.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.6.png" b/public/assets/ch8/8.2.6.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.6.png" rename to public/assets/ch8/8.2.6.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.7.png" b/public/assets/ch8/8.2.7.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.2.7.png" rename to public/assets/ch8/8.2.7.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.3.1.png" b/public/assets/ch8/8.3.1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.3.1.png" rename to public/assets/ch8/8.3.1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.1.png" b/public/assets/ch8/8.4.1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.1.png" rename to public/assets/ch8/8.4.1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.10.png" b/public/assets/ch8/8.4.10.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.10.png" rename to public/assets/ch8/8.4.10.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.11.png" b/public/assets/ch8/8.4.11.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.11.png" rename to public/assets/ch8/8.4.11.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.12.png" b/public/assets/ch8/8.4.12.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.12.png" rename to public/assets/ch8/8.4.12.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.13.png" b/public/assets/ch8/8.4.13.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.13.png" rename to public/assets/ch8/8.4.13.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.14.png" b/public/assets/ch8/8.4.14.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.14.png" rename to public/assets/ch8/8.4.14.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.2.png" b/public/assets/ch8/8.4.2.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.2.png" rename to public/assets/ch8/8.4.2.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.3.png" b/public/assets/ch8/8.4.3.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.3.png" rename to public/assets/ch8/8.4.3.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.4.png" b/public/assets/ch8/8.4.4.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.4.png" rename to public/assets/ch8/8.4.4.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.5.png" b/public/assets/ch8/8.4.5.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.5.png" rename to public/assets/ch8/8.4.5.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.6.png" b/public/assets/ch8/8.4.6.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.6.png" rename to public/assets/ch8/8.4.6.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.7.png" b/public/assets/ch8/8.4.7.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.7.png" rename to public/assets/ch8/8.4.7.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.8.png" b/public/assets/ch8/8.4.8.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.8.png" rename to public/assets/ch8/8.4.8.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.9.png" b/public/assets/ch8/8.4.9.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.4.9.png" rename to public/assets/ch8/8.4.9.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-1.png" b/public/assets/ch8/8.5.1-1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-1.png" rename to public/assets/ch8/8.5.1-1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-2.png" b/public/assets/ch8/8.5.1-2.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-2.png" rename to public/assets/ch8/8.5.1-2.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-3.png" b/public/assets/ch8/8.5.1-3.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-3.png" rename to public/assets/ch8/8.5.1-3.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-4.png" b/public/assets/ch8/8.5.1-4.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-4.png" rename to public/assets/ch8/8.5.1-4.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-5.png" b/public/assets/ch8/8.5.1-5.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-5.png" rename to public/assets/ch8/8.5.1-5.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-6.png" b/public/assets/ch8/8.5.1-6.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-6.png" rename to public/assets/ch8/8.5.1-6.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-7.png" b/public/assets/ch8/8.5.1-7.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-7.png" rename to public/assets/ch8/8.5.1-7.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-8.png" b/public/assets/ch8/8.5.1-8.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.1-8.png" rename to public/assets/ch8/8.5.1-8.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.9-1.png" b/public/assets/ch8/8.5.9-1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.9-1.png" rename to public/assets/ch8/8.5.9-1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.9-2.png" b/public/assets/ch8/8.5.9-2.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.9-2.png" rename to public/assets/ch8/8.5.9-2.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.9-3.png" b/public/assets/ch8/8.5.9-3.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.9-3.png" rename to public/assets/ch8/8.5.9-3.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.9-4.png" b/public/assets/ch8/8.5.9-4.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/8.5.9-4.png" rename to public/assets/ch8/8.5.9-4.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DSSD-01.png" b/public/assets/ch8/DSSD-01.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DSSD-01.png" rename to public/assets/ch8/DSSD-01.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DSSD-02.png" b/public/assets/ch8/DSSD-02.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DSSD-02.png" rename to public/assets/ch8/DSSD-02.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DSSD-03.png" b/public/assets/ch8/DSSD-03.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DSSD-03.png" rename to public/assets/ch8/DSSD-03.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-1.png" b/public/assets/ch8/DetNet-1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-1.png" rename to public/assets/ch8/DetNet-1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-2.png" b/public/assets/ch8/DetNet-2.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-2.png" rename to public/assets/ch8/DetNet-2.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-3.png" b/public/assets/ch8/DetNet-3.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-3.png" rename to public/assets/ch8/DetNet-3.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-4.png" b/public/assets/ch8/DetNet-4.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-4.png" rename to public/assets/ch8/DetNet-4.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-5.png" b/public/assets/ch8/DetNet-5.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-5.png" rename to public/assets/ch8/DetNet-5.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-6.png" b/public/assets/ch8/DetNet-6.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-6.png" rename to public/assets/ch8/DetNet-6.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-7.png" b/public/assets/ch8/DetNet-7.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-7.png" rename to public/assets/ch8/DetNet-7.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-8.png" b/public/assets/ch8/DetNet-8.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/DetNet-8.png" rename to public/assets/ch8/DetNet-8.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/FPN-01.png" b/public/assets/ch8/FPN-01.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/FPN-01.png" rename to public/assets/ch8/FPN-01.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/FPN-02.png" b/public/assets/ch8/FPN-02.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/FPN-02.png" rename to public/assets/ch8/FPN-02.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/FPN-03.png" b/public/assets/ch8/FPN-03.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/FPN-03.png" rename to public/assets/ch8/FPN-03.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/FPN-04.png" b/public/assets/ch8/FPN-04.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/FPN-04.png" rename to public/assets/ch8/FPN-04.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/M2Det-01.png" b/public/assets/ch8/M2Det-01.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/M2Det-01.png" rename to public/assets/ch8/M2Det-01.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/M2Det-02.png" b/public/assets/ch8/M2Det-02.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/M2Det-02.png" rename to public/assets/ch8/M2Det-02.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/M2Det-03.png" b/public/assets/ch8/M2Det-03.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/M2Det-03.png" rename to public/assets/ch8/M2Det-03.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/Mask R-CNN-01.png" b/public/assets/ch8/Mask R-CNN-01.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/Mask R-CNN-01.png" rename to public/assets/ch8/Mask R-CNN-01.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/Mask R-CNN-02.png" b/public/assets/ch8/Mask R-CNN-02.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/Mask R-CNN-02.png" rename to public/assets/ch8/Mask R-CNN-02.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/Mask R-CNN-03.png" b/public/assets/ch8/Mask R-CNN-03.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/Mask R-CNN-03.png" rename to public/assets/ch8/Mask R-CNN-03.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/Mask R-CNN-04.png" b/public/assets/ch8/Mask R-CNN-04.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/Mask R-CNN-04.png" rename to public/assets/ch8/Mask R-CNN-04.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RFBNet-01.png" b/public/assets/ch8/RFBNet-01.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RFBNet-01.png" rename to public/assets/ch8/RFBNet-01.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RFBNet-02.png" b/public/assets/ch8/RFBNet-02.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RFBNet-02.png" rename to public/assets/ch8/RFBNet-02.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RFBNet-03.png" b/public/assets/ch8/RFBNet-03.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RFBNet-03.png" rename to public/assets/ch8/RFBNet-03.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-01.png" b/public/assets/ch8/RetinaNet-01.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-01.png" rename to public/assets/ch8/RetinaNet-01.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-02.png" b/public/assets/ch8/RetinaNet-02.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-02.png" rename to public/assets/ch8/RetinaNet-02.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-03.png" b/public/assets/ch8/RetinaNet-03.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-03.png" rename to public/assets/ch8/RetinaNet-03.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-04.png" b/public/assets/ch8/RetinaNet-04.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-04.png" rename to public/assets/ch8/RetinaNet-04.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-05.png" b/public/assets/ch8/RetinaNet-05.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-05.png" rename to public/assets/ch8/RetinaNet-05.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-06.png" b/public/assets/ch8/RetinaNet-06.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-06.png" rename to public/assets/ch8/RetinaNet-06.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-07.png" b/public/assets/ch8/RetinaNet-07.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-07.png" rename to public/assets/ch8/RetinaNet-07.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-08.png" b/public/assets/ch8/RetinaNet-08.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-08.png" rename to public/assets/ch8/RetinaNet-08.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-09.png" b/public/assets/ch8/RetinaNet-09.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-09.png" rename to public/assets/ch8/RetinaNet-09.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-10.png" b/public/assets/ch8/RetinaNet-10.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-10.png" rename to public/assets/ch8/RetinaNet-10.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-11.png" b/public/assets/ch8/RetinaNet-11.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-11.png" rename to public/assets/ch8/RetinaNet-11.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-12.png" b/public/assets/ch8/RetinaNet-12.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-12.png" rename to public/assets/ch8/RetinaNet-12.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-13.png" b/public/assets/ch8/RetinaNet-13.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-13.png" rename to public/assets/ch8/RetinaNet-13.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-14.png" b/public/assets/ch8/RetinaNet-14.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/RetinaNet-14.png" rename to public/assets/ch8/RetinaNet-14.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/SSD-01.png" b/public/assets/ch8/SSD-01.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/SSD-01.png" rename to public/assets/ch8/SSD-01.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/SSD-02.png" b/public/assets/ch8/SSD-02.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/SSD-02.png" rename to public/assets/ch8/SSD-02.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv1-01.png" b/public/assets/ch8/YOLOv1-01.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv1-01.png" rename to public/assets/ch8/YOLOv1-01.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv1-02.png" b/public/assets/ch8/YOLOv1-02.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv1-02.png" rename to public/assets/ch8/YOLOv1-02.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv1-03.png" b/public/assets/ch8/YOLOv1-03.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv1-03.png" rename to public/assets/ch8/YOLOv1-03.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv1-04.png" b/public/assets/ch8/YOLOv1-04.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv1-04.png" rename to public/assets/ch8/YOLOv1-04.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv2-01.png" b/public/assets/ch8/YOLOv2-01.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv2-01.png" rename to public/assets/ch8/YOLOv2-01.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv2-02.png" b/public/assets/ch8/YOLOv2-02.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv2-02.png" rename to public/assets/ch8/YOLOv2-02.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv2-03.png" b/public/assets/ch8/YOLOv2-03.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv2-03.png" rename to public/assets/ch8/YOLOv2-03.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv2-04.png" b/public/assets/ch8/YOLOv2-04.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv2-04.png" rename to public/assets/ch8/YOLOv2-04.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv3-01.png" b/public/assets/ch8/YOLOv3-01.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv3-01.png" rename to public/assets/ch8/YOLOv3-01.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv3-02.png" b/public/assets/ch8/YOLOv3-02.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv3-02.png" rename to public/assets/ch8/YOLOv3-02.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv3-03.png" b/public/assets/ch8/YOLOv3-03.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/YOLOv3-03.png" rename to public/assets/ch8/YOLOv3-03.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/al8.1.png" b/public/assets/ch8/al8.1.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/al8.1.png" rename to public/assets/ch8/al8.1.png diff --git "a/ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/snip_20181118170528.png" b/public/assets/ch8/snip_20181118170528.png similarity index 100% rename from "ch08_\347\233\256\346\240\207\346\243\200\346\265\213/img/ch8/snip_20181118170528.png" rename to public/assets/ch8/snip_20181118170528.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9-10-1.png" b/public/assets/ch9/9-10-1.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9-10-1.png" rename to public/assets/ch9/9-10-1.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9-10-2.png" b/public/assets/ch9/9-10-2.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9-10-2.png" rename to public/assets/ch9/9-10-2.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9-10-3.png" b/public/assets/ch9/9-10-3.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9-10-3.png" rename to public/assets/ch9/9-10-3.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9.13-1.png" b/public/assets/ch9/9.13-1.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9.13-1.png" rename to public/assets/ch9/9.13-1.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9.13-2.png" b/public/assets/ch9/9.13-2.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9.13-2.png" rename to public/assets/ch9/9.13-2.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9.13-3.png" b/public/assets/ch9/9.13-3.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9.13-3.png" rename to public/assets/ch9/9.13-3.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9.13-4.png" b/public/assets/ch9/9.13-4.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9.13-4.png" rename to public/assets/ch9/9.13-4.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9.13-5.png" b/public/assets/ch9/9.13-5.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/9.13-5.png" rename to public/assets/ch9/9.13-5.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/COCO-01.png" b/public/assets/ch9/COCO-01.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/COCO-01.png" rename to public/assets/ch9/COCO-01.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/Cityscapes-01.png" b/public/assets/ch9/Cityscapes-01.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/Cityscapes-01.png" rename to public/assets/ch9/Cityscapes-01.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/Instance-01.png" b/public/assets/ch9/Instance-01.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/Instance-01.png" rename to public/assets/ch9/Instance-01.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/VOC-01.png" b/public/assets/ch9/VOC-01.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/VOC-01.png" rename to public/assets/ch9/VOC-01.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_1.png" b/public/assets/ch9/figure_9.1.10_1.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_1.png" rename to public/assets/ch9/figure_9.1.10_1.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_2.png" b/public/assets/ch9/figure_9.1.10_2.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_2.png" rename to public/assets/ch9/figure_9.1.10_2.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_3.png" b/public/assets/ch9/figure_9.1.10_3.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_3.png" rename to public/assets/ch9/figure_9.1.10_3.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_4.png" b/public/assets/ch9/figure_9.1.10_4.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_4.png" rename to public/assets/ch9/figure_9.1.10_4.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_5.png" b/public/assets/ch9/figure_9.1.10_5.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_5.png" rename to public/assets/ch9/figure_9.1.10_5.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_6.png" b/public/assets/ch9/figure_9.1.10_6.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.10_6.png" rename to public/assets/ch9/figure_9.1.10_6.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.1_1.jpg" b/public/assets/ch9/figure_9.1.1_1.jpg similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.1_1.jpg" rename to public/assets/ch9/figure_9.1.1_1.jpg diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.1_2.jpg" b/public/assets/ch9/figure_9.1.1_2.jpg similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.1_2.jpg" rename to public/assets/ch9/figure_9.1.1_2.jpg diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.2_1.jpg" b/public/assets/ch9/figure_9.1.2_1.jpg similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.2_1.jpg" rename to public/assets/ch9/figure_9.1.2_1.jpg diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.3_1.jpg" b/public/assets/ch9/figure_9.1.3_1.jpg similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.3_1.jpg" rename to public/assets/ch9/figure_9.1.3_1.jpg diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.7_1.png" b/public/assets/ch9/figure_9.1.7_1.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.7_1.png" rename to public/assets/ch9/figure_9.1.7_1.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.7_2.png" b/public/assets/ch9/figure_9.1.7_2.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.7_2.png" rename to public/assets/ch9/figure_9.1.7_2.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.7_3.png" b/public/assets/ch9/figure_9.1.7_3.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.7_3.png" rename to public/assets/ch9/figure_9.1.7_3.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.7_4.jpg" b/public/assets/ch9/figure_9.1.7_4.jpg similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.7_4.jpg" rename to public/assets/ch9/figure_9.1.7_4.jpg diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.8_1.png" b/public/assets/ch9/figure_9.1.8_1.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.8_1.png" rename to public/assets/ch9/figure_9.1.8_1.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.8_2.png" b/public/assets/ch9/figure_9.1.8_2.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.8_2.png" rename to public/assets/ch9/figure_9.1.8_2.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.9_1.png" b/public/assets/ch9/figure_9.1.9_1.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.1.9_1.png" rename to public/assets/ch9/figure_9.1.9_1.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.2_1.png" b/public/assets/ch9/figure_9.2_1.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.2_1.png" rename to public/assets/ch9/figure_9.2_1.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.3_1.jpg" b/public/assets/ch9/figure_9.3_1.jpg similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.3_1.jpg" rename to public/assets/ch9/figure_9.3_1.jpg diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.3_2.jpg" b/public/assets/ch9/figure_9.3_2.jpg similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.3_2.jpg" rename to public/assets/ch9/figure_9.3_2.jpg diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.3_3.png" b/public/assets/ch9/figure_9.3_3.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.3_3.png" rename to public/assets/ch9/figure_9.3_3.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.3_4.jpg" b/public/assets/ch9/figure_9.3_4.jpg similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.3_4.jpg" rename to public/assets/ch9/figure_9.3_4.jpg diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.4_1.png" b/public/assets/ch9/figure_9.4_1.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.4_1.png" rename to public/assets/ch9/figure_9.4_1.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.4_2.png" b/public/assets/ch9/figure_9.4_2.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.4_2.png" rename to public/assets/ch9/figure_9.4_2.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_1.png" b/public/assets/ch9/figure_9.6_1.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_1.png" rename to public/assets/ch9/figure_9.6_1.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_2.png" b/public/assets/ch9/figure_9.6_2.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_2.png" rename to public/assets/ch9/figure_9.6_2.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_3.png" b/public/assets/ch9/figure_9.6_3.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_3.png" rename to public/assets/ch9/figure_9.6_3.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_4.png" b/public/assets/ch9/figure_9.6_4.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_4.png" rename to public/assets/ch9/figure_9.6_4.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_5.png" b/public/assets/ch9/figure_9.6_5.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_5.png" rename to public/assets/ch9/figure_9.6_5.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_6.png" b/public/assets/ch9/figure_9.6_6.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_6.png" rename to public/assets/ch9/figure_9.6_6.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_7.png" b/public/assets/ch9/figure_9.6_7.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.6_7.png" rename to public/assets/ch9/figure_9.6_7.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.8_1.png" b/public/assets/ch9/figure_9.8_1.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.8_1.png" rename to public/assets/ch9/figure_9.8_1.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.8_2.png" b/public/assets/ch9/figure_9.8_2.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.8_2.png" rename to public/assets/ch9/figure_9.8_2.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.8_3.png" b/public/assets/ch9/figure_9.8_3.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.8_3.png" rename to public/assets/ch9/figure_9.8_3.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.8_4.png" b/public/assets/ch9/figure_9.8_4.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.8_4.png" rename to public/assets/ch9/figure_9.8_4.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_1.png" b/public/assets/ch9/figure_9.9_1.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_1.png" rename to public/assets/ch9/figure_9.9_1.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_2.png" b/public/assets/ch9/figure_9.9_2.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_2.png" rename to public/assets/ch9/figure_9.9_2.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_3.png" b/public/assets/ch9/figure_9.9_3.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_3.png" rename to public/assets/ch9/figure_9.9_3.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_4.png" b/public/assets/ch9/figure_9.9_4.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_4.png" rename to public/assets/ch9/figure_9.9_4.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_5.png" b/public/assets/ch9/figure_9.9_5.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_5.png" rename to public/assets/ch9/figure_9.9_5.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_6.png" b/public/assets/ch9/figure_9.9_6.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_6.png" rename to public/assets/ch9/figure_9.9_6.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_7.png" b/public/assets/ch9/figure_9.9_7.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_7.png" rename to public/assets/ch9/figure_9.9_7.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_8.png" b/public/assets/ch9/figure_9.9_8.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/figure_9.9_8.png" rename to public/assets/ch9/figure_9.9_8.png diff --git "a/ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/semantic-01.png" b/public/assets/ch9/semantic-01.png similarity index 100% rename from "ch09_\345\233\276\345\203\217\345\210\206\345\211\262/img/ch9/semantic-01.png" rename to public/assets/ch9/semantic-01.png diff --git a/qun.png b/qun.png deleted file mode 100644 index bee0e73c..00000000 Binary files a/qun.png and /dev/null differ