1. 首先,你要又并行计算的工具箱,在插件选项里面找到,安装即可

2. 下载训练的数据集,采用matlab演示的材料即可

https://matlabacademy-content.mathworks.com/3.3/R2017b/content/deeplearning_course_files.zip

3. 运行训练脚本:

The code below implements transfer learning for the flower species example in this chapter. It is available as the script trainflowers.mlx in the course example files. You can download the course example files from the help menu in the top-right corner. Note that this example can take some time to run if you run it on a computer that does not have a GPU.

Get training images

flower_ds = imageDatastore('Flowers','IncludeSubfolders',true,'LabelSource','foldernames');
[trainImgs,testImgs] = splitEachLabel(flower_ds,0.6);
numClasses = numel(categories(flower_ds.Labels));

Create a network by modifying AlexNet

net = alexnet;
layers = net.Layers;
layers(end-2) = fullyConnectedLayer(numClasses);
layers(end) = classificationLayer;

Set training algorithm options

options = trainingOptions('sgdm','InitialLearnRate', 0.001);

Perform training

[flowernet,info] = trainNetwork(trainImgs, layers, options);

Use trained network to classify test images

testpreds = classify(flowernet,testImgs);

4. 运行报错,GPU内存不够

设置小一点:options = trainingOptions('sgdm','InitialLearnRate', 0.001,'MiniBatchSize', 64);

options = 

  TrainingOptionsSGDM - 属性:

                     Momentum: 0.9000
             InitialLearnRate: 1.0000e-03
    LearnRateScheduleSettings: [1×1 struct]
             L2Regularization: 1.0000e-04
      GradientThresholdMethod: 'l2norm'
            GradientThreshold: Inf
                    MaxEpochs: 30
                MiniBatchSize: 128
                      Verbose: 1
             VerboseFrequency: 50
               ValidationData: []
          ValidationFrequency: 50
           ValidationPatience: 5
                      Shuffle: 'once'
               CheckpointPath: ''
         ExecutionEnvironment: 'auto'
                   WorkerLoad: []
                    OutputFcn: []
                        Plots: 'none'
               SequenceLength: 'longest'

SequencePaddingValue: 0

5. 结果

Matlab AlexNet 识别花的更多相关文章

  1. TensorFlow迁移学习的识别花试验

    最近学习了TensorFlow,发现一个模型叫vgg16,然后搭建环境跑了一下,觉得十分神奇,而且准确率十分的高.又上了一节选修课,关于人工智能,老师让做一个关于人工智能的试验,于是觉得vgg16很不 ...

  2. MATLAB 物体识别算法说明:vision.ForegroundDetector, vision.BlobAnalysis

    在官方示例中,Motion-Based Multiple Object Tracking和Using Kalman Filter for Object Tracking都使用了下面两个算法进行物体的识 ...

  3. TensorFlow笔记六:基于cifar10数据库的AlexNet识别

    准确率只有70%,cpu版本的TF居然跑了两天才跑完,其他方法将继续尝试. 生成数据目录: import numpy as np import os train_label = {} for i in ...

  4. 简单验证码识别(matlab)

    简单验证码识别(matlab) 验证码识别, matlab 昨天晚上一个朋友给我发了一些验证码的图片,希望能有一个自动识别的程序. 1474529971027.jpg 我看了看这些样本,发现都是很规则 ...

  5. C#中调用Matlab人工神经网络算法实现手写数字识别

    手写数字识别实现 设计技术参数:通过由数字构成的图像,自动实现几个不同数字的识别,设计识别方法,有较高的识别率 关键字:二值化  投影  矩阵  目标定位  Matlab 手写数字图像识别简介: 手写 ...

  6. 基于MATLAB的人脸识别算法的研究

    基于MATLAB的人脸识别算法的研究 作者:lee神 现如今机器视觉越来越盛行,从智能交通系统的车辆识别,车牌识别到交通标牌的识别:从智能手机的人脸识别的性别识别:如今无人驾驶汽车更是应用了大量的机器 ...

  7. MATLAB中文论坛帖子整理(GUI)

    MATLAB中文论坛帖子整理(GUI) 目   录  1.GUI新手之——教你读懂GUI的M文件... 10 2.GUI程序中改变current directory引起的问题... 15 3.GUI中 ...

  8. Matlab中调用VS编译的exe文件并传递变量 的方法

    经历::在网上找了很多方法,都没有实现在matlab中调用vs的exe文件并且能够传递变量参数,一些小细节花费了自己很多时间,比喻忽略了一些空格!  网上很多的方法都是纯粹复制别人的方法,自己都没有去 ...

  9. 基于深度学习和迁移学习的识花实践——利用 VGG16 的深度网络结构中的五轮卷积网络层和池化层,对每张图片得到一个 4096 维的特征向量,然后我们直接用这个特征向量替代原来的图片,再加若干层全连接的神经网络,对花朵数据集进行训练(属于模型迁移)

    基于深度学习和迁移学习的识花实践(转)   深度学习是人工智能领域近年来最火热的话题之一,但是对于个人来说,以往想要玩转深度学习除了要具备高超的编程技巧,还需要有海量的数据和强劲的硬件.不过 Tens ...

随机推荐

  1. lua数组和数据类型转换

    一.lua数组 Lua数组大小不固定,下标是从  1开始. --数组 arr={"aaa","bbb","ccc"} --使用数值 for通 ...

  2. 创建用户的方法 3种mysql创建方法

    mysql创建用户的方法分成三种:INSERT USER表的方法.CREATE USER的方法.GRANT的方法.   一.账号名称的构成方式   账号的组成方式:用户名+主机(所以可以出现重复的用户 ...

  3. NX二次开发-time.h获取计算机本地时间

    NX9+VS2012 #include <stdio.h> #include <time.h> char *wday[] = { "Sun", " ...

  4. flutter 显示base64 图片

    后台返回base64 为了本地显示需要转换成Uint8List 1.导入包 import 'dart:convert';2.后台返回base64 格式不被识别需要切分 //'"data:im ...

  5. (转)Java NIO框架Mina、Netty、Grizzly介绍与对比

    转:http://blog.csdn.net/cankykong1/article/details/19937027 Mina: Mina(Multipurpose Infrastructure fo ...

  6. 拾遗:不用使 sizeof 获取数组大小

    ... #include <stdio.h> #include <unistd.h> int main(void) { ] = {}; size_t num = () - (i ...

  7. 笔记:简单的面向对象-web服务器

    import socket import re import multiprocessing import time import mini_frame class WSGIServer(object ...

  8. await和async

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  9. React和vue的差异和相似地方

    React 单向绑定(加插件后,还是可以双向绑定) Vue 双向绑定 组件化 1. React,需要编写render函数, 2. 当React状态的状态state改变是render就会重新被调用, 重 ...

  10. 检测到“RuntimeLibrary”的不匹配项