resnet 卷积核大小

On final year of uni, they offered three selection subject to choose: Image Processing, AR/VR, and Digital Forensic. I was trying so hard to be different and chose Digital Forensic, my own worst decision. It was so hard and without any interest on the field, i didn’t actually understand (surviving CS 101). Anyway, a lesson for me (and probably you): just be realistic.

在uni的最后一年,他们提供了三个选择主题供您选择:图像处理,AR / VR和Digital Forensic。 我一直在努力与众不同,因此选择了Digital Forensic,这是我自己最糟糕的决定。 这是如此的艰难,并且对该领域没有任何兴趣,我实际上并没有理解(在CS 101中幸存下来)。 无论如何,对我(可能还有您)来说,这是一个教训:要现实一点

So because I was so silly to choose another subject instead of image processing, I tried to learn it myself. Turned out, it’s even more fun to learn by yourself. I will list every source to understand Image Processing the easy way on every point. Anyway, Kaggle provides this free course explaining very detailed about Image Processing with Deep Learning.

因此,由于我很愚蠢地选择另一个主题而不是图像处理,所以我尝试自己学习。 事实证明,自己学习更有趣。 我将列出所有资料,以使您轻松地了解图像处理的所有方面。 无论如何,Kaggle都会提供此免费课程,其中详细说明了有关深度学习的图像处理。

In this article, I used Kaggle dataset with X-ray images that classify COVID-19, Viral pneumonia and Normal Chest. There are 219 COVID-19 Positive images, 1341 Normal images and 1345 Viral Pneumonia images.

在本文中,我将Kaggle数据集与X射线图像一起使用,以对COVID-19,病毒性肺炎和正常胸部进行分类。 有219个COVID-19阳性图像,1341正常图像和1345病毒性肺炎图像。

As always, head to my Github for the code❤️

和往常一样,前往我的Github获取代码❤️

I

一世

影像分类(Image Classification)

Image Classification is a method to extract information of image classes digitally. Shortly, it used to classify images. Image Classification can be supervised (you give label to each images) and also unsupervised (the training model learned to classify the images based on the patterns).

图像分类是一种以数字方式提取图像类别信息的方法。 不久,它用于对图像进行分类。 可以监督图像分类(为每个图像添加标签),也可以不受监督(训练模型可以学习根据模式对图像进行分类)。

This article used Supervised Image Classification with three classes.

本文将监督图像分类与三个类一起使用。

有线电视新闻网 (CNN)

As I mentioned before, I am using Resnet50 layers, which is one of CNN architectures. To know more about CNN, this article explained CNN so clear. To sum it up, the flow of CNN are:

如前所述,我正在使用Resnet50层,这是CNN架构之一。 要了解有关CNN的更多信息,本文对CNN的解释非常清楚。 综上所述,CNN的流为:

  1. Convolution Layer (extract feature with filtering)卷积层(通过过滤提取特征)
  2. Strides (shifting pixels over the input matrix)步幅(在输入矩阵上移动像素)
  3. Padding填充
  4. Rectified Linear Unit (RelU) (introduce non-linearity to the network)整流线性单位(RelU)(引入网络非线性)
  5. Padding Layer (reduce number of parameters)填充层(减少参数数量)
  6. Fully Connected Layer (flatten matrix into vector and feed it to a fully connected neural network layer.)完全连接层(将矩阵展平为向量,并将其馈送到完全连接的神经网络层。)

There are few architecture of CNN (some of the most common is ResNet, VGGNet), but in this post, I will use the ResNet50.

CNN的体系结构很少(最常见的是ResNet,VGGNet),但是在本文中,我将使用ResNet50。

ResNet or Residual Network uses the residual learning instead of trying to learn some features. Residual can be simply understood as subtraction of feature learned from input of that layer. There are some variants of ResNet other than ResNet50. The core idea of ResNet is introducing a shortcut connection that skips one or more layers.

ResNet或残差网络使用残差学习而不是尝试学习某些功能。 残差可以简单地理解为减去从该层的输入中学到的特征。 除ResNet50之外,还有一些ResNet的变体。 ResNet的核心思想是引入一种跳过一层或多层的快捷连接。

