function trainTG(pres) % get features and labels [f,y] = sampleDetector(@detector,pres); f=f'; y=y'; % normalize features to unit variance fstd = std(f); fstd = fstd + (fstd==0); f = f ./ repmat(fstd,size(f,1),1); % fit the model fprintf(2,'Fitting model...\n'); beta = logist2(y,f); % save the result save(sprintf('beta_tg_%s.txt',pres),'fstd','beta','-ascii'); function [f] = detector(im) tg = detTG(im); t = max(tg,[],3); t = t(:); f = [ ones(size(t)) t ]';