0

当我将人工生成的图像保存为 eps 文件时,我会得到振铃效果。但是,当另存为 png 文件时,效果不可见。这是预期的吗?

提到的输出图像:

输出:
png 输出

每股收益:
每股收益

function displayMatrixAsImage(mat, labels);

len = size(mat,1);

if nargin < 2
labels = cell(len);
for k = 1:len
    labels{k} = num2str(k-1);
end
end

max_mat = sum(mat,2); % sum the number of times a target is in the test
m2 = mat ./ repmat(max_mat,1,size(mat,2)); % get the probabilities

imagesc(m2, [0 1]);            %# Create a colored plot of the matrix values
colormap(flipud(gray));  %# Change the colormap to gray (so higher values are
                     %#   black and lower values are white)

% textStrings = num2str(mat(:),'%0.0f');  %# Create strings from the matrix values
textStrings = num2str(100*m2(:),'%0.0f');  %# Create strings from the matrix values
textStrings = strtrim(cellstr(textStrings));  %# Remove any space padding

[x,y] = meshgrid(1:len);   %# Create x and y coordinates for the strings
hStrings = text(x(:),y(:),textStrings(:),...      %# Plot the strings
            'HorizontalAlignment','center',...
            'FontSize', 18);
midValue = mean(get(gca,'CLim'));  %# Get the middle value of the color range
textColors = repmat(m2(:) > midValue,1,3);  %# Choose white or black for the
                                         %#   text color of the strings so
                                         %#   they can be easily seen over
                                         %#   the background color
set(hStrings,{'Color'},num2cell(textColors,2));  %# Change the text colors

set(gca,'XTick',1:len,...                         %# Change the axes tick marks
    'XTickLabel',{labels{1},labels{2}},...  %#   and tick labels
    'YTick',1:len,...
    'YTickLabel',{labels{1},labels{2}},...
    'TickLength',[0 0]);
ylabel('true label');
xlabel('predicted label');
4

0 回答 0