ResNet50 has 50 layers deep, below is the architecture of ResNet50 with 34 layer residual. Here is the paper of the network and here is why ResNet is a good CNN architecture to be used.

ResNet50有50层深,下面是具有34层残留的ResNet50体系结构。 这是网络的文章,这也是ResNet是要使用的良好CNN架构的原因。

Source: http://ethereon.github.io/netscope/#/gist/db945b393d40bfa26006
资料来源: http : //ethereon.github.io/netscope/#/gist/db945b393d40bfa26006

数据 (Data)

I actually wanted to try Image Processing for my research but in that time there were so many people said that image training consumed too much time and memory, plus if you don’t have decent laptop/computer, it might be kind of impossible to do so. So I didn’t. But turned out, you could just use Google Colab. I don’t know how much time if I train it on my computer but with Colab it’s not that long like my friends had said.

我实际上是想尝试图像处理来进行研究,但是那时有很多人说图像训练会浪费大量的时间和内存,如果您没有像样的笔记本电脑,那可能是不可能的事情所以。 所以我没有。 但是事实证明,您只能使用Google Colab。 我不知道要在计算机上培训多少时间,但是使用Colab的时间不长,就像我的朋友所说的那样。

If you wanted to access the data from Kaggle, you could just download the JSON API of your Kaggle account, upload to your Colab files then download and unzip the image data to your Colab environment.

如果您想从Kaggle访问数据,则可以下载Kaggle帐户的JSON API,上传到Colab文件,然后下载图像数据并将其解压缩到Colab环境。

! pip install -q kaggle! mkdir ~/.kaggle! cp kaggle.json ~/.kaggle/! chmod 600 ~/.kaggle/kaggle.json! kaggle datasets download -d tawsifurrahman/covid19-radiography-database! unzip "covid19-radiography-database.zip"

You can also access data from your Google Drive with mounting your Colab session and access your image data location from the Drive.

您还可以通过挂载Colab会话从Google云端硬盘访问数据,并从云端硬盘访问图像数据位置。

from google.colab import drivedrive.mount('/content/drive')

If you want to access the data from an open source website, you can just use request library from Python. To take an example, here’s how to download 20GB data from Physio Net.

如果要从开源网站访问数据,则可以仅使用Python中的请求库。 举个例子,这里是如何从Physio Net下载20GB数据的方法。

import requests, zipfile, iozip_file_url = "https://physionet.org/static/published-projects/siena-scalp-eeg/siena-scalp-eeg-database-1.0.0.zip"r = requests.get(zip_file_url)z = zipfile.ZipFile(io.BytesIO(r.content))z.extractall()

预处理 (Pre-Processing)

Library

图书馆

Some libraries that I used

我使用的一些库

from fastai.vision import *from fastai.metrics import error_rateimport torchimport torch.nn as nnimport torch.optim as optimfrom torch.optim import lr_schedulerfrom torch.autograd import Variableimport numpy as npimport timeimport osfrom fastai.callbacks import ActivationStats%matplotlib inlineimport matplotlib.pyplot as pltplt.style.use('seaborn-whitegrid')

Access the image from folder

从文件夹访问图像

Define the folder path

定义文件夹路径

path = Path('/content/COVID-19 Radiography Database/')folder = pathfolder.mkdir(parents=True, exist_ok=True)

Extract the image data bunch

提取图像数据串

np.random.seed(42)data = ImageDataBunch.from_folder(path, train='.', valid_pct=0.35, ds_tfms=get_transforms(), size=224, num_workers=4).normalize(imagenet_stats)

使用CNN Resnet50进行培训 (Training with CNN Resnet50)

With fastai, we can instantly use the Resnet model by the function of cnn_learner. Don’t forget to define the accuracy metrics so that we can see the loss and accuracy.

使用fastai,我们可以通过cnn_learner的功能立即使用Resnet模型。 不要忘记定义准确性指标,以便我们可以看到损失和准确性。

To reduce time, I will just use four epochs.

