树莓派 神经网络植入

直觉 (Intuition)

Photo by Markus Winkler on Unsplash
Markus Winkler在Unsplash上拍摄的照片

Imagine you’re solving a Jigsaw puzzle. You have completed most of it. Suppose you need to fix a piece in the middle of a picture ( which is nearly complete ). You need a choose a piece from the box which would into a fit in the space and also complete the whole picture.

想象您正在解决拼图游戏。 您已经完成了大部分工作。 假设您需要在图片中间修复一块(几乎完成了)。 您需要从包装盒中选择一块,以适合该空间并完成整个图片。

I’m sure you can do this quickly. But how’s your brain doing this?

我确定您可以快速完成此操作。 但是你的大脑怎么样?

First, it analyses the picture around the empty slot ( where you need to fix a piece of the puzzle ). If there’s a tree in the picture, you’ll search for a green coloured piece ( which is obvious! ). So, in a nutshell, our brain is able to predict the piece ( which will fit into the slot ) by knowing the surrounding context of the image.

首先,它分析空白插槽(您需要修复其中的难题)周围的图片。 如果图片中有一棵树,您将搜索一块绿色的(这很明显!)。 因此,简而言之,我们的大脑就能通过了解图像的周围环境来预测片段(将适合插槽)。

Our model, in this tutorial, is going to perform a similar task. It will learn the image’s context and then predict a part of the image ( which is missing ) using this learned context.

在本教程中,我们的模型将执行类似的任务。 它将学习图像的上下文,然后使用此学习的上下文预测图像的一部分(丢失)。

代码实施 (Code Implementation)

I recommend you should open this notebook (the TF implementation) in another tab so that you have an intuition of what’s going on.

我建议您在另一个选项卡中打开此笔记本(TF实现),以便直观了解正在发生的事情。

问题陈述 (Problem Statement)

We’d like our model to predict a part of an image. Given an image with a hole (a part of the image array which contains only zeros), our model will predict the original image which is complete.

我们希望我们的模型能够预测图像的一部分。 给定一个带Kong的图像(图像数组的一部分仅包含零),我们的模型将预测完整的原始图像。

So our model will reconstruct the missing part of the image using the context it learned during training.

因此,我们的模型将使用在训练中学习到的上下文来重建图像的缺失部分。

Image By Author
图片作者

数据 (The Data)

We’ll select a single domain for our task. We are choosing a number of mountain images that are a part of the Intel Image Classification dataset by Puneet Bansal on Kaggle.

我们将为任务选择一个域。 我们正在选择许多山峰图像,这些山峰图像是Kaggle上Puneet Bansal 撰写的“ 英特尔图像分类”数据集中的一部分。

Why only images of mountains?

为什么只有山的影像?

Here, we choose images which belong to a particular domain. If we choose a dataset which has in the wild images, our model will not perform well. Hence, we restrict it to a single domain.

在这里,我们选择属于特定域的图像。 如果我们选择包含野外图像的数据集,则我们的模型将无法正常运行。 因此,我们将其限制为单个域。

Some images from the dataset. Image By Author
数据集中的一些图像。 图片作者

Download the data which I have hosted on GitHub using wget

使用wget下载我在GitHub上托管的数据

!wget https://github.com/shubham0204/Dataset_Archives/blob/master/mountain_images.zip?raw=true -O images.zip!unzip images.zip

To make our training data, we’ll iterate through each image in our dataset and perform the below tasks on it,

为了制作训练数据,我们将遍历数据集中的每个图像,并在其上执行以下任务,

Image By Author
图片作者
  1. First, we’ll read our image file using PIL.Image.open(). Convert this Image object to a NumPy array using np.asarray().

    首先,我们将使用PIL.Image.open()读取图像文件。 使用np.asarray()将此Image对象转换为NumPy数组。

  2. Determine a window size. This will be the side length of the square which we are going to take from the original image.确定窗口大小。 这将是我们将从原始图像中获取的正方形的边长。
  3. Generate 2 random numbers within the range [ 0 , image_dim — window_size ]. Where image_dim is the size of our square input image.

    生成[ 0 , image_dim — window_size ]范围内的2个随机数。 其中image_dim是正方形输入图像的大小。

  4. These two numbers (called px and py) are the positions from where the original image will be cropped. Select the part of the image array and replace it with a zero array.

    这两个数字(称为pxpy )是裁剪原始图像的位置。 选择图像阵列的一部分,并将其替换为零阵列。

The code looks like this,

代码看起来像这样,

1. Preparing the training data.
1.准备训练数据。

具有跳过连接的自动编码器模型 (Auto Encoder model with skip connections)

