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;
>> lgraph = baseNetwork.layerGraph;
>> newInputLayer = imageInputLayer([500,500,3])
>> lgraph = replaceLayer(lgraph,'data',newInputLayer);
>> 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