⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unbalanced quick network.m

📁 协同神经网络的程序
💻 M
字号:
clear all
clc

NumOfImage = 34;
width=32;
hight=32;
maxGray = 1;

for i = 1: NumOfImage
%   i
   R=imread(num2str(i),'bmp');
   B=(R(:))';
   v(i,:)=double(B);
   vmean(i)=mean(v(i,:));
   v(i,:)=v(i,:)-mean(v(i,:));
   v(i,:)=v(i,:)/norm(v(i,:));
end
%size(v)
%pause

%we get the value of pinv v
VV = (pinv(v))';
%size(VV)

%Q is the row parament
R=imread('q','bmp');
Q=double(R(:));
Qmean= mean(Q);
Q=Q-mean(Q);
Q=Q/norm(Q);

% attention parameter
for m=1:NumOfImage
    lmd(m)=10;
 %   lmd(m)=1-abs(vmean(m)-Qmean)/max(Qmean,maxGray-Qmean);
 end
 lmd(1) = 20;


%A is the order parameter
for k=1:NumOfImage
   A(k)=VV(k,:)*Q;
end

B=1;C=1;
flops(0);
tic;
t=log(3/((B+C)*max(A))+1)/(3*max(lmd));
%t is a little time parameter    
%a simple approch to improve the original Haken competing process  
winner=1;                                        %定义winner为获胜者
for i=1:NumOfImage    
  if lmd(i)-lmd(winner)>log(abs(A(winner)/A(i)))/t
     winner=i
  end
end
flops
toc

% compare results
for i=1:NumOfImage    
   for j = 1:NumOfImage
     comp(i,j)=lmd(i)-lmd(j)-double(log(abs(A(j)/A(i)))/t);
  end
end

% q is the recognized pattern;Output the value of q and draw it;      
draw = 1;
if(draw)
   q=v(winner,:);  
   q = reshape(q,hight,width);
   q = mat2gray(q);
   imshow (q);
end



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -