squeezenet - (Not recommended) SqueezeNet convolutional neural network - MATLAB (original) (raw)
squeezenet
is not recommended. Use the imagePretrainedNetwork function instead.
There are no plans to remove support for the squeezenet
function. However, the imagePretrainedNetwork
function has additional functionality that helps with transfer learning workflows. For example, you can specify the number of classes in your data using thenumClasses
option, and the function returns a network that is ready for retraining without the need for modification.
The imagePretrainedNetwork
function returns the network as adlnetwork
object, which does not store the class names, To get the class names of the pretrained network, use the second output argument of theimagePretrainedNetwork
function.
This table shows some typical usages of the squeezenet
function and how to update your code to use theimagePretrainedNetwork
function instead.
Not Recommended | Recommended |
---|---|
net =squeezenet; | [net,classNames] = imagePretrainedNetwork; |
net =squeezenet(Weights="none"); | net = imagePretrainedNetwork(Weights="none"); |
The imagePretrainedNetwork
returns a dlnetwork object, which also has these advantages:
dlnetwork
objects are a unified data type that supports network building, prediction, built-in training, visualization, compression, verification, and custom training loops.dlnetwork
objects support a wider range of network architectures that you can create or import from external platforms.- The trainnet function supports
dlnetwork
objects, which enables you to easily specify loss functions. You can select from built-in loss functions or specify a custom loss function. - Training and prediction with
dlnetwork
objects is typically faster thanLayerGraph
andtrainNetwork
workflows.
To train a neural network specified as a dlnetwork
object, use the trainnet function.