机器学习图像源代码_使用带有代码的机器学习进行快速房地产图像分类

机器学习图像源代码

RoomNet is a very lightweight (700 KB) and fast Convolutional Neural Net to classify pictures of different rooms of a house/apartment with 88.9 % validation accuracy over 1839 images. I have written this in python and TensorFlow.

RoomNet是一种非常轻巧的( 700 KB )快速快速的卷积神经网络,可对房屋/公寓不同房间的图片进行分类,对1839张图片的验证准确性88.9% 。 我已经用python和TensorFlow编写了这个。

Btw, I made the artwork and yes, I’m actually not in 3rd grade despite tempting popular opinions stemming from it.

顺便说一句,我制作了艺术品,是的,尽管我引诱了公众的意见,但实际上我还不是三年级。

This is a custom architecture I designed to classify an input image into one of the following 6 classes (in order of their class IDs) -

这是我设计的自定义体系结构,旨在将输入图像分类为以下6个类之一(按其类ID的顺序)-

Backyard-0, Bathroom-1, Bedroom-2, Frontyard-3, Kitchen-4, LivingRoom-5

后院 -0, 浴室 -1, 卧室 -2, 前院 -3, 厨房 -4, 客厅 -5

Image for post
Photo credits from left to right in clockwise manner — Photo by Chastity Cortijo on Unsplash (Bathroom), Photo by Roberto Nickson on Unsplash (Bedroom), Photo by Jason Briscoe on Unsplash (Kitchen), Photo by Shaun Montero on Unsplash (Backyard), Photo by Roberto Nickson on Unsplash (Living Room), Photo by Roberto Nickson on Unsplash (Frontyard)
照片信用从左到右以顺时针的方式—照片作者Chastity Cortijo在Unsplash (浴室),由Roberto Nickson在Unsplash (卧室),照片由Jason Briscoe在Unsplash (厨房),照片由Shaun Montero在Unsplash (后院), 罗伯托·尼克森在《 Unsplash》 (起居室)上的照片, 罗伯托·尼克森在《 Unsplash》 (前院)上的照片

建筑积木- (Architecture Building Blocks -)

These blocks are used to construct the final neural net. They’re comprised of basic elemental neural layers like convolution, average pooling, and batch normalization.

这些块用于构建最终的神经网络。 它们由卷积,平均池化和批归一化等基本元素神经层组成。

Image for post
RoomNet Convolutional Block. This is the most basic block
RoomNet卷积块。 这是最基本的块
Image for post
RoomNet Residual Block. It composes of the convolution block described previously.
RoomNet残留块。 它由前面描述的卷积块组成。
Image for post
RoomNet Dense Block. This will be doing the classification from the extracted image features at the end.
RoomNet密集块。 最后将根据提取的图像特征进行分类。

完整的网络架构- (Full Network Architecture -)

Using the building blocks described above, presented below is the full neural net architecture with the relevant arguments.

使用上述构建模块,下面介绍的是带有相关参数的完整神经网络体系结构。

Image for post

The code to train and deploy this can be found on GitHub at —

可以在GitHub上找到用于训练和部署此代码的代码-

开箱即用的推论- (Out-of-box Inference -)

Optimized inference code in infer.py. Refer to the short code in the main method calling the classify_im_dir method.

优化了infer.py中的推理代码。 请参考main方法中调用classify_im_dir方法的简短代码。

培训- (Training -)

Image for post
Validation Accuracy
验证准确性
  • Input image size = 224 x 224 (tried 300 x 300, 600 x 600)

    输入图像大小= 224 x 224(尝试300 x 300、600 x 600)
  • Softmax Cross Entropy Loss used with L2 Weight normalization

    L2权重归一化使用的Softmax交叉熵损失

  • Dropout varied from 0 (initially) to 0.3 (intermittently near the end of training). Dropout layers placed after every block.

    辍学率从0(最初)到0.3(在训练结束时间歇性地)变化。 在每个块之后放置辍学层。

  • Batch Normalization moving means & vars were frozen when being trained with dropout.

    在进行辍学训练时, 批次归一化移动工具和变量被冻结。

  • Adam Optimizer used with exponential learning rate decay.

    Adam Optimizer用于指数学习率衰减。

  • Initially trained with in-batch computation of BatchNorm moving means/vars. Followed this by training net, by disabling this computation and using frozen means/vars during training. Resulted in ~20% immediate jump in validation accuracy (noticeable around train step 150,000). I’ll be publishing another article delving into this phenomenon shortly.

    最初使用BatchNorm移动工具/变量的批内计算进行训练。 其次是训练网,在训练过程中禁用此计算并使用冻结的均值/变量。 导致验证准确性立即提高约20% (在火车第150,000步左右明显)。 不久我将发表另一篇文章探讨这种现象。

  • Batch Size varied from 8 (in the beginning) to 45 (towards training end) as — 8 -> 32 -> 40 -> 45

    批次大小从8(开始时)到45(训练结束时)为— 8-> 32-> 40-> 45
  • Asynchronous Data Reader designed with a Queue based architecture that allows for quick data I/O during training even with large batch sizes.

    异步数据读取器采用基于队列的体系结构设计,即使批量较大,也可以在训练期间快速进行数据I / O。

