% Load pre-trained detector (requires Deep Learning Toolbox) detector = yolov2ObjectDetector('tiny-yolov2-coco'); % Read image I = imread('street_scene.jpg');
% Using pre-trained ResNet-18 net = resnet18; lgraph = layerGraph(net); lgraph = removeLayers(lgraph, 'fc1000', 'prob', 'ClassificationLayer_predictions'); newLayers = [ fullyConnectedLayer(2, 'Name', 'fc_new') softmaxLayer('Name', 'softmax') classificationLayer('Name', 'classout')]; lgraph = addLayers(lgraph, newLayers); lgraph = connectLayers(lgraph, 'pool5', 'fc_new'); % Train on retinal dataset (1000 images/class) options = trainingOptions('sgdm', 'InitialLearnRate', 1e-4, 'MaxEpochs', 20); trainedNet = trainNetwork(augmentedTrainSet, lgraph, options); % Load pre-trained detector (requires Deep Learning Toolbox)
% Detect objects [bboxes, scores, labels] = detect(detector, I); % Read image I = imread('street_scene.jpg')
% Train net = trainNetwork(imds, pxds, lgraph, options); lgraph = layerGraph(net)
% Load pre-trained VDSR network net = vdsrNetwork; % Low-resolution image lrImage = imresize(highResImage, 0.25); lrImage = imresize(lrImage, size(highResImage));