2023年最新改进麻雀搜索算法-多策略改进麻雀搜索算法
摘要
虽然图像检测技术目前广泛应用于各个领域,但是在科幻画相似读检测方面还存在较大的空白。为此提出一种科幻画的相似度检测方法,首先为待检测的源图像和模板图像创建k层金字塔图像,然后在源图像的顶层中利用基于多策略改进的麻雀搜索算法(MISSA)进行粗略匹配来获取初略匹配目标的坐标,以上一层传递的位置为搜索起点,每层在设定的窗口范围内进行逐像素匹配,最后采用感知哈希(pHash)作为相似性度量指标来计算匹配结果的相似性。采用基于阶跃函数的混合搜索策略,多阶段动态控制警戒阈值,以及基于Logistic模型的食物搜索策略来改进SSA,从而形成MISSA来提升在匹配过程中的准确性与实时性。在MISSA的性能验证方面,通过消融实验验证三种改进策略的合理性与有效性,并且在CEC2017基准函数上的实验结果表明MISSA的寻优性能和收敛性能要优于同行算法。通过科幻画相似度检测实验中的对比结果充分验证了我们提出的检测方法在满足匹配的实时性和准确性的要求下仍具有较强的鲁棒性。
Cite this article
[1] Chen, G., Zhu, D. & Chen, X. Similarity detection method of science fiction painting based on multi-strategy improved sparrow search algorithm and Gaussian pyramid. Multimed Tools Appl (2023). https://doi.org/10.1007/s11042-023-15494-8
MISSA算法代码复现
GitHub上搜索文章标题,获取更完整的源码,包括CEC2017.m和main.m 代码片
.
//需要对比进化算法的同学,可以自取源码。
function [fMin , bestX,Convergence_curve ] = MISSA(pop,M,c,d,dim,fobj)
% _____________________________________________________
% Cite this article:Chen, G., Zhu, D. & Chen, X. Similarity detection method of science fiction painting based on multi-strategy improved sparrow search algorithm and Gaussian pyramid. Multimed Tools Appl (2023). https://doi.org/10.1007/s11042-023-15494-8
% title:Similarity detection method of science fiction painting based on multi-strategy improved sparrow search algorithm and Gaussian pyramid
% Contributors:Gang Chen;Donglin Zhu;Xiangyu Chen
% Multimedia Tools and Applications
% DOI: https://doi.org/10.1007/s11042-023-15494-8
% _____________________________________________________
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
P_percent = 0.3; % The population size of producers accounts for "P_percent" percent of the total population size
pNum = round( pop * P_percent ); % The population size of the producers
lb= c.*ones( 1,dim ); % Lower limit/bounds/ a vector
ub= d.*ones( 1,dim ); % Upper limit/bounds/ a vector
%Initialization
for i = 1 : pop
x( i, : ) = lb + (ub - lb) .* rand( 1, dim );
fit( i ) = fobj( x( i, : ) ) ;
end
pFit = fit;
pX = x; % The individual's best position corresponding to the pFit
[ fMin, bestI ] = min( fit ); % fMin denotes the global optimum fitness value
bestX = x( bestI, : ); % bestX denotes the global optimum position corresponding to fMin
% Start updating the solutions.
for t = 1 : M
[ ans, sortIndex ] = sort( pFit );
[fmax,B]=max( pFit );
worse= x(B,:);
r2=rand(1);
if t<500
CG=0.8;
elseif t<1500
CG=0.6.*(sin((pi/2)*(1-((t-500)/(1500-500))))+0.2/0.6);
else
CG=0.2;
end
if(r2<CG)
for i = 1 : pNum % Equation (3)
r1=rand(1);
Xrand = x(floor(pop*rand()+1), :);
if r1>0.5
g=1;
else
g=0;
end
% x( sortIndex( i ), : ) = pX( sortIndex( i ), : )*exp(-(i)/(r1*M));
x( sortIndex( i ), : ) = pX( sortIndex( i ), : )+exp(-(i)/(r1*M)).*(rand().*(g.*Xrand+(1-g).*bestX)-rand().*pX( sortIndex( i ), : ));
x( sortIndex( i ), : ) = Bounds( x( sortIndex( i ), : ), lb, ub );
fit( sortIndex( i ) ) = fobj( x( sortIndex( i ), : ) );
end
else
for i = 1 : pNum
x( sortIndex( i ), : ) = pX( sortIndex( i ), : )+randn(1)*ones(1,dim);
x( sortIndex( i ), : ) = Bounds( x( sortIndex( i ), : ), lb, ub );
fit( sortIndex( i ) ) = fobj( x( sortIndex( i ), : ) );
end
end
[ fMMin, bestII ] = min( fit );
bestXX = x( bestII, : );
for i = ( pNum + 1 ) : pop % Equation (4)
A=floor(rand(1,dim)*2)*2-1;
%%%%WOA部分参数%%%%
r3=rand();
%%%%%%%%%%%%%%%%%%
if( i>(pop/2))
% x( sortIndex(i ), : )=randn(1)*exp((worse-pX( sortIndex( i ), : ))/(i)^2);
rand_leader_index = floor(pop*rand()+1);
X_rand = x(rand_leader_index, :);
D_X_rand=abs(X_rand-pX( sortIndex( i ), : ));
x( sortIndex(i ), : )=X_rand-(4*r3-2).*(1/(1+exp(t/100-10))).*D_X_rand; % Eq. (2.8)
else
x( sortIndex( i ), : )=bestXX+(abs(( pX( sortIndex( i ), : )-bestXX)))*(A'*(A*A')^(-1))*ones(1,dim);
end
x( sortIndex( i ), : ) = Bounds( x( sortIndex( i ), : ), lb, ub );
fit( sortIndex( i ) ) = fobj( x( sortIndex( i ), : ) );
end
c=randperm(numel(sortIndex));
b=sortIndex(c(1:50));
for j = 1 : length(b) % Equation (5)
if( pFit( sortIndex( b(j) ) )>(fMin) )
x( sortIndex( b(j) ), : )=bestX+(randn(1,dim)).*(abs(( pX( sortIndex( b(j) ), : ) -bestX)));
else
x( sortIndex( b(j) ), : ) =pX( sortIndex( b(j) ), : )+(2*rand(1)-1)*(abs(pX( sortIndex( b(j) ), : )-worse))/ ( pFit( sortIndex( b(j) ) )-fmax+1e-50);
end
x( sortIndex(b(j) ), : ) = Bounds( x( sortIndex(b(j) ), : ), lb, ub );
fit( sortIndex( b(j) ) ) = fobj( x( sortIndex( b(j) ), : ) );
end
for i = 1 : pop
if ( fit( i ) < pFit( i ) )
pFit( i ) = fit( i );
pX( i, : ) = x( i, : );
end
if( pFit( i ) < fMin )
fMin= pFit( i );
bestX = pX( i, : );
end
end
Convergence_curve(t)=fMin;
end
% Application of simple limits/bounds
function s = Bounds( s, Lb, Ub)
% Apply the lower bound vector
temp = s;
I = temp < Lb;
temp(I) = Lb(I);
% Apply the upper bound vector
J = temp > Ub;
temp(J) = Ub(J);
% Update this new move
s = temp;
%---------------------------------------------------------------------------------------------------------------------------