为了减少时间,我将仅使用四个时期。

learn = cnn_learner(data, models.resnet50, metrics=accuracy)learn.fit_one_cycle(4)

With the model, we can find the optimal learning rate to get the better performance. Unfreezing the model is used to let the model continue the training. In this case, unfreezing will let the model to train again with the better learning rate after we got the observation.

通过该模型,我们可以找到最佳学习率以获得更好的性能。 解冻模型用于使模型继续训练。 在这种情况下,解冻将使模型在得到观察后以更好的学习率再次训练。

learn.unfreeze()learn.lr_find()learn.recorder.plot(suggestion=True)

Next training with better learning rate can train for just 2 epochs.

具有较高学习率的下一次训练只能训练2个时期。

结果 (Result)

The very good thing that I really love using FastAI is that the model evaluation is so so easy. We can just interpret the classification model like the loss prediction, confusion matrix, most confused.

我真正喜欢使用FastAI的好处是,模型评估是如此简单。 我们可以解释分类模型,例如损失预测,混淆矩阵,最混淆的模型。

interp = ClassificationInterpretation.from_learner(learn)losses, idxs = interp.top_losses()

First, we can plot the loss of prediction from the model.

首先,我们可以绘制模型的预测损失。

interp.plot_top_losses(9, figsize=(15,11))

And then the Confusion Matrix.

然后是混淆矩阵。

interp.plot_confusion_matrix(figsize=(12,12), dpi=100)

结论 (Conclusion)

It’s very convenient to apply many AI methods now, especially with FastAI Image Processing. I think the most important thing to be on studying Machine Learning is to be creative, innovative and never stops learning new things!

现在应用许多AI方法非常方便,尤其是使用FastAI图像处理时。 我认为学习机器学习最重要的是要有创造力,创新能力,并且要不断学习新事物!

Thank you for reading!

感谢您的阅读!

更多学习资料 (More Source to Learn)

翻译自: https://medium.com/swlh/image-classification-with-resnet50-convolution-neural-network-cnn-on-covid-19-radiography-d2a1fd77f5fb

resnet 卷积核大小


http://www.taodudu.cc/news/show-3869251.html

相关文章:

  • 大规模数据的词义消歧的混合词义分类方法——阅读整理总结
  • NNDL 实验四 线性分类
  • shell脚本 重启python脚本
  • python脚本传参
  • Cmake执行Python脚本
  • Kettle执行python脚本
  • 毕设(二)Spring Boot调用Python脚本运行
  • window开机自动运行python脚本
  • Xshell 执行python脚本
  • c++调用python脚本
  • centos运行python脚本_centos执行Python脚本
  • 10个有趣的Python高级脚本,建议收藏!
  • 6个使用的Python脚本
  • 十个Python实用脚本,快用起来
  • uni-app使用阿里巴巴矢量图标库
  • font-face字体图标和inconfont矢量图标库
  • 线程的五种状态及状态的切换
  • java多线程的几种状态
  • Java线程到底有几种状态
  • 简述线程的几种状态以及状态之间的转换
  • 线程的几种状态总结
  • 线程几种状态的说明
  • 线程的几种状态极其转换
  • 线程的生命周期?线程有几种状态
  • java线程的几种状态
  • Java 多线程的几种状态
  • 线程的几种状态转换
  • Echar渲染的图表与数据不匹配
  • Echar line 图标前台封装JS
  • poi生成word文档,插入图片,echar报表生成到word,word表格

