Main Content

Object Detection using Deep Learning

Perform classification, object detection, transfer learning using convolutional neural networks (CNNs, or ConvNets)

Convolutional neural networks (CNNs, or ConvNets) are essential tools for deep learning, and are especially useful for image classification, object detection, and recognition tasks. CNNs are implemented as a series of interconnected layers. The layers are made up of repeated blocks of convolutional, ReLU (rectified linear units), and pooling layers. The convolutional layers convolve their input with a set of filters. The filters were automatically learned during network training. The ReLU layer adds nonlinearity to the network, which enables the network to approximate the nonlinear mapping between image pixels and the semantic content of an image. The pooling layers downsample their inputs and help consolidate local image features

Convolutional neural networks require Deep Learning Toolbox™. Training and prediction are supported on a CUDA®-capable GPU with a compute capability of 3.0 or higher. Use of a GPU is recommended and requires Parallel Computing Toolbox™

You can construct a CNN architecture, train a network using semantic segmentation, and use the trained network to predict class labels or detect objects. You can also extract features from a pretrained network, and use these features to train a classifier. Additionally, you can perform transfer learning which retrains the CNN on new data.You can also use the Image Labeler, Video Labeler, feature extractors, and classifiers to create a custom detector


expand all

boxLabelDatastoreDatastore for bounding box label data
imageDatastoreDatastore for image data
groundTruthGround truth label data
objectDetectorTrainingDataCreate training data for an object detector
combineCombine data from multiple datastores
balanceBoxLabelsBalance image blocks using bounding boxes and big images
bboxcropCrop bounding boxes
bboxresizeResize bounding boxes
bboxwarpApply geometric transformation to bounding boxes
bbox2pointsConvert rectangle to corner points list
imwarpApply geometric transformation to image
imcropCrop image
imresizeResize image
randomAffine2dCreate randomized 2-D affine transformation
centerCropWindow2dCreate rectangular center cropping window
randomCropWindow2dCreate randomized rectangular cropping window
integralImageCalculate 2-D integral image
anchorBoxLayerCreate anchor box layer for object detection
estimateAnchorBoxesEstimate anchor boxes for deep learning object detectors
fasterRCNNLayersCreate a faster R-CNN object detection network
focalLossLayerCreate focal loss layer using focal loss function
roiAlignLayerNon-quantized ROI pooling layer for Mask-CNN
roiInputLayerROI input layer for Fast R-CNN
roiMaxPooling2dLayerNeural network layer used to output fixed-size feature maps for rectangular ROIs
rpnSoftmaxLayerSoftmax layer for region proposal network (RPN)
rpnClassificationLayerClassification layer for region proposal networks (RPNs)
rcnnBoxRegressionLayerBox regression layer for Fast and Faster R-CNN
regionProposalLayerRegion proposal layer for Faster R-CNN
spaceToDepthLayerSpace to depth layer
ssdLayersSSD multibox object detection network
ssdMergeLayerCreate SSD merge layer for object detection
yolov2LayersCreate YOLO v2 object detection network
yolov2TransformLayerCreate transform layer for YOLO v2 object detection network
yolov2OutputLayerCreate output layer for YOLO v2 object detection network
yolov2ReorgLayer(Not recommended) Create reorganization layer for YOLO v2 object detection network
focalCrossEntropyCompute focal cross-entropy loss
trainRCNNObjectDetectorTrain an R-CNN deep learning object detector
trainFastRCNNObjectDetectorTrain a Fast R-CNN deep learning object detector
trainFasterRCNNObjectDetectorTrain a Faster R-CNN deep learning object detector
trainSSDObjectDetectorTrain an SSD deep learning object detector
trainYOLOv2ObjectDetectorTrain YOLO v2 object detector
evaluateDetectionAOSEvaluate average orientation similarity metric for object detection
evaluateDetectionMissRateEvaluate miss rate metric for object detection
evaluateDetectionPrecisionEvaluate precision metric for object detection
bboxOverlapRatioCompute bounding box overlap ratio
bboxPrecisionRecallCompute bounding box precision and recall against ground truth
rcnnObjectDetectorDetect objects using R-CNN deep learning detector
fastRCNNObjectDetectorDetect objects using Fast R-CNN deep learning detector
fasterRCNNObjectDetectorDetect objects using Faster R-CNN deep learning detector
ssdObjectDetectorDetect objects using SSD deep learning detector
yolov2ObjectDetectorDetect objects using YOLO v2 object detector
selectStrongestBboxSelect strongest bounding boxes from overlapping clusters
selectStrongestBboxMulticlassSelect strongest multiclass bounding boxes from overlapping clusters
insertObjectAnnotationAnnotate truecolor or grayscale image or video stream
insertObjectMask Insert masks in image or video stream
insertShapeInsert shapes in image or video
showShapeDisplay shapes on image, video, or point cloud


Get Started

Choose Function to Visualize Detected Objects

Compare visualization functions.

Getting Started with Object Detection Using Deep Learning

Object detection using deep learning neural networks.

Getting Started with R-CNN, Fast R-CNN, and Faster R-CNN

R-CNN, Fast R-CNN, and Faster R-CNN basics

Getting Started with Mask R-CNN for Instance Segmentation

Perform multiclass instance segmentation using Mask R-CNN and deep learning.

Getting Started with YOLO v2

You only look once (YOLO) v2 basics

Getting Started with SSD Multibox Detection

Single shot detection basics.

Anchor Boxes for Object Detection

Basics of anchor boxes that are used in deep learning object detection

Create Training Data for Object Detection

Datastores for Deep Learning (Deep Learning Toolbox)

Learn how to use datastores in deep learning applications.

Training Data for Object Detection and Semantic Segmentation

Create training data for object detection or semantic segmentation using the Image Labeler or Video Labeler.

Object Detection Using Deep Learning

Deep Network Designer (Deep Learning Toolbox)

List of Deep Learning Layers (Deep Learning Toolbox)

Discover all the deep learning layers in MATLAB®.

Deep Learning in MATLAB (Deep Learning Toolbox)

Discover deep learning capabilities in MATLAB using convolutional neural networks for classification and regression, including pretrained networks and transfer learning, and training on GPUs, CPUs, clusters, and clouds.

Pretrained Deep Neural Networks (Deep Learning Toolbox)

Learn how to download and use pretrained convolutional neural networks for classification, transfer learning and feature extraction.

Featured Examples