AlexNet用于识别

AlexNet用于识别_第1张图片AlexNet用于识别_第2张图片

code:

clear;clc;close all;
%获取alexnet
net = alexnet;  
%读照片选物体
I= imread('11.jpg'); 
[cropedim, rect2]=imcrop(I);


cropedim=imresize(cropedim,[227 227]);
figure(1),imshow(cropedim);
% 用AlexNet分类 
label = classify(net, cropedim); 
% 显示结果
figure; 
imshow(I); 
imwrite(I,'111.jpg');
rectangle('position',rect2,'EdgeColor','r','LineWidth',2);
text(10,20,char(label),'Color','white','FontSize',20);


你可能感兴趣的:(matlab)