机器学习图像源代码

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

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.

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

RoomNet Convolutional Block. This is the most basic block
RoomNet卷积块。 这是最基本的块
RoomNet Residual Block. It composes of the convolution block described previously.
RoomNet残留块。 它由前面描述的卷积块组成。
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.

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

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 -)

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分数是精度和查全率的谐波平均值。

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

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

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

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

  1. 机器学习算法 拟合曲线_制定学习曲线以检测机器学习算法中的错误

    机器学习算法 拟合曲线 机器学习 (Machine Learning) The learning curve is very useful to determine how to improve th ...

  2. python特效源代码_人工智能python代码实现魔幻换天视频特效

    魔幻换天视频: python实现魔幻换天特效,特效前,特效后对比视频 视频前后特效对比图 前几期的视频,我们分享了python代码实现的魔幻换天的视频特效,如何使用python代码实现?本期文章我们简 ...

  3. 共享白板程序源代码_教育白板代码共享

    [实例简介] 白板设计.内涵源代码.提供大家开发参考.我觉得还可以 [实例截图] [核心代码] 教育白板源代码 └── 教育白板源代码 ├── Debug │   ├── DLGDengLu.obj ...

  4. 魔塔java源代码_魔塔java代码

    [实例简介] 便宜实惠 [实例截图] [核心代码] Tower-of-the-Deathmaster-master └── Tower-of-the-Deathmaster-master ├── RE ...

  5. cv图像翻转_涨点技巧!汇集13个Kaggle图像分类项目的性能提升指南

    从数据预处理.增强.模型优化.调参再到损失函数... 本文转载自:AI公园 作者:Prince Canuma 编译:ronghuaiyang 注:文末附CV学习交流群 导读 覆盖了模型相关的方方面面, ...

  6. 机器学习 物理引擎_在太阳物理学中使用机器学习

    机器学习 物理引擎 我们如何预测冠状物质抛射? (How Can We Predict Coronal Mass Ejections?) Coronal Mass Ejection (CME) is ...

  7. 机器学习数据拆分_解释了关键的机器学习概念-数据集拆分和随机森林

    机器学习数据拆分 数据集分割 (Dataset Splitting) Splitting up into Training, Cross Validation, and Test sets are c ...

  8. 唐宇迪机器学习课程数据集_最受欢迎的数据科学和机器学习课程-2020年8月

    唐宇迪机器学习课程数据集 There are a lot of great online resources and websites on data science and machine lear ...

  9. 机器学习 文本分类 代码_无需担心机器学习-如何在少于10行代码中对文本进行分类

    机器学习 文本分类 代码 This article builds upon my previous two articles where I share some tips on how to get ...

最新文章

  1. 《不只是美:信息图表设计原理与经典案例》—— 2.5 功能限制形式
  2. python学习详解_深入解析Python小白学习【操作列表】
  3. 不让复制是不可能的----js获取选中文字
  4. 收藏 | 在yolov5上验证一些不成熟的想法
  5. Nginx、servlet、redis、sentinel、nacos、sprng-cloud、
  6. RecyclerView 判断滑到底部 顶部 预加载 更多 分页 MD
  7. PHP使用MySQL数据库
  8. android硬编码封装mp4,音频编解码(软/硬编码),音频转码
  9. IDEA背景颜色及背景图片设置
  10. 判断一个数能否同时被3和5整除
  11. 3.24虎牙直播一面
  12. 定期进行磁盘碎片整理是对计算机系统进行,电脑需要定期对磁盘进行碎片整理吗?整理有什么好处?...
  13. 洛谷日报 2020年3月前索引
  14. (附Matlab程序)(一)基于DCT编码的图像压缩:显示灰度图像 反余弦变换恢复图 DCT变换图 余弦变换系数图
  15. 【趣味】一个将任意数字分解成 114514 构成的公式的工具
  16. AWS Boto3 使用介绍(一)
  17. mongoDB使用及简单命令(忘记了密码怎么办、mongoDB密码重置、创建数据库、mongoDB启动停止)
  18. linux gcc生成可执行代码命令,Makefile万能写法(gcc程序以及arm-linux-gcc程序)
  19. 生信常用分析图形绘制03 -- 富集分析圈图
  20. 用于光导耦合的倾斜光栅的分析

热门文章

  1. c 加密 java解密错误_java解密出错
  2. Linux记录-TCP状态以及(TIME_WAIT/CLOSE_WAIT)分析(转载)
  3. 【python之路14】发送邮件实例
  4. spring的applicationContext.xml如何自动加载
  5. Unix/Linux环境C编程入门教程(27) 内存那些事儿
  6. android的progressDialog 的使用。android数据异步加载 对话框提示
  7. 分享网页到微信朋友圈的官方接口
  8. 网站应该更注重内部链接还是外部链接?
  9. DRF数据验证+数据存储
  10. Python+Appium寻找蓝牙/wifi匹配