转换为推理优化版本- (Conversion to Inference Optimized Version -)

  • Discarded all backpropagation/training related compute node from the Tensorflow Graph.

    从Tensorflow图中丢弃所有与反向传播/训练相关的计算节点。
  • Model size reduced from ~2 MB to ~800 KB.

    模型大小从〜2 MB减少到〜800 KB。
  • network.py contains class defining the model called “RoomNet”

    network.py包含定义称为“ RoomNet”的模型的类

  • The output is an excel file mapping each image path to its label. There is also a provision to split an input directory to directories corresponding to the class names and automatically fill the relevant image in its respective directory.

    输出是一个将每个图像路径映射到其标签的excel文件。 还提供了将输入目录拆分为与类名称相对应的目录,并自动在其相应目录中填充相关图像的条款。

培训环境- (Training Environment -)

  • Training done using Tensorlfow + CUDA 10.0 + cuDNN on NVIDIA GTX 1070 laptop grade GPU with 8GB of GPU memory

    使用Tensorlfow + CUDA 10.0 + cuDNN在具有8GB GPU内存的NVIDIA GTX 1070笔记本电脑级GPU上完成培训
  • Compute system used is an Alienware m17 r4 laptop.

    使用的计算系统是Alienware m17 r4笔记本电脑。
  • CPU used is an Intel Core i7–6700HQ with 8 logical cores at 2.6 GHz of base speed (turbo boost to ~3.3 GHz)

    使用的CPU是Intel Core i7-6700HQ,具有8个逻辑内核,基本速度为2.6 GHz(涡轮增压提升至〜3.3 GHz)
  • The number of training steps from scratch to reach best model is 157,700.

    从头开始到达到最佳模型的培训步骤数为157,700。
  • Time spent on training — ~48 hours

    培训时间–约48小时

尝试过的先前方法- (Previous Approaches tried -)

  • Tried training the final dense NASnet mobile but accuracy never crosses 60%.

    尝试训练最终的密集NASnet移动设备,但准确性从未超过60%。
  • Tried the same with InceptionV3 but convergence takes too damn long.

    与InceptionV3进行了相同的尝试,但是收敛时间太长了。

性能图- (Performance Plots -)

验证类F分数 (Validation Class-wise F-Score)

F-Score is the harmonic mean of precision and recall.

F分数是精度和查全率的谐波平均值。

Image for post

验证类精度 (Validation Class-wise Precision)

Image for post

验证逐级召回 (Validation Class-wise Recall)

Image for post

If you found this helpful, feel free to follow me for more upcoming articles :)

如果您认为这有帮助,请随时关注我以获取更多即将发表的文章:)

I’m the editor of the following publication which publishes Tech articles related to the usage of AI & ML in digital mapping of the Earth. Feel free to follow to stay updated :)

我是以下出版物的编辑,该出版物发表有关在地球数字地图中使用AI和ML的技术文章。 随时关注以保持更新:)

我的个人资料- (My Profiles-)

附加功能— (Extras —)

演示地址

Twitch🤪🤡Twitch上住我

I’m also a musician. Here is one of the vocal covers off of my SoundCloud profile.

我也是音乐家。 这是我的SoundCloud个人资料的主要声音之一。

演示地址

Thank you :)

谢谢 :)

翻译自: https://towardsdatascience.com/fast-real-estate-image-classification-using-machine-learning-with-code-32e0539eab96

机器学习图像源代码

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/391271.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

leetcode 938. 二叉搜索树的范围和