resnet 卷积核大小_resnet50卷积神经网络cnn在covid 19射线照相上的图像分类相关推荐

  1. 花书+吴恩达深度学习(十四)卷积神经网络 CNN 之经典案例(LetNet-5, AlexNet, VGG-16, ResNet, Inception Network)

    目录 0. 前言 1. LeNet-5 2. AlexNet 3. VGG-16 4. ResNet 残差网络 5. Inception Network 如果这篇文章对你有一点小小的帮助,请给个关注, ...

  2. 深度学习之卷积神经网络CNN

    转自:https://blog.csdn.net/cxmscb/article/details/71023576 一.CNN的引入 在人工的全连接神经网络中,每相邻两层之间的每个神经元之间都是有边相连 ...

  3. 卷积神经网络 CNN 学习

    什么是神经网络 人工神经网络(artificial neural network,ANN),简称神经网络(neural network,NN),是一种模仿生物神经网络的结构和功能的数学模型或计算模型. ...

  4. 卷积神经网络 CNN 简述

    文章目录 所解决的问题 需要处理的数据量太大 很难保留图像特征 基本原理 卷积层 -- 提取图像特征 池化层 -- 数据降维(避免过拟合) 全连接层 -- 输出结果 实际应用 图像分类.检索 目标检测 ...

  5. 卷积神经网络(CNN)的参数优化方法

    积神经网络的参数优化方法--调整网络结构是关键!!!你只需不停增加层,直到测试误差不再减少. 著名: 本文是从 Michael Nielsen的电子书Neural Network and Deep L ...

  6. 4. 卷积神经网络CNN

    文章目录 4. 卷积神经网络CNN 4.1 概念 4.1.1 概念 4.1.2 用途 4.2 结构介绍 4.2.1 结构简介 4.2.2 卷积层 1) 基本概念 2) 前期准备 3) 参数共享 4) ...

  7. CNN---用于图像分类的经典的卷积神经网络CNN

    文章目录 概览 1.计算机视觉简介: 2.图像分类 一.LeNet-5 1.模型架构 2.模型简介 3.模型特点 二.AlexNet 1.网络架构 2.模型介绍 3.模型特点 三.VGGNet 1.模 ...

  8. 卷积神经网络CNN(Convolutional Neural Network)

    卷积神经网络CNN(Convolutional Neural Network) 一.CNN与NN的区别 卷积神经网络与传统神经网络的区别: 二.CNN的整体架构 1.输入层:2.卷积层:3.池化层:4 ...

  9. 基于卷积神经网络CNN的水果分类预测,卷积神经网络水果等级识别

    目录 背影 卷积神经网络CNN的原理 卷积神经网络CNN的定义 卷积神经网络CNN的神经元 卷积神经网络CNN的激活函数 卷积神经网络CNN的传递函数 卷积神经网络CNN水果分类预测 基本结构 主要参 ...

最新文章

  1. 【Qt】Qt样式表总结(二):冲突和命名空间
  2. shell中的wait
  3. Django(models中字段+参数)
  4. 海报推广神器:活码加多级加密跳转防封双重保护
  5. msdn的类型成员描述
  6. 关于WebBrowser.DocumentCompleted事件
  7. Jackson 框架使用教程,轻易转换JSON
  8. 【算法入门】动态图展示 6 个常用的数据结构,一目了然!
  9. nearbyserversocket驱动_关于Socket和ServerSocket类详解
  10. arcgis重心迁移分析_山东省植被覆盖度变化与气候因子相关性分析
  11. 如何设计大型游戏服务器架构?
  12. Glusterfs初试
  13. jzoj2137-(GDKOI2004)城市统计【二维前缀和,bfs】
  14. 业务库负载翻了百倍,我做了什么来拯救MySQL架构
  15. php上传图片管理系统,php 登录操作的文件上传管理系统
  16. C语言函数二维数组传递方法
  17. html元素不可见的三种方式
  18. 通俗易懂的MonteCarlo积分方法(七)
  19. linux修改ip配置文件_SSH连接Linux主机进行开发
  20. 易语言API HooK CreateThread创建线程

热门文章

  1. 学习统计学之方差分析
  2. Python3实例分享_阿里云盘下载到机械硬盘产生大量文件碎片的解决办法
  3. VC6.0的MFC简单计算器制作
  4. Java生成二维码并贴到新的图片上
  5. Codevs 3990 中国余数定理 2
  6. java 为什么用大端_Java中的大端和小端
  7. 安卓时间显示TextClock显示日期时间,24小时制和12小时制(自定义时间)
  8. hihocoder 1505
  9. 有两种常见的情况充斥着SEO优化市场,让排名得不到稳定
  10. 三分靠策略 七分靠执行