We add skip connections to our autoencoder model. These skip connections provide better upsampling. By using max-pooling layers, much of the spatial information is lost as it goes down the encoder. In order to reconstruct the image from its latent representation ( produced by the encoder ), we add skip connections, which bring in information from the encoder to the decoder.

我们将跳跃连接添加到我们的自动编码器模型中。 这些跳过连接提供了更好的上采样。 通过使用最大池化层,许多空间信息在沿着编码器传输时会丢失。 为了从图像的潜在表示(由编码器生成)重建图像,我们添加了跳过连接,这些连接将信息从编码器引入解码器。

2. The AutoEncoder model.
2.自动编码器模型。

Finally, we train our autoencoder model with skip connections,

最后,我们使用跳过连接训练自动编码器模型,

model.fit( x_train , y_train , epochs=150 , batch_size=25 , validation_data=( x_test , y_test ) )

Image By Author
图片作者

The above results were obtained on a few test images. We observe the model has nearly learnt how to fill the black boxes! But we can still make out where the box lied in the original image. So this way, we can construct a model to predict the missing part of the image.

以上结果是在一些测试图像上获得的。 我们观察到该模型几乎学会了如何填充黑匣子! 但是我们仍然可以确定盒子在原始图像中的位置。 因此,通过这种方式,我们可以构建模型来预测图像的缺失部分。

进一步阅读 (Further Reading)

If you liked this blog, make sure you read more stories of mine here, on Medium.

如果您喜欢此博客,请确保在此处的“中等”上阅读我的更多故事。

就这样! (That’s All!)

This is just a cool application of Auto Encoders. I got the inspiration for this video from here. Thanks for reading!

这只是自动编码器的一个很酷的应用程序。 我从这里获得了这段视频的灵感。 谢谢阅读!

翻译自: https://medium.com/swlh/neural-implanting-with-autoencoders-and-tensorflow-9c2c7b532198

树莓派 神经网络植入


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