给定二叉搜索树的根结点 root,返回值位于范围 [low, high] 之间的所有结点的值的和。 示例 1: 输入:root [10,5,15,3,7,null,18], low 7, high 15 输出:32 示例 2: 输入:root [10,5,15,3,7,13,18,1,nul…

COVID-19和世界幸福报告数据告诉我们什么?

For many people, the idea of ​​staying home actually sounded good at first. This process was really efficient for Netflix and Amazon. But then sad truths awaited us. What was boring was the number of dead and intubated patients one after the other. We al…

iOS 开发一定要尝试的 Texture(ASDK)

原文链接 - iOS 开发一定要尝试的 Texture(ASDK)(排版正常, 包含视频) 前言 本篇所涉及的性能问题我都将根据滑动的流畅性来评判, 包括掉帧情况和一些实际体验 ASDK 已经改名为 Texture, 我习惯称作 ASDK 编译环境: MacOS 10.13.3, Xcode 9.2 参与测试机型: iPhone 6 10.3.3, i…

lisp语言是最好的语言_Lisp可能不是数据科学的最佳语言,但是我们仍然可以从中学到什么呢?...

lisp语言是最好的语言This article is in response to Emmet Boudreau’s article ‘Should We be Using Lisp for Data-Science’.本文是对 Emmet Boudreau的文章“我们应该将Lisp用于数据科学”的 回应 。 Below, unless otherwise stated, lisp refers to Common Lisp; in …

static、volatile、synchronize

原子性(排他性):不论是多核还是单核,具有原子性的量,同一时刻只能有一个线程来对它进行操作!可见性:多个线程对同一份数据操作,thread1改变了某个变量的值,要保证thread2…

1.10-linux三剑客之sed命令详解及用法

内容:1.sed命令介绍2.语法格式,常用功能查询 增加 替换 批量修改文件名第1章 sed是什么字符流编辑器 Stream Editor第2章 sed功能与版本处理出文本文件,日志,配置文件等增加,删除,修改,查询sed --versionsed -i 修改文件内容第3章 语法格式3.1 语法格式sed [选项] [sed指令…

python pca主成分_超越“经典” PCA:功能主成分分析(FPCA)应用于使用Python的时间序列...

python pca主成分FPCA is traditionally implemented with R but the “FDASRSF” package from J. Derek Tucker will achieve similar (and even greater) results in Python.FPCA传统上是使用R实现的,但是J. Derek Tucker的“ FDASRSF ”软件包将在Python中获得相…

初探Golang(2)-常量和命名规范

1 命名规范 1.1 Go是一门区分大小写的语言。 命名规则涉及变量、常量、全局函数、结构、接口、方法等的命名。 Go语言从语法层面进行了以下限定:任何需要对外暴露的名字必须以大写字母开头,不需要对外暴露的则应该以小写字母开头。 当命名&#xff08…

大数据平台构建_如何像产品一样构建数据平台

大数据平台构建重点 (Top highlight)Over the past few years, many companies have embraced data platforms as an effective way to aggregate, handle, and utilize data at scale. Despite the data platform’s rising popularity, however, little literature exists on…

初探Golang(3)-数据类型

Go语言拥有两大数据类型,基本数据类型和复合数据类型。 1. 数值类型 ##有符号整数 int8(-128 -> 127) int16(-32768 -> 32767) int32(-2,147,483,648 -> 2,147,483,647) int64&#x…

时间序列预测 时间因果建模_时间序列建模以预测投资基金的回报

时间序列预测 时间因果建模Time series analysis, discussed ARIMA, auto ARIMA, auto correlation (ACF), partial auto correlation (PACF), stationarity and differencing.时间序列分析,讨论了ARIMA,自动ARIMA,自动相关(ACF),…

(58)PHP开发

LAMP0、使用include和require命令来包含外部PHP文件。使用include_once命令,但是include和include_once命令相比的不足就是这两个命令并不关心请求的文件是否实际存在,如果不存在,PHP解释器就会直接忽略这个命令并且显示一个错误消息&#xf…

css flexbox模型_如何将Flexbox后备添加到CSS网格

css flexbox模型I shared how to build a calendar with CSS Grid in the previous article. Today, I want to share how to build a Flexbox fallback for the same calendar. 在上一篇文章中,我分享了如何使用CSS Grid构建日历。 今天,我想分享如何为…

贝塞尔修正_贝塞尔修正背后的推理:n-1

贝塞尔修正A standard deviation seems like a simple enough concept. It’s a measure of dispersion of data, and is the root of the summed differences between the mean and its data points, divided by the number of data points…minus one to correct for bias.标…

RESET MASTER和RESET SLAVE使用场景和说明【转】

【前言】在配置主从的时候经常会用到这两个语句,刚开始的时候还不清楚这两个语句的使用特性和使用场景。 经过测试整理了以下文档,希望能对大家有所帮助; 【一】RESET MASTER参数 功能说明:删除所有的binglog日志文件,…

Kubernetes 入门(1)基本概念

1. Kubernetes简介 作为一个目前在生产环境已经广泛使用的开源项目 Kubernetes 被定义成一个用于自动化部署、扩容和管理容器应用的开源系统;它将一个分布式软件的一组容器打包成一个个更容易管理和发现的逻辑单元。 Kubernetes 是希腊语『舵手』的意思&#xff0…

android 西班牙_分析西班牙足球联赛(西甲)

android 西班牙The Spanish football league commonly known as La Liga is the first national football league in Spain, being one of the most popular professional sports leagues in the world. It was founded in 1929 and has been held every year since then with …

Goalng软件包推荐

2019独角兽企业重金招聘Python工程师标准>>> 前言 哈喽大家好呀! 马上要迎来狗年了大家是不是已经怀着过年的心情了呢? 今天笔者给大家带来了一份礼物, Goalng的软件包推荐, 主要总结了一下在go语言中大家开源的优秀的软件, 大家了解之后在后续使用过程有遇到如下软…

Kubernetes 入门(2)基本组件

1. C/S架构 Kubernetes 遵循非常传统的客户端服务端架构,客户端通过 RESTful 接口或者直接使用 kubectl 与 Kubernetes 集群进行通信,这两者在实际上并没有太多的区别,后者也只是对 Kubernetes 提供的 RESTful API 进行封装并提供出来。 左侧…

【powerdesign】从mysql数据库导出到powerdesign,生成数据字典

使用版本powerdesign16.5,mysql 5.5,windows 64 步骤: 1.下载mysql驱动【注意 32和64的驱动都下载下来,具体原因查看第三步 依旧会报错处】 下载地址:https://dev.mysql.com/downloads/connector/odbc/5.3.html 请下…