How to increase the resolution of the input network layer using YOLO v3

4 views (last 30 days)
When using YOLO v3 for deep learning image recognition, how can I change the initial input network layer to be larger than the default 227x227 pixels so that I can detect smaller objects?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 21 Oct 2021
You may want to define a larger input layer than the default 227x227 pixels size. You can increase the resolution of the input layer when detecting objects using YOLO v3 by changing the input layer size of your base network. For example, if you are using “squeezenet” as your base network, you may implement something similar to what follows:
 
>> baseNetwork= squeezenet;
% Extract original layer graph
>> lgraph = baseNetwork.layerGraph;
% Construct a new image input layer with the desired image size
>> newInputLayer = imageInputLayer([500,500,3])
% Replace the 'baseNetwork' input layer named 'data' with our newly constructed 'newInputLayer'
>> lgraph = replaceLayer(lgraph,'data',newInputLayer);
% Assemble network with larger input layer
>> newBaseNetwork = assembleNetwork(lgraph);
You will now use this “newBaseNetwork” when creating your “yolov3ObjectDetector” object.
 
Additional Steps Needed for Implementing New Input Layer:
  • The “assembleNetwork” function will return an error unless you specify the “Mean” property for your new input layer.\n
    •  For more details on the “Mean” and “Normalization” properties, see:
    • https://www.mathworks.com/help/deeplearning/ref/nnet.cnn.layer.imageinputlayer.html  
  • You will also need to make some changes in the preprocessing portion of your code in order to reflect the new image size.\n
    •  For more information on preprocessing data, see:
    • https://www.mathworks.com/help/vision/ug/object-detection-using-yolo-v3-deep-learning.html 

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!