相关文章:

  • opencv 运动追踪_足球运动员追踪-使用OpenCV根据运动员的球衣颜色识别运动员的球队
  • 犀牛建模软件的英文语言包_使用tidytext和textmineR软件包在R中进行主题建模(
  • 使用Keras和TensorFlow构建深度自动编码器
  • 出人意料的生日会400字_出人意料的有效遗传方法进行特征选择
  • fast.ai_使用fast.ai自组织地图—步骤4:使用Fast.ai DataBunch处理非监督数据
  • 无监督学习与监督学习_有监督与无监督学习
  • 分类决策树 回归决策树_决策树分类器背后的数学
  • 检测对抗样本_对抗T恤以逃避ML人检测器
  • 机器学习中一阶段网络是啥_机器学习项目的各个阶段
  • 目标检测 dcn v2_使用Detectron2分6步进行目标检测
  • 生成高分辨率pdf_用于高分辨率图像合成的生成变分自编码器
  • 神经网络激活函数对数函数_神经网络中的激活函数
  • 算法伦理
  • python 降噪_使用降噪自动编码器重建损坏的数据(Python代码)
  • bert简介_BERT简介
  • 卷积神经网络结构_卷积神经网络
  • html两个框架同时_两个框架的故事
  • 深度学习中交叉熵_深度计算机视觉,用于检测高熵合金中的钽和铌碎片
  • 梯度提升树python_梯度增强树回归— Spark和Python
  • 5行代码可实现5倍Scikit-Learn参数调整的更快速度
  • tensorflow 多人_使用TensorFlow2.x进行实时多人2D姿势估计
  • keras构建卷积神经网络_在Keras中构建,加载和保存卷积神经网络
  • 深度学习背后的数学_深度学习背后的简单数学
  • 深度学习:在图像上找到手势_使用深度学习的人类情绪和手势检测器:第1部分
  • 单光子探测技术应用_我如何最终在光学/光子学应用程序中使用机器学习作为博士学位
  • 基于深度学习的病理_组织病理学的深度学习(第二部分)
  • ai无法启动产品_启动AI启动的三个关键教训
  • 达尔文进化奖_使用Kydavra GeneticAlgorithmSelector将达尔文进化应用于特征选择
  • 变异函数 python_使用Python进行变异测试
  • 信号处理深度学习机器学习_机器学习与信号处理

树莓派 神经网络植入_使用自动编码器和TensorFlow进行神经植入相关推荐

  1. 贝叶斯优化神经网络参数_贝叶斯超参数优化:神经网络,TensorFlow,相预测示例

    贝叶斯优化神经网络参数 The purpose of this work is to optimize the neural network model hyper-parameters to est ...

  2. python神经网络多元函数_阿里达摩院推荐的最新400集python教程,据说懂中文就能上手...

    小编的内心是强大的,网友虐我千百遍,我待网友如初恋,因为今天又给大家带来了干货,Python入门教程完整版,完整版啊!完整版! 为了吸取教训,小编一定要分享一下攻略,"怎样获得小编分享的教程 ...

  3. 图像对抗生成网络 GAN学习01:从头搭建最简单的GAN网络,利用神经网络生成手写体数字数据(tensorflow)

    图像对抗生成网络 GAN学习01:从头搭建最简单的GAN网络,利用神经网络生成手写体数字数据(tensorflow) 文章目录 图像对抗生成网络 GAN学习01:从头搭建最简单的GAN网络,利用神经网 ...

  4. [Python人工智能] 八.卷积神经网络CNN原理详解及TensorFlow编写CNN

    从本专栏开始,作者正式开始研究Python深度学习.神经网络及人工智能相关知识.前一篇文章介绍了什么是过拟合,并采用droput解决神经网络中过拟合的问题,以TensorFlow和sklearn的lo ...

  5. 利用卷积神经网络实现人脸识别(python+TensorFlow)

    利用CNN卷积神经网络实现人脸识别(python+TensorFlow) 使用的人脸数据是耶鲁大学的一个人脸数据集Yale_64x64.mat,数据集已经上传Yale 64x64.mat 程序: '' ...

  6. 神经网络学习小记录2——利用tensorflow构建循环神经网络(RNN)

    神经网络学习小记录2--利用tensorflow构建循环神经网络(RNN) 学习前言 RNN简介 tensorflow中RNN的相关函数 tf.nn.rnn_cell.BasicLSTMCell tf ...

  7. python工程师认证考试 怎么报名_我是如何通过TensorFlow开发人员认证考试的?

    全文共4806字,预计学习时长18分钟 5月初,我决定参加TensorFlow开发人员认证考试.接着我学习了相关课程来提高自己的技能,并在几天前参加了认证考试. 不出意外,我通过了.本文将分享我是如何 ...

  8. bp神经网络训练_数据分析模型6——神经网络基础(人工智能的底层模型)

    未经许可请勿转载 更多数据分析内容参看这里 今天我们来学习人工智能的底层模型--神经网络(NEURAL NETWORKS),现在比较热门的一个模型是深度学习,深度学习的基础也是神经网络,要学好深度学习 ...

  9. python 卷积神经网络 应用_卷积神经网络概述及python实现

    摘要:本文概括地介绍CNN的基本原理 ,并通过阿拉伯字母分类例子具体介绍其实现过程,理论与实践的结合体. 对于卷积神经网络(CNN)而言,相信很多读者并不陌生,该网络近年来在大多数领域都表现优异,尤其 ...

最新文章

  1. Tomcat 之 tomcat安装和组件介绍
  2. i卡来了!英特尔公布游戏独显出货时间表,放话今年要卖400万张
  3. Spring Cloud 2020.0.3 发布!
  4. JVM:gc什么时候开始?System.gc()能保证gc一定发生吗?
  5. 46、Power Query-Table.FillDown函数简介
  6. 无软件linux,无需安装即可运行或演示Linux的方法 (1)
  7. python json dumps utf8_Python2操作JSON出现乱码的解决方案
  8. C# DateTime.Compare判断两个DateTime 日期是否相等
  9. 高一数学集合知识点整理_高一 | 数学 “集合”知识点总结及归纳~
  10. MCGS 无限配方数据存储及U盘导入导出-第一集
  11. linux shell 基本规范
  12. [datatable]关于在DataTable中执行DataTable.Select(“条件“)返回DataTable的解决方法
  13. 职场pua是什么意思,如何反职场pua,职场pua如何走出来
  14. idea debug端口被占用
  15. 虚拟机安装苹果系统_黑苹果原版系统镜像下载,MacOS如何安装到虚拟机?(附软件+教程)...
  16. Linux 硬盘故障修复
  17. 第1章 初始JAVA
  18. dapr源码分析--injector
  19. 我国魏晋时期割圆法现在用计算机mn,割圆术
  20. ios手机python编译器免费_适用与IOS手机的python编辑器,让你不限空间,地点都能玩转pyhton代码 !...

热门文章

  1. javascript常用判断写法
  2. 多列集合的索引器实现
  3. 网段:192.168.6.0的机器A要访问网段:10.1.56.0的机器B
  4. 用samba服务构建基于企业级的文件共享服务
  5. Silverlight开发历程—模糊特效与投影特效
  6. linux以服务的方式启动mongodb,linux以服务的方式启动MongoDB
  7. vba传值调用_Access VBA如何使用Shell命令以及如何传递参数
  8. qq安全保护进程更改计算机,分享win10电脑系统关闭qq安全防护进程的步骤
  9. [蓝桥杯][2018年第九届真题]倍数问题(贪心+思维)
  10. mysql fio测试_MySQL Hardware--FIO压测